org.apache.olingo.commons.api.edm.provider.CsdlEntityContainer Java Examples
The following examples show how to use
org.apache.olingo.commons.api.edm.provider.CsdlEntityContainer.
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: MetadataDocumentXmlSerializerTest.java From olingo-odata4 with Apache License 2.0 | 6 votes |
@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 #2
Source File: EdmEntityContainerImplTest.java From olingo-odata4 with Apache License 2.0 | 6 votes |
@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: AbstractEdmAnnotatableTest.java From olingo-odata4 with Apache License 2.0 | 6 votes |
@Test public void singleAnnotation() { CsdlEntityContainer annotatable = new CsdlEntityContainer(); CsdlAnnotation annotation = new CsdlAnnotation(); annotation.setTerm("namespace.name"); List<CsdlAnnotation> annotations = new ArrayList<CsdlAnnotation>(); annotations.add(annotation); annotatable.setAnnotations(annotations); EdmAnnotatable anno = new EdmAnnotatableTester(edm, annotatable); assertNotNull(anno.getAnnotations()); assertEquals(1, anno.getAnnotations().size()); assertNotNull(anno.getAnnotation(term, null)); assertNull(anno.getAnnotation(term, "qualifier")); }
Example #4
Source File: DemoEdmProvider.java From olingo-odata4 with Apache License 2.0 | 6 votes |
@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: DemoEdmProvider.java From olingo-odata4 with Apache License 2.0 | 6 votes |
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: MetadataTest.java From olingo-odata4 with Apache License 2.0 | 6 votes |
@Test public void multipleSchemas() { final XMLMetadata metadata = client.getDeserializer(ContentType.APPLICATION_XML). toMetadata(getClass().getResourceAsStream("northwind-metadata.xml")); assertNotNull(metadata); final CsdlSchema first = metadata.getSchema("NorthwindModel"); assertNotNull(first); final CsdlSchema second = metadata.getSchema("ODataWebExperimental.Northwind.Model"); assertNotNull(second); final CsdlEntityContainer entityContainer = second.getEntityContainer(); assertNotNull(entityContainer); assertEquals("NorthwindEntities", entityContainer.getName()); }
Example #7
Source File: DemoEdmProvider.java From olingo-odata4 with Apache License 2.0 | 6 votes |
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 #8
Source File: CsdlTypeValidator.java From olingo-odata4 with Apache License 2.0 | 6 votes |
/** * 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 #9
Source File: SchemaBasedEdmProvider.java From olingo-odata4 with Apache License 2.0 | 6 votes |
@Override public CsdlActionImport getActionImport(FullQualifiedName fqn, String actionImportName) throws ODataException { CsdlSchema schema = getSchema(fqn.getNamespace()); if (schema != null) { CsdlEntityContainer ec = schema.getEntityContainer(); if (ec != null && ec.getActionImports() != null) { for (CsdlActionImport es : ec.getActionImports()) { if (es.getName().equals(actionImportName)) { return es; } } } } return null; }
Example #10
Source File: SchemaBasedEdmProvider.java From olingo-odata4 with Apache License 2.0 | 6 votes |
@Override public CsdlFunctionImport getFunctionImport(FullQualifiedName fqn, String functionImportName) throws ODataException { CsdlSchema schema = getSchema(fqn.getNamespace()); if (schema != null) { CsdlEntityContainer ec = schema.getEntityContainer(); if (ec != null && ec.getFunctionImports() != null) { for (CsdlFunctionImport es : ec.getFunctionImports()) { if (es.getName().equals(functionImportName)) { return es; } } } } return null; }
Example #11
Source File: CsdlTypeValidator.java From olingo-odata4 with Apache License 2.0 | 5 votes |
/** * This method validates Csdl action import. * It checks if action imports are part of correct container and * actions defined for action imports are correct */ private void validateCsdlActionImport() { for (Map.Entry<FullQualifiedName, CsdlEntityContainer> container : csdlContainersMap.entrySet()) { for (CsdlActionImport actionImport : container.getValue().getActionImports()) { FullQualifiedName fqaction = actionImport.getActionFQN(); if (!(csdlActionsMap.containsKey(fqaction))) { validateCsdlActionsWithAlias(fqaction); } } } }
Example #12
Source File: DemoEdmProvider.java From olingo-odata4 with Apache License 2.0 | 5 votes |
@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 #13
Source File: CsdlTypeValidator.java From olingo-odata4 with Apache License 2.0 | 5 votes |
/** * This methods validates csdl function imports. * It checks if function imports are part of correct container and * functions defined for function imports are correct */ private void validateCsdlFunctionImport() { for (Map.Entry<FullQualifiedName, CsdlEntityContainer> container : csdlContainersMap.entrySet()) { for (CsdlFunctionImport functionImport : container.getValue().getFunctionImports()) { FullQualifiedName fqaction = functionImport.getFunctionFQN(); if (!(csdlFunctionsMap.containsKey(fqaction))) { validateCsdlFunctionsWithAlias(fqaction); } } } }
Example #14
Source File: CsdlTypeValidator.java From olingo-odata4 with Apache License 2.0 | 5 votes |
/** * This method validates Csdl entity sets. * It checks if entity sets are part of correct container and * entity types defined for entity sets are correct. */ private void validateCsdlEntitySet() { for (Map.Entry<FullQualifiedName, CsdlEntityContainer> container : csdlContainersMap.entrySet()) { for (CsdlEntitySet entitySet : container.getValue().getEntitySets()) { FullQualifiedName entityType = entitySet.getTypeFQN(); if (!(csdlEntityTypesMap.containsKey(entityType))) { validateCsdlEntityTypeWithAlias(entityType); } validateNavigationBindingPaths(entitySet, container); } } }
Example #15
Source File: DemoEdmProvider.java From olingo-odata4 with Apache License 2.0 | 5 votes |
@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 #16
Source File: DemoEdmProvider.java From olingo-odata4 with Apache License 2.0 | 5 votes |
@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 #17
Source File: CsdlTypeValidator.java From olingo-odata4 with Apache License 2.0 | 5 votes |
/** * * @param aliasNamespaceMap * @param csdlContainersMap * @param csdlEntityTypesMap * @param csdlComplexTypesMap * @param csdlActionsMap * @param csdlFunctionsMap * @param csdlTermsMap */ public CsdlTypeValidator(Map<String, String> aliasNamespaceMap, Map<FullQualifiedName, CsdlEntityContainer> csdlContainersMap, Map<FullQualifiedName, CsdlEntityType> csdlEntityTypesMap, Map<FullQualifiedName, CsdlComplexType> csdlComplexTypesMap, Map<FullQualifiedName, CsdlAction> csdlActionsMap, Map<FullQualifiedName, CsdlFunction> csdlFunctionsMap) { this.aliasNamespaceMap = aliasNamespaceMap; this.csdlContainersMap = csdlContainersMap; this.csdlEntityTypesMap = csdlEntityTypesMap; this.csdlComplexTypesMap = csdlComplexTypesMap; this.csdlActionsMap = csdlActionsMap; this.csdlFunctionsMap = csdlFunctionsMap; }
Example #18
Source File: ClientCsdlEdmProvider.java From olingo-odata4 with Apache License 2.0 | 5 votes |
@Override public CsdlEntityContainer getEntityContainer() throws ODataException { for (CsdlSchema schema : xmlSchemas.values()) { if (schema.getEntityContainer() != null) { return schema.getEntityContainer(); } } return null; }
Example #19
Source File: DemoEdmProvider.java From olingo-odata4 with Apache License 2.0 | 5 votes |
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 #20
Source File: SchemaBasedEdmProvider.java From olingo-odata4 with Apache License 2.0 | 5 votes |
@Override public CsdlEntityContainerInfo getEntityContainerInfo(FullQualifiedName fqn) throws ODataException { CsdlSchema schema = null; if (fqn == null) { for (CsdlSchema s : this.edmSchemas) { if (s.getEntityContainer() != null) { schema = s; break; } } } else { schema = getSchema(fqn.getNamespace()); } if (schema != null) { CsdlEntityContainer ec = schema.getEntityContainer(); if (ec != null) { CsdlEntityContainerInfo info = new CsdlEntityContainerInfo(); info.setContainerName(new FullQualifiedName(schema.getNamespace(), ec.getName())); if (schema.getEntityContainer().getExtendsContainer() != null) { info.setExtendsContainer(new FullQualifiedName(schema.getEntityContainer().getExtendsContainer())); } return info; } } return null; }
Example #21
Source File: DemoEdmProvider.java From olingo-odata4 with Apache License 2.0 | 5 votes |
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 #22
Source File: DemoEdmProvider.java From olingo-odata4 with Apache License 2.0 | 5 votes |
@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 #23
Source File: DemoEdmProvider.java From olingo-odata4 with Apache License 2.0 | 5 votes |
@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 #24
Source File: DemoEdmProvider.java From olingo-odata4 with Apache License 2.0 | 5 votes |
@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 #25
Source File: DemoEdmProvider.java From olingo-odata4 with Apache License 2.0 | 5 votes |
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 |
@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 #27
Source File: DemoEdmProvider.java From olingo-odata4 with Apache License 2.0 | 5 votes |
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 #28
Source File: DemoEdmProvider.java From olingo-odata4 with Apache License 2.0 | 5 votes |
@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 |
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 #30
Source File: CarsEdmProvider.java From olingo-odata4 with Apache License 2.0 | 5 votes |
@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; }