Details
-
Question
-
Status: Open
-
Major
-
Resolution: Unresolved
-
(Java) V4 4.8.0
-
None
-
None
Description
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.
//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); }
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">
<EntitySet Name="Persons" EntityType="mynamespace.Person"> <Annotation> <Record> <PropertyValue Property="NonFilterableProperties"> <Collection> <PropertyPath>token</PropertyPath> </Collection> </PropertyValue> </Record> </Annotation> </EntitySet>