Class EhrAccess

    • Method Detail

      • retrieveInstanceBySubject

        public static UUID retrieveInstanceBySubject​(I_DomainAccess domainAccess,
                                                     UUID subjectUuid)
        Description copied from interface: I_EhrAccess
        // TODO: keep! likely to be used by EHR controller retrieve an Ehr for a subject UUID
        a subject identification consists of the issuer identification (ex. NHS) and an identification code
        Parameters:
        domainAccess - SQL access
        subjectUuid - the subject uuid
        Returns:
        UUID of corresponding Ehr or null
        Throws:
        IllegalArgumentException - if retrieving failed for given input
      • retrieveInstanceBySubject

        public static UUID retrieveInstanceBySubject​(I_DomainAccess domainAccess,
                                                     String subjectId,
                                                     String issuerSpace)
        Description copied from interface: I_EhrAccess
        // TODO: keep! likely to be used by EHR controller retrieve an Ehr for a subject identification with an identifier
        a subject identification consists of the issuer identification (ex. NHS) and an identification code
        Parameters:
        domainAccess - SQL access
        subjectId - the subject code or number
        issuerSpace - the issuer identifier
        Returns:
        UUID of corresponding Ehr or null
        Throws:
        IllegalArgumentException - if retrieving failed for given input
      • retrieveInstanceBySubjectExternalRef

        public static UUID retrieveInstanceBySubjectExternalRef​(I_DomainAccess domainAccess,
                                                                String subjectId,
                                                                String issuerSpace)
        Description copied from interface: I_EhrAccess
        // TODO: keep! likely to be used by EHR controller retrieve an Ehr for a subject identification by external reference
        a subject identification consists of the issuer identification (ex. NHS) and an identification code
        Parameters:
        domainAccess - SQL access
        subjectId - the subject code or number
        issuerSpace - the namespace
        Returns:
        UUID of corresponding Ehr or null
        Throws:
        IllegalArgumentException - if retrieving failed for given input
      • retrieveInstance

        public static I_EhrAccess retrieveInstance​(I_DomainAccess domainAccess,
                                                   UUID ehrId)
        Description copied from interface: I_EhrAccess
        Retrieve the Ehr entry from its ID (incl latest STATUS).
        Parameters:
        domainAccess - SQL access
        ehrId - the Ehr UUID
        Returns:
        UUID of corresponding Ehr or null
        Throws:
        IllegalArgumentException - when either no EHR for ID, or problem with data structure of EHR, or DB inconsistency
      • fetchSubjectIdentifiers

        public static Map<String,​Object> fetchSubjectIdentifiers​(I_DomainAccess domainAccess,
                                                                       UUID ehrId)
        Description copied from interface: I_EhrAccess
        retrieve the list of identifiers for a subject owning an Ehr
        the identifiers are formatted as: "CODE:ISSUER"
        Parameters:
        domainAccess - SQL access
        ehrId - the Ehr Id to search the subject from
        Returns:
        a list of identifiers
        Throws:
        IllegalArgumentException - when no EHR found for ID
      • getCompositionList

        public static Map<String,​Map<String,​String>> getCompositionList​(I_DomainAccess domainAccess,
                                                                                    UUID ehrId)
        FIXME: check this method. appears to be needed later on. problematic: it actually gets a list of entries, not compositions. why only with three attributes? what about the unique key problem below?
        Returns:
        Throws:
        IllegalArgumentException - when no EHR found for ID
      • removeDirectory

        public static boolean removeDirectory​(I_DomainAccess domainAccess,
                                              UUID ehrId)
        Removes the directory row value by setting it to 'NULL'. Usually his will be used after the deletion of a directories root folder.
        Parameters:
        domainAccess - - Database access
        ehrId - - Target EHR id
        Returns:
        Setting NULL value succeeded
      • setAccess

        public void setAccess​(UUID access)
        Description copied from interface: I_EhrAccess
        set access id
        Specified by:
        setAccess in interface I_EhrAccess
        Parameters:
        access - UUID
      • setDirectory

        public void setDirectory​(UUID directory)
        Description copied from interface: I_EhrAccess
        set directory id
        Specified by:
        setDirectory in interface I_EhrAccess
        Parameters:
        directory - UUID
      • setSystem

        public void setSystem​(UUID system)
        Description copied from interface: I_EhrAccess
        set system Id
        Specified by:
        setSystem in interface I_EhrAccess
        Parameters:
        system - UUID
      • setName

        public void setName​(com.nedap.archie.rm.datavalues.DvText name)
        Specified by:
        setName in interface I_EhrAccess
      • setName

        public void setName​(com.nedap.archie.rm.datavalues.DvCodedText name)
        Specified by:
        setName in interface I_EhrAccess
      • commit

        @Deprecated
        public UUID commit()
        Deprecated.
        Description copied from interface: I_SimpleCRUD
        storeComposition a new entry in the DB, using a default transaction time
        only implemented with "root" tables: ehr, contribution and composition!
        Specified by:
        commit in interface I_SimpleCRUD
        Returns:
        the UUID of the newly created record
        Throws:
        InternalServerException - because inherited interface function isn't implemented in this class
      • update

        public Boolean update​(Timestamp transactionTime)
        updateComposition the current entry
        depending on the implementation, records are updated only if one or more field(s) have been changed
        Specified by:
        update in interface I_SimpleCRUD
        Returns:
        Throws:
        InvalidApiParameterException - when marshalling of EHR_STATUS / OTHER_DETAILS failed
      • update

        public Boolean update​(Timestamp transactionTime,
                              boolean force)
        updateComposition the current entry even if the record is not modified
        intended to be used with temporal tables to ensure that a set of interdependent tables are updated in sync. This approach is used to simplify versions retrieval.
        Specified by:
        update in interface I_SimpleCRUD
        Returns:
        Throws:
        InvalidApiParameterException - when marshalling of EHR_STATUS / OTHER_DETAILS failed
      • update

        @Deprecated
        public Boolean update()
        Deprecated.
        Description copied from interface: I_SimpleCRUD
        updateComposition the current entry using time now as the system transaction time
        only implemented at root level object (contribution, composition, ehr). depending on the implementation, records are updated only if one or more field(s) have been changed
        Specified by:
        update in interface I_SimpleCRUD
        Returns:
        Throws:
        InternalServerException - because inherited interface function isn't implemented in this class
      • update

        @Deprecated
        public Boolean update​(Boolean force)
        Deprecated.
        Description copied from interface: I_SimpleCRUD
        updateComposition the current entry using time now as the system transaction time
        only implemented at root level object (contribution, composition, ehr). depending on the implementation, records are updated only if one or more field(s) have been changed
        Specified by:
        update in interface I_SimpleCRUD
        Returns:
        Throws:
        InternalServerException - because inherited interface function isn't implemented in this class
      • update

        public Boolean update​(UUID committerId,
                              UUID systemId,
                              UUID contributionId,
                              ContributionDef.ContributionState state,
                              I_ConceptAccess.ContributionChangeType contributionChangeType,
                              String description)
        Description copied from interface: I_EhrAccess
        Updates the whole EHR access in the DB, e.g. to update the status. Embeds contribution and audit handling.
        Specified by:
        update in interface I_EhrAccess
        Parameters:
        committerId - ID of committer
        systemId - ID of committing system
        contributionId - Optional custom contribution ID, can be null
        state - State of contribution
        contributionChangeType - Change type of contribution
        description - Description field
        Returns:
        True for success
      • delete

        @Deprecated
        public Integer delete()
        Deprecated.
        Description copied from interface: I_SimpleCRUD
        delete the Versioned Object associated with the instance implementing this Data Access Interface. Relies on ON DELETE CASCADE
        Specified by:
        delete in interface I_SimpleCRUD
        Returns:
        Throws:
        InternalServerException - because inherited interface function isn't implemented in this class
      • reload

        public UUID reload()
        Description copied from interface: I_EhrAccess
        TODO: doc or is this one really not needed anymore? delete if so.
        Specified by:
        reload in interface I_EhrAccess
        Returns:
        Throws:
        IllegalArgumentException - when instance's EHR ID can't be matched to existing one
      • isNew

        public boolean isNew()
        Description copied from interface: I_EhrAccess
        check if Ehr is newly created (uncommitted)
        Specified by:
        isNew in interface I_EhrAccess
        Returns:
        true if new, false otherwise
      • setOtherDetails

        public void setOtherDetails​(com.nedap.archie.rm.datastructures.ItemStructure otherDetails,
                                    String templateId)
        Specified by:
        setOtherDetails in interface I_EhrAccess
      • getOtherDetails

        public com.nedap.archie.rm.datastructures.ItemStructure getOtherDetails()
        Specified by:
        getOtherDetails in interface I_EhrAccess
      • setStatus

        public void setStatus​(com.nedap.archie.rm.ehr.EhrStatus status)
        Specified by:
        setStatus in interface I_EhrAccess
      • getStatus

        public com.nedap.archie.rm.ehr.EhrStatus getStatus()
        Description copied from interface: I_EhrAccess
        Gets latest EHR_STATUS, which is attached to this EHR instance after retrieving it.
        Specified by:
        getStatus in interface I_EhrAccess
        Returns:
        Latest EHR_STATUS
      • hasEhr

        public static boolean hasEhr​(I_DomainAccess domainAccess,
                                     UUID ehrId)
        Description copied from interface: I_EhrAccess
        Check for existence of given ID as EHR.
        Parameters:
        domainAccess - Context
        ehrId - EHR ID to check
        Returns:
        true or false
      • isModifiable

        public static boolean isModifiable​(I_DomainAccess domainAccess,
                                           UUID ehrId)
        Description copied from interface: I_EhrAccess
        Check if the EHR identified by the given ID is marked as modifiable. Use this method if you do not need a full I_EhrAccess instance.
        Parameters:
        domainAccess - Context
        ehrId - EHR ID to check
        Returns:
        true if EHR.ehr_status.isModifiable, false otherwise (missing EHR will also return false)