It's all about the answers!

Ask a question

How to get a workitem name


Marcelo Bilezker (4619) | asked Oct 20 '21, 4:58 p.m.

 

I am using EWM 7.0.2 on eclipse using Java on server side.

I have a workitem belonging to a workitemType.
The workitem has type "enumeration".

I get successfully the value of the enumeration inside the workitem, using workItem.getValue()
that brings me a string representing the  enumearation value.

I need to know the Name of the enumeration, that appers in the xml. for example in:

<action icon="processattachment:/workflow/unresolve.gif" id="FlujoIniciativas.action.a14" name="Ir a Kick off" state="FlujoIniciativas.state.s6"/>

with workItem.getValue(), I get: "FlujoIniciativas.state.s6"

But i need to get the name of the enumeration, which in this case is: "Ir a Kick off"

Is this possible?



One answer



permanent link
Ralph Schoon (63.1k33645) | answered Oct 21 '21, 2:34 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
edited Oct 21 '21, 2:39 a.m.

As long as you do not seem to understand the basic concepts of EWM work items and their names, it does not even make sense to try to answer and I won't. I will outline what the problems with this question are, so maybe you can fix them and at some point communicate what you want to do.  


I would suggest you read How should I ask a question in the Forum if I want to receive useful answers? and follow the suggestions and explain what you are trying to do. Fix your tagging, if you try to write a server extension, usage is not the tag you want to use, you want to use extending for example.

Now the rest of the issues.

1. A work item does not have a name. A work item has a Subject or also often called a Title which is an attribute containing a HTML/XML string with a short description of the work item.
2. Although it is possible to create a work item type Enumeration, this is likely not the case in the question. You might try to talk about a work item attribute having the type of one of the defined enumerations.
3. The XML you refer to is actually NOT for an enumeration, but for an action (state change in a workflow). Enumerations is a list of enumeration literals e.g. (I replaced the XML brackets to not confuse the editor)

[enumeration attributeTypeId="priority" name="Priority"]
        [literal default="true" icon="processattachment:/enumeration/unassigned.gif" id="priority.literal.l01" name="Unassigned"/]
        [literal icon="processattachment:/enumeration/low.gif" id="priority.literal.l02" name="Low"/]
        [literal icon="processattachment:/enumeration/medium.gif" id="priority.literal.l07" name="Medium"/]
        [literal icon="processattachment:/enumeration/high.gif" id="priority.literal.l11" name="High"/]
    [/enumeration]

4. You talk about the name of an Enumeration, that would be something like Priority or Severity. I suspect you are trying to get the name/display text for an enumeration literal.


Comments
Marcelo Bilezker commented Oct 21 '21, 6:38 a.m.

 I understand I did not have yet the enough skills or knowledge to formulate the question properly. I am sorry for that,

 
You write:

4. You talk about the name of an Enumeration, that would be something like Priority or Severity. I suspect you are trying to get the name/display text for an enumeration literal.

Yes, this is exactly what I want to get.

It is possible?


Ralph Schoon commented Oct 21 '21, 6:48 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

Of course. I shared all relevant API in https://jazz.net/forum/questions/277454/getting-an-enumeration-value-from-an-iattribute already. The second link shows how to and contains a download link for example code.  


Marcelo Bilezker commented Oct 21 '21, 6:48 a.m.

I found it myself, it is (pseudo code)

IEnumeration enumeration= workItemCommon.resolveEnumeration(attribute, monitor);
ILiteral literal= enumeration.findLiteral(workItem.getValue(attribute));
String name= literal.getName();


Your answer


Register or to post your answer.