olingo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ramya (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (OLINGO-1130) Unable to fetch property annotations
Date Wed, 14 Jun 2017 07:53:00 GMT

    [ https://issues.apache.org/jira/browse/OLINGO-1130?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16048813#comment-16048813
] 

Ramya commented on OLINGO-1130:
-------------------------------

Hi,
You could try this
XMLMetadataRequest request = ODataClientFactory.getClient().getRetrieveRequestFactory().getXMLMetadataRequest("http://services.odata.org/V4/TripPinService/");
ODataRetrieveResponse<XMLMetadata> response = request.execute();
XMLMetadata xmlMetadata = response.getBody();
CsdlSchema schema = xmlMetadata.getSchema(0);
CsdlEntityType entityType = schema.getEntityType("Person");
CsdlProperty property = entityType.getProperty("Concurrency");
List<CsdlAnnotation> annotations = property.getAnnotations();
for (CsdlAnnotation annotation : annotations) {
    String term = annotation.getTerm();
    CsdlExpression expression = annotation.getExpression();
}

Hope this helps..

Regards,
Ramya

> Unable to fetch property annotations 
> -------------------------------------
>
>                 Key: OLINGO-1130
>                 URL: https://issues.apache.org/jira/browse/OLINGO-1130
>             Project: Olingo
>          Issue Type: Bug
>          Components: odata4-client
>            Reporter: Gauri Kalra
>
> While trying to fetch metadata from the following end-point:
> http://services.odata.org/V4/TripPinService/$metadata
> and using the following code snippet to fetch annotations using Olingo library version
4.3.0:
> List<EdmAnnotation> annotations = property.getAnnotations();
> if(annotations.size() != 0) {
> 	EdmAnnotationImpl impl = (EdmAnnotationImpl) annotations.get(0);
> 	CsdlTerm csterm = new CsdlTerm();
> 	csterm.setName("Org.OData.Core.V1.Computed");
> 	EdmTerm term = new EdmTermImpl(edm, "Microsoft.OData.SampleService.Models.TripPin",
csterm);
> 	EdmAnnotation ann = impl.getAnnotation(term, null);
> }
> the value returned is null.
> Is there another way that one can fetch property-level annotations?



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Mime
View raw message