04-16-2009 07:38 AM
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>
04-16-2009 09:02 AM
public List<SelectItem> getStatusValues() {
PropertyDefinition pd = getDictionaryService().getProperty(MyModel.STATUS_PROP);
List<SelectItem> result = new ArrayList<SelectItem>();
for (ConstraintDefinition cd : pd.getConstraints()) {
if (cd.getConstraint() instanceof ListOfValuesConstraint) {
ListOfValuesConstraint lc = (ListOfValuesConstraint) cd.getConstraint()
for (String val : lc.getAllowedValues()) {
result.add(new SelectItem(val));
}
}
}
return result;
}
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.