Java Code Examples for org.apache.olingo.commons.api.edm.Edm#getTerm()
The following examples show how to use
org.apache.olingo.commons.api.edm.Edm#getTerm() .
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: MetadataTest.java From olingo-odata4 with Apache License 2.0 | 7 votes |
@Test public void readAnnotationOnComplexType() { final Edm edm = fetchEdm(); assertNotNull(edm); EdmComplexType complexType = edm.getComplexTypeWithAnnotations( new FullQualifiedName("SEPMRA_SO_MAN2", "CTPrim")); assertEquals(2, complexType.getAnnotations().size()); assertEquals("HeaderInfo", complexType.getAnnotations().get(0).getTerm().getName()); // Annotations on complex type property EdmProperty complexTypeProp = (EdmProperty) complexType.getProperty("PropertyInt16"); assertEquals(1, complexTypeProp.getAnnotations().size()); assertEquals("HeaderInfo", complexTypeProp.getAnnotations().get(0).getTerm().getName()); // Annotations on complex type navigation property EdmNavigationProperty complexTypeNavProp = complexType.getNavigationProperty( "NavPropertyDraftAdministrativeDataType"); assertEquals(1, complexTypeNavProp.getAnnotations().size()); assertEquals("HeaderInfo", complexTypeNavProp.getAnnotations().get(0).getTerm().getName()); FullQualifiedName termName = new FullQualifiedName("Integration", "Extractable"); EdmTerm term = edm.getTerm(termName); EdmAnnotation annotation = complexType.getAnnotation(term, null); assertNotNull(annotation); }
Example 2
Source File: BasicITCase.java From olingo-odata4 with Apache License 2.0 | 6 votes |
@Test public void readMetadataWithTerm() { EdmMetadataRequest request = getClient().getRetrieveRequestFactory().getMetadataRequest(SERVICE_URI); assertNotNull(request); setCookieHeader(request); ODataRetrieveResponse<Edm> response = request.execute(); saveCookieHeader(response); assertEquals(HttpStatusCode.OK.getStatusCode(), response.getStatusCode()); Edm edm = response.getBody(); assertNotNull(edm); final EdmTerm descriptionTerm = edm.getTerm(new FullQualifiedName("Core", "Description")); assertNotNull(descriptionTerm); assertEquals(descriptionTerm.getFullQualifiedName(), edm.getTerm(new FullQualifiedName("Org.OData.Core.V1", "Description")).getFullQualifiedName()); }
Example 3
Source File: MetadataTest.java From olingo-odata4 with Apache License 2.0 | 6 votes |
@Test public void readAnnotationOnASingleton() { final Edm edm = fetchEdm(); assertNotNull(edm); EdmEntityContainer container = edm.getEntityContainer(); EdmSingleton singleton = container.getSingleton("SINav"); assertEquals(2, singleton.getAnnotations().size()); FullQualifiedName termName = new FullQualifiedName("UI", "HeaderInfo"); EdmTerm term = edm.getTerm(termName); EdmAnnotation annotation = singleton.getAnnotation(term, null); assertNotNull(annotation); EdmEntityType singletonET = singleton.getEntityType(); EdmProperty singlComplexProp = (EdmProperty) singletonET.getProperty("ComplexProperty"); EdmComplexType singlCompType = (EdmComplexType) singlComplexProp.getTypeWithAnnotations(); EdmNavigationProperty singlNavProp = (EdmNavigationProperty) singlCompType.getNavigationProperty( "NavPropertyDraftAdministrativeDataType"); assertEquals(2, singlNavProp.getAnnotations().size()); assertEquals("AdditionalInfo", singlNavProp.getAnnotations().get(0).getTerm().getName()); }
Example 4
Source File: MetadataTest.java From olingo-odata4 with Apache License 2.0 | 6 votes |
@Test public void readAnnotationOnBoundActions() { final Edm edm = fetchEdm(); assertNotNull(edm); EdmAction action = edm.getBoundAction(new FullQualifiedName("SEPMRA_SO_MAN2", "BA_RTCountryVHType"), new FullQualifiedName("SEPMRA_SO_MAN2", "I_DraftAdministrativeDataType"), false); assertEquals(1, action.getAnnotations().size()); assertEquals("HeaderInfo", action.getAnnotations().get(0).getTerm().getName()); // Annotations on Bound Action parameter assertEquals(2, action.getParameter("ParameterCTPrim").getAnnotations().size()); assertEquals("HeaderInfo", action.getParameter("ParameterCTPrim") .getAnnotations().get(0).getTerm().getName()); FullQualifiedName termName = new FullQualifiedName("UI", "AdditionalInfo"); EdmTerm term = edm.getTerm(termName); EdmAnnotation annotation = action.getParameter("ParameterCTPrim").getAnnotation(term, null); assertNotNull(annotation); }
Example 5
Source File: MetadataTest.java From olingo-odata4 with Apache License 2.0 | 6 votes |
@Test public void readAnnotationWithAliasOnEntitySetProperties() { final Edm edm = fetchEdm(); assertNotNull(edm); EdmEntityContainer container = edm.getEntityContainer(); EdmEntitySet entitySet = container.getEntitySet("I_DraftAdministrativeData"); EdmEntityType entityType = entitySet.getEntityTypeWithAnnotations(); List<EdmAnnotation> annotations = ((EdmProperty)entityType.getProperty("DraftUUID")).getAnnotations(); assertEquals(3, annotations.size()); FullQualifiedName termName = new FullQualifiedName("Integration", "Extractable"); EdmTerm term = edm.getTerm(termName); EdmAnnotation annotation = ((EdmProperty)entityType.getProperty("DraftUUID")).getAnnotation(term, null); assertNotNull(annotation); }
Example 6
Source File: MetadataTest.java From olingo-odata4 with Apache License 2.0 | 6 votes |
@Test public void readAnnotationOnFunction() { final Edm edm = fetchEdm(); assertNotNull(edm); List<EdmFunction> function = edm.getUnboundFunctions(new FullQualifiedName("SEPMRA_SO_MAN2", "UFCRTCollString")); assertEquals(1, function.size()); List<EdmAnnotation> annotations = function.get(0).getAnnotations(); assertEquals(2, annotations.size()); FullQualifiedName termName = new FullQualifiedName("Integration", "Extractable"); EdmTerm term = edm.getTerm(termName); EdmAnnotation annotation = function.get(0).getAnnotation(term, null); assertNotNull(annotation); }
Example 7
Source File: MetadataTestITCase.java From olingo-odata4 with Apache License 2.0 | 5 votes |
@Test public void vocabularies() { final Edm edm = client.getRetrieveRequestFactory(). getMetadataRequest(testVocabulariesServiceRootURL).execute().getBody(); assertNotNull(edm); final EdmTerm isLanguageDependent = edm.getTerm(new FullQualifiedName("Core", "IsLanguageDependent")); assertNotNull(isLanguageDependent); assertTrue(isLanguageDependent.getAppliesTo().contains(TargetType.Property)); assertTrue(isLanguageDependent.getAppliesTo().contains(TargetType.Term)); assertEquals(edm.getTypeDefinition(new FullQualifiedName("Core", "Tag")), isLanguageDependent.getType()); assertEquals(EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Boolean), ((EdmTypeDefinition) isLanguageDependent.getType()).getUnderlyingType()); final EdmTerm permissions = edm.getTerm(new FullQualifiedName("Core", "Permissions")); assertNotNull(permissions); assertTrue(permissions.getType() instanceof EdmEnumType); // 2. measures final EdmSchema measures = edm.getSchema("UoM"); assertNotNull(measures); final EdmTerm scale = edm.getTerm(new FullQualifiedName("UoM", "Scale")); assertNotNull(scale); final EdmAnnotation requiresTypeInScale = scale.getAnnotation(edm.getTerm(new FullQualifiedName("Core", "RequiresType")), null); assertNotNull(requiresTypeInScale); assertEquals("Edm.Decimal", requiresTypeInScale.getExpression().asConstant().getValueAsString()); // 3. capabilities final EdmTerm deleteRestrictions = edm.getTerm(new FullQualifiedName("Capabilities", "DeleteRestrictions")); assertNotNull(deleteRestrictions); assertEquals(deleteRestrictions.getType().getFullQualifiedName(), edm.getComplexType(new FullQualifiedName("Capabilities", "DeleteRestrictionsType")).getFullQualifiedName()); }
Example 8
Source File: MetadataTest.java From olingo-odata4 with Apache License 2.0 | 5 votes |
@Test public void readAnnotationOnFunctionImport() { final Edm edm = fetchEdm(); assertNotNull(edm); EdmEntityContainer container = edm.getEntityContainer(); EdmFunctionImport functionImport = container.getFunctionImport("FIC_RTTimeOfDay_"); assertEquals(3, functionImport.getAnnotations().size()); FullQualifiedName termName = new FullQualifiedName("UI", "Identification"); EdmTerm term = edm.getTerm(termName); EdmAnnotation annotation = functionImport.getAnnotation(term, null); assertNotNull(annotation); }
Example 9
Source File: MetadataTest.java From olingo-odata4 with Apache License 2.0 | 5 votes |
@Test public void readAnnotationFetchingAllSingletons() { final Edm edm = fetchEdm(); assertNotNull(edm); EdmEntityContainer container = edm.getEntityContainer(); List<EdmSingleton> singletons = container.getSingletons(); assertEquals(1, singletons.size()); FullQualifiedName termName = new FullQualifiedName("UI", "HeaderInfo"); EdmTerm term = edm.getTerm(termName); EdmAnnotation annotation = singletons.get(0).getAnnotation(term, null); assertNotNull(annotation); }
Example 10
Source File: MetadataTest.java From olingo-odata4 with Apache License 2.0 | 5 votes |
@Test public void readAnnotationFetchingAllFunctionImports() { final Edm edm = fetchEdm(); assertNotNull(edm); EdmEntityContainer container = edm.getEntityContainer(); List<EdmFunctionImport> functionImports = container.getFunctionImports(); assertEquals(1, functionImports.size()); FullQualifiedName termName = new FullQualifiedName("Integration", "Extractable"); EdmTerm term = edm.getTerm(termName); EdmAnnotation annotation = functionImports.get(0).getAnnotation(term, null); assertNotNull(annotation); }
Example 11
Source File: MetadataTest.java From olingo-odata4 with Apache License 2.0 | 5 votes |
@Test public void readAnnotationFetchingAllEntitySets() { final Edm edm = fetchEdm(); assertNotNull(edm); EdmEntityContainer container = edm.getEntityContainer(); List<EdmEntitySet> entitySets = container.getEntitySets(); assertEquals(4, entitySets.size()); FullQualifiedName termName = new FullQualifiedName("UI", "HeaderInfo"); EdmTerm term = edm.getTerm(termName); EdmAnnotation annotation = entitySets.get(0).getAnnotation(term, null); assertNotNull(annotation); }
Example 12
Source File: MetadataTest.java From olingo-odata4 with Apache License 2.0 | 5 votes |
@Test public void readAnnotationOnEnumTypes() { final Edm edm = fetchEdm(); assertNotNull(edm); EdmEnumType enumType = edm.getEnumType(new FullQualifiedName("SEPMRA_SO_MAN2.ENString")); EdmMember member = enumType.getMember("String1"); assertEquals(1, member.getAnnotations().size()); FullQualifiedName termName = new FullQualifiedName("Integration", "OriginalDataType"); EdmTerm term = edm.getTerm(termName); EdmAnnotation annotation = member.getAnnotation(term, null); assertNotNull(annotation); }
Example 13
Source File: MetadataTest.java From olingo-odata4 with Apache License 2.0 | 5 votes |
@Test public void readAnnotationOnAction() { final Edm edm = fetchEdm(); assertNotNull(edm); EdmAction action = edm.getUnboundAction(new FullQualifiedName("SEPMRA_SO_MAN2", "UARTString")); List<EdmAnnotation> annotations = action.getAnnotations(); assertEquals(2, annotations.size()); FullQualifiedName termName = new FullQualifiedName("Integration", "Extractable"); EdmTerm term = edm.getTerm(termName); EdmAnnotation annotation = action.getAnnotation(term, null); assertNotNull(annotation); }