Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

How to set Priority & Severity using Plain java API

I am using the following code 

Identifier<IPriority> iPrio = Identifier.create(IPriority.class,"High");
workItem.setPriority(iPrio);
Identifier<ISeverity> iSever = Identifier.create(ISeverity.class,"Major");
workItem.setSeverity(iSever);

but the above code adds one more entry to the enumeration instead of selecting existing one.

Can anyone tell me what mistake i am doing?

Thanks

1

0 votes


Accepted answer

Permanent link
the third post here https://jazz.net/forum/questions/94776/assertionfailedexception-problem-with-getting-the-values-of-attributes shows how to go the other way, (get the human value of enumerations) but uses the right apis to get the values.

so, you would get the list of values for the list of enum entries, find the literal value that matches and use that.
the severity enum looks like this

<code>
                <enumeration attributeTypeId="severity" name="Severity">
                    <literal icon="processattachment:/enumeration/unassigned2.gif" id="severity.literal.l1" name="Unclassified"/>
                    <literal icon="processattachment:/enumeration/minor.gif" id="severity.literal.l2" name="Minor"/>
                    <literal default="true" icon="processattachment:/enumeration/normal.gif" id="severity.literal.l3" name="Normal"/>
                    <literal icon="processattachment:/enumeration/major.gif" id="severity.literal.l4" name="Major"/>
                    <literal icon="processattachment:/enumeration/critical.gif" id="severity.literal.l5" name="Critical"/>
                    <literal icon="processattachment:/enumeration/blocker.gif" id="severity.literal.l6" name="Blocker"/>
                </enumeration>
</code>

to set "Major" the value is " severity.literal.l4"
Karthik Krishnan selected this answer as the correct answer

2 votes

Comments

 Thanks a lot. I think i will go with the simple "severity.literal.l4"

works great. Thanks once again 

Karthik, for more advanced scenarios you might want to check this post: http://rsjazz.wordpress.com/2012/08/20/manipulationg-work-item-enumeration-values/

Your answer

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

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 10,930
× 411

Question asked: Apr 11 '13, 5:08 a.m.

Question was seen: 7,365 times

Last updated: Apr 12 '13, 5:30 a.m.

Confirmation Cancel Confirm