Interface CompositionService

    • Method Detail

      • retrieveByTimestamp

        Optional<CompositionDto> retrieveByTimestamp​(UUID compositionId,
                                                     LocalDateTime timestamp)
        TODO: untested because not needed, yet Gets the composition that is closest in time before timestamp
        Parameters:
        compositionId - UUID (versioned_object_id) of composition
        timestamp - Given time
        Returns:
        Optional of CompositionDto closest in time before timestamp
      • serialize

        StructuredString serialize​(CompositionDto composition,
                                   CompositionFormat format)
        Public serializer entry point which will be called with composition dto fetched from database and the desired target serialized string format. Will parse the composition dto into target format either with a custom lambda expression for desired target format
        Parameters:
        composition - Composition dto from database
        format - Target format
        Returns:
        Structured string with string of data and content format
      • create

        UUID create​(UUID ehrId,
                    String content,
                    CompositionFormat format)
        Overloaded wrapper function to create composition with minimal set of input. TemplateID is read from composition content.
        Parameters:
        ehrId - - Target EHR
        content - - String representation of content
        format - - Format of data within the string representation
        Returns:
        - UUID of new created composition entry
        Throws:
        InternalServerException
      • create

        UUID create​(UUID ehrId,
                    String content,
                    CompositionFormat format,
                    String templateId,
                    UUID linkUid)
        Creates a deserialized representation of the composition data from source format and stores these data into the corresponding tables.
        Parameters:
        ehrId - - Target EHR
        content - - String representation of content
        format - - Format of data within the string representation
        templateId - - Template id for usage with Marand's composition converter
        linkUid - - UUID of link for compo_xref entry master
        Returns:
        - UUID of new created composition entry
        Throws:
        InternalServerException
      • create

        UUID create​(UUID ehrId,
                    com.nedap.archie.rm.composition.Composition composition,
                    UUID contributionId)
        Creates a composition which will be connected to the given existing contribution. Unlike with the general create() methods, where the contribution will be created ad hoc.
        Parameters:
        ehrId - Target EHR
        composition - Composition as RM object
        contributionId - ID of the contribution this composition is part of
        Returns:
        UUID of newly created composition
        Throws:
        InternalServerException - when creation failed
      • update

        String update​(UUID compositionId,
                      CompositionFormat format,
                      String content)
        Overloaded wrapper function to update composition with minimal set of input. TemplateID is read from composition content.
        Parameters:
        compositionId -
        format -
        content -
        Returns:
        Versioned id string of updated composition
        Throws:
        InternalServerException - when updating failed
        ObjectNotFoundException - when targeted composition couldn't be found
      • update

        String update​(UUID compositionId,
                      CompositionFormat format,
                      String content,
                      String templateId)
        Updates an existing composition entry with new data. Implicitly created new contribution ad-hoc.
        Parameters:
        compositionId - - Target composition UUID to update
        format - - Source format of content
        content - - String representation of payload data
        templateId - - Corresponding template id
        Returns:
        - Versioned id string of updated composition
        Throws:
        InternalServerException - when updating failed
        ObjectNotFoundException - when targeted composition couldn't be found
      • update

        String update​(UUID compositionId,
                      com.nedap.archie.rm.composition.Composition composition,
                      UUID contributionId)
        Updates a composition which will be connected to the given existing contribution. Unlike with the general update() methods, where the contribution will be created ad hoc.
        Parameters:
        compositionId - Target composition UUID to update
        composition - Composition as RM object
        contributionId - ID of the contribution this composition is part of
        Returns:
        Versioned id string of updated composition
        Throws:
        InternalServerException - when updating failed
        ObjectNotFoundException - when targeted composition couldn't be found
      • delete

        LocalDateTime delete​(UUID compositionId)
        Deletes a composition, i.e. creates a new version with deleted status. Return time of deletion.
        Parameters:
        compositionId - - Target composition UUID
        Returns:
        Time of deletion on database level
        Throws:
        ObjectNotFoundException - when targeted composition couldn't be found
        InternalServerException - when deletion failed
      • delete

        LocalDateTime delete​(UUID compositionId,
                             UUID contributionId)
        Deletes a composition which will be connected to the given existing contribution. Unlike with the general delete() methods, where the contribution will be created ad hoc.
        Parameters:
        compositionId - Target composition UUID
        contributionId - Custom contribution UUID
        Returns:
        Time of deletion, if successful
      • getLastVersionNumber

        Integer getLastVersionNumber​(UUID compositionId)
      • getUidFromInputComposition

        String getUidFromInputComposition​(String content,
                                          CompositionFormat format)
        Helper function to read UUID from given composition input in stated format.
        Parameters:
        content - Composition input
        format - Composition format
        Returns:
        The UUID or null when not available.
      • getVersionByTimestamp

        Integer getVersionByTimestamp​(UUID compositionId,
                                      LocalDateTime timestamp)
        Gets the version of a composition that is closest in time before timestamp
        Parameters:
        compositionId - UUID (versioned_object_id) of composition
        timestamp - Given time
        Returns:
        Version closest in time before given timestamp, or `null` in case of
      • exists

        boolean exists​(UUID versionedObjectId)
        Checks if given ID is a valid composition ID.
        Parameters:
        versionedObjectId - ID to check
        Returns:
        True if ID exists
        Throws:
        ObjectNotFoundException - if ID does not exist
      • isDeleted

        boolean isDeleted​(UUID versionedObjectId)
        Checks if given composition ID is ID of a logically deleted composition.
        Parameters:
        versionedObjectId - ID to check
        Returns:
        True if deleted, false if not