Java Code Examples for org.apache.olingo.odata2.api.edm.FullQualifiedName#equals()

The following examples show how to use org.apache.olingo.odata2.api.edm.FullQualifiedName#equals() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JPAEdmExtension.java    From lemonaid with MIT License 5 votes vote down vote up
private EntityType getEntityType(Schema edmSchema, FullQualifiedName entityType) {
	for (EntityType e : edmSchema.getEntityTypes()) {
		if (entityType.equals(new FullQualifiedName(edmSchema.getNamespace(), e.getName()))) {
			return e;
		}
	}
	return null;
}
 
Example 2
Source File: JPAEdmAssociationEnd.java    From olingo-odata2 with Apache License 2.0 4 votes vote down vote up
@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;
}