Hi,I am looking for a way to programmatically retrieve the values of a list constraint. The example below tries to do exactly this, but does not work as expected.
public List<SelectItem> getStatusValues() {
PropertyDefinition pd = getDictionaryService().getProperty(MyModel.STATUS_PROP);
List<SelectItem> result = new ArrayList<SelectItem>();
for (ConstraintDefinition cd : pd.getConstraints()) {
cd.getConstraint().
result.add(new SelectItem(cd.getName().getLocalName()));
}
return result;
}
So the expected output in a listbox would be two entries with values "open" and "closed", given the constraint definition below.
<constraint name="enum-status" type="LIST">
<parameter name="allowedValues">
<list>
<value>open</value>
<value>closed</value>
</list>
</parameter>
</constraint>
…
<property name="status">
…
<constraints>
<constraint ref="enum-status"/>
</constraints>
</property>
Unfortunately, all I get is a single entry "status_anon_13". What would be the correct code to produce the desired listbox entries?