Create new enumeration type using Java API
I've searched, but I only find how to add enumeration value to existing enum. But did anyone created new enumeration type?
|
2 answers
It looks that I found way to create new enumeration type stored in database:
public class OperationParticipant extends AbstractService implements IOperationParticipant { private IProjectArea fProjectArea; private class enumDetails { public String id; public String name; public enumDetails(String identifier, String displayName) { id = identifier; name = displayName; } } @SuppressWarnings("restriction") @Override public void run(AdvisableOperation operation, IProcessConfigurationElement participantConfig, IParticipantInfoCollector collector, IProgressMonitor monitor) throws TeamRepositoryException { // TODO Auto-generated method stub List<enumDetails> enumsToCreate = new ArrayList<OperationParticipant.enumDetails>(); enumsToCreate.add(new enumDetails("hwVersion", "Found In HW")); enumsToCreate.add(new enumDetails("mechanicVersion", "Mechanic Version")); IRepositoryItemService itemService = (IRepositoryItemService)getService(IRepositoryItemService.class); this.fProjectArea = ((IProjectArea)itemService.fetchItem(operation.getProcessArea(), IRepositoryItemService.COMPLETE)); IEnumerationService enumServ = (IEnumerationService) getService(IEnumerationService.class); for (enumDetails enumDetails : enumsToCreate) { Enumeration enumToCreate = EnumerationFactory.eINSTANCE.createEnumeration(); enumToCreate.initNew(); enumToCreate.setContextId(fProjectArea.getContextId()); enumToCreate.setName(enumDetails.name); enumToCreate.setIdentifier(enumDetails.id); enumToCreate.setProjectArea(fProjectArea); enumToCreate.setItemId(UUID.generate()); enumServ.save(enumToCreate); } } |
Ralph Schoon (63.3k●3●36●46)
| answered Mar 13 '18, 7:35 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER As far as I know, you would have to directly modify the process XML and save it.
Comments
Marcin Blacha
commented Mar 13 '18, 7:46 a.m.
I've tried to search in process XML, but database stored enumerations are not saved there, everything is stored in database only.
They are created in the Eclipse Rich client, so you can try to search the RTC Client SDK, what the code does. It is likely still unsupported internal API.
|
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.