org.apache.olingo.commons.api.edm.FullQualifiedName Java Examples
The following examples show how to use
org.apache.olingo.commons.api.edm.FullQualifiedName.
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 olingo-odata4 with Apache License 2.0 | 6 votes |
@Override public List<CsdlAction> getActions(final FullQualifiedName actionName) { if(actionName.equals(ACTION_RESET_FQN)) { // It is allowed to overload actions, so we have to provide a list of Actions for each action name final List<CsdlAction> actions = new ArrayList<CsdlAction>(); // Create parameters final List<CsdlParameter> parameters = new ArrayList<CsdlParameter>(); final CsdlParameter parameter = new CsdlParameter(); parameter.setName(PARAMETER_AMOUNT); parameter.setType(EdmPrimitiveTypeKind.Int32.getFullQualifiedName()); parameters.add(parameter); // Create the Csdl Action final CsdlAction action = new CsdlAction(); action.setName(ACTION_RESET_FQN.getName()); action.setParameters(parameters); actions.add(action); return actions; } return null; }
Example #2
Source File: ContextURLBuilderTest.java From olingo-odata4 with Apache License 2.0 | 6 votes |
@Test public void buildComplexType() throws Exception { EdmComplexType baseType = mock(EdmComplexType.class); when(baseType.getFullQualifiedName()).thenReturn(new FullQualifiedName("namespace", "BaseTypeName")); ContextURL contextURL = ContextURL.with().serviceRoot(serviceRoot) .type(baseType) .build(); assertEquals(serviceRoot + "$metadata#namespace.BaseTypeName", ContextURLBuilder.create(contextURL).toASCIIString()); contextURL = ContextURL.with().serviceRoot(serviceRoot) .type(baseType) .asCollection() .build(); assertEquals(serviceRoot + "$metadata#Collection(namespace.BaseTypeName)", ContextURLBuilder.create(contextURL).toASCIIString()); }
Example #3
Source File: AbstractEdm.java From olingo-odata4 with Apache License 2.0 | 6 votes |
protected EdmComplexType getComplexTypeWithAnnotations(final FullQualifiedName namespaceOrAliasFQN, boolean isComplexDerivedFromES) { this.isComplexDerivedFromES = isComplexDerivedFromES; final FullQualifiedName fqn = resolvePossibleAlias(namespaceOrAliasFQN); if (!isPreviousES() && getEntityContainer() != null) { getEntityContainer().getEntitySetsWithAnnotations(); } EdmComplexType complexType = complexTypesDerivedFromES.get(fqn); if (complexType == null) { complexType = createComplexType(fqn); if (complexType != null) { complexTypesDerivedFromES.put(fqn, complexType); } } this.isComplexDerivedFromES = false; return complexType; }
Example #4
Source File: CMODataClientTransportMarshallingTest.java From devops-cm-client with Apache License 2.0 | 6 votes |
@Test public void testAllMembersMarshalled() { ClientEntity transportEnity = new ClientEntityImpl(new FullQualifiedName("AI_CRM_GW_CM_CI_SRV.Change")); List<ClientProperty> props = transportEnity.getProperties(); props.add(new ClientPropertyImpl("TransportID", new ClientObjectFactoryImpl().newPrimitiveValueBuilder().setValue("8000038673").build())); props.add(new ClientPropertyImpl("DevelopmentSystemID", new ClientObjectFactoryImpl().newPrimitiveValueBuilder().setValue("J01~JAVA").build())); props.add(new ClientPropertyImpl("IsModifiable", new ClientObjectFactoryImpl().newPrimitiveValueBuilder().setValue("true").build())); props.add(new ClientPropertyImpl("Owner", new ClientObjectFactoryImpl().newPrimitiveValueBuilder().setValue("me").build())); props.add(new ClientPropertyImpl("Description", new ClientObjectFactoryImpl().newPrimitiveValueBuilder().setValue("Lorem ipsum").build())); CMODataTransport transport = CMODataSolmanClient.toTransport("x", transportEnity); assertThat(transport.getTransportID(), is(equalTo("8000038673"))); assertThat(transport.isModifiable(), is(equalTo(true))); assertThat(transport.getOwner(), is(equalTo("me"))); assertThat(transport.getDescription(), is(equalTo("Lorem ipsum"))); }
Example #5
Source File: DemoEdmProvider.java From olingo-odata4 with Apache License 2.0 | 6 votes |
@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 #6
Source File: GenericEdmProvider.java From spring-boot-Olingo-oData with Apache License 2.0 | 6 votes |
@Override public EntityType getEntityType(FullQualifiedName entityTypeName) throws ODataException { EntityType result = null; Map<String, EntityProvider> entityProviders = ctx .getBeansOfType(EntityProvider.class); for (String entity : entityProviders.keySet()) { EntityProvider entityProvider = entityProviders.get(entity); EntityType entityType = entityProvider.getEntityType(); if (entityType.getName().equals(entityTypeName.getName())) { result = entityType; break; } } return result; }
Example #7
Source File: ContextURLHelperTest.java From olingo-odata4 with Apache License 2.0 | 6 votes |
@Test public void buildSelectWithAction() throws Exception { final EdmEntitySet entitySet = entityContainer.getEntitySet("ESTwoKeyNav"); final EdmAction action = edm.getBoundAction( new FullQualifiedName("olingo.odata.test1.BAESTwoKeyNavRTESTwoKeyNav"), new FullQualifiedName("olingo.odata.test1.ETTwoKeyNav"), true); final SelectItem selectItem = ExpandSelectMock.mockSelectItemHavingAction( entitySet, action); final SelectOption select = ExpandSelectMock.mockSelectOption(Arrays.asList( selectItem)); final ContextURL contextURL = ContextURL.with().entitySet(entitySet) .selectList(ContextURLHelper.buildSelectList(entitySet.getEntityType(), null, select)).build(); assertEquals("$metadata#ESTwoKeyNav(PropertyInt16,PropertyString," + "olingo.odata.test1.BAESTwoKeyNavRTESTwoKeyNav)", ContextURLBuilder.create(contextURL).toASCIIString()); }
Example #8
Source File: DemoEdmProvider.java From olingo-odata4 with Apache License 2.0 | 6 votes |
@Override public CsdlEntityType getEntityType(FullQualifiedName entityTypeName) { // this method is called for one of the EntityTypes that are configured in the Schema if(ET_PRODUCT_FQN.equals(entityTypeName)){ //create EntityType properties CsdlProperty id = new CsdlProperty().setName("ID").setType(EdmPrimitiveTypeKind.Int32.getFullQualifiedName()); CsdlProperty name = new CsdlProperty().setName("Name").setType(EdmPrimitiveTypeKind.String.getFullQualifiedName()); CsdlProperty description = new CsdlProperty().setName("Description").setType(EdmPrimitiveTypeKind.String.getFullQualifiedName()); // create PropertyRef for Key element CsdlPropertyRef propertyRef = new CsdlPropertyRef(); propertyRef.setName("ID"); // configure EntityType CsdlEntityType entityType = new CsdlEntityType(); entityType.setName(ET_PRODUCT_NAME); entityType.setProperties(Arrays.asList(id, name, description)); entityType.setKey(Collections.singletonList(propertyRef)); return entityType; } return null; }
Example #9
Source File: SelectParser.java From olingo-odata4 with Apache License 2.0 | 6 votes |
private UriResourcePartTyped parseBoundOperation(UriTokenizer tokenizer, final FullQualifiedName qualifiedName, final EdmStructuredType referencedType, final boolean referencedIsCollection) throws UriParserException { final EdmAction boundAction = edm.getBoundAction(qualifiedName, referencedType.getFullQualifiedName(), referencedIsCollection); if (boundAction == null) { final List<String> parameterNames = parseFunctionParameterNames(tokenizer); final EdmFunction boundFunction = edm.getBoundFunction(qualifiedName, referencedType.getFullQualifiedName(), referencedIsCollection, parameterNames); if (boundFunction == null) { throw new UriParserSemanticException("Function not found.", UriParserSemanticException.MessageKeys.UNKNOWN_PART, qualifiedName.getFullQualifiedNameAsString()); } else { return new UriResourceFunctionImpl(null, boundFunction, null); } } else { return new UriResourceActionImpl(boundAction); } }
Example #10
Source File: EdmRecordImplTest.java From olingo-odata4 with Apache License 2.0 | 6 votes |
@Test public void recordWithEntityTypeAndPropValues() { CsdlRecord csdlRecord = new CsdlRecord(); csdlRecord.setType("ns.et"); Edm mock = mock(Edm.class); when(mock.getEntityType(new FullQualifiedName("ns", "et"))).thenReturn(mock(EdmEntityType.class)); List<CsdlPropertyValue> propertyValues = new ArrayList<CsdlPropertyValue>(); propertyValues.add(new CsdlPropertyValue()); csdlRecord.setPropertyValues(propertyValues); List<CsdlAnnotation> csdlAnnotations = new ArrayList<CsdlAnnotation>(); csdlAnnotations.add(new CsdlAnnotation().setTerm("ns.term")); csdlRecord.setAnnotations(csdlAnnotations); EdmExpression record = AbstractEdmExpression.getExpression(mock, csdlRecord); EdmDynamicExpression dynExp = assertDynamic(record); EdmRecord asRecord = dynExp.asRecord(); assertNotNull(asRecord.getPropertyValues()); assertEquals(1, asRecord.getPropertyValues().size()); assertNotNull(asRecord.getType()); assertTrue(asRecord.getType() instanceof EdmEntityType); assertNotNull(asRecord.getAnnotations()); assertEquals(1, asRecord.getAnnotations().size()); }
Example #11
Source File: EdmProviderImpl.java From olingo-odata4 with Apache License 2.0 | 6 votes |
/** * @param bindingParameterTypeName * @param parameter * @param isBindingParameterCollection * @return * @throws ODataException */ private boolean isComplexPreviousTypeCompatibleToBindingParam( final FullQualifiedName bindingParameterTypeName, final CsdlParameter parameter, Boolean isBindingParameterCollection) throws ODataException { CsdlComplexType complexType = provider.getComplexType(bindingParameterTypeName); if(provider.getEntityType(parameter.getTypeFQN()) == null){ return false; } List<CsdlProperty> properties = provider.getEntityType(parameter.getTypeFQN()).getProperties(); for (CsdlProperty property : properties) { String paramPropertyTypeName = property.getTypeAsFQNObject().getFullQualifiedNameAsString(); if ((complexType != null && complexType.getBaseType() != null && complexType.getBaseTypeFQN().getFullQualifiedNameAsString().equals(paramPropertyTypeName)) || paramPropertyTypeName.equals(bindingParameterTypeName.getFullQualifiedNameAsString()) && isBindingParameterCollection.booleanValue() == property.isCollection()) { return true; } } return false; }
Example #12
Source File: MetadataDocumentXmlSerializerTest.java From olingo-odata4 with Apache License 2.0 | 6 votes |
@Override public CsdlComplexType getComplexType(final FullQualifiedName complexTypeName) throws ODataException { if (complexTypeName.equals(nameCTTwoPrim)) { return new CsdlComplexType() .setName("CTTwoPrim") .setProperties(Arrays.asList(propertyInt16_NotNullable, propertyString)); } if (complexTypeName.equals(nameCTTwoPrimBase)) { return new CsdlComplexType() .setName("CTTwoPrimBase") .setBaseType(nameCTTwoPrim) .setProperties(Arrays.asList(propertyInt16_NotNullable, propertyString)); } return null; }
Example #13
Source File: ParserHelper.java From olingo-odata4 with Apache License 2.0 | 6 votes |
protected static EdmStructuredType parseTypeCast(UriTokenizer tokenizer, final Edm edm, final EdmStructuredType referencedType) throws UriParserException { if (tokenizer.next(TokenKind.QualifiedName)) { final FullQualifiedName qualifiedName = new FullQualifiedName(tokenizer.getText()); final EdmStructuredType type = referencedType.getKind() == EdmTypeKind.ENTITY ? edm.getEntityType(qualifiedName) : edm.getComplexType(qualifiedName); if (type == null) { throw new UriParserSemanticException("Type '" + qualifiedName + "' not found.", UriParserSemanticException.MessageKeys.UNKNOWN_PART, qualifiedName.getFullQualifiedNameAsString()); } else { if (!type.compatibleTo(referencedType)) { throw new UriParserSemanticException("The type cast '" + qualifiedName + "' is not compatible.", UriParserSemanticException.MessageKeys.INCOMPATIBLE_TYPE_FILTER, type.getName()); } } return type; } return null; }
Example #14
Source File: MetadataTest.java From olingo-odata4 with Apache License 2.0 | 6 votes |
@Test public void readPropertyAnnotationsTest() { List<InputStream> streams = new ArrayList<InputStream>(); streams.add(getClass().getResourceAsStream("VOC_Core.xml")); final Edm edm = client.getReader().readMetadata(getClass().getResourceAsStream("edmxWithCsdlAnnotationPath.xml"), streams); assertNotNull(edm); final EdmEntityType person = edm.getEntityType( new FullQualifiedName("Microsoft.Exchange.Services.OData.Model", "Person")); assertNotNull(person); EdmProperty userName = (EdmProperty) person.getProperty("UserName"); List<EdmAnnotation> userNameAnnotations = userName.getAnnotations(); for (EdmAnnotation annotation : userNameAnnotations) { EdmTerm term = annotation.getTerm(); assertNotNull(term); assertEquals("Permissions", term.getName()); assertEquals("Org.OData.Core.V1.Permissions", term.getFullQualifiedName().getFullQualifiedNameAsString()); EdmExpression expression = annotation.getExpression(); assertNotNull(expression); assertTrue(expression.isDynamic()); assertEquals("AnnotationPath", expression.asDynamic().getExpressionName()); } }
Example #15
Source File: ComplexInvocationHandler.java From olingo-odata4 with Apache License 2.0 | 6 votes |
private static Pair<ClientComplexValue, Class<?>> init( final Class<?> typeRef, final AbstractService<?> service) { final Class<?> complexTypeRef; if (Collection.class.isAssignableFrom(typeRef)) { complexTypeRef = ClassUtils.extractTypeArg(typeRef); } else { complexTypeRef = typeRef; } final ComplexType annotation = complexTypeRef.getAnnotation(ComplexType.class); if (annotation == null) { throw new IllegalArgumentException("Invalid complex type " + complexTypeRef); } final FullQualifiedName typeName = new FullQualifiedName(ClassUtils.getNamespace(complexTypeRef), annotation.name()); final ClientComplexValue complex = service.getClient().getObjectFactory().newComplexValue(typeName.toString()); return new ImmutablePair<ClientComplexValue, Class<?>>(complex, complexTypeRef); }
Example #16
Source File: ODataHandlerImplTest.java From olingo-odata4 with Apache License 2.0 | 6 votes |
@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 #17
Source File: EdmProviderImpl.java From olingo-odata4 with Apache License 2.0 | 6 votes |
@Override protected List<EdmFunction> createUnboundFunctions(final FullQualifiedName functionName) { List<EdmFunction> result = new ArrayList<>(); try { List<CsdlFunction> functions = functionsMap.get(functionName); if (functions == null) { functions = provider.getFunctions(functionName); if (functions != null) { functionsMap.put(functionName, functions); } } if (functions != null) { for (CsdlFunction function : functions) { if (!function.isBound()) { addOperationsAnnotations(function, functionName); result.add(new EdmFunctionImpl(this, functionName, function)); } } } } catch (ODataException e) { throw new EdmException(e); } return result; }
Example #18
Source File: EdmTermImplTest.java From olingo-odata4 with Apache License 2.0 | 6 votes |
@Test public void termWithEntityType() { CsdlTerm csdlTerm = new CsdlTerm(); FullQualifiedName csdlTerm1Name = new FullQualifiedName("namespace", "name1"); csdlTerm.setName(csdlTerm1Name.getName()); String namespaceAndName = "mySchema.Entity"; String name = "Entity"; csdlTerm.setType(namespaceAndName); Edm edm = mock(Edm.class); EdmEntityType typeMock = mock(EdmEntityType.class); when(typeMock.getName()).thenReturn(name); when(edm.getEntityType(new FullQualifiedName(namespaceAndName))).thenReturn(typeMock); EdmTerm localTerm = new EdmTermImpl(edm, "namespace", csdlTerm); assertNotNull(localTerm.getType()); assertEquals(name, localTerm.getType().getName()); }
Example #19
Source File: ExpressionParser.java From olingo-odata4 with Apache License 2.0 | 5 votes |
private void parseBoundFunction(final FullQualifiedName fullQualifiedName, UriInfoImpl uriInfo, final UriResourcePartTyped lastResource) throws UriParserException, UriValidationException { final EdmType type = lastResource.getType(); final List<UriParameter> parameters = ParserHelper.parseFunctionParameters(tokenizer, edm, referringType, true, aliases); final List<String> parameterNames = ParserHelper.getParameterNames(parameters); final EdmFunction boundFunction = edm.getBoundFunction(fullQualifiedName, type.getFullQualifiedName(), lastResource.isCollection(), parameterNames); if (boundFunction == null) { throw new UriParserSemanticException("Bound function '" + fullQualifiedName + "' not found.", UriParserSemanticException.MessageKeys.FUNCTION_NOT_FOUND, fullQualifiedName.getFullQualifiedNameAsString()); } ParserHelper.validateFunctionParameters(boundFunction, parameters, edm, referringType, aliases); parseFunctionRest(uriInfo, boundFunction, parameters); }
Example #20
Source File: EdmEntityContainerImpl.java From olingo-odata4 with Apache License 2.0 | 5 votes |
private void addOperationImportAnnotations(CsdlOperationImport operationImport, FullQualifiedName entityContainerName) { List<CsdlAnnotation> annotations = ((EdmProviderImpl)edm).getAnnotationsMap(). get(entityContainerName + SLASH + operationImport.getName()); addAnnotationsOnOperationImport(operationImport, annotations); String aliasName = getAliasInfo(entityContainerName.getNamespace()); List<CsdlAnnotation> annotationsOnAlias = ((EdmProviderImpl)edm).getAnnotationsMap(). get(aliasName + DOT + entityContainerName.getName() + SLASH + operationImport.getName()); addAnnotationsOnOperationImport(operationImport, annotationsOnAlias); }
Example #21
Source File: ConditionalITCase.java From olingo-odata4 with Apache License 2.0 | 5 votes |
@Test public void updateWithoutIfMatch() throws Exception { executeAndExpectError( getClient().getCUDRequestFactory().getEntityUpdateRequest( uriEntity, UpdateType.PATCH, getFactory().newEntity(new FullQualifiedName(SERVICE_NAMESPACE, "Order"))), HttpStatusCode.PRECONDITION_REQUIRED); }
Example #22
Source File: EdmEntityContainerImpl.java From olingo-odata4 with Apache License 2.0 | 5 votes |
private void addEntitySetAnnotations(CsdlEntitySet entitySet, FullQualifiedName entityContainerName) { CsdlEntityType entityType = getCsdlEntityTypeFromEntitySet(entitySet); if (entityType == null) { return; } List<CsdlAnnotation> annotations = ((EdmProviderImpl)edm).getAnnotationsMap(). get(entityContainerName + SLASH + entitySet.getName()); addAnnotationsOnEntitySet(entitySet, annotations); String aliasName = getAliasInfo(entityContainerName.getNamespace()); List<CsdlAnnotation> annotationsOnAlias = ((EdmProviderImpl)edm).getAnnotationsMap(). get(aliasName + DOT + entityContainerName.getName() + SLASH + entitySet.getName()); addAnnotationsOnEntitySet(entitySet, annotationsOnAlias); addAnnotationsToPropertiesIncludedFromES(entitySet, entityContainerName, entityType); }
Example #23
Source File: EdmEntityContainerImplTest.java From olingo-odata4 with Apache License 2.0 | 5 votes |
@Before public void setup() { CsdlEdmProvider provider = new CustomProvider(); EdmProviderImpl edm = new EdmProviderImpl(provider); CsdlEntityContainerInfo entityContainerInfo = new CsdlEntityContainerInfo().setContainerName(new FullQualifiedName("space", "name")); container = new EdmEntityContainerImpl(edm, provider, entityContainerInfo); }
Example #24
Source File: EdmProviderImplTest.java From olingo-odata4 with Apache License 2.0 | 5 votes |
private void callMethodAndExpectEdmException(final Edm localEdm, final String methodName) throws Exception { Method method = localEdm.getClass().getMethod(methodName, FullQualifiedName.class); try { method.invoke(localEdm, new FullQualifiedName("namespace", "name")); } catch (InvocationTargetException e) { Throwable cause = e.getCause(); if (cause instanceof EdmException) { return; } } fail("EdmException expected for method: " + methodName); }
Example #25
Source File: EdmProviderImpl.java From olingo-odata4 with Apache License 2.0 | 5 votes |
@Override public EdmEntityContainer createEntityContainer(final FullQualifiedName containerName) { try { CsdlEntityContainerInfo entityContainerInfo = provider.getEntityContainerInfo(containerName); if (entityContainerInfo != null) { CsdlEntityContainer entityContainer = provider.getEntityContainer(); addEntityContainerAnnotations(entityContainer, entityContainerInfo.getContainerName()); return new EdmEntityContainerImpl(this, provider, entityContainerInfo.getContainerName(), entityContainer); } return null; } catch (ODataException e) { throw new EdmException(e); } }
Example #26
Source File: EdmProviderImplTest.java From olingo-odata4 with Apache License 2.0 | 5 votes |
@Before public void setup() throws Exception { CsdlEdmProvider provider = mock(CsdlEdmProvider.class); CsdlEntityContainerInfo containerInfo = new CsdlEntityContainerInfo().setContainerName(FQN); when(provider.getEntityContainerInfo(FQN)).thenReturn(containerInfo); when(provider.getEntityContainerInfo(null)).thenReturn(containerInfo); CsdlEnumType enumType = new CsdlEnumType().setName(FQN.getName()); when(provider.getEnumType(FQN)).thenReturn(enumType); CsdlTypeDefinition typeDefinition = new CsdlTypeDefinition().setName(FQN.getName()).setUnderlyingType(new FullQualifiedName("Edm", "String")); when(provider.getTypeDefinition(FQN)).thenReturn(typeDefinition); CsdlEntityType entityType = new CsdlEntityType().setName(FQN.getName()).setKey(new ArrayList<CsdlPropertyRef>()); when(provider.getEntityType(FQN)).thenReturn(entityType); CsdlComplexType complexType = new CsdlComplexType().setName(FQN.getName()); when(provider.getComplexType(FQN)).thenReturn(complexType); List<CsdlAliasInfo> aliasInfos = new ArrayList<CsdlAliasInfo>(); aliasInfos.add(new CsdlAliasInfo().setAlias("alias").setNamespace("namespace")); when(provider.getAliasInfos()).thenReturn(aliasInfos); CsdlAnnotations annotationsGroup = new CsdlAnnotations(); annotationsGroup.setTarget("FQN.FQN"); when(provider.getAnnotationsGroup(FQN, null)).thenReturn(annotationsGroup); edm = new EdmProviderImpl(provider); }
Example #27
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 #28
Source File: DemoEdmProvider.java From olingo-odata4 with Apache License 2.0 | 5 votes |
@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 #29
Source File: ClientCsdlEdmProvider.java From olingo-odata4 with Apache License 2.0 | 5 votes |
@Override public CsdlTerm getTerm(final FullQualifiedName termName) throws ODataException { CsdlSchema schema = xmlSchemas.get(termName.getNamespace()); if (schema != null) { return schema.getTerm(termName.getName()); } return null; }
Example #30
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); }