@Test public void testCompare() { assertTrue(objJPAEdmAssociationEnd.compare(getAssociationEnd("SOID", 1), getAssociationEnd("String", 1))); assertFalse(objJPAEdmAssociationEnd.compare(getAssociationEnd("String", 2), getAssociationEnd("SOID", 1))); }
@Override public boolean compare(final AssociationEnd end1, final AssociationEnd end2) { FullQualifiedName end1Type = end1.getType(); FullQualifiedName currentAssociationEnd1Type = currentAssociationEnd1.getType(); FullQualifiedName end2Type = end2.getType(); FullQualifiedName currentAssociationEnd2Type = currentAssociationEnd2.getType(); if(end1.getMultiplicity() == null || currentAssociationEnd1.getMultiplicity() == null) { return false; } if(end2.getMultiplicity() == null || currentAssociationEnd2.getMultiplicity() == null) { return false; } boolean end1eqCurEnd1 = end1.getMultiplicity().equals(currentAssociationEnd1.getMultiplicity()); boolean end2eqCurEnd2 = end2.getMultiplicity().equals(currentAssociationEnd2.getMultiplicity()); if(end1Type.equals(currentAssociationEnd1Type) && end2Type.equals(currentAssociationEnd2Type) && end1eqCurEnd1 && end2eqCurEnd2) { return true; } boolean end1EqCurEnd2 = end1.getMultiplicity().equals(currentAssociationEnd2.getMultiplicity()); boolean end2EqCurEnd1 = end2.getMultiplicity().equals(currentAssociationEnd1.getMultiplicity()); if(end1Type.equals(currentAssociationEnd2Type) && end2Type.equals(currentAssociationEnd1Type) && end1EqCurEnd2 && end2EqCurEnd1) { return true; } boolean end1IsZeroToOne = end1.getMultiplicity() == EdmMultiplicity.ZERO_TO_ONE; boolean end1IsOne = end1.getMultiplicity() == EdmMultiplicity.ONE; boolean end2IsZeroToOne = end2.getMultiplicity() == EdmMultiplicity.ZERO_TO_ONE; boolean end2IsOne = end2.getMultiplicity() == EdmMultiplicity.ONE; if (end1Type.equals(currentAssociationEnd1Type) && end2Type.equals(currentAssociationEnd2Type)) { if ((end1IsZeroToOne && currentAssociationEnd1.getMultiplicity() == EdmMultiplicity.ONE || end1IsOne && currentAssociationEnd1.getMultiplicity() == EdmMultiplicity.ZERO_TO_ONE) && end2eqCurEnd2) { return true; } if ((end2IsZeroToOne && currentAssociationEnd2.getMultiplicity() == EdmMultiplicity.ONE || end2IsOne && currentAssociationEnd2.getMultiplicity() == EdmMultiplicity.ZERO_TO_ONE) && end1eqCurEnd1) { return true; } } if (end2Type.equals(currentAssociationEnd1Type) && end1Type.equals(currentAssociationEnd2Type)) { if ((end1IsZeroToOne && currentAssociationEnd2.getMultiplicity() == EdmMultiplicity.ONE || end1IsOne && currentAssociationEnd2.getMultiplicity() == EdmMultiplicity.ZERO_TO_ONE) && end2EqCurEnd1) { return true; } if ((end2IsZeroToOne && currentAssociationEnd1.getMultiplicity() == EdmMultiplicity.ONE || end2IsOne && currentAssociationEnd1.getMultiplicity() == EdmMultiplicity.ZERO_TO_ONE) && end1EqCurEnd2) { return true; } } return false; }
JPAEdmAssociationEnd extends JPAEdmBaseViewImpl implements JPAEdmAssociationEndView { @Override public boolean compare(final AssociationEnd end1, final AssociationEnd end2) { FullQualifiedName end1Type = end1.getType(); FullQualifiedName currentAssociationEnd1Type = currentAssociationEnd1.getType(); FullQualifiedName end2Type = end2.getType(); FullQualifiedName currentAssociationEnd2Type = currentAssociationEnd2.getType(); if(end1.getMultiplicity() == null || currentAssociationEnd1.getMultiplicity() == null) { return false; } if(end2.getMultiplicity() == null || currentAssociationEnd2.getMultiplicity() == null) { return false; } boolean end1eqCurEnd1 = end1.getMultiplicity().equals(currentAssociationEnd1.getMultiplicity()); boolean end2eqCurEnd2 = end2.getMultiplicity().equals(currentAssociationEnd2.getMultiplicity()); if(end1Type.equals(currentAssociationEnd1Type) && end2Type.equals(currentAssociationEnd2Type) && end1eqCurEnd1 && end2eqCurEnd2) { return true; } boolean end1EqCurEnd2 = end1.getMultiplicity().equals(currentAssociationEnd2.getMultiplicity()); boolean end2EqCurEnd1 = end2.getMultiplicity().equals(currentAssociationEnd1.getMultiplicity()); if(end1Type.equals(currentAssociationEnd2Type) && end2Type.equals(currentAssociationEnd1Type) && end1EqCurEnd2 && end2EqCurEnd1) { return true; } boolean end1IsZeroToOne = end1.getMultiplicity() == EdmMultiplicity.ZERO_TO_ONE; boolean end1IsOne = end1.getMultiplicity() == EdmMultiplicity.ONE; boolean end2IsZeroToOne = end2.getMultiplicity() == EdmMultiplicity.ZERO_TO_ONE; boolean end2IsOne = end2.getMultiplicity() == EdmMultiplicity.ONE; if (end1Type.equals(currentAssociationEnd1Type) && end2Type.equals(currentAssociationEnd2Type)) { if ((end1IsZeroToOne && currentAssociationEnd1.getMultiplicity() == EdmMultiplicity.ONE || end1IsOne && currentAssociationEnd1.getMultiplicity() == EdmMultiplicity.ZERO_TO_ONE) && end2eqCurEnd2) { return true; } if ((end2IsZeroToOne && currentAssociationEnd2.getMultiplicity() == EdmMultiplicity.ONE || end2IsOne && currentAssociationEnd2.getMultiplicity() == EdmMultiplicity.ZERO_TO_ONE) && end1eqCurEnd1) { return true; } } if (end2Type.equals(currentAssociationEnd1Type) && end1Type.equals(currentAssociationEnd2Type)) { if ((end1IsZeroToOne && currentAssociationEnd2.getMultiplicity() == EdmMultiplicity.ONE || end1IsOne && currentAssociationEnd2.getMultiplicity() == EdmMultiplicity.ZERO_TO_ONE) && end2EqCurEnd1) { return true; } if ((end2IsZeroToOne && currentAssociationEnd1.getMultiplicity() == EdmMultiplicity.ONE || end2IsOne && currentAssociationEnd1.getMultiplicity() == EdmMultiplicity.ZERO_TO_ONE) && end1EqCurEnd2) { return true; } } return false; } }
JPAEdmAssociationEnd extends JPAEdmBaseViewImpl implements JPAEdmAssociationEndView { @Override public boolean compare(final AssociationEnd end1, final AssociationEnd end2) { FullQualifiedName end1Type = end1.getType(); FullQualifiedName currentAssociationEnd1Type = currentAssociationEnd1.getType(); FullQualifiedName end2Type = end2.getType(); FullQualifiedName currentAssociationEnd2Type = currentAssociationEnd2.getType(); if(end1.getMultiplicity() == null || currentAssociationEnd1.getMultiplicity() == null) { return false; } if(end2.getMultiplicity() == null || currentAssociationEnd2.getMultiplicity() == null) { return false; } boolean end1eqCurEnd1 = end1.getMultiplicity().equals(currentAssociationEnd1.getMultiplicity()); boolean end2eqCurEnd2 = end2.getMultiplicity().equals(currentAssociationEnd2.getMultiplicity()); if(end1Type.equals(currentAssociationEnd1Type) && end2Type.equals(currentAssociationEnd2Type) && end1eqCurEnd1 && end2eqCurEnd2) { return true; } boolean end1EqCurEnd2 = end1.getMultiplicity().equals(currentAssociationEnd2.getMultiplicity()); boolean end2EqCurEnd1 = end2.getMultiplicity().equals(currentAssociationEnd1.getMultiplicity()); if(end1Type.equals(currentAssociationEnd2Type) && end2Type.equals(currentAssociationEnd1Type) && end1EqCurEnd2 && end2EqCurEnd1) { return true; } boolean end1IsZeroToOne = end1.getMultiplicity() == EdmMultiplicity.ZERO_TO_ONE; boolean end1IsOne = end1.getMultiplicity() == EdmMultiplicity.ONE; boolean end2IsZeroToOne = end2.getMultiplicity() == EdmMultiplicity.ZERO_TO_ONE; boolean end2IsOne = end2.getMultiplicity() == EdmMultiplicity.ONE; if (end1Type.equals(currentAssociationEnd1Type) && end2Type.equals(currentAssociationEnd2Type)) { if ((end1IsZeroToOne && currentAssociationEnd1.getMultiplicity() == EdmMultiplicity.ONE || end1IsOne && currentAssociationEnd1.getMultiplicity() == EdmMultiplicity.ZERO_TO_ONE) && end2eqCurEnd2) { return true; } if ((end2IsZeroToOne && currentAssociationEnd2.getMultiplicity() == EdmMultiplicity.ONE || end2IsOne && currentAssociationEnd2.getMultiplicity() == EdmMultiplicity.ZERO_TO_ONE) && end1eqCurEnd1) { return true; } } if (end2Type.equals(currentAssociationEnd1Type) && end1Type.equals(currentAssociationEnd2Type)) { if ((end1IsZeroToOne && currentAssociationEnd2.getMultiplicity() == EdmMultiplicity.ONE || end1IsOne && currentAssociationEnd2.getMultiplicity() == EdmMultiplicity.ZERO_TO_ONE) && end2EqCurEnd1) { return true; } if ((end2IsZeroToOne && currentAssociationEnd1.getMultiplicity() == EdmMultiplicity.ONE || end2IsOne && currentAssociationEnd1.getMultiplicity() == EdmMultiplicity.ZERO_TO_ONE) && end1EqCurEnd2) { return true; } } return false; } JPAEdmAssociationEnd(final JPAEdmEntityTypeView entityTypeView, final JPAEdmPropertyView propertyView); }
JPAEdmAssociationEnd extends JPAEdmBaseViewImpl implements JPAEdmAssociationEndView { @Override public boolean compare(final AssociationEnd end1, final AssociationEnd end2) { FullQualifiedName end1Type = end1.getType(); FullQualifiedName currentAssociationEnd1Type = currentAssociationEnd1.getType(); FullQualifiedName end2Type = end2.getType(); FullQualifiedName currentAssociationEnd2Type = currentAssociationEnd2.getType(); if(end1.getMultiplicity() == null || currentAssociationEnd1.getMultiplicity() == null) { return false; } if(end2.getMultiplicity() == null || currentAssociationEnd2.getMultiplicity() == null) { return false; } boolean end1eqCurEnd1 = end1.getMultiplicity().equals(currentAssociationEnd1.getMultiplicity()); boolean end2eqCurEnd2 = end2.getMultiplicity().equals(currentAssociationEnd2.getMultiplicity()); if(end1Type.equals(currentAssociationEnd1Type) && end2Type.equals(currentAssociationEnd2Type) && end1eqCurEnd1 && end2eqCurEnd2) { return true; } boolean end1EqCurEnd2 = end1.getMultiplicity().equals(currentAssociationEnd2.getMultiplicity()); boolean end2EqCurEnd1 = end2.getMultiplicity().equals(currentAssociationEnd1.getMultiplicity()); if(end1Type.equals(currentAssociationEnd2Type) && end2Type.equals(currentAssociationEnd1Type) && end1EqCurEnd2 && end2EqCurEnd1) { return true; } boolean end1IsZeroToOne = end1.getMultiplicity() == EdmMultiplicity.ZERO_TO_ONE; boolean end1IsOne = end1.getMultiplicity() == EdmMultiplicity.ONE; boolean end2IsZeroToOne = end2.getMultiplicity() == EdmMultiplicity.ZERO_TO_ONE; boolean end2IsOne = end2.getMultiplicity() == EdmMultiplicity.ONE; if (end1Type.equals(currentAssociationEnd1Type) && end2Type.equals(currentAssociationEnd2Type)) { if ((end1IsZeroToOne && currentAssociationEnd1.getMultiplicity() == EdmMultiplicity.ONE || end1IsOne && currentAssociationEnd1.getMultiplicity() == EdmMultiplicity.ZERO_TO_ONE) && end2eqCurEnd2) { return true; } if ((end2IsZeroToOne && currentAssociationEnd2.getMultiplicity() == EdmMultiplicity.ONE || end2IsOne && currentAssociationEnd2.getMultiplicity() == EdmMultiplicity.ZERO_TO_ONE) && end1eqCurEnd1) { return true; } } if (end2Type.equals(currentAssociationEnd1Type) && end1Type.equals(currentAssociationEnd2Type)) { if ((end1IsZeroToOne && currentAssociationEnd2.getMultiplicity() == EdmMultiplicity.ONE || end1IsOne && currentAssociationEnd2.getMultiplicity() == EdmMultiplicity.ZERO_TO_ONE) && end2EqCurEnd1) { return true; } if ((end2IsZeroToOne && currentAssociationEnd1.getMultiplicity() == EdmMultiplicity.ONE || end2IsOne && currentAssociationEnd1.getMultiplicity() == EdmMultiplicity.ZERO_TO_ONE) && end1EqCurEnd2) { return true; } } return false; } JPAEdmAssociationEnd(final JPAEdmEntityTypeView entityTypeView, final JPAEdmPropertyView propertyView); @Override JPAEdmBuilder getBuilder(); @Override AssociationEnd getEdmAssociationEnd1(); @Override AssociationEnd getEdmAssociationEnd2(); @Override boolean compare(final AssociationEnd end1, final AssociationEnd end2); @Override String[] getJoinColumnNames(); @Override String[] getJoinColumnReferenceColumnNames(); @Override String getMappedByName(); @Override String getOwningPropertyName(); }
JPAEdmAssociationEnd extends JPAEdmBaseViewImpl implements JPAEdmAssociationEndView { @Override public boolean compare(final AssociationEnd end1, final AssociationEnd end2) { FullQualifiedName end1Type = end1.getType(); FullQualifiedName currentAssociationEnd1Type = currentAssociationEnd1.getType(); FullQualifiedName end2Type = end2.getType(); FullQualifiedName currentAssociationEnd2Type = currentAssociationEnd2.getType(); if(end1.getMultiplicity() == null || currentAssociationEnd1.getMultiplicity() == null) { return false; } if(end2.getMultiplicity() == null || currentAssociationEnd2.getMultiplicity() == null) { return false; } boolean end1eqCurEnd1 = end1.getMultiplicity().equals(currentAssociationEnd1.getMultiplicity()); boolean end2eqCurEnd2 = end2.getMultiplicity().equals(currentAssociationEnd2.getMultiplicity()); if(end1Type.equals(currentAssociationEnd1Type) && end2Type.equals(currentAssociationEnd2Type) && end1eqCurEnd1 && end2eqCurEnd2) { return true; } boolean end1EqCurEnd2 = end1.getMultiplicity().equals(currentAssociationEnd2.getMultiplicity()); boolean end2EqCurEnd1 = end2.getMultiplicity().equals(currentAssociationEnd1.getMultiplicity()); if(end1Type.equals(currentAssociationEnd2Type) && end2Type.equals(currentAssociationEnd1Type) && end1EqCurEnd2 && end2EqCurEnd1) { return true; } boolean end1IsZeroToOne = end1.getMultiplicity() == EdmMultiplicity.ZERO_TO_ONE; boolean end1IsOne = end1.getMultiplicity() == EdmMultiplicity.ONE; boolean end2IsZeroToOne = end2.getMultiplicity() == EdmMultiplicity.ZERO_TO_ONE; boolean end2IsOne = end2.getMultiplicity() == EdmMultiplicity.ONE; if (end1Type.equals(currentAssociationEnd1Type) && end2Type.equals(currentAssociationEnd2Type)) { if ((end1IsZeroToOne && currentAssociationEnd1.getMultiplicity() == EdmMultiplicity.ONE || end1IsOne && currentAssociationEnd1.getMultiplicity() == EdmMultiplicity.ZERO_TO_ONE) && end2eqCurEnd2) { return true; } if ((end2IsZeroToOne && currentAssociationEnd2.getMultiplicity() == EdmMultiplicity.ONE || end2IsOne && currentAssociationEnd2.getMultiplicity() == EdmMultiplicity.ZERO_TO_ONE) && end1eqCurEnd1) { return true; } } if (end2Type.equals(currentAssociationEnd1Type) && end1Type.equals(currentAssociationEnd2Type)) { if ((end1IsZeroToOne && currentAssociationEnd2.getMultiplicity() == EdmMultiplicity.ONE || end1IsOne && currentAssociationEnd2.getMultiplicity() == EdmMultiplicity.ZERO_TO_ONE) && end2EqCurEnd1) { return true; } if ((end2IsZeroToOne && currentAssociationEnd1.getMultiplicity() == EdmMultiplicity.ONE || end2IsOne && currentAssociationEnd1.getMultiplicity() == EdmMultiplicity.ZERO_TO_ONE) && end1EqCurEnd2) { return true; } } return false; } JPAEdmAssociationEnd(final JPAEdmEntityTypeView entityTypeView, final JPAEdmPropertyView propertyView); @Override JPAEdmBuilder getBuilder(); @Override AssociationEnd getEdmAssociationEnd1(); @Override AssociationEnd getEdmAssociationEnd2(); @Override boolean compare(final AssociationEnd end1, final AssociationEnd end2); @Override String[] getJoinColumnNames(); @Override String[] getJoinColumnReferenceColumnNames(); @Override String getMappedByName(); @Override String getOwningPropertyName();  }