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

The following examples show how to use org.apache.olingo.commons.api.edm.provider.CsdlEntityContainer#setFunctionImports() . 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: 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 2
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 3
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 4
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 5
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 6
Source File: MetadataDocumentJsonSerializerTest.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");

  // EntitySets
  container.setEntitySets(Arrays.asList(getEntitySet(nameContainer, "ESAllPrim"),
      getEntitySet(nameContainer, "ES"),
      getEntitySet(nameContainer, "ESOne"),
      getEntitySet(nameContainer, "ESTwoKeyNav"),
      getEntitySet(nameContainer, "ESTwoKeyNavOne")));

  // Singletons
  container.setSingletons(Arrays.asList(getSingleton(nameContainer, "SI"),
      getSingleton(nameContainer, "SIBinding")));

  // ActionImports
  container.setActionImports(Collections.singletonList(getActionImport(nameContainer, "AIRTPrimParam")));

  // FunctionImports
  container.setFunctionImports(Arrays.asList(getFunctionImport(nameContainer, "FINRTInt16"),
      getFunctionImport(null, "FINRTInt161")));
  
  container.setExtendsContainer(new FullQualifiedName(nameSpace1, "container1").getFullQualifiedNameAsString());

  return container;
}
 
Example 7
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;
}