Java Code Examples for org.apache.olingo.commons.api.edm.provider.CsdlEntityContainer#setEntitySets()

The following examples show how to use org.apache.olingo.commons.api.edm.provider.CsdlEntityContainer#setEntitySets() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DemoEdmProvider.java    From olingo-odata4 with Apache License 2.0 6 votes vote down vote up
public CsdlEntityContainer getEntityContainer() {
  // create EntitySets
  List<CsdlEntitySet> entitySets = new ArrayList<CsdlEntitySet>();
  entitySets.add(getEntitySet(CONTAINER, ES_PRODUCTS_NAME));
  entitySets.add(getEntitySet(CONTAINER, ES_CATEGORIES_NAME));
  
  // Create function imports
  List<CsdlFunctionImport> functionImports = new ArrayList<CsdlFunctionImport>();
  functionImports.add(getFunctionImport(CONTAINER, FUNCTION_COUNT_CATEGORIES));
  
  // Create action imports
  List<CsdlActionImport> actionImports = new ArrayList<CsdlActionImport>();
  actionImports.add(getActionImport(CONTAINER, ACTION_RESET));
  
  // create EntityContainer
  CsdlEntityContainer entityContainer = new CsdlEntityContainer();
  entityContainer.setName(CONTAINER_NAME);
  entityContainer.setEntitySets(entitySets);
  entityContainer.setFunctionImports(functionImports);
  entityContainer.setActionImports(actionImports);
  
  return entityContainer;

}
 
Example 2
Source File: EdmEntityContainerImplTest.java    From olingo-odata4 with Apache License 2.0 6 votes vote down vote up
@Override
public CsdlEntityContainer getEntityContainer() throws ODataException {
  CsdlEntityContainer container = new CsdlEntityContainer();
  List<CsdlEntitySet> entitySets = new ArrayList<CsdlEntitySet>();
  entitySets.add(new CsdlEntitySet().setName("entitySetName"));
  entitySets.add(new CsdlEntitySet().setName("entitySetName2"));
  container.setEntitySets(entitySets);

  List<CsdlSingleton> singletons = new ArrayList<CsdlSingleton>();
  singletons.add(new CsdlSingleton().setName("singletonName"));
  singletons.add(new CsdlSingleton().setName("singletonName2"));
  container.setSingletons(singletons);

  List<CsdlActionImport> actionImports = new ArrayList<CsdlActionImport>();
  actionImports.add(new CsdlActionImport().setName("actionImportName"));
  actionImports.add(new CsdlActionImport().setName("actionImportName2"));
  container.setActionImports(actionImports);

  List<CsdlFunctionImport> functionImports = new ArrayList<CsdlFunctionImport>();
  functionImports.add(new CsdlFunctionImport().setName("functionImportName"));
  functionImports.add(new CsdlFunctionImport().setName("functionImportName2"));
  container.setFunctionImports(functionImports);

  return container;
}
 
Example 3
Source File: MetadataDocumentXmlSerializerTest.java    From olingo-odata4 with Apache License 2.0 6 votes vote down vote up
@Override
public CsdlEntityContainer getEntityContainer() throws ODataException {
  CsdlEntityContainer container = new CsdlEntityContainer();
  container.setName("container");
  
  // EntitySets
  List<CsdlEntitySet> entitySets = new ArrayList<>();
  entitySets.add(getEntitySet(nameContainer, "ESAllPrim"));
  container.setEntitySets(entitySets);

  // Singletons
  container.setSingletons(Collections.singletonList(getSingleton(nameContainer, "SI")));

  // ActionImports
  container.setActionImports(Arrays.asList(getActionImport(nameContainer, "AIRTPrimParam"), 
      getActionImport(nameContainer, "AIRTOtherEntity"), getActionImport(nameContainer, "AIRTEntity"),
      getActionImport(nameContainer, "AIRTEntityNoES")));

  // FunctionImports
  container.setFunctionImports(Arrays.asList(getFunctionImport(nameContainer, "FINRTInt16"),
      getFunctionImport(nameContainer, "FINRTET")));

  return container;
}
 
Example 4
Source File: DemoEdmProvider.java    From olingo-odata4 with Apache License 2.0 6 votes vote down vote up
@Override
public CsdlEntityContainer getEntityContainer() {

  // create EntitySets
  List<CsdlEntitySet> entitySets = new ArrayList<CsdlEntitySet>();
  entitySets.add(getEntitySet(CONTAINER, ES_PRODUCTS_NAME));
  entitySets.add(getEntitySet(CONTAINER, ES_CATEGORIES_NAME));
  entitySets.add(getEntitySet(CONTAINER, ES_ADVERTISEMENTS_NAME));
  
  // Create function imports
  List<CsdlFunctionImport> functionImports = new ArrayList<CsdlFunctionImport>();
  functionImports.add(getFunctionImport(CONTAINER, FUNCTION_COUNT_CATEGORIES));
  
  // Create action imports
  List<CsdlActionImport> actionImports = new ArrayList<CsdlActionImport>();
  actionImports.add(getActionImport(CONTAINER, ACTION_RESET));
  
  // create EntityContainer
  CsdlEntityContainer entityContainer = new CsdlEntityContainer();
  entityContainer.setName(CONTAINER_NAME);
  entityContainer.setActionImports(actionImports);
  entityContainer.setFunctionImports(functionImports);
  entityContainer.setEntitySets(entitySets);

  return entityContainer;
}
 
Example 5
Source File: CarsEdmProvider.java    From olingo-odata4 with Apache License 2.0 5 votes vote down vote up
@Override
public CsdlEntityContainer getEntityContainer() throws ODataException {
  CsdlEntityContainer container = new CsdlEntityContainer();
  container.setName(CONTAINER_FQN.getName());

  // EntitySets
  List<CsdlEntitySet> entitySets = new ArrayList<CsdlEntitySet>();
  container.setEntitySets(entitySets);
  entitySets.add(getEntitySet(CONTAINER_FQN, ES_CARS_NAME));
  entitySets.add(getEntitySet(CONTAINER_FQN, ES_MANUFACTURER_NAME));

  return container;
}
 
Example 6
Source File: DemoEdmProvider.java    From olingo-odata4 with Apache License 2.0 5 votes vote down vote up
@Override
public CsdlEntityContainer getEntityContainer() {

  // create EntitySets
  List<CsdlEntitySet> entitySets = new ArrayList<CsdlEntitySet>();
  entitySets.add(getEntitySet(CONTAINER, ES_PRODUCTS_NAME));
  entitySets.add(getEntitySet(CONTAINER, ES_CATEGORIES_NAME));

  // create EntityContainer
  CsdlEntityContainer entityContainer = new CsdlEntityContainer();
  entityContainer.setName(CONTAINER_NAME);
  entityContainer.setEntitySets(entitySets);

  return entityContainer;
}
 
Example 7
Source File: DemoEdmProvider.java    From olingo-odata4 with Apache License 2.0 5 votes vote down vote up
@Override
public CsdlEntityContainer getEntityContainer() {
  // create EntitySets
  List<CsdlEntitySet> entitySets = new ArrayList<CsdlEntitySet>();
  entitySets.add(getEntitySet(CONTAINER, ES_PRODUCTS_NAME));

  // create EntityContainer
  CsdlEntityContainer entityContainer = new CsdlEntityContainer();
  entityContainer.setName(CONTAINER_NAME);
  entityContainer.setEntitySets(entitySets);

  return entityContainer;

}
 
Example 8
Source File: DemoEdmProvider.java    From olingo-odata4 with Apache License 2.0 5 votes vote down vote up
@Override
public CsdlEntityContainer getEntityContainer() {

  // create EntitySets
  List<CsdlEntitySet> entitySets = new ArrayList<CsdlEntitySet>();
  entitySets.add(getEntitySet(CONTAINER, ES_PRODUCTS_NAME));
  entitySets.add(getEntitySet(CONTAINER, ES_CATEGORIES_NAME));

  // create EntityContainer
  CsdlEntityContainer entityContainer = new CsdlEntityContainer();
  entityContainer.setName(CONTAINER_NAME);
  entityContainer.setEntitySets(entitySets);

  return entityContainer;
}
 
Example 9
Source File: DemoEdmProvider.java    From olingo-odata4 with Apache License 2.0 5 votes vote down vote up
@Override
public CsdlEntityContainer getEntityContainer() {
  // create EntitySets
  List<CsdlEntitySet> entitySets = new ArrayList<CsdlEntitySet>();
  entitySets.add(getEntitySet(CONTAINER, ES_PRODUCTS_NAME));

  // create EntityContainer
  CsdlEntityContainer entityContainer = new CsdlEntityContainer();
  entityContainer.setName(CONTAINER_NAME);
  entityContainer.setEntitySets(entitySets);

  return entityContainer;

}
 
Example 10
Source File: DemoEdmProvider.java    From olingo-odata4 with Apache License 2.0 5 votes vote down vote up
public CsdlEntityContainer getEntityContainer() {
  // create EntitySets
  List<CsdlEntitySet> entitySets = new ArrayList<CsdlEntitySet>();
  entitySets.add(getEntitySet(CONTAINER, ES_PRODUCTS_NAME));

  // create EntityContainer
  CsdlEntityContainer entityContainer = new CsdlEntityContainer();
  entityContainer.setName(CONTAINER_NAME);
  entityContainer.setEntitySets(entitySets);

  return entityContainer;

}
 
Example 11
Source File: DemoEdmProvider.java    From olingo-odata4 with Apache License 2.0 5 votes vote down vote up
@Override
public CsdlEntityContainer getEntityContainer() {
  // create EntitySets
  List<CsdlEntitySet> entitySets = new ArrayList<CsdlEntitySet>();
  entitySets.add(getEntitySet(CONTAINER, ES_PRODUCTS_NAME));

  // create EntityContainer
  CsdlEntityContainer entityContainer = new CsdlEntityContainer();
  entityContainer.setName(CONTAINER_NAME);
  entityContainer.setEntitySets(entitySets);

  return entityContainer;

}
 
Example 12
Source File: DemoEdmProvider.java    From cxf with Apache License 2.0 5 votes vote down vote up
@Override
public CsdlEntityContainer getEntityContainer() {

    // create EntitySets
    List<CsdlEntitySet> entitySets = new ArrayList<>();
    entitySets.add(getEntitySet(CONTAINER, ES_PRODUCTS_NAME));

    // create EntityContainer
    CsdlEntityContainer entityContainer = new CsdlEntityContainer();
    entityContainer.setName(CONTAINER_NAME);
    entityContainer.setEntitySets(entitySets);

    return entityContainer;
}
 
Example 13
Source File: EDMProvider.java    From micro-integrator with Apache License 2.0 5 votes vote down vote up
/**
 * This method creates a Csdl entity container.
 *
 * @return Csdl entity container
 * @see CsdlEntityContainer
 */
private CsdlEntityContainer generateCsdlEntityContainer() {
    CsdlEntityContainer container = new CsdlEntityContainer();
    container.setName(containerFullQName.getName());
    container.setEntitySets(new ArrayList<>(csdlEntitySetMap.values()));
    return container;
}
 
Example 14
Source File: DemoEdmProvider.java    From olingo-odata4 with Apache License 2.0 5 votes vote down vote up
@Override
public CsdlEntityContainer getEntityContainer() {
  // create EntitySets
  List<CsdlEntitySet> entitySets = new ArrayList<CsdlEntitySet>();
  entitySets.add(getEntitySet(CONTAINER, ES_PRODUCTS_NAME));

  // create EntityContainer
  CsdlEntityContainer entityContainer = new CsdlEntityContainer();
  entityContainer.setName(CONTAINER_NAME);
  entityContainer.setEntitySets(entitySets);

  return entityContainer;
}
 
Example 15
Source File: MetadataDocumentXmlSerializerTest.java    From olingo-odata4 with Apache License 2.0 5 votes vote down vote up
public CsdlEntityContainer getEntityContainer1() throws ODataException {
  CsdlEntityContainer container = new CsdlEntityContainer();
  container.setName("container1");
  
  // EntitySets
  container.setEntitySets(Collections.singletonList(getEntitySet(nameContainer1, "ES")));
  return container;
}
 
Example 16
Source File: DemoEdmProvider.java    From olingo-odata4 with Apache License 2.0 5 votes vote down vote up
public CsdlEntityContainer getEntityContainer() {
  // create EntitySets
  List<CsdlEntitySet> entitySets = new ArrayList<CsdlEntitySet>();
  entitySets.add(getEntitySet(CONTAINER, ES_PRODUCTS_NAME));
  entitySets.add(getEntitySet(CONTAINER, ES_CATEGORIES_NAME));
  
  // create EntityContainer
  CsdlEntityContainer entityContainer = new CsdlEntityContainer();
  entityContainer.setName(CONTAINER_NAME);
  entityContainer.setEntitySets(entitySets);
  
  return entityContainer;

}
 
Example 17
Source File: MetadataDocumentJsonSerializerTest.java    From olingo-odata4 with Apache License 2.0 5 votes vote down vote up
public CsdlEntityContainer getEntityContainer1() throws ODataException {
  CsdlEntityContainer container = new CsdlEntityContainer();
  container.setName("container1");

  // EntitySets
  container.setEntitySets(Arrays.asList(getEntitySet(nameContainer1, "ESAllPrim")));
  container.setExtendsContainer(nameContainer2.getFullQualifiedNameAsString());

  return container;
}
 
Example 18
Source File: ObservationCsdlEdmProvider.java    From arctic-sea with Apache License 2.0 5 votes vote down vote up
@Override
public CsdlEntityContainer getEntityContainer() throws ODataException {
    CsdlEntityContainer entityContainer = new CsdlEntityContainer();
    entityContainer.setName(CONTAINER_NAME);
    entityContainer.setEntitySets(Collections
                                          .singletonList(getEntitySet(FQN.CONTAINER, Prop.OBSERVATION_COLLECTION)));
    return entityContainer;
}
 
Example 19
Source File: ProductsEdmProvider.java    From syndesis with Apache License 2.0 5 votes vote down vote up
@Override
public CsdlEntityContainer getEntityContainer() {

    // create EntitySets
    List<CsdlEntitySet> entitySets = new ArrayList<CsdlEntitySet>();
    entitySets.add(getEntitySet(CONTAINER, ES_PRODUCTS_NAME));

    // create EntityContainer
    CsdlEntityContainer entityContainer = new CsdlEntityContainer();
    entityContainer.setName(CONTAINER_NAME);
    entityContainer.setEntitySets(entitySets);

    return entityContainer;
}
 
Example 20
Source File: EdmSchemaImplTest.java    From olingo-odata4 with Apache License 2.0 4 votes vote down vote up
@Override
public List<CsdlSchema> getSchemas() throws ODataException {
  CsdlSchema providerSchema = new CsdlSchema();
  providerSchema.setNamespace(NAMESPACE);
  providerSchema.setAlias(ALIAS);
  CsdlEntityContainer container = new CsdlEntityContainer().setName("container");

  List<CsdlEntitySet> entitySets = new ArrayList<CsdlEntitySet>();
  entitySets.add(new CsdlEntitySet().setName("entitySetName")
      .setType(new FullQualifiedName(NAMESPACE, "entityType1")));
  entitySets
      .add(new CsdlEntitySet().setName("entitySetName2").setType(new FullQualifiedName(NAMESPACE, "entityType2")));
  container.setEntitySets(entitySets);

  List<CsdlSingleton> singletons = new ArrayList<CsdlSingleton>();
  singletons.add(new CsdlSingleton().setName("singletonName")
      .setType(new FullQualifiedName(NAMESPACE, "entityType1")));
  singletons
      .add(new CsdlSingleton().setName("singletonName2").setType(new FullQualifiedName(NAMESPACE, "entityType2")));
  container.setSingletons(singletons);

  List<CsdlActionImport> actionImports = new ArrayList<CsdlActionImport>();
  actionImports.add(new CsdlActionImport().setName("actionImportName").setAction(
      new FullQualifiedName(NAMESPACE, "action1")));
  actionImports.add(new CsdlActionImport().setName("actionImportName2").setAction(
      new FullQualifiedName(NAMESPACE, "action2")));
  container.setActionImports(actionImports);

  List<CsdlFunctionImport> functionImports = new ArrayList<CsdlFunctionImport>();
  functionImports.add(new CsdlFunctionImport().setName("functionImportName").setFunction(
      new FullQualifiedName(NAMESPACE, "function1")));
  functionImports.add(new CsdlFunctionImport().setName("functionImportName2").setFunction(
      new FullQualifiedName(NAMESPACE, "function2")));
  container.setFunctionImports(functionImports);
  providerSchema.setEntityContainer(container);

  List<CsdlTypeDefinition> typeDefinitions = new ArrayList<CsdlTypeDefinition>();
  typeDefinitions.add(new CsdlTypeDefinition().setName("typeDefinition1").setUnderlyingType(
      EdmPrimitiveTypeKind.String.getFullQualifiedName()));
  typeDefinitions.add(new CsdlTypeDefinition().setName("typeDefinition2").setUnderlyingType(
      EdmPrimitiveTypeKind.String.getFullQualifiedName()));
  providerSchema.setTypeDefinitions(typeDefinitions);

  List<CsdlEnumType> enumTypes = new ArrayList<CsdlEnumType>();
  enumTypes.add(new CsdlEnumType().setName("enumType1"));
  enumTypes.add(new CsdlEnumType().setName("enumType2"));
  providerSchema.setEnumTypes(enumTypes);

  List<CsdlEntityType> entityTypes = new ArrayList<CsdlEntityType>();
  entityTypes.add(new CsdlEntityType().setName("entityType1"));
  entityTypes.add(new CsdlEntityType().setName("entityType2")
      .setBaseType(new FullQualifiedName(NAMESPACE, "entityType1")));
  providerSchema.setEntityTypes(entityTypes);

  List<CsdlComplexType> complexTypes = new ArrayList<CsdlComplexType>();
  complexTypes.add(new CsdlComplexType().setName("complexType1"));
  complexTypes.add(new CsdlComplexType().setName("complexType2").setBaseType(
      new FullQualifiedName(NAMESPACE, "complexType1")));
  providerSchema.setComplexTypes(complexTypes);

  List<CsdlAction> actions = new ArrayList<CsdlAction>();
  actions.add(new CsdlAction().setName("action1"));
  actions.add(new CsdlAction().setName("action2"));
  providerSchema.setActions(actions);

  List<CsdlFunction> functions = new ArrayList<CsdlFunction>();
  functions.add(new CsdlFunction().setName("function1"));
  functions.add(new CsdlFunction().setName("function2"));
  providerSchema.setFunctions(functions);

  List<CsdlAnnotations> annotationGroups = new ArrayList<CsdlAnnotations>();
  annotationGroups.add(new CsdlAnnotations().setTarget(NAMESPACE + ".entityType1"));
  annotationGroups.add(new CsdlAnnotations().setTarget(NAMESPACE + ".entityType2"));
  providerSchema.setAnnotationsGroup(annotationGroups);

  List<CsdlTerm> terms = new ArrayList<CsdlTerm>();
  terms.add(new CsdlTerm().setName("term1").setType("Edm.String"));
  terms.add(new CsdlTerm().setName("term2").setType("Edm.String"));
  providerSchema.setTerms(terms);

  ArrayList<CsdlSchema> schemas = new ArrayList<CsdlSchema>();
  schemas.add(providerSchema);
  return schemas;
}