Saurabh Talwalkar created OLINGO-1513: -----------------------------------------
Summary: How can I add Annotations from core vocabularies in my Metadata.xml file using olingo Java? Key: OLINGO-1513 URL: https://issues.apache.org/jira/browse/OLINGO-1513 Project: Olingo Issue Type: Question Components: odata4-server Affects Versions: (Java) V4 4.8.0 Reporter: Saurabh Talwalkar I am trying to add an annotation to mark an Entity Set as NonFilterable to my Metadata. I cannot find any example on the internet to do this. Is there a sample which shows how to write Olingo 4 code to generate a metadata file with FilterRestrictions annotation or any other core vocabulary annotations? I have tried this method after creating my entity set in my Entity Data Model Provider class. {code:java} //In my EntityDataModelProvider.java I call this method after i create an EntitySet private void setNonFilterableTypeId(CsdlEntitySet csdlEntitySet{ List<CsdlAnnotation> annotationList = csdlEntitySet.getAnnotations(); CsdlPropertyPath path = new CsdlPropertyPath(); path.setValue("token"); CsdlCollection collection = new CsdlCollection(); collection.setItems(Arrays.asList(path)); CsdlPropertyValue propertyValue1 = new CsdlPropertyValue(); propertyValue1.setProperty("NonFilterableProperties"); propertyValue1.setValue(collection); CsdlRecord record = new CsdlRecord(); record.setPropertyValues(Arrays.asList(propertyValue1)); CsdlAnnotation annotation = new CsdlAnnotation(); annotation.setTerm("Org.OData.Capabilities.V1.FilterRestrictions"); annotation.setExpression(record); annotationList.add(annotation); } {code} The output Metadata XML that is created is missing the value of the term attribute. It shows <Annotation> instead of <Annotation Term="Org.OData.Capabilities.V1.FilterRestrictions"> {code:java} <EntitySet Name="Persons" EntityType="mynamespace.Person"> <Annotation> <Record> <PropertyValue Property="NonFilterableProperties"> <Collection> <PropertyPath>token</PropertyPath> </Collection> </PropertyValue> </Record> </Annotation> </EntitySet> {code} -- This message was sent by Atlassian Jira (v8.3.4#803005)