It's all about the answers!

Ask a question

getting value from an enum of Workitem through Plain Java Library

Harish Raj (1131619) | asked Feb 17 '14, 4:37 p.m.
edited Feb 18 '14, 1:53 p.m. by Fariz Saracevic (904613)
I looked at the Manipulating Work Item Enumeration Values. But it gives me an error at the method getIdentifier2() of ILiteral all the time. I tried 3.x version and even 4.x But no luck. It is quite urgent. Please help me.


private ILiteral getLiteralbyID(Identifier findLliteralID, IAttributeHandle iAttribute) throws TeamRepositoryException {
	IWorkItemClient workItemClient = (IWorkItemClient) teamRepository().getClientLibrary(IWorkItemClient.class);
	IEnumeration enumeration = workItemClient.resolveEnumeration(iAttribute, null);

	List literals = enumeration.getEnumerationLiterals();
	for (Iterator iterator = literals.iterator(); iterator.hasNext();) {
		ILiteral iLiteral = (ILiteral);
		if (iLiteral.getIdentifier2().equals(findLliteralID)) {
			return iLiteral;
	return null;

Accepted answer

permanent link
sam detweiler (12.5k6195201) | answered Feb 17 '14, 5:00 p.m.
see post 2 here

routine PrintAttributes()

detects what kind of attribute, then prints its value
Harish Raj selected this answer as the correct answer

Harish Raj commented Feb 18 '14, 3:07 a.m.

Thank you, Sam. :)

Your answer

Register or to post your answer.