Uploaded image for project: 'jBPM'
  1. jBPM
  2. JBPM-8404

Marshalling and Unmarshalling of Documents (the Document wrapper) is broken when using JAXB or JSON

    Details

    • Type: Feature Request
    • Status: Pull Request Sent (View Workflow)
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 7.20.0.Final
    • Fix Version/s: None
    • Component/s: KieServer
    • Labels:
      None
    • Environment:

      RHPAM 7.3, Java 8

    • Docs QE Status:
      NEW
    • QE Status:
      NEW

      Description

      The Documents class, the class we use to store a collection of Document instances, can not be marshalled and unmarshalled with JAXB and JSON over the KIE-Server API (XStream does work). There seem to be multiple problems. The main issue is that Documents contains a List<Document>, where Document is an interface.

      JAXB does not like interfaces, and hence won't marshall and/or unmarshall such an object.

      The problem with JSON is that the JSON Marshaller won't work unless we register Documents and Document as extra remoteable classes. However, KIE-Server does not allow us to register interfaces as Remoteable classes, so this breaks as well.

      What seems to be the solution is to:

      • Add JAXB annotations to the List<Document> attribute of the Documents class. To be specific the annotations:
        @XmlElementWrapper
        @XmlAnyElement(lax=true)
        private List<Document> documents = new ArrayList<>();
        
      • Add the Documents class automatically to the "extraClasses" of the KieContainerInstance.
      • Add the Document interface only to the extra class of the JSONMarshaller (as adding them to the JAXBContext will break JAXB. The idea is to do this via a KIE-Server JSONMarshaller extension.

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                swiderski.maciej Maciej Swiderski
                Reporter:
                McCloud Duncan Doyle
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated: