You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@olingo.apache.org by "Peter Lawrence (Jira)" <ji...@apache.org> on 2020/08/24 08:55:00 UTC

[jira] [Updated] (OLINGO-1477) org.apache.olingo.commons.api.data.Property instance annotation not serialized in response

     [ https://issues.apache.org/jira/browse/OLINGO-1477?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Peter Lawrence updated OLINGO-1477:
-----------------------------------
    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:
{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?

  was:
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.

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?


> org.apache.olingo.commons.api.data.Property instance annotation not serialized in response
> ------------------------------------------------------------------------------------------
>
>                 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)