Package org.apache.olingo.odata2.api.edm.provider

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


    return getJPAAttributeLocal();
  }

  @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


  }

  private List<Association> getEdmAssociationListLocal() {
    List<Association> associationList = new ArrayList<Association>();

    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"));

    associationList.add(association);
    return associationList;
  }
View Full Code Here

    when(edmProvider.getEntityType(new FullQualifiedName("EntityType1Ns", "EntityType1"))).thenReturn(entityType);

    ComplexType complexType = new ComplexType().setName("ComplexType1");
    when(edmProvider.getComplexType(new FullQualifiedName("ComplexType1Ns", "ComplexType1"))).thenReturn(complexType);

    Association association = new Association().setName("Association1");
    when(edmProvider.getAssociation(new FullQualifiedName("Association1Ns", "Association1"))).thenReturn(association);

    EntityContainerInfo defaultEntityContainer = new EntityContainerInfo().setName("Container1");
    when(edmProvider.getEntityContainerInfo(null)).thenReturn(defaultEntityContainer);
    when(edmProvider.getEntityContainerInfo("Container1")).thenReturn(defaultEntityContainer);
View Full Code Here

    FunctionImport funImp = aep.getFunctionImport(ModelSharedConstants.CONTAINER_1, "NoImport");
    assertNull(funImp);

    final FullQualifiedName associationFqn = new FullQualifiedName(
        ModelSharedConstants.NAMESPACE_1, "NoAssociation");
    Association noAssociation = aep.getAssociation(associationFqn);
    assertNull(noAssociation);

    AssociationSet noAssociationSet = aep.getAssociationSet(
        ModelSharedConstants.CONTAINER_1, associationFqn, "NoSrc", "NoSrcEntity");
    assertNull(noAssociationSet);
View Full Code Here

    assertEquals("Address", nameStr);
  }

  @Test
  public void testGetAssociationFullQualifiedName() {
    Association association = null;
    try {
      association =
          edmProvider.getAssociation(new FullQualifiedName("salesorderprocessing", "SalesOrderHeader_SalesOrderItem"));
    } catch (ODataException e) {
      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
    }
    assertNotNull(association);
    assertEquals("SalesOrderHeader_SalesOrderItem", association.getName());
  }
View Full Code Here

  }

  @Test
  public void testGetAssociationWithBuffer() {
    HashMap<String, Association> associations = new HashMap<String, Association>();
    Association association = new Association();
    association.setName("SalesOrderHeader_SalesOrderItem");
    associations.put("salesorderprocessing" + "." + "SalesOrderHeader_SalesOrderItem", association);
    ODataJPAEdmProvider jpaEdmProv = new ODataJPAEdmProvider();
    Class<?> claz = jpaEdmProv.getClass();
    Field f;
    try {
View Full Code Here

    }
  }

  @Test
  public void testGetAssociationFullQualifiedName() {
    Association association = null;
    try {
      association =
          edmProvider.getAssociation(new FullQualifiedName("salesorderprocessing", "SalesOrderHeader_SalesOrderItem"));
    } catch (ODataException e) {
      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
View Full Code Here

      if (ASSOCIATION_ET1_ET2.getName().equals(edmFQName.getName())) {
        final AssociationEnd end1 =
            new AssociationEnd().setMultiplicity(EdmMultiplicity.ONE).setRole(ROLE_1).setType(ET_KEY_IS_STRING);
        final AssociationEnd end2 =
            new AssociationEnd().setMultiplicity(EdmMultiplicity.ONE).setRole(ROLE_2).setType(ET_KEY_IS_INTEGER);
        return new Association().setName("Association").setEnd1(end1).setEnd2(end2);
      }
    }

    return null;
  }
View Full Code Here

  @Override
  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(
View Full Code Here

  @Override
  public Association searchAssociation(final JPAEdmAssociationEndView view) {
    if (view != null) {
      for (String key : associationMap.keySet()) {
        Association association = associationMap.get(key);
        if (association != null) {
          if (view.compare(association.getEnd1(), association.getEnd2())) {
            JPAEdmAssociationEndView associationEnd = associationEndMap.get(association.getName());
            if (associationEnd.getJoinColumnName() != null && associationEnd.getJoinColumnReferenceColumnName() != null
                && view.getJoinColumnName() != null && view.getJoinColumnReferenceColumnName() != null) {
              if (view.getJoinColumnName().equals(associationEnd.getJoinColumnName())
                  && view.getJoinColumnReferenceColumnName()
                  .equals(associationEnd.getJoinColumnReferenceColumnName())) {
View Full Code Here

TOP

Related Classes of org.apache.olingo.odata2.api.edm.provider.Association

Copyright © 2018 www.massapicom. 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.