It's all about the answers!

Ask a question

How to set Priority & Severity using Plain java API


0
1
Karthik Krishnan (859389132) | asked Apr 11 '13, 5:08 a.m.
edited Apr 11 '13, 5:26 a.m.
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

Accepted answer


permanent link
sam detweiler (12.4k6173200) | answered Apr 11 '13, 7:40 a.m.
edited Apr 11 '13, 7:41 a.m.
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

Comments
Karthik Krishnan commented Apr 11 '13, 8:55 a.m.

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


Karthik Krishnan commented Apr 12 '13, 4:21 a.m.

works great. Thanks once again 


Ralph Schoon commented Apr 12 '13, 5:30 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

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 to post your answer.