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
        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
      • 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
      • 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,
                              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
        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
      • getLastVersionNumberOfStatus

        public Integer getLastVersionNumberOfStatus​(I_DomainAccess domainAccess,
                                                    UUID ehrStatusId)
        Description copied from interface: I_EhrAccess
        Get latest version number of EHR_STATUS by versioned object UID.
        Specified by:
        getLastVersionNumberOfStatus in interface I_EhrAccess
        Parameters:
        domainAccess - access
        ehrStatusId - versioned object UID
        Returns:
        version number
      • getEhrStatusVersionFromTimeStamp

        public int getEhrStatusVersionFromTimeStamp​(Timestamp time)
        Description copied from interface: I_EhrAccess
        Get a specific version number of the associated EHR_STATUS of this EhrAccess by timestamp. General idea behind the algorithm: 'what version was the top version at moment T?'
        Specified by:
        getEhrStatusVersionFromTimeStamp in interface I_EhrAccess
        Parameters:
        time - Timestamp
        Returns:
        version number
      • getNumberOfEhrStatusVersions

        public Integer getNumberOfEhrStatusVersions()
        Description copied from interface: I_EhrAccess
        Get number of available versions of EhrStatus' linked to this EhrAccess instance.
        Specified by:
        getNumberOfEhrStatusVersions in interface I_EhrAccess
        Returns:
        Number of versions