Uploaded image for project: 'Olingo'
  1. Olingo
  2. OLINGO-1477

org.apache.olingo.commons.api.data.Property instance annotation not serialized in response to request

    XMLWordPrintableJSON

Details

    • Question
    • Status: Open
    • Major
    • Resolution: Unresolved
    • (Java) V4 4.7.1
    • None
    • odata4-commons
    • 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?

      Attachments

        Activity

          People

            Unassigned Unassigned
            peterlawrence Peter Lawrence
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: