org.apache.olingo.commons.api.edm.provider.CsdlEntitySet Java Examples

The following examples show how to use org.apache.olingo.commons.api.edm.provider.CsdlEntitySet. 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: CsdlTypeValidator.java    From olingo-odata4 with Apache License 2.0 6 votes vote down vote up
/**
 * This looks for the correct entity set 
 * when the target entity set is part of some other namespace
 * e.g <NavigationPropertyBinding Path="Products" Target="SomeModel.SomeContainer/SomeSet" />
 * @param navBindingTarget
 * @return String
 */
private String findLastQualifiedTargetName(String navBindingTarget) {
  String[] targetPaths = navBindingTarget.split("/");
  CsdlEntityContainer csdlContainer = csdlContainersMap.containsKey(new FullQualifiedName(targetPaths[0])) ?
    csdlContainersMap.get(new FullQualifiedName(targetPaths[0])) : 
      csdlContainersMap.get(fetchCorrectNamespaceFromAlias(new FullQualifiedName(targetPaths[0])));
  if (csdlContainer == null) {
    throw new RuntimeException("Container with FullyQualifiedName " + targetPaths[0] + " not found.");
  }
  String targetEntitySetName = targetPaths[1];
  CsdlEntitySet csdlEntitySet = csdlContainer.getEntitySet(targetEntitySetName);
  if (csdlEntitySet == null) {
    throw new RuntimeException("Target Entity Set mentioned in navigationBindingProperty "
        + "not found in the container " + csdlContainer.getName());
  }
  FullQualifiedName fqName = csdlEntitySet.getTypeFQN();
  if (!(csdlEntityTypesMap.containsKey(fqName))) {
    fqName = validateCsdlEntityTypeWithAlias(fqName);
  }
  return fqName.getFullQualifiedNameAsString();
}
 
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: 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: EdmEntityContainerImpl.java    From olingo-odata4 with Apache License 2.0 6 votes vote down vote up
protected void loadAllEntitySets() {
  loadContainer();
  final List<CsdlEntitySet> providerEntitySets = container.getEntitySets();
  final List<EdmEntitySet> entitySetsLocal = new ArrayList<EdmEntitySet>();

  if (providerEntitySets != null) {
    for (CsdlEntitySet entitySet : providerEntitySets) {
addEntitySetAnnotations(entitySet, entityContainerName);
      final EdmEntitySetImpl impl = new EdmEntitySetImpl(edm, this, entitySet);
      if (isAnnotationsIncluded) {
        entitySetWithAnnotationsCache.put(impl.getName(), impl);
      } else {
        entitySetCache.put(impl.getName(), impl);
      }
      entitySetsLocal.add(impl);
    }
    entitySets = entitySetsLocal;
 ((EdmProviderImpl)edm).setIsPreviousES(true);
  }
}
 
Example #6
Source File: EdmMappingTest.java    From olingo-odata4 with Apache License 2.0 6 votes vote down vote up
@Test
public void initialMappingMustBeNull() {
  CsdlProperty property = new CsdlProperty().setType(EdmPrimitiveTypeKind.DateTimeOffset.getFullQualifiedName());
  EdmProperty edmProperty = new EdmPropertyImpl(null, property);
  assertNull(edmProperty.getMapping());

  CsdlParameter parameter = new CsdlParameter().setType(EdmPrimitiveTypeKind.DateTimeOffset.getFullQualifiedName());
  EdmParameter edmParameter = new EdmParameterImpl(null, parameter);
  assertNull(edmParameter.getMapping());

  CsdlEntitySet es = new CsdlEntitySet().setName("test");
  EdmEntitySet edmES = new EdmEntitySetImpl(null, null, es);
  assertNull(edmES.getMapping());

  CsdlSingleton si = new CsdlSingleton().setName("test");
  EdmSingleton edmSi = new EdmSingletonImpl(null, null, si);
  assertNull(edmSi.getMapping());
}
 
Example #7
Source File: EdmMappingTest.java    From olingo-odata4 with Apache License 2.0 6 votes vote down vote up
public void getInternalNameViaMapping() {
  CsdlMapping mapping = new CsdlMapping().setInternalName("internalName");

  CsdlProperty property =
      new CsdlProperty().setType(EdmPrimitiveTypeKind.DateTimeOffset.getFullQualifiedName()).setMapping(mapping);
  EdmProperty edmProperty = new EdmPropertyImpl(null, property);
  assertNotNull(edmProperty.getMapping());
  assertEquals("internalName", edmProperty.getMapping().getInternalName());

  CsdlParameter parameter =
      new CsdlParameter().setType(EdmPrimitiveTypeKind.DateTimeOffset.getFullQualifiedName()).setMapping(mapping);
  EdmParameter edmParameter = new EdmParameterImpl(null, parameter);
  assertNotNull(edmParameter.getMapping());
  assertEquals("internalName", edmParameter.getMapping().getInternalName());

  CsdlEntitySet es = new CsdlEntitySet().setName("test").setMapping(mapping);
  EdmEntitySet edmES = new EdmEntitySetImpl(null, null, es);
  assertNotNull(edmES.getMapping());
  assertEquals("internalName", edmES.getMapping().getInternalName());

  CsdlSingleton si = new CsdlSingleton().setName("test").setMapping(mapping);
  EdmSingleton edmSi = new EdmSingletonImpl(null, null, si);
  assertNotNull(edmSi.getMapping());
  assertEquals("internalName", edmSi.getMapping().getInternalName());
}
 
Example #8
Source File: EdmEntityContainerImpl.java    From olingo-odata4 with Apache License 2.0 6 votes vote down vote up
/** Adds annotations to Entity type Properties derived from entity set
 * E.g of target paths 
 * MySchema.MyEntityContainer/MyEntitySet/MyProperty
 * MySchema.MyEntityContainer/MyEntitySet/MyNavigationProperty
 * MySchema.MyEntityContainer/MyEntitySet/MyComplexProperty/MyProperty
 * MySchema.MyEntityContainer/MyEntitySet/MyComplexProperty/MyNavigationProperty
 * @param entitySet
 * @param entityContainerName
 * @param entityType 
 * @return
 */
private void addAnnotationsToPropertiesIncludedFromES(CsdlEntitySet entitySet,
    FullQualifiedName entityContainerName, CsdlEntityType entityType) {
  for (CsdlProperty property : entityType.getProperties()) {
    removeAnnotationsAddedToPropertiesOfEntityType(entityType, property, entityContainerName);
      if (isPropertyComplex(property)) {
        CsdlComplexType complexType = getComplexTypeFromProperty(property);
        addAnnotationsToComplexTypeIncludedFromES(entitySet, entityContainerName,
           property, complexType);
      } else {
        addAnnotationsToETProperties(entitySet, entityContainerName, entityType, property);
      }
    }
   for (CsdlNavigationProperty navProperty : entityType.getNavigationProperties()) {
     removeAnnotationAddedToNavProperties(entityType, navProperty, entityContainerName);
     addAnnotationsToETNavProperties(entitySet, entityContainerName, entityType, navProperty);
   }
}
 
Example #9
Source File: ODataHandlerImplTest.java    From olingo-odata4 with Apache License 2.0 6 votes vote down vote up
@Test
public void uriParserExceptionResultsInRightResponseEdmCause() throws Exception {
  final OData odata = OData.newInstance();
  final ServiceMetadata serviceMetadata = odata.createServiceMetadata(
      new CsdlAbstractEdmProvider() {
        @Override
        public CsdlEntitySet getEntitySet(final FullQualifiedName entityContainer, final String entitySetName)
            throws ODataException {
          throw new ODataException("msg");
        }
      },
      Collections.<EdmxReference> emptyList());

  ODataRequest request = new ODataRequest();
  request.setMethod(HttpMethod.GET);
  request.setRawODataPath("EdmException");

  final ODataResponse response =
      new ODataHandlerImpl(odata, serviceMetadata, new ServerCoreDebugger(odata)).process(request);
  assertNotNull(response);
  assertEquals(HttpStatusCode.INTERNAL_SERVER_ERROR.getStatusCode(), response.getStatusCode());
}
 
Example #10
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 #11
Source File: DemoEdmProvider.java    From olingo-odata4 with Apache License 2.0 6 votes vote down vote up
@Override
public CsdlEntitySet getEntitySet(FullQualifiedName entityContainer, String entitySetName) {

  if(entityContainer.equals(CONTAINER)){
    if(entitySetName.equals(ES_PRODUCTS_NAME)){
      CsdlEntitySet entitySet = new CsdlEntitySet();
      entitySet.setName(ES_PRODUCTS_NAME);
      entitySet.setType(ET_PRODUCT_FQN);

      return entitySet;
    }
  }

  return null;

}
 
Example #12
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 #13
Source File: DemoEdmProvider.java    From olingo-odata4 with Apache License 2.0 6 votes vote down vote up
@Override
public CsdlEntitySet getEntitySet(FullQualifiedName entityContainer, String entitySetName) {

  if(entityContainer.equals(CONTAINER)){
    if(entitySetName.equals(ES_PRODUCTS_NAME)){
      CsdlEntitySet entitySet = new CsdlEntitySet();
      entitySet.setName(ES_PRODUCTS_NAME);
      entitySet.setType(ET_PRODUCT_FQN);

      return entitySet;
    }
  }

  return null;

}
 
Example #14
Source File: CarsEdmProvider.java    From olingo-odata4 with Apache License 2.0 6 votes vote down vote up
@Override
public CsdlEntitySet getEntitySet(final FullQualifiedName entityContainer, final String entitySetName)
    throws ODataException {
  if (CONTAINER_FQN.equals(entityContainer)) {
    if (ES_CARS_NAME.equals(entitySetName)) {
      return new CsdlEntitySet()
          .setName(ES_CARS_NAME)
          .setType(ET_CAR)
          .setNavigationPropertyBindings(
              Arrays.asList(
                  new CsdlNavigationPropertyBinding().setPath("Manufacturer").setTarget(
                      CONTAINER_FQN.getFullQualifiedNameAsString() + "/" + ES_MANUFACTURER_NAME)));
    } else if (ES_MANUFACTURER_NAME.equals(entitySetName)) {
      return new CsdlEntitySet()
          .setName(ES_MANUFACTURER_NAME)
          .setType(ET_MANUFACTURER).setNavigationPropertyBindings(
              Arrays.asList(
                  new CsdlNavigationPropertyBinding().setPath("Cars")
                      .setTarget(CONTAINER_FQN.getFullQualifiedNameAsString() + "/" + ES_CARS_NAME)));
    }
  }

  return null;
}
 
Example #15
Source File: ODataHandlerImplTest.java    From olingo-odata4 with Apache License 2.0 6 votes vote down vote up
@Test
public void handlerExtTest() throws Exception {
  final OData odata = OData.newInstance();
  final ServiceMetadata serviceMetadata = odata.createServiceMetadata(
      new CsdlAbstractEdmProvider() {
        @Override
        public CsdlEntitySet getEntitySet(final FullQualifiedName entityContainer, final String entitySetName)
            throws ODataException {
          throw new ODataException("msg");
        }
      },
      Collections.<EdmxReference> emptyList());

  ODataRequest request = new ODataRequest();
  request.setMethod(HttpMethod.GET);
  request.setRawODataPath("EdmException");
  ODataHandlerImpl handler =  new ODataHandlerImpl(odata, serviceMetadata, new ServerCoreDebugger(odata));
  Processor extension =  new TechnicalActionProcessor(null, serviceMetadata);
  handler.register(extension);
  assertNull(handler.getLastThrownException());
  assertNull(handler.getUriInfo());
}
 
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));
  entitySets.add(getEntitySet(CONTAINER, ES_ADVERTISEMENTS_NAME));
  
  // create EntityContainer
  CsdlEntityContainer entityContainer = new CsdlEntityContainer();
  entityContainer.setName(CONTAINER_NAME);
  entityContainer.setEntitySets(entitySets);
  
  return entityContainer;
}
 
Example #17
Source File: DemoEdmProvider.java    From cxf with Apache License 2.0 5 votes vote down vote up
@Override
public CsdlEntitySet getEntitySet(FullQualifiedName entityContainer, String entitySetName) {

    if (entityContainer.equals(CONTAINER)) {
        if (entitySetName.equals(ES_PRODUCTS_NAME)) {
            CsdlEntitySet entitySet = new CsdlEntitySet();
            entitySet.setName(ES_PRODUCTS_NAME);
            entitySet.setType(ET_PRODUCT_FQN);

            return entitySet;
        }
    }

    return null;
}
 
Example #18
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 #19
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 #20
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 #21
Source File: DemoEdmProvider.java    From olingo-odata4 with Apache License 2.0 5 votes vote down vote up
@Override
public CsdlEntitySet getEntitySet(FullQualifiedName entityContainer, String entitySetName) {
  if (entityContainer.equals(CONTAINER)) {
    if (entitySetName.equals(ES_PRODUCTS_NAME)) {
      CsdlEntitySet entitySet = new CsdlEntitySet();
      entitySet.setName(ES_PRODUCTS_NAME);
      entitySet.setType(ET_PRODUCT_FQN);

      return entitySet;
    }
  }

  return null;

}
 
Example #22
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 #23
Source File: DemoEdmProvider.java    From olingo-odata4 with Apache License 2.0 5 votes vote down vote up
@Override
public CsdlEntitySet getEntitySet(FullQualifiedName entityContainer, String entitySetName)  {
  if(entityContainer.equals(CONTAINER)){
    if(entitySetName.equals(ES_PRODUCTS_NAME)){
      CsdlEntitySet entitySet = new CsdlEntitySet();
      entitySet.setName(ES_PRODUCTS_NAME);
      entitySet.setType(ET_PRODUCT_FQN);

      return entitySet;
    }
  }

  return null;

}
 
Example #24
Source File: DemoEdmProvider.java    From olingo-odata4 with Apache License 2.0 5 votes vote down vote up
@Override
public CsdlEntitySet getEntitySet(FullQualifiedName entityContainer, String entitySetName) {
  if(entityContainer.equals(CONTAINER)){
    if(entitySetName.equals(ES_PRODUCTS_NAME)){
      CsdlEntitySet entitySet = new CsdlEntitySet();
      entitySet.setName(ES_PRODUCTS_NAME);
      entitySet.setType(ET_PRODUCT_FQN);

      return entitySet;
    }
  }

  return null;
}
 
Example #25
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 #26
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 #27
Source File: DemoEdmProvider.java    From olingo-odata4 with Apache License 2.0 5 votes vote down vote up
@Override
public CsdlEntitySet getEntitySet(FullQualifiedName entityContainer, String entitySetName)  {
  if(entityContainer.equals(CONTAINER)){
    if(entitySetName.equals(ES_PRODUCTS_NAME)){
      CsdlEntitySet entitySet = new CsdlEntitySet();
      entitySet.setName(ES_PRODUCTS_NAME);
      entitySet.setType(ET_PRODUCT_FQN);

      return entitySet;
    }
  }

  return null;

}
 
Example #28
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 #29
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 #30
Source File: DemoEdmProvider.java    From olingo-odata4 with Apache License 2.0 5 votes vote down vote up
@Override
public CsdlEntitySet getEntitySet(FullQualifiedName entityContainer, String entitySetName) {
  if(entityContainer.equals(CONTAINER)){
    if(entitySetName.equals(ES_PRODUCTS_NAME)){
      CsdlEntitySet entitySet = new CsdlEntitySet();
      entitySet.setName(ES_PRODUCTS_NAME);
      entitySet.setType(ET_PRODUCT_FQN);

      return entitySet;
    }
  }

  return null;

}