Why is json "truncated" for enumerations if externalValue="" ?
I spent some time this morning trying to figure out why an OSLC library I use began complaining about a null result on some enumeration literal or another. I figured out "why" but would like to understand why the json output will NOT contain literals which have externalValue="" on their definition ? [ I guess because they could not be distinguished from one another,otherwise ]
That is, if say priority has the following:
<enumeration attributeTypeId="priority">
<literal default="true" externalValue="" icon="processattachment:/enumeration/unassigned.gif" id="priority.literal.l01" name="Unassigned"/>
<literal externalValue="" icon="processattachment:/enumeration/low.gif" id="priority.literal.l02" name="Low"/>
<literal externalValue="" icon="processattachment:/enumeration/medium.gif" id="priority.literal.l07" name="Medium"/>
<literal externalValue="" icon="processattachment:/enumeration/high.gif" id="priority.literal.l11" name="High"/>
</enumeration>
Doing a REST call to get it (https://server:port/CONTEXT/oslc/enumerations/PROJECT_UUID/priority.json gives this:
[
{
"rdf:resource": "https://server:port/CONTEXT/oslc/enumerations/PROJECT_UUID/priority/priority.literal.l01",
"dc:title": "Unassigned"
}
]
I have worked around this by setting the externalValue == id. Is removing the externalValue="" also an acceptable course ?
I followed the above trail thanks to https://jazz.net/library/article/1002#enumerations
RTC 4.0.3
That is, if say priority has the following:
<enumeration attributeTypeId="priority">
<literal default="true" externalValue="" icon="processattachment:/enumeration/unassigned.gif" id="priority.literal.l01" name="Unassigned"/>
<literal externalValue="" icon="processattachment:/enumeration/low.gif" id="priority.literal.l02" name="Low"/>
<literal externalValue="" icon="processattachment:/enumeration/medium.gif" id="priority.literal.l07" name="Medium"/>
<literal externalValue="" icon="processattachment:/enumeration/high.gif" id="priority.literal.l11" name="High"/>
</enumeration>
Doing a REST call to get it (https://server:port/CONTEXT/oslc/enumerations/PROJECT_UUID/priority.json gives this:
[
{
"rdf:resource": "https://server:port/CONTEXT/oslc/enumerations/PROJECT_UUID/priority/priority.literal.l01",
"dc:title": "Unassigned"
}
]
I have worked around this by setting the externalValue == id. Is removing the externalValue="" also an acceptable course ?
I followed the above trail thanks to https://jazz.net/library/article/1002#enumerations
RTC 4.0.3
2 answers
Kevin,
When creating a new project area, the externalValue entries are not present on the enumeration definition.
Adding externalValue="" to all the enumeration entries for priority causes the problem you've described to appear for both 4.0.3 and 4.0.6 M1.
Removing externalValue="" from all the enumeration entries for priority allows all of the enumerations to be returned instead of just one for both 4.0.3 and 4.0.6 M1.
Shawn
When creating a new project area, the externalValue entries are not present on the enumeration definition.
Adding externalValue="" to all the enumeration entries for priority causes the problem you've described to appear for both 4.0.3 and 4.0.6 M1.
Removing externalValue="" from all the enumeration entries for priority allows all of the enumerations to be returned instead of just one for both 4.0.3 and 4.0.6 M1.
Shawn