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

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


    return createMockedEdmEntitySet(edmProvider, entitySetName);
  }

  private EdmEntitySet createMockedEdmEntitySet(final AnnotationEdmProvider edmProvider, final String entitySetName)
      throws ODataException {
    EntitySet entitySet = edmProvider.getEntitySet(DEFAULT_CONTAINER, entitySetName);
    FullQualifiedName entityType = entitySet.getEntityType();

    EdmEntitySet edmEntitySet = Mockito.mock(EdmEntitySet.class);
    Mockito.when(edmEntitySet.getName()).thenReturn(entitySetName);
    EdmEntityType edmEntityType = Mockito.mock(EdmEntityType.class);
    Mockito.when(edmEntitySet.getEntityType()).thenReturn(edmEntityType);
View Full Code Here


  @Override
  public EntitySet getEntitySet(final String entityContainer, final String name) throws ODataMessageException {
    if (ENTITY_CONTAINER_1.equals(entityContainer)) {
      if (ES_KEY_IS_STRING.equals(name)) {
        return new EntitySet().setName(name).setEntityType(ET_KEY_IS_STRING);
      } else if (ES_KEY_IS_INTEGER.equals(name)) {
        return new EntitySet().setName(name).setEntityType(ET_KEY_IS_INTEGER);
      } else if (ES_COMPLEX_KEY.equals(name)) {
        return new EntitySet().setName(name).setEntityType(ET_COMPLEX_KEY);
      } else if (ES_ALL_TYPES.equals(name)) {
        return new EntitySet().setName(name).setEntityType(ET_ALL_TYPES);
      } else if (ES_STRING_FACETS.equals(name)) {
        return new EntitySet().setName(name).setEntityType(ET_STRING_FACETS);
      }
    }

    return null;
  }
View Full Code Here

  @Override
  public EntitySet getEntitySet(final String entityContainer, final String name) throws ODataException {
    if (ENTITY_CONTAINER_1.equals(entityContainer)) {
      if (ENTITY_SET_1_1.equals(name)) {
        return new EntitySet().setName(name).setEntityType(ENTITY_TYPE_1_1);
      } else if (ENTITY_SET_1_2.equals(name)) {
        return new EntitySet().setName(name).setEntityType(ENTITY_TYPE_1_2);
      } else if (ENTITY_SET_1_3.equals(name)) {
        return new EntitySet().setName(name).setEntityType(ENTITY_TYPE_1_3);
      } else if (ENTITY_SET_1_4.equals(name)) {
        return new EntitySet().setName(name).setEntityType(ENTITY_TYPE_1_4);
      } else if (ENTITY_SET_1_5.equals(name)) {
        return new EntitySet().setName(name).setEntityType(ENTITY_TYPE_1_5);
      }

    } else if (ENTITY_CONTAINER_2.equals(entityContainer)) {
      if (ENTITY_SET_2_1.equals(name)) {
        return new EntitySet().setName(name).setEntityType(ENTITY_TYPE_2_1);
      }
    }

    return null;
  }
View Full Code Here

  @Override
  public EntitySet getEntitySet(final String entityContainer, final String name) throws ODataException {
    if (ENTITY_CONTAINER_1.equals(entityContainer)) {
      if (ENTITY_SET_1_1.equals(name)) {
        return new EntitySet().setName(name).setEntityType(ENTITY_TYPE_1_1);
      } else if (ENTITY_SET_1_2.equals(name)) {
        return new EntitySet().setName(name).setEntityType(ENTITY_TYPE_1_2);
      } else if (ENTITY_SET_1_3.equals(name)) {
        return new EntitySet().setName(name).setEntityType(ENTITY_TYPE_1_3);
      } else if (ENTITY_SET_1_4.equals(name)) {
        return new EntitySet().setName(name).setEntityType(ENTITY_TYPE_1_4);
      } else if (ENTITY_SET_1_5.equals(name)) {
        return new EntitySet().setName(name).setEntityType(ENTITY_TYPE_1_5);
      }

    } else if (ENTITY_CONTAINER_2.equals(entityContainer)) {
      if (ENTITY_SET_2_1.equals(name)) {
        return new EntitySet().setName(name).setEntityType(ENTITY_TYPE_2_1);
      }
    }

    return null;
  }
View Full Code Here

      if (entityTypeView.isConsistent() && entityTypeView.getConsistentEdmEntityTypes() != null) {

        String nameSpace = schemaView.getEdmSchema().getNamespace();
        for (EntityType entityType : entityTypeView.getConsistentEdmEntityTypes()) {

          currentEntitySet = new EntitySet();
          currentEntitySet.setEntityType(new FullQualifiedName(nameSpace, entityType.getName()));
          JPAEdmNameBuilder.build(JPAEdmEntitySet.this, entityTypeView);
          consistentEntitySetList.add(currentEntitySet);

        }
View Full Code Here

    return associationSet;
  }

  private EntitySet readEntitySet(final XMLStreamReader reader) throws XMLStreamException, EntityProviderException {
    reader.require(XMLStreamConstants.START_ELEMENT, edmNamespace, XmlMetadataConstants.EDM_ENTITY_SET);
    EntitySet entitySet = new EntitySet();
    List<AnnotationElement> annotationElements = new ArrayList<AnnotationElement>();
    entitySet.setName(reader.getAttributeValue(null, XmlMetadataConstants.EDM_NAME));
    String entityType = reader.getAttributeValue(null, XmlMetadataConstants.EDM_ENTITY_TYPE);
    if (entityType != null) {
      FullQualifiedName fqName = extractFQName(entityType);
      entitySet.setEntityType(fqName);
    } else {
      throw new EntityProviderException(EntityProviderException.MISSING_ATTRIBUTE
          .addContent(XmlMetadataConstants.EDM_ENTITY_TYPE).addContent(XmlMetadataConstants.EDM_ENTITY_SET));
    }
    entitySet.setAnnotationAttributes(readAnnotationAttribute(reader));
    while (reader.hasNext()
        && !(reader.isEndElement() && edmNamespace.equals(reader.getNamespaceURI())
        && XmlMetadataConstants.EDM_ENTITY_SET.equals(reader.getLocalName()))) {
      reader.next();
      if (reader.isStartElement()) {
        extractNamespaces(reader);
        annotationElements.add(readAnnotationElement(reader));
      }
    }
    entitySet.setAnnotationElements(annotationElements);
    return entitySet;
  }
View Full Code Here

    EdmEntitySet edmEntitySet = edmEntitySets.get(name);
    if (edmEntitySet != null) {
      return edmEntitySet;
    }

    EntitySet entitySet;
    try {
      entitySet = edm.edmProvider.getEntitySet(entityContainer.getName(), name);
    } catch (ODataException e) {
      throw new EdmException(EdmException.PROVIDERPROBLEM, e);
    }
View Full Code Here

    return associationSets;
  }

  private static List<EntitySet> createEntitySets() {
    List<EntitySet> entitySets = new ArrayList<EntitySet>();
    EntitySet entitySet = new EntitySet();
    entitySet.setName(ENTITY_SET_NAME_ONE);
    entitySet.setEntityType(new FullQualifiedName(NAMESPACE, ENTITY_NAME_ONE));
    entitySets.add(entitySet);
    entitySet = new EntitySet();
    entitySet.setName(ENTITY_SET_NAME_TWO);
    entitySet.setEntityType(new FullQualifiedName(NAMESPACE, ENTITY_NAME_TWO));
    entitySets.add(entitySet);
    return entitySets;
  }
View Full Code Here

    EntityContainerInfo containerInfo = new EntityContainerInfo().setName("Container");
    when(edmProvider.getEntityContainerInfo("Container")).thenReturn(containerInfo);
    edmEntityContainer = new EdmEntityContainerImplProv(edmImplProv, containerInfo);

    EntitySet fooEntitySet = new EntitySet().setName("fooEntitySet");
    when(edmProvider.getEntitySet("Container", "fooEntitySet")).thenReturn(fooEntitySet);

    ReturnType fooReturnType =
        new ReturnType().setTypeName(EdmSimpleTypeKind.String.getFullQualifiedName()).setMultiplicity(
            EdmMultiplicity.ONE);
View Full Code Here

  @Test
  public void oneEntitySetOneContainerForInfo() throws Exception {
    String entitySetUriString = new URI("Employees").toASCIIString();

    List<EntitySet> entitySets = new ArrayList<EntitySet>();
    EntitySet entitySet = new EntitySet().setName("Employees");
    entitySets.add(entitySet);

    List<EntityContainer> entityContainers = new ArrayList<EntityContainer>();
    EntityContainer container =
        new EntityContainer().setDefaultEntityContainer(true).setName("Container").setEntitySets(entitySets);
View Full Code Here

TOP

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

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.