How to get enumeration value
I am writing program to get enumeration values by http client using OSLC-CM 2.0.
I want to know how I can get all id and name of enumeration by OSLC-CM 2.0 in java api.
For example:
<enumeration attributeTypeId="bugtype" name="bugproblemtype">
<literal id="bugtype.literal.l1" name="CA-用例缺陷"/>
<literal id="bugtype.literal.l2" name="DOC-文档错误"/>
<literal id="bugtype.literal.l3" name="EC-编码错误"/>
</enumeration>
1. I want to get a map <id, name> of enumeration.
AttributeTypeId ="bugtype" or name ="bugproblemtype" as argument. I want to get the map as below:
<bugtype.literal.l1, CA-用例缺陷>, <bugtype.literal.l2, DOC-文档错误>, <bugtype.literal.l3, EC-编码错误>
2. I want to get a id by name
Input CA-用例缺陷 as argument, the id bugtype.literal.l1 will be return.
Please give me an advise.
Accepted answer
IWorkItemClient svc = (IWorkItemClient)teamrepo.getClientLibrary(IWorkItemClient.class);
IEnumeration<ILiteral> enum = (IEnumeration<ILiteral>)svc.resolveEnumeration(attribute, null);
List<ILiteral> literals = enum.getEnumerationLiterals();
Now, you said both HTTP (meaning REST?) and Java API, this is just the Java API method.