Java Code Examples for org.apache.olingo.odata2.api.edm.provider.Association#getName()

The following examples show how to use org.apache.olingo.odata2.api.edm.provider.Association#getName() . 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: AnnotationEdmProvider.java    From olingo-odata2 with Apache License 2.0 6 votes vote down vote up
public void addAssociationSets(final Collection<Association> associations) throws ODataException {
  for (Association association : associations) {
    AssociationSet as = new AssociationSet();
    as.setName(association.getName());
    FullQualifiedName asAssociationFqn = new FullQualifiedName(namespace, association.getName());
    as.setAssociation(asAssociationFqn);

    AssociationSetEnd asEnd1 = new AssociationSetEnd();
    asEnd1.setEntitySet(getEntitySetName(association.getEnd1()));
    asEnd1.setRole(association.getEnd1().getRole());
    as.setEnd1(asEnd1);

    AssociationSetEnd asEnd2 = new AssociationSetEnd();
    asEnd2.setEntitySet(getEntitySetName(association.getEnd2()));
    asEnd2.setRole(association.getEnd2().getRole());
    as.setEnd2(asEnd2);

    associationSets.add(as);
  }
}
 
Example 2
Source File: AnnotationEdmProviderTest.java    From olingo-odata2 with Apache License 2.0 6 votes vote down vote up
private void validateAssociation(final Association association) {
  String name = association.getName();
  if (name.equals("r_Employees_2_r_Room")) {
    validateAssociation(association,
        "r_Room", EdmMultiplicity.ONE, defaultFqn("Room"),
        "r_Employees", EdmMultiplicity.MANY, defaultFqn("Employee"));
  } else if (name.equals("BuildingRooms")) {
    validateAssociation(association,
        "r_Building", EdmMultiplicity.ONE, defaultFqn("Building"),
        "r_Rooms", EdmMultiplicity.MANY, defaultFqn("Room"));
  } else if (name.equals("ManagerEmployees")) {
    validateAssociation(association,
        "r_Manager", EdmMultiplicity.ONE, defaultFqn("Manager"),
        "r_Employees", EdmMultiplicity.MANY, defaultFqn("Employee"));
  } else if (name.equals("TeamEmployees")) {
    validateAssociation(association,
        "r_Team", EdmMultiplicity.ONE, defaultFqn("Team"),
        "r_Employees", EdmMultiplicity.MANY, defaultFqn("Employee"));
  } else if (name.equals("Team_2_r_SubTeam")) {
    validateAssociation(association,
        "Team", EdmMultiplicity.ONE, defaultFqn("Team"),
        "r_SubTeam", EdmMultiplicity.ONE, defaultFqn("Team"));
  } else {
    fail("Got unknown association to validate with name '" + name + "'.");
  }
}
 
Example 3
Source File: AnnotationEdmProvider.java    From olingo-odata2 with Apache License 2.0 5 votes vote down vote up
public void addAssociations(final Collection<Association> associations) {
  for (Association association : associations) {
    final String relationshipName = association.getName();
    if (name2Associations.containsKey(relationshipName)) {
      association = mergeAssociations(name2Associations.get(relationshipName), association);
    }
    name2Associations.put(relationshipName, association);
  }
}
 
Example 4
Source File: EdmAssociationImplProv.java    From olingo-odata2 with Apache License 2.0 4 votes vote down vote up
public EdmAssociationImplProv(final EdmImplProv edm, final Association association, final String namespace)
    throws EdmException {
  super(edm, association.getName());
  this.association = association;
  this.namespace = namespace;
}