Class FolderAccess

    • Method Detail

      • update

        public Boolean update​(Timestamp transactionTime,
                              boolean force)
        Description copied from interface: I_SimpleCRUD
        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:
      • update

        public Boolean update()
        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:
      • update

        public Boolean update​(Boolean force)
        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:
      • delete

        public Integer delete()
        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:
      • commit

        public UUID commit()
        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
      • commit

        public UUID commit​(Timestamp transactionTime)
        Description copied from interface: I_SimpleCRUD
        storeComposition a new entry in the DB
        Specified by:
        commit in interface I_SimpleCRUD
        Returns:
        the UUID of the newly created record
      • commit

        public UUID commit​(Timestamp transactionTime,
                           UUID contributionId)
        Additional commit method to store a new entry of folder to the database and get all of inserted sub folders connected by one contribution which has been created before.
        Specified by:
        commit in interface I_FolderAccess
        Parameters:
        transactionTime - - Timestamp which will be applied to all folder sys_transaction values
        contributionId - - ID of contribution for CREATE applied to all folders that will be created
        Returns:
        UUID of the new created root folder
      • retrieveInstanceForExistingFolder

        public static I_FolderAccess retrieveInstanceForExistingFolder​(I_DomainAccess domainAccess,
                                                                       UUID folderId)
        Retrieve instance of I_FolderAccess with the information needed retrieve the folder and its sub-folders.
        Parameters:
        domainAccess - providing the information about the DB connection.
        folderId - UUID of the Folder to be fetched from the DB.
        Returns:
        the I_FolderAccess that provides DB access to the Folder that corresponds to the provided folderId param.
        Throws:
        Exception
      • getNewFolderAccessInstance

        public static I_FolderAccess getNewFolderAccessInstance​(I_DomainAccess domainAccess,
                                                                com.nedap.archie.rm.directory.Folder folder,
                                                                org.joda.time.DateTime dateTime,
                                                                UUID ehrId)
        Builds the I_FolderAccess for persisting the Folder provided as param.
        Parameters:
        domainAccess - providing the information about the DB connection.
        folder - to define the I_FolderAccess that allows its DB access.
        dateTime - that will be set as transaction date when the Folder is persisted
        ehrId - of the Ehr that references the Folder provided as param.
        Returns:
        I_FolderAccess with the information to persist the provided Folder
      • buildPlainFolderAccess

        public static I_FolderAccess buildPlainFolderAccess​(I_DomainAccess domainAccess,
                                                            com.nedap.archie.rm.directory.Folder folder,
                                                            org.joda.time.DateTime dateTime,
                                                            UUID ehrId,
                                                            I_ContributionAccess contributionAccess)
        Builds the FolderAccess with the collection of subfolders empty.
        Parameters:
        domainAccess - providing the information about the DB connection.
        folder - to define a corresponding I_FolderAccess for allowing its persistence.
        dateTime - that will be set as transaction date when the Folder is persisted
        ehrId - of the Ehr that references this Folder
        Returns:
        I_FolderAccess with the information to persist the provided Folder
      • buildNewFolderAccessHierarchy

        public static I_FolderAccess buildNewFolderAccessHierarchy​(I_DomainAccess domainAccess,
                                                                   com.nedap.archie.rm.directory.Folder folder,
                                                                   org.joda.time.DateTime timeStamp,
                                                                   UUID ehrId,
                                                                   I_ContributionAccess contributionAccess)
        Builds a folderAccess hierarchy recursively by iterating over all sub folders of given folder instance. This works for all folders, i.e. from root for an insert as well for a sub folder hierarchy for update.
        Parameters:
        domainAccess - - DB connection context
        folder - - Folder to create access for
        timeStamp - - Current time for transaction audit
        ehrId - - Corresponding EHR
        contributionAccess - - Contribution instance for creation of all folders
        Returns:
        FolderAccess instance for folder
      • getLastVersionNumber

        public static Integer getLastVersionNumber​(I_DomainAccess domainAccess,
                                                   UUID folderId)
        Returns the last version number of a given folder by counting all previous versions of a given folder id. If there are no previous versions in the history table the version number will be 1. Otherwise the current version equals the count of entries in the folder history table plus 1.
        Parameters:
        domainAccess - - Database connection access context
        folderId - - UUID of the folder to check for the last version
        Returns:
        Latest version number for the folder
      • hasPreviousVersion

        public static boolean hasPreviousVersion​(I_DomainAccess domainAccess,
                                                 UUID folderId)
        Checks if there are existing entries for given folder uuid at the folder history table. If there are entries existing, the folder has been modified during previous actions and there are older versions existing.
        Parameters:
        domainAccess - - Database connection access context
        folderId - - UUID of folder to check
        Returns:
        Folder has previous versions or not
      • getEhrId

        public UUID getEhrId()
        Getters and Setters for the FolderRecord to store
      • setEhrId

        public void setEhrId​(UUID ehrId)
      • setContributionAccess

        public void setContributionAccess​(I_ContributionAccess contributionAccess)
      • setDetails

        public void setDetails​(com.nedap.archie.rm.datastructures.ItemStructure details)
        Description copied from interface: I_FolderAccess
        Set the details stored as a part of the given Folder
        Specified by:
        setDetails in interface I_FolderAccess
      • getDetails

        public com.nedap.archie.rm.datastructures.ItemStructure getDetails()
        Description copied from interface: I_FolderAccess
        Get the details stored as a part of the given Folder
        Specified by:
        getDetails in interface I_FolderAccess
        Returns:
        details of the Folder that corresponds to this I_FolderAccess
      • getItems

        public List<com.nedap.archie.rm.support.identification.ObjectRef> getItems()
        Description copied from interface: I_FolderAccess
        Get the items references stored as a part of the given Folder
        Specified by:
        getItems in interface I_FolderAccess
        Returns:
        items of the Folder that corresponds to this I_FolderAccess
      • getFolderDetails

        public com.nedap.archie.rm.datastructures.ItemStructure getFolderDetails()
        Specified by:
        getFolderDetails in interface I_FolderAccess
      • setFolderDetails

        public void setFolderDetails​(com.nedap.archie.rm.datastructures.ItemStructure folderDetails)
        Specified by:
        setFolderDetails in interface I_FolderAccess