[ https://issues.apache.org/jira/browse/OLINGO-1477?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Peter Lawrence updated OLINGO-1477: ----------------------------------- Summary: org.apache.olingo.commons.api.data.Property instance annotation not serialized in response to request (was: org.apache.olingo.commons.api.data.Property instance annotation not serialized in response) > org.apache.olingo.commons.api.data.Property instance annotation not > serialized in response to request > ----------------------------------------------------------------------------------------------------- > > Key: OLINGO-1477 > URL: https://issues.apache.org/jira/browse/OLINGO-1477 > Project: Olingo > Issue Type: Question > Components: odata4-commons > Affects Versions: (Java) V4 4.7.1 > Reporter: Peter Lawrence > Priority: Major > > 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: > {code:java} > 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); > {code} > However these annotations are not serialized. > What am I missing? -- This message was sent by Atlassian Jira (v8.3.4#803005)