@Override
public void build() throws ODataJPAModelException, ODataJPARuntimeException {
if (associationEndView != null && searchAssociation(associationEndView) == null) {
currentAssociation = new Association();
currentAssociation.setEnd1(associationEndView.getEdmAssociationEnd1());
currentAssociation.setEnd2(associationEndView.getEdmAssociationEnd2());
JPAEdmNameBuilder.build(JPAEdmAssociation.this, numberOfSimilarEndPoints);
associationMap.put(currentAssociation.getName(), currentAssociation);
} else if (!inconsistentRefConstraintViewList.isEmpty()) {
int inconsistentRefConstraintViewSize = inconsistentRefConstraintViewList.size();
int index = 0;
for (int i = 0; i < inconsistentRefConstraintViewSize; i++) {
JPAEdmReferentialConstraintView view = inconsistentRefConstraintViewList.get(index);
if (view.isExists() && !view.isConsistent()) {
view.getBuilder().build();
}
if (view.isConsistent()) {
Association newAssociation = new Association();
copyAssociation(newAssociation, associationMap.get(view.getEdmRelationShipName()));
newAssociation.setReferentialConstraint(view.getEdmReferentialConstraint());
consistentAssociatonList.add(newAssociation);
associationMap.put(view.getEdmRelationShipName(), newAssociation);
inconsistentRefConstraintViewList.remove(index);
} else {
associationMap.remove(view.getEdmRelationShipName());
index++;
}
}
}
if (associationMap.size() == consistentAssociatonList.size()) {
isConsistent = true;
} else {
for (String key : associationMap.keySet()) {
Association association = associationMap.get(key);
if (!consistentAssociatonList.contains(association)) {
consistentAssociatonList.add(association);
}
}
isConsistent = true;