It's all about the answers!

Ask a question

Unable to fetch the list of allowed values for Defect attribute i.e priority, severity of type Enumeration .


Rahul Singh Bhadauriya (2811720) | asked Feb 04 '14, 9:06 a.m.
edited Feb 04 '14, 9:10 a.m.
Hi,
I have following configurations:
Jazz Server with RTC 4.0.3
I am working with the REST API of RTC 4.0.3 and trying to fetch the list of  allowed values of the attributes of type enumeration i.e severity, priority or any custom enum type through the Java Client.

As per the REST API documentation i am able to fetch the Resource Shape details for the creation factory of the type defect.
It shows the RDF/XML data like this:

<oslc:property>
<oslc:Property rdf:about="https://localhost:9443/ccm/oslc/context/_xE9Ycmk-EeOkI5-xWTQ7Fw/shapes/workitems/defect/property/internalSeverity">
<dcterms:title rdf:parseType="Literal">Severity</dcterms:title>
<oslc:readOnly rdf:datatype="http://www.w3.org/2001/XMLSchema#boolean">true</oslc:readOnly>
<oslc:representation rdf:resource="http://open-services.net/ns/core#Either"/>
<oslc:valueType rdf:resource="http://open-services.net/ns/core#Resource"/>
<oslc:allowedValues>
<oslc:AllowedValues rdf:about="https://localhost:9443/ccm/oslc/context/_xE9Ycmk-EeOkI5-xWTQ7Fw/shapes/workitems/defect/property/internalSeverity/allowedValues">
<oslc:allowedValue rdf:resource="https://localhost:9443/ccm/oslc/enumerations/_xE9Ycmk-EeOkI5-xWTQ7Fw/severity/severity.literal.l2"/>
</oslc:AllowedValues>
</oslc:allowedValues>
<oslc:name rdf:datatype="http://www.w3.org/2001/XMLSchema#string">severity</oslc:name>
<
oslc:defaultValue rdf:resource="https://localhost:9443/ccm/oslc/enumerations/_xE9Ycmk-EeOkI5-xWTQ7Fw/severity/severity.literal.l3"/>ore#Exactly-one"/>
</
oslc:property>

Here i can see the tag
: "oslc:allowedValue" which will list the allowed values for the attribute priority which is showing the single value only

<oslc:allowedValue rdf:resource="https://localhost:9443/ccm/oslc/enumerations/_xE9Ycmk-EeOkI5-xWTQ7Fw/severity/severity.literal.l2"/>
		
		
</oslc:AllowedValues>

But when i am seeing the RTC Web UI i am able to see the all the 4 items in the drop down box.
RTC Serverity Enum

Question : 01 Why i am unable to fetch the all the enum values for the attribute of type enum(i.e severity) from the resource shape of the creation factory?

Question :02 When i have set the external value from the enumeration settings as shown in the below snapshot , it starts showing the list in the allowed values field in the resource shape . Why is it like this?

Enum Settings Priority

Any pointer regarding this issue will we highly appreciated.

Thanks & Regards,
Rahul

7 answers



permanent link
Eric Jodet (6.3k5100120) | answered Feb 05 '14, 5:43 a.m.
JAZZ DEVELOPER
  Hello Rahul,
not sure I follow you here.
In the above comment:
- OSLC request shows you look for internalPriority
- screen cap shows severity

In OOTB SCRUM PA - we don't have any external values both both attributes.

The doubt I have is about your concern / problem.
Are you saying:
1 - if I add external values to enum, then I can not fetch all values - but only get the default one
Or 
2 - if I remove external values to enum, then I can not fetch all values - but only get the default one
(which implicitly means - you are able to fetch values if you have external values)

As per your questions:

Q: Are you able to fetch the all allowed values after removing the External Value for any enum type attribute?
A: yes

Q: why should i provide these external values?  it's even not mandatory to add. 
A: you don't need to provide them - https://jazz.net/library/article/1003
External values can be used for accessing attributes via RTC's REST API, such as the OSLC implementation.


Comments
Eric Jodet commented Feb 05 '14, 9:51 a.m.
JAZZ DEVELOPER

 Hello Rahul,

so the difference between your env and my env is RTC version.
You are using 4.0.3
I am using 4.0.5

Any possibility for you to test 4.0.5?
Did you check ccm log and search for error?

Thanks


permanent link
Eric Jodet (6.3k5100120) | answered Feb 04 '14, 11:01 a.m.
JAZZ DEVELOPER
Hello Rahul,

I first fetched shapes (for defect):
ccm/oslc/context/_fzVScHhOEeOaco7oIGRnEg/shapes/workitems/defect

Checked the XML, and found:
  <rdf:Description rdf:about="https://9.37.26.38:9443/ccm/oslc/context/_fzVScHhOEeOaco7oIGRnEg/shapes/workitems/defect/property/internalPriority">
    <oslc:occurs rdf:resource="http://open-services.net/ns/core#Zero-or-one"/>
    <oslc:valueType rdf:resource="http://open-services.net/ns/core#Resource"/>
    <dcterms:title rdf:parseType="Literal">Priority</dcterms:title>
    <oslc:allowedValues rdf:resource="https://9.37.26.38:9443/ccm/oslc/context/_fzVScHhOEeOaco7oIGRnEg/shapes/workitems/defect/property/internalPriority/allowedValues"/>
    <oslc:propertyDefinition rdf:resource="http://open-services.net/ns/cm-x#priority"/>
    <oslc:representation rdf:resource="http://open-services.net/ns/core#Either"/>
    <oslc:name rdf:datatype="http://www.w3.org/2001/XMLSchema#string">priority</oslc:name>
    <rdf:type rdf:resource="http://open-services.net/ns/core#Property"/>
    <oslc:defaultValue rdf:resource="https://9.37.26.38:9443/ccm/oslc/enumerations/_fzVScHhOEeOaco7oIGRnEg/priority/priority.literal.l01"/>
    <oslc:readOnly rdf:datatype="http://www.w3.org/2001/XMLSchema#boolean">false</oslc:readOnly>
  </rdf:Description>

So I used:
ccm/oslc/context/_fzVScHhOEeOaco7oIGRnEg/shapes/workitems/defect/property/internalPriority/allowedValues

and received:
<rdf:RDF
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns:oslc="http://open-services.net/ns/core#" > 
  <rdf:Description rdf:about="https://9.37.26.38:9443/ccm/oslc/context/_fzVScHhOEeOaco7oIGRnEg/shapes/workitems/defect/property/internalPriority/allowedValues">
    <rdf:type rdf:resource="http://open-services.net/ns/core#AllowedValues"/>
    <oslc:allowedValue rdf:resource="https://9.37.26.38:9443/ccm/oslc/enumerations/_fzVScHhOEeOaco7oIGRnEg/priority/priority.literal.l11"/>
    <oslc:allowedValue rdf:resource="https://9.37.26.38:9443/ccm/oslc/enumerations/_fzVScHhOEeOaco7oIGRnEg/priority/priority.literal.l07"/>
    <oslc:allowedValue rdf:resource="https://9.37.26.38:9443/ccm/oslc/enumerations/_fzVScHhOEeOaco7oIGRnEg/priority/priority.literal.l02"/>
    <oslc:allowedValue rdf:resource="https://9.37.26.38:9443/ccm/oslc/enumerations/_fzVScHhOEeOaco7oIGRnEg/priority/priority.literal.l01"/>
  </rdf:Description>
</rdf:RDF>

Comments
Eric Jodet commented Feb 04 '14, 11:02 a.m.
JAZZ DEVELOPER

 Reference: https://jazz.net/library/article/1001


permanent link
Eric Jodet (6.3k5100120) | answered Feb 04 '14, 11:04 a.m.
JAZZ DEVELOPER
 So in your context:
https://localhost:9443/ccm/oslc/context/_xE9Ycmk-EeOkI5-xWTQ7Fw/shapes/workitems/defect/property/internalSeverity/allowedValues

should fetch all values.

Hope it helps,
Eric

permanent link
Rahul Singh Bhadauriya (2811720) | answered Feb 04 '14, 11:47 p.m.
Hi Eric,
Thanks for your answer!

As per my question:02 If i don't set the External Value for the severity via settings -> Manage Project Area ->Workitem -> Enumerations -> choose the severity enum for edit  -> Delete the External values if set
Now i am not able to fetch the list of the allowed severity values via the URL
https://localhost:9443/ccm/oslc/context/_xE9Ycmk-EeOkI5-xWTQ7Fw/shapes/workitems/defect/property/internalPriority/allowedValues
Severity Edit

It shows me only one default value
  • <rdf:RDF
  • xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
  • xmlns:oslc="http://open-services.net/ns/core#" >
  • <rdf:Description rdf:about="https:/localhost:9443/ccm/oslc/context/_xE9Ycmk-EeOkI5-xWTQ7Fw/shapes/workitems/defect/property/internalPriority/allowedValues">
  • <rdf:type rdf:resource="http://open-services.net/ns/core#AllowedValues"/>
  • <oslc:allowedValue rdf:resource="https://localhost:9443/ccm/oslc/enumerations/_xE9Ycmk-EeOkI5-xWTQ7Fw/priority/priority.literal.l01"/>
  • </rdf:Description>
  • </rdf:RDF>
  • Are you able to fetch the all allowed values after removing the External Value for any enum type attribute?

    And why should i provide these external values?  it's even not mandatory to add.


    Thanks & Regards,

    Rahul




    permanent link
    Eric Jodet (6.3k5100120) | answered Feb 05 '14, 5:44 a.m.
    JAZZ DEVELOPER
     Here is what I tested, and what I fetched:
    OOTB - no external values
        <oslc:allowedvalue rdf:resource="https://9.37.26.38:9443/ccm/oslc/enumerations/_fzVScHhOEeOaco7oIGRnEg/priority/priority.literal.l11"/>;
        <oslc:allowedvalue rdf:resource="https://9.37.26.38:9443/ccm/oslc/enumerations/_fzVScHhOEeOaco7oIGRnEg/priority/priority.literal.l07"/>;
        <oslc:allowedvalue rdf:resource="https://9.37.26.38:9443/ccm/oslc/enumerations/_fzVScHhOEeOaco7oIGRnEg/priority/priority.literal.l02"/>;
        <oslc:allowedvalue rdf:resource="https://9.37.26.38:9443/ccm/oslc/enumerations/_fzVScHhOEeOaco7oIGRnEg/priority/priority.literal.l01"/>;

    with external values
        <oslc:allowedValue rdf:resource="https://9.37.26.38:9443/ccm/oslc/enumerations/_fzVScHhOEeOaco7oIGRnEg/priority/High"/>
        <oslc:allowedValue rdf:resource="https://9.37.26.38:9443/ccm/oslc/enumerations/_fzVScHhOEeOaco7oIGRnEg/priority/Medium"/>
        <oslc:allowedValue rdf:resource="https://9.37.26.38:9443/ccm/oslc/enumerations/_fzVScHhOEeOaco7oIGRnEg/priority/Low"/>
        <oslc:allowedValue rdf:resource="https://9.37.26.38:9443/ccm/oslc/enumerations/_fzVScHhOEeOaco7oIGRnEg/priority/Unassigned"/>
    removed external values
    <oslc:allowedValue rdf:resource="https://9.37.26.38:9443/ccm/oslc/enumerations/_fzVScHhOEeOaco7oIGRnEg/priority/priority.literal.l11"/>
        <oslc:allowedValue rdf:resource="https://9.37.26.38:9443/ccm/oslc/enumerations/_fzVScHhOEeOaco7oIGRnEg/priority/priority.literal.l07"/>
        <oslc:allowedValue rdf:resource="https://9.37.26.38:9443/ccm/oslc/enumerations/_fzVScHhOEeOaco7oIGRnEg/priority/priority.literal.l02"/>
        <oslc:allowedValue rdf:resource="https://9.37.26.38:9443/ccm/oslc/enumerations/_fzVScHhOEeOaco7oIGRnEg/priority/priority.literal.l01"/>

    Comments
    Eric Jodet commented Feb 05 '14, 5:45 a.m.
    JAZZ DEVELOPER

     which means:

    - we fetch external values if / when set
    - we fetch internal values if / when no external values set


    permanent link
    Rahul Singh Bhadauriya (2811720) | answered Feb 05 '14, 9:07 a.m.
    Hi Eric,
    Sorry for the mismatch screen shots between the priority and severity and thanks again for the explanation.

    I have tried with a new project area.
    When i have tried to fetch the value of enum it works perfect and displaying the all allowed value.

    Now i have set the external value for the enum.
    This also gives me all the allowed values.

    Now i have removed the External Values for the enum and here the issue is:
    It gives me the only one value

    For Severity
    https://localhost:9443/ccm/oslc/enumerations/_lybzUo41EeOWAuxJalNJdg/severity/severity.literal.l1
    
    For Priority

    https://localhost:9443/ccm/oslc/enumerations/_lybzUo41EeOWAuxJalNJdg/priority/priority.literal.l01
    
    As per your answer It should display the allowed values, but in my case the issue is still reproducible .

    Thanks & Regards,
    Rahul





    Comments
    Myles F commented Mar 06 '15, 5:21 p.m. | edited Mar 06 '15, 5:22 p.m.

    I have encountered this issue as well, so far with RTC 4.0.0.2 and 4.0.6 but not with 5.0.x versions.
    When no external value is set, internalSeverity and internalPriority only return a single allowed value (ie priority.literal.l01). Once external values are set, the allowed values start showing up in the resource shape, but if the external values are removed, they disappear again.

    Rahul, were you ever able to find a solution for this problem?


    permanent link
    Sujith Babu Bandla (111) | answered Sep 05 '17, 9:13 a.m.

     Hi Rahul,


    Please try using this code 

    //Look at the allowed values for Priority. This is generally a required field for defects.
    Property PriorityProperty = shape.getProperty(new URI("http://open-services.net/ns/cm-x#priority"));
    if (PriorityProperty != null) {
    System.out.println("Inside not null property");
    URI allowedValuesRef8 = PriorityProperty.getAllowedValuesRef();
    ClientResponse allowedValuesResponse8 = client.getResource(allowedValuesRef8.toString(),OslcMediaType.APPLICATION_XML);
    AllowedValues allowedValues8 = allowedValuesResponse8.getEntity(AllowedValues.class);
    Object[] values8 = allowedValues8.getValues().toArray();
    for(Object val:values8) {
    System.out.println("The values of Priority literal are "+val);
    }
    //If this fails, you might need to check that the value is not "Unassigned", which is an allowed value in some RTC project areas.
    //Try the second value instead of the first, most project area processes create more than one category
    defect1.getExtendedProperties().put(new QName("http://open-services.net/ns/cm-x#", "priority"), (URI) values8[2]);
    }

    Thanks,
    Sujith Babu

    Your answer


    Register or to post your answer.