Class ContributionServiceHelper


  • public class ContributionServiceHelper
    extends Object
    Helper class to collect helper methods for contribution processing.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static List<com.nedap.archie.rm.changecontrol.Version> extractVersionObjects​(ArrayList listVersions, org.ehrbase.response.ehrscape.CompositionFormat format)
      returns a list of RM VERSIONs extracted from given serialization
      static com.nedap.archie.rm.generic.AuditDetails parseAuditDetails​(String content, org.ehrbase.response.ehrscape.CompositionFormat format)
      Helper that parses the AuditDetails from the contribution input.
      static List<com.nedap.archie.rm.changecontrol.Version> parseVersions​(String content, org.ehrbase.response.ehrscape.CompositionFormat format)
      Convenience helper that combines some methods from above and prepares direct access to the list of contained versions
      static Map<String,​Object> splitContent​(String content, org.ehrbase.response.ehrscape.CompositionFormat format)
      splits contribution string content into its versions list & audit part
      static com.nedap.archie.rm.RMObject unmarshalMapContentToRmObject​(LinkedHashMap content, org.ehrbase.response.ehrscape.CompositionFormat format)
      TODO CONTRIBUTION: isn't this in its current form independent of the format? the map should be without JSON specifics.
    • Constructor Detail

      • ContributionServiceHelper

        public ContributionServiceHelper()
    • Method Detail

      • splitContent

        public static Map<String,​Object> splitContent​(String content,
                                                            org.ehrbase.response.ehrscape.CompositionFormat format)
        splits contribution string content into its versions list & audit part
        Parameters:
        content - Payload serialized input
        format - Format of given input
        Returns:
        Map split at first level of input, so access to the version list and audit is directly possible
      • extractVersionObjects

        public static List<com.nedap.archie.rm.changecontrol.Version> extractVersionObjects​(ArrayList listVersions,
                                                                                            org.ehrbase.response.ehrscape.CompositionFormat format)
        returns a list of RM VERSIONs extracted from given serialization
        Parameters:
        listVersions - List of still serialized version objects
        format - Format of the serialization
        Returns:
        List of deserialized version objects
        Throws:
        IllegalArgumentException - when processing of given input fails
      • unmarshalMapContentToRmObject

        public static com.nedap.archie.rm.RMObject unmarshalMapContentToRmObject​(LinkedHashMap content,
                                                                                 org.ehrbase.response.ehrscape.CompositionFormat format)
        TODO CONTRIBUTION: isn't this in its current form independent of the format? the map should be without JSON specifics. only the problematic round trip conversation depends of a format, but that could be fix. unmarshaller that creates an RMObject from a Map's content
        Parameters:
        content - Map instance containing data for a RMObject (i.e. pseudo marshalled)
        format - Format of the origin payload // TODO technically given content doesn't contain any (real) marshalled, for instance, json parts anymore
        Returns:
        RM Object representation fitting the given content
        Throws:
        IllegalArgumentException - when processing of given input fails
      • parseVersions

        public static List<com.nedap.archie.rm.changecontrol.Version> parseVersions​(String content,
                                                                                    org.ehrbase.response.ehrscape.CompositionFormat format)
        Convenience helper that combines some methods from above and prepares direct access to the list of contained versions
        Parameters:
        content - Plain string content
        format - Format of content
        Returns:
        List of version objects extracted from content
      • parseAuditDetails

        public static com.nedap.archie.rm.generic.AuditDetails parseAuditDetails​(String content,
                                                                                 org.ehrbase.response.ehrscape.CompositionFormat format)
        Helper that parses the AuditDetails from the contribution input.
        Parameters:
        content - Plain string content
        format - Format of content
        Returns:
        AuditDetails object