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

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


    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);
    entityContainers.add(container);

    List<Schema> schemas = new ArrayList<Schema>();
    schemas.add(new Schema().setEntityContainers(entityContainers));
View Full Code Here


    EntitySet entitySet = new EntitySet().setName("Employees");
    entitySets.add(entitySet);
    entitySets.add(entitySet);

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

    List<Schema> schemas = new ArrayList<Schema>();
    schemas.add(new Schema().setEntityContainers(entityContainers));
View Full Code Here

    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);
    entityContainers.add(container);

    EntityContainer container2 =
        new EntityContainer().setDefaultEntityContainer(false).setName("Container2").setEntitySets(entitySets);
    entityContainers.add(container2);

    List<Schema> schemas = new ArrayList<Schema>();
    schemas.add(new Schema().setEntityContainers(entityContainers));
View Full Code Here

    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);
    entityContainers.add(container);

    List<Schema> schemas = new ArrayList<Schema>();
    schemas.add(new Schema().setEntityContainers(entityContainers));
    schemas.add(new Schema().setEntityContainers(entityContainers));
View Full Code Here

    assertEquals(1, schemas.size());

    Schema schema = schemas.get(0);
    List<EntityContainer> containers = schema.getEntityContainers();
    assertEquals(1, containers.size());
    EntityContainer container = containers.get(0);
    assertEquals(ModelSharedConstants.CONTAINER_1, container.getName());
    final List<EntitySet> entitySets = container.getEntitySets();
    assertEquals(6, entitySets.size());

    List<Association> associations = schema.getAssociations();
    assertEquals(4, associations.size());
    for (Association association : associations) {
View Full Code Here

    return schema;
  }

  private static List<EntityContainer> createEntityContainer() {
    List<EntityContainer> entityContainers = new ArrayList<EntityContainer>();
    EntityContainer entityContainer = new EntityContainer();
    entityContainer.setDefaultEntityContainer(true);
    entityContainer.setName(ENTITY_CONTAINER_NAME);
    entityContainer.setEntitySets(createEntitySets());
    entityContainer.setAssociationSets(createAssociationSets());
    entityContainer.setFunctionImports(createFunctionImports());
    entityContainers.add(entityContainer);
    return entityContainers;
  }
View Full Code Here

        getEntityType(ET_COMPLEX_KEY),
        getEntityType(ET_ALL_TYPES)));

    schema.setComplexTypes(Arrays.asList(getComplexType(CT_ALL_TYPES)));

    final EntityContainer entityContainer = new EntityContainer();
    entityContainer.setName(ENTITY_CONTAINER_1).setDefaultEntityContainer(true);
    entityContainer.setEntitySets(Arrays.asList(
        getEntitySet(ENTITY_CONTAINER_1, ES_KEY_IS_STRING),
        getEntitySet(ENTITY_CONTAINER_1, ES_KEY_IS_INTEGER),
        getEntitySet(ENTITY_CONTAINER_1, ES_COMPLEX_KEY),
        getEntitySet(ENTITY_CONTAINER_1, ES_ALL_TYPES),
        getEntitySet(ENTITY_CONTAINER_1, ES_STRING_FACETS)));
View Full Code Here

    associations.add(getAssociation(ASSOCIATION_1_2));
    associations.add(getAssociation(ASSOCIATION_1_3));
    associations.add(getAssociation(ASSOCIATION_1_4));
    schema.setAssociations(associations);

    EntityContainer entityContainer = new EntityContainer();
    entityContainer.setName(ENTITY_CONTAINER_1).setDefaultEntityContainer(true);

    List<EntitySet> entitySets = new ArrayList<EntitySet>();
    entitySets.add(getEntitySet(ENTITY_CONTAINER_1, ENTITY_SET_1_1));
    entitySets.add(getEntitySet(ENTITY_CONTAINER_1, ENTITY_SET_1_2));
    entitySets.add(getEntitySet(ENTITY_CONTAINER_1, ENTITY_SET_1_3));
    entitySets.add(getEntitySet(ENTITY_CONTAINER_1, ENTITY_SET_1_4));
    entitySets.add(getEntitySet(ENTITY_CONTAINER_1, ENTITY_SET_1_5));
    entityContainer.setEntitySets(entitySets);

    List<AssociationSet> associationSets = new ArrayList<AssociationSet>();
    associationSets.add(getAssociationSet(ENTITY_CONTAINER_1, ASSOCIATION_1_1, ENTITY_SET_1_4, ROLE_1_4));
    associationSets.add(getAssociationSet(ENTITY_CONTAINER_1, ASSOCIATION_1_2, ENTITY_SET_1_2, ROLE_1_2));
    associationSets.add(getAssociationSet(ENTITY_CONTAINER_1, ASSOCIATION_1_3, ENTITY_SET_1_3, ROLE_1_3));
    associationSets.add(getAssociationSet(ENTITY_CONTAINER_1, ASSOCIATION_1_4, ENTITY_SET_1_5, ROLE_1_5));
    entityContainer.setAssociationSets(associationSets);

    List<FunctionImport> functionImports = new ArrayList<FunctionImport>();
    functionImports.add(getFunctionImport(ENTITY_CONTAINER_1, FUNCTION_IMPORT_1));
    functionImports.add(getFunctionImport(ENTITY_CONTAINER_1, FUNCTION_IMPORT_2));
    functionImports.add(getFunctionImport(ENTITY_CONTAINER_1, FUNCTION_IMPORT_3));
    functionImports.add(getFunctionImport(ENTITY_CONTAINER_1, FUNCTION_IMPORT_4));
    functionImports.add(getFunctionImport(ENTITY_CONTAINER_1, FUNCTION_IMPORT_5));
    functionImports.add(getFunctionImport(ENTITY_CONTAINER_1, FUNCTION_IMPORT_6));
    functionImports.add(getFunctionImport(ENTITY_CONTAINER_1, FUNCTION_IMPORT_7));
    entityContainer.setFunctionImports(functionImports);

    schema.setEntityContainers(Arrays.asList(entityContainer));

    schemas.add(schema);

    schema = new Schema();
    schema.setNamespace(NAMESPACE_2);

    schema.setEntityTypes(Arrays.asList(getEntityType(ENTITY_TYPE_2_1)));

    entityContainer = new EntityContainer();
    entityContainer.setName(ENTITY_CONTAINER_2);
    entityContainer.setEntitySets(Arrays.asList(getEntitySet(ENTITY_CONTAINER_2, ENTITY_SET_2_1)));
    schema.setEntityContainers(Arrays.asList(entityContainer));

    schemas.add(schema);

    return schemas;
View Full Code Here

  }

  private EntityContainer readEntityContainer(final XMLStreamReader reader)
      throws XMLStreamException, EntityProviderException {
    reader.require(XMLStreamConstants.START_ELEMENT, edmNamespace, XmlMetadataConstants.EDM_ENTITY_CONTAINER);
    EntityContainer container = new EntityContainer();
    List<EntitySet> entitySets = new ArrayList<EntitySet>();
    List<AssociationSet> associationSets = new ArrayList<AssociationSet>();
    List<FunctionImport> functionImports = new ArrayList<FunctionImport>();
    List<AnnotationElement> annotationElements = new ArrayList<AnnotationElement>();

    container.setName(reader.getAttributeValue(null, XmlMetadataConstants.EDM_NAME));
    if (reader.getAttributeValue(Edm.NAMESPACE_M_2007_08, XmlMetadataConstants.EDM_CONTAINER_IS_DEFAULT) != null) {
      container.setDefaultEntityContainer("true".equalsIgnoreCase(reader.getAttributeValue(Edm.NAMESPACE_M_2007_08,
          "IsDefaultEntityContainer")));
    }
    container.setExtendz(reader.getAttributeValue(null, XmlMetadataConstants.EDM_CONTAINER_EXTENDZ));
    container.setAnnotationAttributes(readAnnotationAttribute(reader));

    while (reader.hasNext()
        && !(reader.isEndElement() && edmNamespace.equals(reader.getNamespaceURI())
        && XmlMetadataConstants.EDM_ENTITY_CONTAINER.equals(reader.getLocalName()))) {
      reader.next();
      if (reader.isStartElement()) {
        extractNamespaces(reader);
        currentHandledStartTagName = reader.getLocalName();
        if (XmlMetadataConstants.EDM_ENTITY_SET.equals(currentHandledStartTagName)) {
          entitySets.add(readEntitySet(reader));
        } else if (XmlMetadataConstants.EDM_ASSOCIATION_SET.equals(currentHandledStartTagName)) {
          associationSets.add(readAssociationSet(reader));
        } else if (XmlMetadataConstants.EDM_FUNCTION_IMPORT.equals(currentHandledStartTagName)) {
          functionImports.add(readFunctionImport(reader));
        } else {
          annotationElements.add(readAnnotationElement(reader));
        }
      }
    }
    if (!annotationElements.isEmpty()) {
      container.setAnnotationElements(annotationElements);
    }
    container.setEntitySets(entitySets).setAssociationSets(associationSets).setFunctionImports(functionImports);

    containerMap.put(new FullQualifiedName(currentNamespace, container.getName()), container);
    return container;
  }
View Full Code Here

    assertEquals(1, schemas.size());

    Schema schema = schemas.get(0);
    List<EntityContainer> containers = schema.getEntityContainers();
    assertEquals(1, containers.size());
    EntityContainer container = containers.get(0);
    assertEquals(ModelSharedConstants.CONTAINER_1, container.getName());
    final List<EntitySet> entitySets = container.getEntitySets();
    assertEquals(6, entitySets.size());

    List<Association> associations = schema.getAssociations();
    assertEquals(4, associations.size());
    for (Association association : associations) {
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.