It's all about the answers!

Ask a question

How to programmatically add value to an Enumeration?

Eduardo Bello (4401921) | asked May 26 '11, 2:19 p.m.

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?

7 answers

permanent link
Eduardo Bello (4401921) | answered Jun 06 '11, 8:32 a.m.

permanent link
Kevin Ramer (4.5k8178197) | answered Jun 06 '11, 10:58 a.m.

This post helped me:

permanent link
Eduardo Bello (4401921) | answered Jun 06 '11, 1:28 p.m.

This post helped me:

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.

permanent link
Nick Edgar (6.5k711) | answered Jun 09 '11, 4:02 p.m.
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.

IProjectAreaWorkingCopy extends IProcessAreaWorkingCopy, IProcessContainerWorkingCopy --> IDocument

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

permanent link
Nick Edgar (6.5k711) | answered Jul 19 '11, 5:27 p.m.
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.

permanent link
Michele Pegoraro (1.8k14117103) | answered Oct 12 '12, 6:05 a.m.
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?


permanent link
Andrada Roman (201014) | answered Mar 05 '15, 8:32 a.m.
 Hello Eduardo,

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


Your answer

Register or to post your answer.