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

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


    Association fooBarAssoc = new Association().setName("fooBarAssoc").setEnd1(fooEnd).setEnd2(barEnd);
    when(edmProvider.getAssociation(fooBarAssocName)).thenReturn(fooBarAssoc);

    AssociationSet associationSet =
        new AssociationSet().setName("fooBarRelation").setEnd1(
            new AssociationSetEnd().setRole("fromFoo").setEntitySet("foo")).setEnd2(
            new AssociationSetEnd().setRole("toBar").setEntitySet("bar"));
    FullQualifiedName assocFQName = new FullQualifiedName("namespace", "fooBarAssoc");
    when(edmProvider.getAssociationSet("Container", assocFQName, "foo", "fromFoo")).thenReturn(associationSet);

    edmEntitySetFoo = new EdmEntitySetImplProv(edmImplProv, entitySetFoo, edmEntityContainer);
    edmEnitiySetBar = new EdmEntitySetImplProv(edmImplProv, entitySetBar, edmEntityContainer);
View Full Code Here


      reader.next();
      if (reader.isStartElement()) {
        extractNamespaces(reader);
        currentHandledStartTagName = reader.getLocalName();
        if (XmlMetadataConstants.EDM_ASSOCIATION_END.equals(currentHandledStartTagName)) {
          AssociationSetEnd associationSetEnd = new AssociationSetEnd();
          associationSetEnd.setEntitySet(reader.getAttributeValue(null, XmlMetadataConstants.EDM_ENTITY_SET));
          associationSetEnd.setRole(reader.getAttributeValue(null, XmlMetadataConstants.EDM_ROLE));
          ends.add(associationSetEnd);
        } else {
          annotationElements.add(readAnnotationElement(reader));
        }
      }
View Full Code Here

  }

  @Override
  public AssociationSet getEdmAssociationSet() {
    AssociationSet associationSet = new AssociationSet();
    associationSet.setEnd1(new AssociationSetEnd());
    associationSet.setEnd2(new AssociationSetEnd());

    return associationSet;
  }
View Full Code Here

  @Override
  public AssociationSet getAssociationSet(final String entityContainer, final FullQualifiedName association,
      final String sourceEntitySetName, final String sourceEntitySetRole) throws ODataMessageException {
    if (ENTITY_CONTAINER_1.equals(entityContainer)) {
      if (ASSOCIATION_ET1_ET2.equals(association)) {
        final AssociationSetEnd end1 = new AssociationSetEnd().setRole(ROLE_1).setEntitySet(ES_KEY_IS_STRING);
        final AssociationSetEnd end2 = new AssociationSetEnd().setRole(ROLE_2).setEntitySet(ES_KEY_IS_INTEGER);

        return new AssociationSet().setName("AssociationSet").setEnd1(end1).setEnd2(end2);
      }
    }
    return null;
View Full Code Here

      final String sourceEntitySetName, final String sourceEntitySetRole) throws ODataException {
    if (ENTITY_CONTAINER_1.equals(entityContainer)) {
      if (ASSOCIATION_1_1.equals(association)) {
        return new AssociationSet().setName(ASSOCIATION_1_1.getName())
            .setAssociation(ASSOCIATION_1_1)
            .setEnd1(new AssociationSetEnd().setRole(ROLE_1_4).setEntitySet(ENTITY_SET_1_4))
            .setEnd2(new AssociationSetEnd().setRole(ROLE_1_1).setEntitySet(ENTITY_SET_1_1));
      } else if (ASSOCIATION_1_2.equals(association)) {
        return new AssociationSet().setName(ASSOCIATION_1_2.getName())
            .setAssociation(ASSOCIATION_1_2)
            .setEnd1(new AssociationSetEnd().setRole(ROLE_1_2).setEntitySet(ENTITY_SET_1_2))
            .setEnd2(new AssociationSetEnd().setRole(ROLE_1_1).setEntitySet(ENTITY_SET_1_1));
      } else if (ASSOCIATION_1_3.equals(association)) {
        return new AssociationSet().setName(ASSOCIATION_1_3.getName())
            .setAssociation(ASSOCIATION_1_3)
            .setEnd1(new AssociationSetEnd().setRole(ROLE_1_3).setEntitySet(ENTITY_SET_1_3))
            .setEnd2(new AssociationSetEnd().setRole(ROLE_1_1).setEntitySet(ENTITY_SET_1_1));
      } else if (ASSOCIATION_1_4.equals(association)) {
        return new AssociationSet().setName(ASSOCIATION_1_4.getName())
            .setAssociation(ASSOCIATION_1_4)
            .setEnd1(new AssociationSetEnd().setRole(ROLE_1_5).setEntitySet(ENTITY_SET_1_5))
            .setEnd2(new AssociationSetEnd().setRole(ROLE_1_3).setEntitySet(ENTITY_SET_1_3));
      }
    }

    return null;
  }
View Full Code Here

    return association;
  }

  @Override
  public EdmAssociationSetEnd getEnd(final String role) throws EdmException {
    AssociationSetEnd end;

    if (associationSet.getEnd1().getRole().equals(role)) {
      end = associationSet.getEnd1();
    } else if (associationSet.getEnd2().getRole().equals(role)) {
      end = associationSet.getEnd2();
    } else {
      return null;
    }

    EdmEntitySet entitySet = edmEntityContainer.getEntitySet(end.getEntitySet());
    if (entitySet == null) {
      throw new EdmException(EdmException.COMMON);
    }

    return new EdmAssociationSetEndImplProv(end, entitySet);
View Full Code Here

      reader.next();
      if (reader.isStartElement()) {
        extractNamespaces(reader);
        currentHandledStartTagName = reader.getLocalName();
        if (XmlMetadataConstants.EDM_ASSOCIATION_END.equals(currentHandledStartTagName)) {
          AssociationSetEnd associationSetEnd = new AssociationSetEnd();
          associationSetEnd.setEntitySet(reader.getAttributeValue(null, XmlMetadataConstants.EDM_ENTITY_SET));
          associationSetEnd.setRole(reader.getAttributeValue(null, XmlMetadataConstants.EDM_ROLE));
          ends.add(associationSetEnd);
        } else {
          annotationElements.add(readAnnotationElement(reader));
        }
      }
View Full Code Here

            fQname = entitySet.getEntityType();
            endFlag = 0;
            if (fQname.equals(association.getEnd1().getType()) || ++endFlag > 1
                || fQname.equals(association.getEnd2().getType())) {

              AssociationSetEnd end = new AssociationSetEnd();
              end.setEntitySet(entitySet.getName());
              if (endFlag == 0) {
                currentAssociationSet.setEnd1(end);
                end.setRole(association.getEnd1().getRole());
                endCount++;
              } else {
                endCount++;
                currentAssociationSet.setEnd2(end);
                end.setRole(association.getEnd2().getRole());
              }

              if (endCount == 2) {
                break;
              }
View Full Code Here

      final String sourceEntitySetName, final String sourceEntitySetRole) throws ODataException {
    if (ENTITY_CONTAINER_1.equals(entityContainer)) {
      if (ASSOCIATION_1_1.equals(association)) {
        return new AssociationSet().setName(ASSOCIATION_1_1.getName())
            .setAssociation(ASSOCIATION_1_1)
            .setEnd1(new AssociationSetEnd().setRole(ROLE_1_4).setEntitySet(ENTITY_SET_1_4))
            .setEnd2(new AssociationSetEnd().setRole(ROLE_1_1).setEntitySet(ENTITY_SET_1_1));
      } else if (ASSOCIATION_1_2.equals(association)) {
        return new AssociationSet().setName(ASSOCIATION_1_2.getName())
            .setAssociation(ASSOCIATION_1_2)
            .setEnd1(new AssociationSetEnd().setRole(ROLE_1_2).setEntitySet(ENTITY_SET_1_2))
            .setEnd2(new AssociationSetEnd().setRole(ROLE_1_1).setEntitySet(ENTITY_SET_1_1));
      } else if (ASSOCIATION_1_3.equals(association)) {
        return new AssociationSet().setName(ASSOCIATION_1_3.getName())
            .setAssociation(ASSOCIATION_1_3)
            .setEnd1(new AssociationSetEnd().setRole(ROLE_1_3).setEntitySet(ENTITY_SET_1_3))
            .setEnd2(new AssociationSetEnd().setRole(ROLE_1_1).setEntitySet(ENTITY_SET_1_1));
      } else if (ASSOCIATION_1_4.equals(association)) {
        return new AssociationSet().setName(ASSOCIATION_1_4.getName())
            .setAssociation(ASSOCIATION_1_4)
            .setEnd1(new AssociationSetEnd().setRole(ROLE_1_5).setEntitySet(ENTITY_SET_1_5))
            .setEnd2(new AssociationSetEnd().setRole(ROLE_1_3).setEntitySet(ENTITY_SET_1_3));
      }
    }

    return null;
  }
View Full Code Here

    List<AssociationSet> associationSets = new ArrayList<AssociationSet>();
    AssociationSet associationSet = new AssociationSet();
    associationSet.setName(ASSOCIATION_SET_NAME);
    associationSet.setAssociation(new FullQualifiedName(NAMESPACE, ASSOCIATION_NAME));
    associationSet
        .setEnd1(new AssociationSetEnd().setEntitySet(ENTITY_SET_NAME_ONE).setRole(ASSOCIATION_ROLE_NAME_ONE));
    associationSet
        .setEnd2(new AssociationSetEnd().setEntitySet(ENTITY_SET_NAME_TWO).setRole(ASSOCIATION_ROLE_NAME_TWO));
    associationSets.add(associationSet);
    return associationSets;
  }
View Full Code Here

TOP

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

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.