Examples of AssociationEnd


Examples of org.apache.olingo.odata2.api.edm.provider.AssociationEnd

      }

      @Override
      public Association getEdmAssociation() {
        Association association = new Association();
        association.setEnd1(new AssociationEnd().setType(new FullQualifiedName("salesorderprocessing",
            "SalesOrderHeader")));
        association.setEnd2(new AssociationEnd()
            .setType(new FullQualifiedName("salesorderprocessing", "SalesOrderItem")));

        return association;
      }
View Full Code Here

Examples of org.apache.olingo.odata2.api.edm.provider.AssociationEnd

  @Override
  public Association getEdmAssociation() {
    Association association = new Association();
    association.setName("Assoc_SalesOrderHeader_SalesOrderItem");
    association.setEnd1(new AssociationEnd().setType(new FullQualifiedName("salesorderprocessing", "String")).setRole(
        "SalesOrderHeader"));
    association.setEnd2(new AssociationEnd().setType(new FullQualifiedName("salesorderprocessing", "SalesOrderItem"))
        .setRole("SalesOrderItem"));
    return association;
  }
View Full Code Here

Examples of org.apache.olingo.odata2.api.edm.provider.AssociationEnd

  @Override
  public Association getEdmAssociation() {
    Association association = new Association();
    association.setName("Assoc_SalesOrderHeader_SalesOrderItem");
    association.setEnd1(new AssociationEnd().setType(new FullQualifiedName("salesorderprocessing", "String")).setRole(
        "SalesOrderHeader"));
    association.setEnd2(new AssociationEnd().setType(new FullQualifiedName("salesorderprocessing", "SalesOrderItem"))
        .setRole("SalesOrderItem"));
    return association;
  }
View Full Code Here

Examples of org.apache.olingo.odata2.api.edm.provider.AssociationEnd

          currentRole.setPropertyRefs(propertyRefs);
          if (propertyRefs.isEmpty()) {
            isConsistent = false;
            return;
          }
          AssociationEnd end = association.getEnd1();
          if (end.getType().getName().equals(edmEntityType.getName())) {
            currentRole.setRole(end.getRole());
            isConsistent = true;
          } else {
            end = association.getEnd2();
            if (end.getType().getName().equals(edmEntityType.getName())) {
              currentRole.setRole(end.getRole());
              isConsistent = true;
            }
          }
        }
View Full Code Here

Examples of org.apache.olingo.odata2.api.edm.provider.AssociationEnd

  }

  @Override
  public int getNumberOfAssociationsWithSimilarEndPoints(final JPAEdmAssociationEndView view) {
    int count = 0;
    AssociationEnd currentAssociationEnd1 = view.getEdmAssociationEnd1();
    AssociationEnd currentAssociationEnd2 = view.getEdmAssociationEnd2();
    AssociationEnd end1 = null;
    AssociationEnd end2 = null;
    for (String key : associationMap.keySet()) {
      Association association = associationMap.get(key);
      if (association != null) {
        end1 = association.getEnd1();
        end2 = association.getEnd2();
        if ((end1.getType().equals(currentAssociationEnd1.getType()) && end2.getType().equals(
            currentAssociationEnd2.getType()))
            || (end1.getType().equals(currentAssociationEnd2.getType()) && end2.getType().equals(
                currentAssociationEnd1.getType()))) {
          count++;
        }
      }
    }
View Full Code Here

Examples of org.apache.olingo.odata2.api.edm.provider.AssociationEnd

  private class JPAEdmAssociationEndBuilder implements JPAEdmBuilder {

    @Override
    public void build() throws ODataJPAModelException {

      currentAssociationEnd1 = new AssociationEnd();
      currentAssociationEnd2 = new AssociationEnd();

      JPAEdmNameBuilder.build(JPAEdmAssociationEnd.this, entityTypeView, propertyView);

      currentAssociationEnd1.setRole(currentAssociationEnd1.getType().getName());
      currentAssociationEnd2.setRole(currentAssociationEnd2.getType().getName());
View Full Code Here

Examples of org.apache.olingo.odata2.api.edm.provider.AssociationEnd

  public Association getAssociation(final FullQualifiedName edmFQName) throws ODataException {
    if (NAMESPACE_1.equals(edmFQName.getNamespace())) {
      if (ASSOCIATION_1_1.getName().equals(edmFQName.getName())) {
        return new Association().setName(ASSOCIATION_1_1.getName())
            .setEnd1(
                new AssociationEnd().setType(ENTITY_TYPE_1_1).setRole(ROLE_1_1).setMultiplicity(EdmMultiplicity.MANY))
            .setEnd2(
                new AssociationEnd().setType(ENTITY_TYPE_1_4).setRole(ROLE_1_4).setMultiplicity(EdmMultiplicity.ONE));
      } else if (ASSOCIATION_1_2.getName().equals(edmFQName.getName())) {
        return new Association().setName(ASSOCIATION_1_2.getName())
            .setEnd1(
                new AssociationEnd().setType(ENTITY_TYPE_1_1).setRole(ROLE_1_1).setMultiplicity(EdmMultiplicity.MANY))
            .setEnd2(
                new AssociationEnd().setType(ENTITY_TYPE_1_2).setRole(ROLE_1_2).setMultiplicity(EdmMultiplicity.ONE));
      } else if (ASSOCIATION_1_3.getName().equals(edmFQName.getName())) {
        return new Association().setName(ASSOCIATION_1_3.getName())
            .setEnd1(
                new AssociationEnd().setType(ENTITY_TYPE_1_1).setRole(ROLE_1_1).setMultiplicity(EdmMultiplicity.MANY))
            .setEnd2(
                new AssociationEnd().setType(ENTITY_TYPE_1_3).setRole(ROLE_1_3).setMultiplicity(EdmMultiplicity.ONE));
      } else if (ASSOCIATION_1_4.getName().equals(edmFQName.getName())) {
        final List<PropertyRef> propertyRefsPrincipal = new ArrayList<PropertyRef>();
        propertyRefsPrincipal.add(new PropertyRef().setName("Id"));
        propertyRefsPrincipal.add(new PropertyRef().setName("Id2"));
        final List<PropertyRef> propertyRefsDependent = new ArrayList<PropertyRef>();
        propertyRefsDependent.add(new PropertyRef().setName("Id"));
        propertyRefsDependent.add(new PropertyRef().setName("Id2"));
        return new Association().setName(ASSOCIATION_1_4.getName())
            .setEnd1(
                new AssociationEnd().setType(ENTITY_TYPE_1_5).setRole(ROLE_1_5).setMultiplicity(EdmMultiplicity.ONE))
            .setEnd2(
                new AssociationEnd().setType(ENTITY_TYPE_1_3).setRole(ROLE_1_3).setMultiplicity(EdmMultiplicity.MANY))
            .setReferentialConstraint(
                new ReferentialConstraint().setPrincipal(
                    new ReferentialConstraintRole().setRole("BuildingToRoom").setPropertyRefs(propertyRefsPrincipal))
                    .setDependent(
                        new ReferentialConstraintRole().setRole("RoomToBuilding")
View Full Code Here

Examples of org.apache.olingo.odata2.api.edm.provider.AssociationEnd

  public static void getEdmEntityContainerImpl() throws Exception {

    edmProvider = mock(EdmProvider.class);
    EdmImplProv edmImplProv = new EdmImplProv(edmProvider);

    AssociationEnd end1 =
        new AssociationEnd().setRole("end1Role").setMultiplicity(EdmMultiplicity.ONE).setType(
            EdmSimpleTypeKind.String.getFullQualifiedName());
    AssociationEnd end2 =
        new AssociationEnd().setRole("end2Role").setMultiplicity(EdmMultiplicity.ONE).setType(
            EdmSimpleTypeKind.String.getFullQualifiedName());

    List<PropertyRef> propRef = new ArrayList<PropertyRef>();
    propRef.add(new PropertyRef().setName("prop1"));
    List<PropertyRef> propRef2 = new ArrayList<PropertyRef>();
View Full Code Here

Examples of org.apache.olingo.odata2.api.edm.provider.AssociationEnd

    private Association createAssociation(final Field field, final NavigationProperty navProperty) {
      Association association = new Association();
      EdmNavigationProperty navigation = field.getAnnotation(EdmNavigationProperty.class);

      AssociationEnd fromEnd = new AssociationEnd();
      fromEnd.setRole(navProperty.getFromRole());
      String typeName = ANNOTATION_HELPER.extractEntityTypeName(field.getDeclaringClass());
      fromEnd.setType(new FullQualifiedName(namespace, typeName));
      fromEnd.setMultiplicity(EdmMultiplicity.ONE);
      association.setEnd1(fromEnd);

      AssociationEnd toEnd = new AssociationEnd();
      toEnd.setRole(navProperty.getToRole());
      String toTypeName = ANNOTATION_HELPER.extractEntitTypeName(navigation, field);
      toEnd.setType(new FullQualifiedName(namespace, toTypeName));
      toEnd.setMultiplicity(ANNOTATION_HELPER.getMultiplicity(navigation, field));
      association.setEnd2(toEnd);

      String associationName = navProperty.getRelationship().getName();
      association.setName(associationName);
      return association;
View Full Code Here

Examples of org.apache.olingo.odata2.api.edm.provider.AssociationEnd

        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);
          }
        }
      }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.