It's all about the answers!

Ask a question

How to add Literals to existing enumeration programmatically


Dashrath Kale (1542523) | asked Sep 19 '11, 5:35 a.m.
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.

6 answers



permanent link
Laurence Caraccio (9166) | answered Oct 04 '11, 5:21 a.m.
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

permanent link
Dashrath Kale (1542523) | answered Dec 20 '11, 6:09 a.m.
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();
}

permanent link
sam detweiler (12.4k6182201) | answered Dec 20 '11, 9:58 a.m.
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

permanent link
VK L (8177139159) | answered Aug 10 '12, 4:02 a.m.
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.

permanent link
Arjun Pande (3513) | answered Mar 25 '15, 2:40 a.m.

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


permanent link
Arjun Pande (3513) | answered Mar 25 '15, 2:40 a.m.

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

Your answer


Register or to post your answer.