M2Model model = AlfrescoConversionUtil.getContentModel(conversion);
// Check if model contains an aspect for the property
String propertyName = getPropertyName(referenceDefinition, conversion);
M2ClassAssociation association = new M2ClassAssociation();
association.setName(propertyName);
association.setTitle(referenceDefinition.getName());
M2AssociationSource source = new M2AssociationSource();
source.setMany(false);
source.setMandatory(true);
M2AssociationTarget target = new M2AssociationTarget();
target.setClassName(referenceDefinition.getType());
target.setMandatory(referenceDefinition.isMandatory());
// Determine whether or not it's allowed to select multiple targets
boolean isTargetMany = extractBooleanFromParameters(referenceDefinition.getParameters(),
AlfrescoConversionConstants.PARAMETER_REFERENCE_MANY, false);
target.setMany(isTargetMany);
association.setTarget(target);
association.setSource(source);
M2Aspect aspect = model.getAspect(propertyName);
if (aspect != null) {
if (aspect.getAssociations().isEmpty()) {
aspect.getAssociations().add(association);