Interface ContributionService

  • All Superinterfaces:
    BaseService

    public interface ContributionService
    extends BaseService
    Interface for contribution service roughly based on openEHR SM "I_EHR_CONTRIBUTION Interface", see: https://specifications.openehr.org/releases/SM/latest/openehr_platform.html#_i_ehr_contribution_interface
    • Method Detail

      • hasContribution

        boolean hasContribution​(UUID ehrId,
                                UUID contributionId)
        Check if given contribution exists and is part of given EHR.
        Parameters:
        ehrId - ID of EHR
        contributionId - ID of contribution
        Returns:
        True if exists and part of EHR, false if not
      • getContribution

        Optional<org.ehrbase.response.ehrscape.ContributionDto> getContribution​(UUID ehrId,
                                                                                UUID contributionId)
        Return the Contribution with given id in given EHR.
        Parameters:
        ehrId - ID of EHR
        contributionId - ID of contribution
        Returns:
        Optional containing a ContributionDto if successful, empty if not
      • commitContribution

        UUID commitContribution​(UUID ehrId,
                                String content,
                                org.ehrbase.response.ehrscape.CompositionFormat format)
        Commit a CONTRIBUTION containing any number of serialized VERSION objects.
        Parameters:
        ehrId - ID of EHR
        content - serialized content, containing version objects and audit object in given format
        format - format of serialized versions
        Returns:
        ID of successfully committed contribution
        Throws:
        IllegalArgumentException - when input can't be processed
        InternalServerException - when DB is inconsistent
      • adminDelete

        void adminDelete​(UUID contributionId)
        Admin method to delete a Contribution from the DB. See EHRbase Admin API specification for details.
        Parameters:
        contributionId - Contribution to delete
      • getListOfTemplates

        Set<String> getListOfTemplates​(String contribution,
                                       org.ehrbase.response.ehrscape.CompositionFormat format)
        Extracts set of used templates in payload's compositions.
        Parameters:
        contribution - Contribution request content
        format - Format of that content
        Returns:
        Set of templates used by compositions