Package org.ehrbase.repository
Class EhrFolderRepository
java.lang.Object
org.ehrbase.repository.EhrFolderRepository
Handles DB-Access to
EhrFolder and EhrFolderHistory- Author:
- Stefan Spiska
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionEhrFolderRepository(org.jooq.DSLContext context, TenantService tenantService, ContributionRepository contributionRepository, ServerConfig serverConfig) -
Method Summary
Modifier and TypeMethodDescriptionvoidadminDelete(UUID ehrId, Integer ehrFoldersIdx) voidcommit(List<EhrFolderRecord> folderRecordList, UUID contributionId, UUID auditId) Create a new Folder in the DBorg.jooq.Field<?>[]convertToEhrFolderHistoryFields(org.jooq.Field<?>[] fields) Converts an array of JOOQFields to an array of JOOQFields of typeEHR_FOLDER_HISTORY, applying a givenFunctionto each field.voiddelete(UUID ehrId, UUID rootFolderId, int version, int ehrFoldersIdx, UUID contributionId, UUID auditId) Delete a Folder in the DBList<com.nedap.archie.rm.support.identification.ObjectVersionId>findForContribution(UUID ehrId, UUID contributionId) com.nedap.archie.rm.directory.Folderfrom(List<EhrFolderRecord> ehrFolderRecords) fromHistory(List<EhrFolderHistoryRecord> historyRecords) org.jooq.Result<EhrFolderHistoryRecord>getByTime(UUID ehrId, OffsetDateTime time) org.jooq.Result<EhrFolderHistoryRecord>getByVersion(UUID ehrId, int version) org.jooq.Result<EhrFolderRecord>getFolderHead(UUID ehrId, int ehrFoldersIdx) Get the all folders of the latest active (not deleted) Version from the DB for a given Ehr.getLatestHistoryRoot(UUID ehrid, int ehrFoldersIdx) Get the latest root folder from the History in the DB for a given Ehr.booleanhasDirectory(UUID ehrId) voidupdate(List<EhrFolderRecord> folderRecordList, UUID contributionId, UUID auditId) Update a Folder in the DB
-
Field Details
-
NOT_MATCH_LATEST_VERSION
- See Also:
-
-
Constructor Details
-
EhrFolderRepository
public EhrFolderRepository(org.jooq.DSLContext context, TenantService tenantService, ContributionRepository contributionRepository, ServerConfig serverConfig)
-
-
Method Details
-
commit
@Transactional public void commit(List<EhrFolderRecord> folderRecordList, @Nullable UUID contributionId, @Nullable UUID auditId) Create a new Folder in the DB- Parameters:
folderRecordList-contributionId- Ifnulldefault contribution will be createdContributionRepository.createDefault(UUID, ContributionDataType, ContributionChangeType)auditId- Ifnulldefault audit will be createdContributionRepository.createDefaultAudit(ContributionChangeType)
-
update
@Transactional public void update(List<EhrFolderRecord> folderRecordList, UUID contributionId, UUID auditId) Update a Folder in the DB- Parameters:
folderRecordList-contributionId- Ifnulldefault contribution will be createdContributionRepository.createDefault(UUID, ContributionDataType, ContributionChangeType)auditId- Ifnulldefault audit will be createdContributionRepository.createDefaultAudit(ContributionChangeType)
-
fromHistory
-
getFolderHead
Get the all folders of the latest active (not deleted) Version from the DB for a given Ehr.- Parameters:
ehrId-ehrFoldersIdx-- Returns:
-
getLatestHistoryRoot
Get the latest root folder from the History in the DB for a given Ehr.- Parameters:
ehrid-- Returns:
-
delete
@Transactional public void delete(UUID ehrId, UUID rootFolderId, int version, int ehrFoldersIdx, UUID contributionId, UUID auditId) Delete a Folder in the DB- Parameters:
ehrId-rootFolderId-version- Version to be deleted. Must match latest.ehrFoldersIdx-contributionId- Ifnulldefault contribution will be createdContributionRepository.createDefault(UUID, ContributionDataType, ContributionChangeType)auditId- Ifnulldefault audit will be createdContributionRepository.createDefaultAudit(ContributionChangeType)
-
getByVersion
-
convertToEhrFolderHistoryFields
public org.jooq.Field<?>[] convertToEhrFolderHistoryFields(org.jooq.Field<?>[] fields) Converts an array of JOOQFields to an array of JOOQFields of typeEHR_FOLDER_HISTORY, applying a givenFunctionto each field.- Parameters:
fields- the array of JOOQFields to be converted- Returns:
- an array of JOOQ
Fields of typeEHR_FOLDER_HISTORY
-
getByTime
-
from
-
hasDirectory
-
toRecord
-
adminDelete
-
findForContribution
-