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

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


  public void writeServiceDocumentWithOneEnitySetOneContainerOneSchema() throws Exception {
    List<EntitySet> entitySets = new ArrayList<EntitySet>();
    entitySets.add(new EntitySet().setName("Employees"));

    List<EntityContainer> entityContainers = new ArrayList<EntityContainer>();
    entityContainers.add(new EntityContainer().setDefaultEntityContainer(true).setName("Container").setEntitySets(
        entitySets));

    schemas.add(new Schema().setEntityContainers(entityContainers));

    ODataResponse response = new AtomEntityProvider().writeServiceDocument(edm, "http://localhost");
View Full Code Here


  public void writeServiceDocumentWithOneEnitySetTwoContainersOneSchema() throws Exception {
    List<EntitySet> entitySets = new ArrayList<EntitySet>();
    entitySets.add(new EntitySet().setName("Employees"));

    List<EntityContainer> entityContainers = new ArrayList<EntityContainer>();
    entityContainers.add(new EntityContainer().setDefaultEntityContainer(true).setName("Container").setEntitySets(
        entitySets));
    entityContainers.add(new EntityContainer().setDefaultEntityContainer(false).setName("Container2").setEntitySets(
        entitySets));

    schemas.add(new Schema().setEntityContainers(entityContainers));

    ODataResponse response = new AtomEntityProvider().writeServiceDocument(edm, "http://localhost");
View Full Code Here

  public void writeServiceDocumentWithOneEnitySetTwoContainersTwoSchemas() throws Exception {
    List<EntitySet> entitySets = new ArrayList<EntitySet>();
    entitySets.add(new EntitySet().setName("Employees"));

    List<EntityContainer> entityContainers = new ArrayList<EntityContainer>();
    entityContainers.add(new EntityContainer().setDefaultEntityContainer(true).setName("Container").setEntitySets(
        entitySets));
    entityContainers.add(new EntityContainer().setDefaultEntityContainer(false).setName("Container2").setEntitySets(
        entitySets));

    List<EntityContainer> entityContainers2 = new ArrayList<EntityContainer>();
    entityContainers2.add(new EntityContainer().setDefaultEntityContainer(false).setName("Container3").setEntitySets(
        entitySets));
    entityContainers2.add(new EntityContainer().setDefaultEntityContainer(false).setName("Container4").setEntitySets(
        entitySets));

    schemas.add(new Schema().setEntityContainers(entityContainers));
    schemas.add(new Schema().setEntityContainers(entityContainers2));
View Full Code Here

    entitySet = new EntitySet();
    entitySet.setName(mapping[ENTITYSET][EDM]);
    entitySet.setEntityType(new FullQualifiedName(NAMESPACE, mapping[ENTITYTYPE][EDM]));
    entitySet.setMapping(new Mapping().setObject(mapping[ENTITYSET][BACKEND]));

    entityContainer = new EntityContainer();
    entityContainer.setDefaultEntityContainer(true);
    entityContainer.setName(MAPPING_CONTAINER);
    entityContainer.setEntitySets(Arrays.asList(entitySet));

    schema = new Schema();
View Full Code Here

     * ************************************************************
     */
    @Override
    public void build() throws ODataJPAModelException, ODataJPARuntimeException {

      currentEntityContainer = new EntityContainer();

      if (consistentEntityContainerList == null) {
        currentEntityContainer.setDefaultEntityContainer(true);
        consistentEntityContainerList = new ArrayList<EntityContainer>();
      }
View Full Code Here

        Class<? extends ODataJPAEdmProvider> clazz = provider.getClass();
        Field field = clazz.getDeclaredField("schemas");
        field.setAccessible(true);
        List<Schema> schemas = new ArrayList<Schema>();
        Schema schema = new Schema().setNamespace("salesorderprocessing");
        EntityContainer container = new EntityContainer().setName("salesorderprocessingContainer");
        List<EntityContainer> containerList = new ArrayList<EntityContainer>();
        containerList.add(container); // Empty Container
        schema.setEntityContainers(containerList);
        schemas.add(schema); // Empty Schema
        field.set(provider, schemas);
View Full Code Here

        associationSets.add(as);
      }
    }

    public EntityContainer build() {
      EntityContainer ec = new EntityContainer();
      ec.setName(name);
      ec.setDefaultEntityContainer(defaultContainer);
      ec.setEntitySets(entitySets);
      ec.setAssociationSets(associationSets);
      ec.setFunctionImports(functionImports);
      return ec;
    }
View Full Code Here

  @Override
  public EntitySet getEntitySet(final String entityContainer, final String name) throws ODataException {

    EntitySet returnedSet = null;
    EntityContainer container = null;
    if (!entityContainerInfos.containsKey(entityContainer)) {
      container = (EntityContainer) getEntityContainerInfo(entityContainer);
    } else {
      container = (EntityContainer) entityContainerInfos.get(entityContainer);
    }

    if (container != null && name != null) {
      for (EntitySet es : container.getEntitySets()) {
        if (name.equals(es.getName())) {
          returnedSet = es;
          break;
        }
      }
View Full Code Here

  @Override
  public AssociationSet getAssociationSet(final String entityContainer, final FullQualifiedName association,
      final String sourceEntitySetName, final String sourceEntitySetRole) throws ODataException {

    EntityContainer container = null;
    if (!entityContainerInfos.containsKey(entityContainer)) {
      container = (EntityContainer) getEntityContainerInfo(entityContainer);
    } else {
      container = (EntityContainer) entityContainerInfos.get(entityContainer);
    }

    if (container != null && association != null && container.getAssociationSets() != null) {
      for (AssociationSet as : container.getAssociationSets()) {
        if (association.equals(as.getAssociation())) {
          AssociationSetEnd end = as.getEnd1();
          if (sourceEntitySetName.equals(end.getEntitySet()) && sourceEntitySetRole.equals(end.getRole())) {
            return as;
          } else {
View Full Code Here

    if (functionImports.containsKey(name)) {
      return functionImports.get(name);
    }

    EntityContainer container = null;
    if (!entityContainerInfos.containsKey(entityContainer)) {
      container = (EntityContainer) getEntityContainerInfo(entityContainer);
    } else {
      container = (EntityContainer) entityContainerInfos.get(entityContainer);
    }

    if (container != null && name != null) {
      if (container.getFunctionImports() == null) {
        return null;
      }
      for (FunctionImport fi : container.getFunctionImports()) {
        if (name.equals(fi.getName())) {
          functionImports.put(name, fi);
          return fi;
        }
      }
View Full Code Here

TOP

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

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.