It's all about the answers!

Ask a question

Java API - ServerSide : Get priority name


Antoine LELEU (5012728) | asked Feb 14 '14, 7:37 a.m.
 
Hello,

Do you know how get the label (name) of priority with the ID ?

"Identifier<IPriority> priorityValue = currentWorkItem.getPriority();"

Thanks,
Antoine

Accepted answer


permanent link
sam detweiler (12.5k6185201) | answered Feb 14 '14, 7:43 a.m.
from my pgm here, post 2,
https://jazz.net/forum/questions/94776/assertionfailedexception-problem-with-getting-the-values-of-attributes

                                String[] iaval = ia
                                        .getValue(auditableClient, workItem,
                                                monitor).toString().split(":");
                                if (iaval.length > 1 && iaval[1] != null)
                                {
                                    List<ILiteral> enumerationLiterals = enumeration
                                            .getEnumerationLiterals();
                                    for (ILiteral literal : enumerationLiterals)
                                    {
                                        if (literal.getIdentifier2()
                                                .getStringIdentifier()
                                                .equalsIgnoreCase(iaval[1]))
                                        {
                                            System.out
                                            .println("\t\t\t\t --> attribute id="
                                                    + ia.getIdentifier()
                                                    + ", type"
                                                    + "="
                                                    + ia.getAttributeType()
                                                    + " literal="
                                                    + literal
                                                    .getIdentifier2()
                                                    .getStringIdentifier()
                                                    + " literal name="
                                                    + literal.getName());
                                            break;
                                        }
                                    }
                                }
Antoine LELEU selected this answer as the correct answer

One other answer



permanent link
Antoine LELEU (5012728) | answered Feb 14 '14, 11:49 a.m.
 
Thanks,

i could fix my problem with your sample.

Antoine

Your answer


Register or to post your answer.