name2Associations.put(relationshipName, association);
}
}
private Association mergeAssociations(final Association associationOne, final Association associationTwo) {
AssociationEnd oneEnd1 = associationOne.getEnd1();
AssociationEnd oneEnd2 = associationOne.getEnd2();
AssociationEnd twoEnd1 = associationTwo.getEnd1();
AssociationEnd twoEnd2 = associationTwo.getEnd2();
AssociationEnd[] oneEnds = new AssociationEnd[] { oneEnd1, oneEnd2 };
for (AssociationEnd associationEnd : oneEnds) {
if (associationEnd.getRole().equals(twoEnd1.getRole())) {
if (twoEnd1.getMultiplicity() == EdmMultiplicity.MANY) {
associationEnd.setMultiplicity(EdmMultiplicity.MANY);
}
} else if (associationEnd.getRole().equals(twoEnd2.getRole())) {
if (twoEnd2.getMultiplicity() == EdmMultiplicity.MANY) {
associationEnd.setMultiplicity(EdmMultiplicity.MANY);
}
}
}