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

How to programmatically add value to an Enumeration?

Hi,

I'm developing a client that need to add values to an enumeration if they didn't exists (change the process configuration programmatically ).

I'm able to get the IEnumeration object using client library, something like this:


IEnumeration<ILiteral> enumeration = (IEnumeration<ILiteral>) workItemClient.resolveEnumeration(attr, null);


But I didn't figure it out how to add a new value (literal and display name) to this enumeration.


I think that I'll need to use IProcessClientService to get IClientProcess then finally get an IProcessConfigurationData. Or I use IProcessItemService to obtain an IProcessDefinition... But this is as far as I can get.

Any suggestions?

1

1 vote


Accepted answer

Permanent link

 Hi,


You may check this question! 

Also, I added an answer on the same question that has some code snippets for adding literals to enumeration using RTC client side SDK :

Thank you!
Mohammad Alawneh

Ralph Schoon selected this answer as the correct answer

0 votes

Comments

Note that this question is very old.  


7 other answers

Permanent link
Anyone?

0 votes


Permanent link
Anyone?


This post helped me:

https://jazz.net/forums/viewtopic.php?t=14847

0 votes

Comments

Some how this link says  "File not Found " Is it removed ? Can you help me to get this link working please

This is a 13 year old question. There is no telling why the answer is gone.  


Permanent link
Anyone?


This post helped me:

https://jazz.net/forums/viewtopic.php?t=14847

Thank you... Actually I did participate on the post that you mentioned, helping someone else.

But my case is a little bit different. I want to add a new value for an existing enumeration.

Anyway, thank you very much for trying to help me.

0 votes


Permanent link
I've not used this myself, but it appears the process specification can be accessed, modified and saved via the process area working copies API.
e.g.

com.ibm.team.process.client.workingcopies.IWorkingCopyManager.getWorkingCopy(IProcessItem)

IProjectAreaWorkingCopy extends IProcessAreaWorkingCopy, IProcessContainerWorkingCopy

com.ibm.team.process.client.workingcopies.IProcessContainerWorkingCopy.getProcessSpecification() --> IDocument

org.eclipse.jface.text.IDocument.get() --> String
org.eclipse.jface.text.IDocument.set(String)

com.ibm.team.process.client.workingcopies.IProcessItemWorkingCopy.save(IProgressMonitor)

0 votes


Permanent link
To get the IWorkingCopyManager mentioned above, you can use helpers like the following (taken from the Process test suites):

protected IProcessItemService getProcessService() {
return (IProcessItemService) getRepository().getClientLibrary(IProcessItemService.class);
}

public IWorkingCopyManager getWorkingCopyManager() {
return getProcessService().getWorkingCopyManager();
}

where getRepository() returns the ITeamRepository representing the connection to your repo.

0 votes


Permanent link
Hi Nick,
these API works correctly in the sense that the process source configuration is changed. But in order to use the new configuration it seems to be necessary to "refresh" the project area using eclipse client. In my case if I open process configuration I find all the modification I've made but if I try to create a new work-item this work-item does not see them.

Is there some refresh operation that must be performed in order to work?

Other question: I can use getProcessSpecification() methods both on IProcessDefinitionWorkingCopy (obtained from the project area) and IProjectAreaWorkingCopy. Which of them is correct in order to modify the project area configuration?

Thanks,
Michele.

0 votes


Permanent link
 Hello Eduardo,

I am interested to programmaticaly add a value to an enumeration as well. Have you managed to do this?
Thank You!

Andrada

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,938

Question asked: May 26 '11, 2:19 p.m.

Question was seen: 9,764 times

Last updated: Jan 18, 10:56 a.m.

Confirmation Cancel Confirm