Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

How to add Literals to existing enumeration programmatically

Hi

Is there any way in RTC to add the literals to the existing enumerations programmatically using RTC JAVA API's.?

For Eaxmple: Suppose we have enumeration called Operating System but we need to add the literal values(like WindowsXP , Linux etc.) for this enumeration programmatically using RTC JAVA API's.

Please let me if anyone has any idea.

0 votes



6 answers

Permanent link
Hi

Is there any way in RTC to add the literals to the existing enumerations programmatically using RTC JAVA API's.?

For Eaxmple: Suppose we have enumeration called Operating System but we need to add the literal values(like WindowsXP , Linux etc.) for this enumeration programmatically using RTC JAVA API's.

Please let me if anyone has any idea.


You either make a new attribute of type enumeration with the values you want or write a piece of code to edit the xml you can get through the eclipse client

0 votes


Permanent link
I have tried to get the enumeration from process configuration source xml but I can not find any methods to add the literals or the element to the enumeration:

		IClientProcess clientProcess1 = service.getClientProcess(

processAreaNew, null);

IProcessConfigurationData processConfigurationData = clientProcess1.getProjectConfigurationData("com.ibm.team.workitem.configuration.enumerations", monitor);
System.out.println("Process configuration data:\n"+processConfigurationData.getElements());
IProcessConfigurationElement[] processConfigArray = processConfigurationData.getElements();
System.out.println("processConfigArray : "+processConfigArray.length);

for(int i=0 ; i<processConfigArray.length; i++){

IProcessConfigurationElement a = processConfigArray[i];

System.out.println("Enumeration Element : "+a.getName());
a.getChildren();
System.out.println("a.getChildren():"+a.getChildren());
System.out.println("a.getChildren().length:"+a.getChildren().length);
IProcessConfigurationElement[] childs = a.getChildren();

for (int j=0 ; j<a.getChildren().length; j++){
IProcessConfigurationElement literal = childs[j];
System.out.println("Literal Element : "+literal.getName());
System.out.println("abc:"+literal.toString());
literal.getAttribute("name").toString();
literal.getAttribute("id").toString();
}

0 votes


Permanent link
In many cases there is no externalized method (api) to do what you want.

so, you will have to read the source for the product UI and discover how they did it, and knowing there is no api, your code will be exposed to undocumented changes in the implementation.. so net, after you learn it, you shouldn't skip around the safety net and write direct code..

ps.. I have had to do this myself.. I submitted Enhancements to Jazz to enable my code to be using supported methods in the future..
1 was accepted(shipped in 3.0.1), 1 was rejected, 1 was being worked on already (maybe to ship in 3.5)

Sam

0 votes


Permanent link
Hi All,
           Is it possible to create the enumeration and configure the dependency and value-set provider programatically? (or) Is it only possible by editing process template?

My requirement is to automatically populate stream-list from the repo for a chosen project-area - so this has to be dynamic.

Please advise.

Thanks.

0 votes


Permanent link

Hi All,

Is it programmatically possible to get the operation id from the process configuration source?

I need to get acess to the id of the operation behavior.

The id which I am trying to access from the process configuration source is

<behavior>
<role id="default">

<operation id="com.ibm.team.workitem.operation.workItemSave">

<preconditions>

I need to get access to the operation id of the behavior "com.ibm.team.workitem.operation.workItemSave". Can you please help me with the interface and the method. Thanks

0 votes


Permanent link

Hi All,

Is it programmatically possible to get the operation id from the process configuration source?

I need to get acess to the id of the operation behavior.

The id which I am trying to access from the process configuration source is

<behavior>
<role id="default">

<operation id="com.ibm.team.workitem.operation.workItemSave">

<preconditions>

I need to get access to the operation id of the behavior "com.ibm.team.workitem.operation.workItemSave". Can you please help me with the interface and the method. Thanks

0 votes

Your answer

Register or log in to post your answer.

Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 10,952

Question asked: Sep 19 '11, 5:35 a.m.

Question was seen: 10,396 times

Last updated: Mar 25 '15, 2:40 a.m.

Confirmation Cancel Confirm