Java Code Examples for org.apache.olingo.commons.api.edm.provider.CsdlSchema#setEntityTypes()

The following examples show how to use org.apache.olingo.commons.api.edm.provider.CsdlSchema#setEntityTypes() . 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 cxf with Apache License 2.0 6 votes vote down vote up
@Override
public List<CsdlSchema> getSchemas() {

    // create Schema
    CsdlSchema schema = new CsdlSchema();
    schema.setNamespace(NAMESPACE);

    // add EntityTypes
    List<CsdlEntityType> entityTypes = new ArrayList<>();
    entityTypes.add(getEntityType(ET_PRODUCT_FQN));
    schema.setEntityTypes(entityTypes);

    // add EntityContainer
    schema.setEntityContainer(getEntityContainer());

    // finally
    List<CsdlSchema> schemas = new ArrayList<>();
    schemas.add(schema);

    return schemas;
}
 
Example 2
Source File: DemoEdmProvider.java    From olingo-odata4 with Apache License 2.0 6 votes vote down vote up
@Override
public List<CsdlSchema> getSchemas() {
  // create Schema
  CsdlSchema schema = new CsdlSchema();
  schema.setNamespace(NAMESPACE);

  // add EntityTypes
  List<CsdlEntityType> entityTypes = new ArrayList<CsdlEntityType>();
  entityTypes.add(getEntityType(ET_PRODUCT_FQN));
  schema.setEntityTypes(entityTypes);

  // add EntityContainer
  schema.setEntityContainer(getEntityContainer());

  // finally
  List<CsdlSchema> schemas = new ArrayList<CsdlSchema>();
  schemas.add(schema);

  return schemas;

}
 
Example 3
Source File: DemoEdmProvider.java    From olingo-odata4 with Apache License 2.0 6 votes vote down vote up
@Override
public List<CsdlSchema> getSchemas() {

  // create Schema
  CsdlSchema schema = new CsdlSchema();
  schema.setNamespace(NAMESPACE);

  // add EntityTypes
  List<CsdlEntityType> entityTypes = new ArrayList<CsdlEntityType>();
  entityTypes.add(getEntityType(ET_PRODUCT_FQN));
  entityTypes.add(getEntityType(ET_CATEGORY_FQN));
  schema.setEntityTypes(entityTypes);
  
  // add EntityContainer
  schema.setEntityContainer(getEntityContainer());

  // finally
  List<CsdlSchema> schemas = new ArrayList<CsdlSchema>();
  schemas.add(schema);

  return schemas;
}
 
Example 4
Source File: DemoEdmProvider.java    From olingo-odata4 with Apache License 2.0 6 votes vote down vote up
@Override
public List<CsdlSchema> getSchemas() {

  // create Schema
  CsdlSchema schema = new CsdlSchema();
  schema.setNamespace(NAMESPACE);

  // add EntityTypes
  List<CsdlEntityType> entityTypes = new ArrayList<CsdlEntityType>();
  entityTypes.add(getEntityType(ET_PRODUCT_FQN));
  schema.setEntityTypes(entityTypes);

  // add EntityContainer
  schema.setEntityContainer(getEntityContainer());

  // finally
  List<CsdlSchema> schemas = new ArrayList<CsdlSchema>();
  schemas.add(schema);

  return schemas;
}
 
Example 5
Source File: DemoEdmProvider.java    From olingo-odata4 with Apache License 2.0 6 votes vote down vote up
@Override
public List<CsdlSchema> getSchemas() {

  // create Schema
  CsdlSchema schema = new CsdlSchema();
  schema.setNamespace(NAMESPACE);

  // add EntityTypes
  List<CsdlEntityType> entityTypes = new ArrayList<CsdlEntityType>();
  entityTypes.add(getEntityType(ET_PRODUCT_FQN));
  schema.setEntityTypes(entityTypes);

  // add EntityContainer
  schema.setEntityContainer(getEntityContainer());

  // finally
  List<CsdlSchema> schemas = new ArrayList<CsdlSchema>();
  schemas.add(schema);

  return schemas;
}
 
Example 6
Source File: DemoEdmProvider.java    From olingo-odata4 with Apache License 2.0 6 votes vote down vote up
@Override
public List<CsdlSchema> getSchemas() {
  // create Schema
  CsdlSchema schema = new CsdlSchema();
  schema.setNamespace(NAMESPACE);

  // add EntityTypes
  List<CsdlEntityType> entityTypes = new ArrayList<CsdlEntityType>();
  entityTypes.add(getEntityType(ET_PRODUCT_FQN));
  schema.setEntityTypes(entityTypes);

  // add EntityContainer
  schema.setEntityContainer(getEntityContainer());

  // finally
  List<CsdlSchema> schemas = new ArrayList<CsdlSchema>();
  schemas.add(schema);

  return schemas;

}
 
Example 7
Source File: DemoEdmProvider.java    From olingo-odata4 with Apache License 2.0 6 votes vote down vote up
@Override
public List<CsdlSchema> getSchemas() {
  // create Schema
  CsdlSchema schema = new CsdlSchema();
  schema.setNamespace(NAMESPACE);

  // add EntityTypes
  List<CsdlEntityType> entityTypes = new ArrayList<CsdlEntityType>();
  entityTypes.add(getEntityType(ET_PRODUCT_FQN));
  entityTypes.add(getEntityType(ET_CATEGORY_FQN));
  schema.setEntityTypes(entityTypes);

  // add EntityContainer
  schema.setEntityContainer(getEntityContainer());

  // finally
  List<CsdlSchema> schemas = new ArrayList<CsdlSchema>();
  schemas.add(schema);

  return schemas;
}
 
Example 8
Source File: DemoEdmProvider.java    From olingo-odata4 with Apache License 2.0 6 votes vote down vote up
@Override
public List<CsdlSchema> getSchemas() {

  // create Schema
  CsdlSchema schema = new CsdlSchema();
  schema.setNamespace(NAMESPACE);

  // add EntityTypes
  List<CsdlEntityType> entityTypes = new ArrayList<CsdlEntityType>();
  entityTypes.add(getEntityType(ET_PRODUCT_FQN));
  entityTypes.add(getEntityType(ET_CATEGORY_FQN));
  entityTypes.add(getEntityType(ET_ADVERTISEMENT_FQN));
  schema.setEntityTypes(entityTypes);
  
  // add EntityContainer
  schema.setEntityContainer(getEntityContainer());

  // finally
  List<CsdlSchema> schemas = new ArrayList<CsdlSchema>();
  schemas.add(schema);

  return schemas;
}
 
Example 9
Source File: DemoEdmProvider.java    From olingo-odata4 with Apache License 2.0 6 votes vote down vote up
@Override
public List<CsdlSchema> getSchemas() {
  // create Schema
  CsdlSchema schema = new CsdlSchema();
  schema.setNamespace(NAMESPACE);

  // add EntityTypes
  List<CsdlEntityType> entityTypes = new ArrayList<CsdlEntityType>();
  entityTypes.add(getEntityType(ET_PRODUCT_FQN));
  schema.setEntityTypes(entityTypes);

  // add EntityContainer
  schema.setEntityContainer(getEntityContainer());

  // finally
  List<CsdlSchema> schemas = new ArrayList<CsdlSchema>();
  schemas.add(schema);

  return schemas;

}
 
Example 10
Source File: DemoEdmProvider.java    From olingo-odata4 with Apache License 2.0 6 votes vote down vote up
@Override
public List<CsdlSchema> getSchemas() {

  // create Schema
  CsdlSchema schema = new CsdlSchema();
  schema.setNamespace(NAMESPACE);

  // add EntityTypes
  List<CsdlEntityType> entityTypes = new ArrayList<CsdlEntityType>();
  entityTypes.add(getEntityType(ET_PRODUCT_FQN));
  entityTypes.add(getEntityType(ET_CATEGORY_FQN));
  schema.setEntityTypes(entityTypes);
  
  // add EntityContainer
  schema.setEntityContainer(getEntityContainer());

  // finally
  List<CsdlSchema> schemas = new ArrayList<CsdlSchema>();
  schemas.add(schema);

  return schemas;
}
 
Example 11
Source File: DemoEdmProvider.java    From olingo-odata4 with Apache License 2.0 6 votes vote down vote up
@Override
public List<CsdlSchema> getSchemas() {
  // create Schema
  CsdlSchema schema = new CsdlSchema();
  schema.setNamespace(NAMESPACE);

  // add EntityTypes
  List<CsdlEntityType> entityTypes = new ArrayList<CsdlEntityType>();
  entityTypes.add(getEntityType(ET_PRODUCT_FQN));
  schema.setEntityTypes(entityTypes);

  // add EntityContainer
  schema.setEntityContainer(getEntityContainer());

  // finally
  List<CsdlSchema> schemas = new ArrayList<CsdlSchema>();
  schemas.add(schema);

  return schemas;

}
 
Example 12
Source File: DemoEdmProvider.java    From olingo-odata4 with Apache License 2.0 6 votes vote down vote up
@Override
public List<CsdlSchema> getSchemas() {
  // create Schema
  CsdlSchema schema = new CsdlSchema();
  schema.setNamespace(NAMESPACE);

  // add EntityTypes
  List<CsdlEntityType> entityTypes = new ArrayList<CsdlEntityType>();
  entityTypes.add(getEntityType(ET_PRODUCT_FQN));
  schema.setEntityTypes(entityTypes);

  // add EntityContainer
  schema.setEntityContainer(getEntityContainer());

  // finally
  List<CsdlSchema> schemas = new ArrayList<CsdlSchema>();
  schemas.add(schema);

  return schemas;

}
 
Example 13
Source File: CarsEdmProvider.java    From olingo-odata4 with Apache License 2.0 6 votes vote down vote up
@Override
public List<CsdlSchema> getSchemas() throws ODataException {
  List<CsdlSchema> schemas = new ArrayList<CsdlSchema>();
  CsdlSchema schema = new CsdlSchema();
  schema.setNamespace(NAMESPACE);
  // EntityTypes
  List<CsdlEntityType> entityTypes = new ArrayList<CsdlEntityType>();
  entityTypes.add(getEntityType(ET_CAR));
  entityTypes.add(getEntityType(ET_MANUFACTURER));
  schema.setEntityTypes(entityTypes);

  // ComplexTypes
  List<CsdlComplexType> complexTypes = new ArrayList<CsdlComplexType>();
  complexTypes.add(getComplexType(CT_ADDRESS));
  schema.setComplexTypes(complexTypes);

  // EntityContainer
  schema.setEntityContainer(getEntityContainer());
  schemas.add(schema);

  return schemas;
}
 
Example 14
Source File: EDMProvider.java    From micro-integrator with Apache License 2.0 5 votes vote down vote up
/**
 * This method creates a list of Csdl schema.
 *
 * @return List of Csdl schema
 * @see CsdlSchema
 */
private List<CsdlSchema> generateSchemaList() {
    List<CsdlSchema> schemaList = new ArrayList<>();
    CsdlSchema schema = new CsdlSchema();
    schema.setNamespace(namespace);
    // EntityTypes
    if (!csdlEntityTypesMap.isEmpty()) {
        schema.setEntityTypes(new ArrayList<>(csdlEntityTypesMap.values()));
    }
    schema.setEntityContainer(csdlEntityContainer);
    schemaList.add(schema);
    return schemaList;
}
 
Example 15
Source File: DemoEdmProvider.java    From olingo-odata4 with Apache License 2.0 5 votes vote down vote up
@Override
public List<CsdlSchema> getSchemas() {

  // create Schema
  CsdlSchema schema = new CsdlSchema();
  schema.setNamespace(NAMESPACE);

  // add EntityTypes
  List<CsdlEntityType> entityTypes = new ArrayList<CsdlEntityType>();
  entityTypes.add(getEntityType(ET_PRODUCT_FQN));
  entityTypes.add(getEntityType(ET_CATEGORY_FQN));
  schema.setEntityTypes(entityTypes);
  
  // add actions
  List<CsdlAction> actions = new ArrayList<CsdlAction>();
  actions.addAll(getActions(ACTION_RESET_FQN));
  schema.setActions(actions);
  
  // add functions
  List<CsdlFunction> functions = new ArrayList<CsdlFunction>();
  functions.addAll(getFunctions(FUNCTION_COUNT_CATEGORIES_FQN));
  schema.setFunctions(functions);
  
  // add EntityContainer
  schema.setEntityContainer(getEntityContainer());

  // finally
  List<CsdlSchema> schemas = new ArrayList<CsdlSchema>();
  schemas.add(schema);

  return schemas;
}
 
Example 16
Source File: DemoEdmProvider.java    From olingo-odata4 with Apache License 2.0 5 votes vote down vote up
@Override
public List<CsdlSchema> getSchemas() {

  // create Schema
  CsdlSchema schema = new CsdlSchema();
  schema.setNamespace(NAMESPACE);

  // add EntityTypes
  List<CsdlEntityType> entityTypes = new ArrayList<CsdlEntityType>();
  entityTypes.add(getEntityType(ET_PRODUCT_FQN));
  entityTypes.add(getEntityType(ET_CATEGORY_FQN));
  schema.setEntityTypes(entityTypes);
  
  // add actions
  List<CsdlAction> actions = new ArrayList<CsdlAction>();
  actions.addAll(getActions(ACTION_RESET_FQN));
  actions.addAll(getActions(ACTION_PROVIDE_DISCOUNT_FQN));
  actions.addAll(getActions(ACTION_PROVIDE_DISCOUNT_FOR_PRODUCT_FQN));
  schema.setActions(actions);
  
  // add functions
  List<CsdlFunction> functions = new ArrayList<CsdlFunction>();
  functions.addAll(getFunctions(FUNCTION_COUNT_CATEGORIES_FQN));
  functions.addAll(getFunctions(FUNCTION_PROVIDE_DISCOUNT_FQN));
  functions.addAll(getFunctions(FUNCTION_PROVIDE_DISCOUNT_FOR_PRODUCT_FQN));
  schema.setFunctions(functions);
  
  // add EntityContainer
  schema.setEntityContainer(getEntityContainer());

  // finally
  List<CsdlSchema> schemas = new ArrayList<CsdlSchema>();
  schemas.add(schema);

  return schemas;
}
 
Example 17
Source File: DemoEdmProvider.java    From olingo-odata4 with Apache License 2.0 5 votes vote down vote up
@Override
public List<CsdlSchema> getSchemas() {
  // create Schema
  CsdlSchema schema = new CsdlSchema();
  schema.setNamespace(NAMESPACE);

  // add EntityTypes
  List<CsdlEntityType> entityTypes = new ArrayList<CsdlEntityType>();
  entityTypes.add(getEntityType(ET_PRODUCT_FQN));
  entityTypes.add(getEntityType(ET_CATEGORY_FQN));
  entityTypes.add(getEntityType(ET_SUPPLIER_FQN));
  schema.setEntityTypes(entityTypes);

  // add Complex Types
  List<CsdlComplexType> complexTypes = new ArrayList<CsdlComplexType>();
  complexTypes.add(getComplexType(CT_ADDRESS_FQN));
  schema.setComplexTypes(complexTypes);
  
  // add EntityContainer
  schema.setEntityContainer(getEntityContainer());

  // finally
  List<CsdlSchema> schemas = new ArrayList<CsdlSchema>();
  schemas.add(schema);

  return schemas;
}
 
Example 18
Source File: ProductsEdmProvider.java    From syndesis with Apache License 2.0 5 votes vote down vote up
@Override
public List<CsdlSchema> getSchemas() {

    // create Schema
    CsdlSchema schema = new CsdlSchema();
    schema.setNamespace(NAMESPACE);

    List<CsdlEnumType> enumTypes = new ArrayList<>();
    enumTypes.add(getEnumType(ET_POWER_TYPE_FQN));
    schema.setEnumTypes(enumTypes);

    List<CsdlComplexType> complexTypes = new ArrayList<>();
    complexTypes.add(getComplexType(ET_SPEC_FQN));
    schema.setComplexTypes(complexTypes);

    // add EntityTypes
    List<CsdlEntityType> entityTypes = new ArrayList<>();
    entityTypes.add(getEntityType(ET_PRODUCT_FQN));
    schema.setEntityTypes(entityTypes);

    // add EntityContainer
    schema.setEntityContainer(getEntityContainer());

    // finally
    List<CsdlSchema> schemas = new ArrayList<CsdlSchema>();
    schemas.add(schema);

    return schemas;
}
 
Example 19
Source File: MetadataDocumentXmlSerializerTest.java    From olingo-odata4 with Apache License 2.0 4 votes vote down vote up
@Override
public List<CsdlSchema> getSchemas() throws ODataException {
  List<CsdlSchema> schemas = new ArrayList<CsdlSchema>();
  CsdlSchema schema = new CsdlSchema();
  schema.setNamespace(nameSpace);
  schema.setAlias("Alias");
  schemas.add(schema);
  
  CsdlSchema schema1 = new CsdlSchema();
  schema1.setNamespace(nameSpace1);
  schema1.setAlias("Alias1");
  schemas.add(schema1);
  
  // Add entity type
  schema1.setEntityTypes(Arrays.asList(getEntityType(nameET)));
  
  // Add entity container
  schema1.setEntityContainer(getEntityContainer1());

  // EnumTypes
  schema.setEnumTypes(Collections.singletonList(getEnumType(nameENString)));

  // EntityTypes
  schema.setEntityTypes(Arrays.asList(
      getEntityType(nameETAbstract),
      getEntityType(nameETAbstractBase)));

  // ComplexTypes
  schema.setComplexTypes(Arrays.asList(
      getComplexType(nameCTTwoPrim),
      getComplexType(nameCTTwoPrimBase)));

  // TypeDefinitions

  // Actions
  List<CsdlAction> actions = new ArrayList<>();
  actions.addAll(getActions(nameUARTPrimParam));
  actions.addAll(getActions(nameUARTOtherEntity));
  actions.addAll(getActions(nameUARTEntity));
  schema.setActions(actions);

  // Functions
  schema.setFunctions(getFunctions(nameUFNRTInt16));
  
  schema.setFunctions(getFunctions(nameUFNRTETAllPrim));

  // EntityContainer
  schema.setEntityContainer(getEntityContainer());

  // Terms
  schema.setTerms(Arrays.asList(
      getTerm(new FullQualifiedName("ns", "term")),
      getTerm(new FullQualifiedName("namespace", "Term1")),
      getTerm(new FullQualifiedName("ns", "Term2")),
      getTerm(new FullQualifiedName("ns", "Term3")),
      getTerm(new FullQualifiedName("ns", "Term4"))));

  // Annotationgroups
  schema.setAnnotationsGroup(Collections.singletonList(
      getAnnotationsGroup(new FullQualifiedName("Alias", "ETAbstract"), "Tablett")));

  return schemas;
}
 
Example 20
Source File: MetadataDocumentJsonSerializerTest.java    From olingo-odata4 with Apache License 2.0 4 votes vote down vote up
@Override
 public List<CsdlSchema> getSchemas() throws ODataException {
   List<CsdlSchema> schemas = new ArrayList<CsdlSchema>();
   CsdlSchema schema1 = new CsdlSchema();
   schema1.setNamespace(nameSpace1);
   schema1.setAlias("Alias1");
   schemas.add(schema1);
// EntityContainer
   schema1.setEntityContainer(getEntityContainer1());
   
   CsdlSchema schema2 = new CsdlSchema();
   schema2.setNamespace(nameSpace2);
   schemas.add(schema2);
// EntityContainer
   schema2.setEntityContainer(getEntityContainer2());

   
   CsdlSchema schema = new CsdlSchema();
   schema.setNamespace(nameSpace);
   schema.setAlias("Alias");
   schemas.add(schema);

   // EnumTypes
   schema.setEnumTypes(Collections.singletonList(getEnumType(nameENString)));

   // EntityTypes
   schema.setEntityTypes(Arrays.asList(
       getEntityType(nameETAbstract),
       getEntityType(nameETAbstractBase),
       getEntityType(nameET),
       getEntityType(nameETOne),
       getEntityType(nameETTwoKeyNav),
       getEntityType(nameETTwoKeyNavOne)));

   // ComplexTypes
   schema.setComplexTypes(Arrays.asList(
       getComplexType(nameCTTwoPrim),
       getComplexType(nameCTTwoPrimBase),
       getComplexType(nameCTEntityInfo),
       getComplexType(nameCTPrimComp)));

   // TypeDefinitions

   // Actions
   List<CsdlAction> actions1 = getActions(nameUARTPrimParam);
   List<CsdlAction> actions2 = getActions(nameBAETTwoKeyNavRTETTwoKeyNavParam);
   List<CsdlAction> actions3 = getActions(nameBAProp);
   List<CsdlAction> actions = new ArrayList<CsdlAction>();
   actions.addAll(actions1);
   actions.addAll(actions2);
   actions.addAll(actions3);
   
   schema.setActions(actions);

   // Functions
   List<CsdlFunction> function1 = getFunctions(nameUFNRTInt16);
   List<CsdlFunction> function2 = getFunctions(nameBFETTwoKeyNavRTETTwoKeyNavParam);
   List<CsdlFunction> functions = new ArrayList<CsdlFunction>();
   functions.addAll(function1);
   functions.addAll(function2);
   
   schema.setFunctions(functions);

   // EntityContainer
   schema.setEntityContainer(getEntityContainer());

   // Terms
   schema.setTerms(Arrays.asList(
       getTerm(new FullQualifiedName("ns", "term")),
       getTerm(new FullQualifiedName("namespace", "Term1")),
       getTerm(new FullQualifiedName("ns", "Term2")),
       getTerm(new FullQualifiedName("ns", "Term3")),
       getTerm(new FullQualifiedName("ns", "Term4"))));

   // Annotationgroups
   schema.setAnnotationsGroup(Arrays.asList(
       getAnnotationsGroup(new FullQualifiedName("Alias", "ETAbstract"), "Tablett"),
       getAnnotationsGroup(new FullQualifiedName("Alias", "ET"), "T")));
   
   return schemas;
 }