setValue in custom enumeration
How can I set a value in a custom enumeration?
I use this code for example to set the Priority
But I don't know how to set the value in custom enumeration.
Thanks in advance.
I use this code for example to set the Priority
IAttribute priority = service.findAttribute(projectArea,IWorkItem.PRIORITY_PROPERTY, monitor);
IEnumeration<IPriority> resolveEnumerationPriority = (IEnumeration<IPriority>) workItemCommon.resolveEnumeration(priority, monitor);
List priorities = resolveEnumerationPriority.getEnumerationLiterals();
IPriority priorityLiteral = (IPriority) priorities.get(2);
workItem.setValue(priority, priorityLiteral.getIdentifier2());
But I don't know how to set the value in custom enumeration.
Thanks in advance.
One answer
cargne80 wrote:
it works basically the same as in the example above, except that you need to load your custom attribute by ID, then use ILiteral instead of IPriority
IAttribute myAttribute= workItemCommon.findAttribute(projectArea, "myCustomAttributeId", monitor);
IEnumeration<ILiteral> enumeration= (IEnumeration<ILiteral>)workItemCommon.resolveEnumeration(myAttribute, monitor);
List<ILiteral> literals= enumeration.getEnumerationLiterals();
ILiteral literal = literals.get(2);
workItem.setValue(myAttribute, literal.getIdentifier2());
--
MikeS
Jazz Agile Planning team
How can I set a value in a custom enumeration?
I use this code for example to set the Priority
IAttribute priority =
service.findAttribute(projectArea,IWorkItem.PRIORITY_PROPERTY,
monitor);
IEnumeration<IPriority> resolveEnumerationPriority =
(IEnumeration<IPriority>)
workItemCommon.resolveEnumeration(priority, monitor);
List priorities =
resolveEnumerationPriority.getEnumerationLiterals();
IPriority priorityLiteral = (IPriority)
priorities.get(2);
workItem.setValue(priority,
priorityLiteral.getIdentifier2());
But I don't know how to set the value in custom enumeration.
Thanks in advance.
it works basically the same as in the example above, except that you need to load your custom attribute by ID, then use ILiteral instead of IPriority
IAttribute myAttribute= workItemCommon.findAttribute(projectArea, "myCustomAttributeId", monitor);
IEnumeration<ILiteral> enumeration= (IEnumeration<ILiteral>)workItemCommon.resolveEnumeration(myAttribute, monitor);
List<ILiteral> literals= enumeration.getEnumerationLiterals();
ILiteral literal = literals.get(2);
workItem.setValue(myAttribute, literal.getIdentifier2());
--
MikeS
Jazz Agile Planning team