Retrieving enumeration values from a multi-select field
![]()
I have a custom attribute defined as shortString with a multi-select checkbox presentation set up with a custom property field with key 'enumeration' and the value being the name of the enumeration I want to display for selection.
What I want to do is programatically retrieve the enumeration values selected. IWorkItem.getValue() returns a comma-separated String of enumeration identifiers matching the selection, and from this I want to retrieve the actual ILiteral objects to call ILiteral.getName() on them to get their displayable names or 'values'. The problem I'm having is actually resolving the IEnumeration object used in the multi-select checkbox presentation. Normally the attribute type itself is tied to an enumeration, with the enumeration being defined as the attribute type. In that case it's easy: I just use IWorkItemCommon.resolveEnumeration(IAttribute, IProgressMonitor) However for my mult-select checkbox field, the attribute is defined as type 'smallString' and so the call above won't work as theirs no enumeration directly associated with it, only associated with the presentation of it in an editor. Therefore how can I resolve the enumeration in this situation? From hunting around I've resolved it in the following manner, but it's not a clean implementation and so I would really like to know if there's a proper way of doing this. IEnumeration enumeration = ((WorkItemCommon) workItemCommon).internalResolveEnumeration(projectArea, enumerationName, monitor); You can see that I've had to use an internal method of WorkItemCommon and not available in the IWorkItemCommon interface to resolve it. Is it possible to resolve it through the standard API rather than this internal method? For scope I've included my whole method for reference: public String[] getMultiSelectEnumerationValues(final IWorkItem workItem, final String attributeName, final enumerationName, final IProjectAreaHandle projectArea, IWorkItemCommon workItemCommon, final IProgressMonitor monitor) Many thanks in advance. |
2 answers
![]()
Hi
This is the only way to do this. Please file an API request on jazz.net (e.g. as enhancement) against Work Items. Regards Marcel Jazz Work Item team |
![]() |
Comments
Hi there
I have a similar problem with RTC 3.x and server side extension, here I can see
final IEnumeration enumeration = ((WorkItemCommon) workItemCommon).internalResolveEnumeration(projectArea, enumerationName, monitor);
has been used, however for workItemServer does not seems to have a similar internal function which cane be used for resolving the enumeration. Also can you please let me know the enumeration name used?
Many thanks in advance.
IWorkItemCommon www;
www.resolveEnumeration(attribute, monitor)
IWorkItemCommon is a service exported by com.ibm.team.workitem,service jar file
<provides>
<providedService interface="com.ibm.team.workitem.common.IWorkItemCommon"/>
<providedService interface="com.ibm.team.workitem.service.IWorkItemServer"/>
I posted my updated source to dynamically detect and decode the V3 multi-select enum list