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

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


        switch (uriInfo.getUriType()) {
        case URI4:
        case URI5:
            // simple property
            final List<EdmProperty> simplePropertyPath = uriInfo.getPropertyPath();
            final EdmProperty simpleProperty = simplePropertyPath.get(simplePropertyPath.size() - 1);
            responseContentType = simpleProperty.getMimeType();
            if (uriInfo.isValue()) {
                response = EntityProvider.writePropertyValue(simpleProperty, content);
                responseContentType = ContentType.TEXT_PLAIN_CS_UTF_8.toString();
            } else {
                response = EntityProvider.writeProperty(getContentType(), simpleProperty, content);
            }
            break;

        case URI3:
            // complex property
            final List<EdmProperty> complexPropertyPath = uriInfo.getPropertyPath();
            final EdmProperty complexProperty = complexPropertyPath.get(complexPropertyPath.size() - 1);
            response = EntityProvider.writeProperty(responseContentType, complexProperty, content);
            break;

        case URI7A:
            // $links with 0..1 cardinality property
View Full Code Here


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

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

  }

  @Test
  public void entitySetTeams() throws Exception {
    // validate teams
    EntitySet teams = aep.getEntitySet(ModelSharedConstants.CONTAINER_1, "Teams");
    assertEquals(ModelSharedConstants.NAMESPACE_1, teams.getEntityType().getNamespace());
    assertEquals("Team", teams.getEntityType().getName());
  }
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

    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));
      }
    }
    if (!annotationElements.isEmpty()) {
      entitySet.setAnnotationElements(annotationElements);
    }
    return entitySet;
  }
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

    when(edmProvider.getEntityContainerInfo(containerParentName))
        .thenReturn(new EntityContainerInfo().setName(containerParentName));
    EntityContainerInfo entityContainerInfo =
        new EntityContainerInfo().setName(containerName).setExtendz(containerParentName);

    EntitySet entitySetFooFromParent = new EntitySet().setName("fooFromParent");
    entitySetsParent.add(entitySetFooFromParent);
    when(edmProvider.getEntitySet(containerParentName, "fooFromParent")).thenReturn(entitySetFooFromParent);

    EntitySet entitySetFoo = new EntitySet().setName("foo");
    entitySets.add(entitySetFoo);
    when(edmProvider.getEntitySet(containerName, "foo")).thenReturn(entitySetFoo);

    EntitySet entitySetBar = new EntitySet().setName("bar");
    entitySets.add(entitySetBar);
    when(edmProvider.getEntitySet(containerName, "bar")).thenReturn(entitySetBar);

    AssociationSet associationSet = new AssociationSet().setName("4711");
    FullQualifiedName assocFQName = new FullQualifiedName("AssocNs", "AssocName");
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

    }
  }

  private EntitySet createEntitySet(final FullQualifiedName typeName, final Class<?> entitySetClass) {
    String entitySetName = ANNOTATION_HELPER.extractEntitySetName(entitySetClass);
    return new EntitySet().setName(entitySetName).setEntityType(typeName);
  }
View Full Code Here

  @Override
  public EntitySet getEntitySet(final String entityContainer, final String name) throws ODataException {
    if (ENTITY_CONTAINER.equals(entityContainer)) {
      if (ENTITY_SET_NAME_CARS.equals(name)) {
        return new EntitySet().setName(name).setEntityType(ENTITY_TYPE_1_1);
      } else if (ENTITY_SET_NAME_MANUFACTURERS.equals(name)) {
        return new EntitySet().setName(name).setEntityType(ENTITY_TYPE_1_2);
      }
    }
    return null;
  }
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.