It's all about the answers!

Ask a question

How to get the allowed values for the Enumeration List(multiple checkbox)


Sujith Babu Bandla (262) | asked Sep 27 '17, 5:31 a.m.

 Hi,


Please let me know, How to get the allowed values for the Enumeration List(multiple checkbox)?


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>
</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

One answer



permanent link
Donald Nong (14.4k314) | answered Oct 17 '17, 2:02 a.m.

Not sure if it's too late to answer. Since the type is "enumeration list", the allowed value is any combination of the values in the "range". In your example,  a combination of 1 to 7 out of the 7 values would be valid.

Your answer


Register or to post your answer.