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 (779613)
Hi,
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.

Thanks.

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) iterator.next();
		if (iLiteral.getIdentifier2().equals(findLliteralID)) {
			return iLiteral;
		}
	}
	return null;
}

Accepted answer


permanent link
sam detweiler (12.4k6182201) | answered Feb 17 '14, 5:00 p.m.
see post 2 here https://jazz.net/forum/questions/94776/assertionfailedexception-problem-with-getting-the-values-of-attributes

routine PrintAttributes()

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

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

Thank you, Sam. :)

Your answer


Register or to post your answer.