Thank you for the suggestion. I couldn't get that exact method to work but it did put me on the right path and I ended up with the following. Note that this collects both global enumerations and legal value lists.
public RequestResponse handleRequest() {
logger.trace("handleRequest()");
HashMap<String, List<LocalizedValue>> result = new HashMap<>();
try {
Locale loc = SessionHelper.getLocale();
String type = request.getParameter("type");
WCTypeIdentifier wti = new WCTypeIdentifier(type);
AttributeTypeIdentifier[] attrs = TypeInstanceHelper.getSoftAttributeTypeIdentifiers(wti);
Map<AttributeTypeIdentifier, AttributeTypeSummary> summaries = AttributeTypeSummaryHelper.SERVICE.getATS(Arrays.asList(attrs), loc);
for (AttributeTypeIdentifier ati : attrs) {
logger.debug("attr: {}", ati.getAttributeName());
AttributeDefinitionReadView attrDef = TypeDefinitionServiceHelper.service.getAttributeDefView(ati);
ConstraintDefinitionReadView globalEnumConstraint = EnumerationConstraintHelper.getGlobalEnumeratedValueListConstraint(attrDef);
EnumerationDefinitionReadView enumDef = globalEnumConstraint != null ? globalEnumConstraint.getEnumDef() : null;
Map<String, EnumerationEntryReadView> entries = enumDef != null ? enumDef.getAllEnumerationEntries() : null;
DataSet ds = (DataSet) summaries.get(ati).getLegalValueSet();
ArrayList<LocalizedValue> values = new ArrayList<>();
// Collect gloal enumeration entties
if (entries != null) {
for (Map.Entry<String, EnumerationEntryReadView> entry : entries.entrySet()) {
EnumerationEntryReadView value = entry.getValue();
PropertyValueReadView display = value.getPropertyValueByName("displayName");
String localizedDisplay = display.getValueAsString(loc, true);
values.add(new LocalizedValue(entry.getKey(), localizedDisplay));
}
}
// Collect legal value list entties
if (ds != null && ds instanceof DiscreteSet) {
DiscreteSet set = (DiscreteSet) ds;
for (Object el : set.getElements()) {
String strValue = el.toString();
values.add(new LocalizedValue(strValue, strValue));
}
}
if (values.size() > 0) {
result.put(ati.getAttributeName(), values);
}
}
} catch (WTException ex) {
throw new RuntimeException(ex);
}
return success(result);
}
Thanks again!