Details
-
Question
-
Status: Open
-
Major
-
Resolution: Unresolved
-
(Java) V4 4.7.1
-
None
-
None
Description
I want my OData V4 server to annotate an instance value before it is serialized and sent to the client in response to a request. The client can then use the annotation in conjunction with the property value.
The OData V4 standard refers to instance annotation:
http://docs.oasis-open.org/odata/odata-json-format/v4.0/os/odata-json-format-v4.0-os.html#_Toc372793088
This thread https://groups.google.com/g/odata-discussion/c/91TqloIzgcQ/m/E-QHYqIwBwAJ state "instance annotations are supported in the current V4 library. Our serializer can serialize payloads and also deserialize payloads having such annotations."
OLINGO-264 suggests it was added in 4.0
However the only methods I can see on org.apache.olingo.commons.api.data.Property are getAnnotations(), but not setAnnotations as with the CSDLAnnotations.
I have tried adding an Annotation as follows:
Property property = new Property(null, rdfProperty.propertyName, ValueType.PRIMITIVE, Cast(value, rdfProperty.propertyTypeName)); Annotation scriptAnnotation = new Annotation(); scriptAnnotation.setValue(ValueType.PRIMITIVE, "this is an annotation"); scriptAnnotation.setTerm(RdfConstants.SCRIPT_FQN); scriptAnnotation.setType("PRIMITIVE"); property.getAnnotations().add(scriptAnnotation);
However these annotations are not serialized.
What am I missing?