How to get the allowed values for the Enumeration List(multiple checkbox)
Hi,
Please let me know, How to get the allowed values for the Enumeration List(multiple checkbox)?
As per below Donald comment in(https://jazz.net/forum/questions/240074/how-to-get-all-the-values-for-the-multiple-checkboxenumeration-list ),i think i'm able to get the
Donald Nongcommented Jun 06, 3:28 a.m.
No, you will not get <oslc:allowedValues>. Instead, you should get <oslc:range>, which is missing in your output above, for some reason. If you can get the <oslc:range> attribute, and access the resource URI within it, you will get all the allowed enumeration values.
I'm able to get the below range form the URL: https://localhost:9443/ccm/oslc/enumerations/_GFWMAHjbEee7Pug-3D3SBA/enumerationList$Variant_ID/ ,but not sure how to get the allowed values from therange.Please help me on that.
<oslc_cm:Collection oslc_cm:totalCount="7">
<rtc_cm:Literal rdf:resource="https://localhost:9443/ccm/oslc/enumerations/_GFWMAHjbEee7Pug-3D3SBA/enumerationList$Variant_ID/Variant_ID.literal.l15"><dc:identifier>Variant_ID.literal.l15</dc:identifier><dc:title>Select a value</dc:title><rtc_cm:iconUrl/></rtc_cm:Literal>
<rtc_cm:Literal rdf:resource="https://localhost:9443/ccm/oslc/enumerations/_GFWMAHjbEee7Pug-3D3SBA/enumerationList$Variant_ID/Variant_ID.literal.l56"><dc:identifier>Variant_ID.literal.l56</dc:identifier><dc:title>High +</dc:title><rtc_cm:iconUrl/></rtc_cm:Literal>
<rtc_cm:Literal rdf:resource="https://localhost:9443/ccm/oslc/enumerations/_GFWMAHjbEee7Pug-3D3SBA/enumerationList$Variant_ID/Variant_ID.literal.l57"><dc:identifier>Variant_ID.literal.l57</dc:identifier><dc:title>High</dc:title><rtc_cm:iconUrl/></rtc_cm:Literal>
<rtc_cm:Literal rdf:resource="https://localhost:9443/ccm/oslc/enumerations/_GFWMAHjbEee7Pug-3D3SBA/enumerationList$Variant_ID/Variant_ID.literal.l58"><dc:identifier>Variant_ID.literal.l58</dc:identifier><dc:title>Mid</dc:title><rtc_cm:iconUrl/></rtc_cm:Literal>
<rtc_cm:Literal rdf:resource="https://localhost:9443/ccm/oslc/enumerations/_GFWMAHjbEee7Pug-3D3SBA/enumerationList$Variant_ID/Variant_ID.literal.l9"><dc:identifier>Variant_ID.literal.l9</dc:identifier><dc:title>Base Optional</dc:title><rtc_cm:iconUrl/></rtc_cm:Literal>
<rtc_cm:Literal rdf:resource="https://localhost:9443/ccm/oslc/enumerations/_GFWMAHjbEee7Pug-3D3SBA/enumerationList$Variant_ID/Variant_ID.literal.l59"><dc:identifier>Variant_ID.literal.l59</dc:identifier><dc:title>Base</dc:title><rtc_cm:iconUrl/></rtc_cm:Literal>
<rtc_cm:Literal rdf:resource="https://localhost:9443/ccm/oslc/enumerations/_GFWMAHjbEee7Pug-3D3SBA/enumerationList$Variant_ID/Variant_ID.literal.l60"><dc:identifier>Variant_ID.literal.l60</dc:identifier><dc:title>Limited Edition (2017)</dc:title><rtc_cm:iconUrl/>
</rtc_cm:Literal>
</oslc_cm:Collection>
Tha java OSLC code used is
Property vehicle_typeProperty1 = shape.getProperty(new URI("http://jazz.net/xmlns/prod/jazz/rtc/ext/1.0/"+"vehicle_variant_defect"));
if(null !=vehicle_typeProperty1) {
URI[] allowedValuesRef4=vehicle_typeProperty1.getRange();
ClientResponse allowedValuesResponse9= client.getResource(allowedValuesRef20.toString(),OslcMediaType.APPLICATION_XML);
AllowedValues allowedValues9 = allowedValuesResponse9.getEntity(AllowedValues.class);
Object[] values9 = allowedValues9.getValues().toArray();
defect1.getExtendedProperties().put(new QName("http://jazz.net/xmlns/prod/jazz/rtc/ext/1.0/","vehicle_variant_defect", "rtc_ext"), (URI) values9[2]);
defect1.getExtendedProperties().put(new QName("http://jazz.net/xmlns/prod/jazz/rtc/ext/1.0/","vehicle_variant_defect", "rtc_ext"), (URI) values9[1]);
}
}
Thanks,
Sujith Babu