M2Model model = AlfrescoConversionUtil.getContentModel(conversion);
contentType.getProperties().add(property);
// Create constraint for the values
if(def.getTransitions() != null && !def.getTransitions().isEmpty()) {
M2Constraint valueConstraint = new M2Constraint();
valueConstraint.setType(AlfrescoConversionConstants.CONTENT_MODEL_CONSTRAINT_TYPE_LIST);
valueConstraint.setName(propertyName + AlfrescoConversionConstants.CONTENT_MODEL_CONSTRAINT_TYPE_LIST.toLowerCase());
List<String> values = new ArrayList<String>(def.getTransitions().size());
for(ListPropertyEntry entry : def.getTransitions()) {
values.add(entry.getValue());
}
valueConstraint.getParameters().add(new M2NamedValue(AlfrescoConversionConstants.CONTENT_MODEL_CONSTRAINT_ALLOWED_VALUES, null, values));
// Add constraint to the root model instead of the type itself and reference it from within the property
// for readability and reuse of the model
model.getConstraints().add(valueConstraint);
M2Constraint reference = new M2Constraint();
reference.setRef(valueConstraint.getName());
property.getConstraints().add(reference);
}
// Add a pointer to the transition-property as well, using an override
M2PropertyOverride override = new M2PropertyOverride();