It's all about the answers!

Ask a question

multi-select enumerations


1
1
Ryan Golbeck (211) | asked Dec 14 '11, 4:37 p.m.
retagged Jul 23 '12, 8:53 a.m. by Jared Russell (1.3k12019)
Is there anyway to get an IEnumeration directly without having an attribute of that enumeration type (Not calling resolveEnumeration) in the Java API?

Basically, what I have is an attribute on a work item that should be a multi select attribute. To set this up I created an attribute of type string, and added a presentation editor that attaches an enumeration to the custom attribute.

When multiple values of the enumeration are selected, the string value of the custom work item is something like "test.multiselect.enumeration.l1,test.multiselect.enumeration.l2" and I need a way of first knowing that this custom attribute of type string is actually a multi select, and second translating the values of the enumeration literals to the display names.

Thanks for any help,
-ryan

2 answers



permanent link
sam detweiler (12.5k6195201) | answered Dec 14 '11, 6:17 p.m.
well, and enumeration is an ordered array of values. always..

in some uses of the values of the enumeration could be a single or multi-select field.. but the enumeration itself is not multi-anything.. just an ordered array of values.

so, the field defines what to do.. can we see the field definition?

you can get the literals of an enumeration from the enumeration.

I would guess that l1 is literal 1, l2 is literal 2, etc..

If u get them all, then u would know how many values there were and could match..
enumeration.getEnumerationLiterals(false)l returns only the current active values. in a List<>

but I'd still like to see this string variable, with a multiselect list UI.

Sam

permanent link
Ryan Golbeck (211) | answered Dec 14 '11, 6:30 p.m.
Right, I understand that the enumeration is just an array of values.

The problem is I can't get a handle on the IEnumeration associated with my attribute, because the attribute is of type String.

If I setup the custom attribute to have type enumeration, then that attribute can only hold one literal from the enumeration.

To make the custom attribute, I made it of type string, and then added UI presentation to make editing that attribute use the backing enumeration as a multi-select checkbox list.

Is there anyway to get a handle on the IEnumeration that I can call getEnumerationLiterals on if I only know the enumeration's ID?

Your answer


Register or 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.