Package org.ehrbase.service
Class TemplateDBStorageService
- java.lang.Object
-
- org.ehrbase.service.TemplateDBStorageService
-
- All Implemented Interfaces:
TemplateStorage
@Service @Transactional public class TemplateDBStorageService extends Object implements TemplateStorage
-
-
Constructor Summary
Constructors Constructor Description TemplateDBStorageService(org.jooq.DSLContext context, ServerConfig serverConfig)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intadminDeleteAllTemplates(List<TemplateMetaData> templateMetaDataList)Removes all templates from template storage and returns the number of deleted entries.StringadminUpdateTemplate(org.openehr.schemas.v1.OPERATIONALTEMPLATE template)Replaces the content of an existing template with the same id as in the provided template with the new content from provided one.booleandeleteTemplate(String templateId)Deletes an operational template from template storage.Set<String>findAllTemplateIds()Find all templates ids in the store;protected I_DomainAccessgetDataAccess()List<TemplateMetaData>listAllOperationalTemplates()List all Templates in the store;Optional<org.openehr.schemas.v1.OPERATIONALTEMPLATE>readOperationaltemplate(String templateId)Find and return a saved Template by templateIdvoidstoreTemplate(org.openehr.schemas.v1.OPERATIONALTEMPLATE template)Save a template in the store
-
-
-
Constructor Detail
-
TemplateDBStorageService
public TemplateDBStorageService(org.jooq.DSLContext context, ServerConfig serverConfig)
-
-
Method Detail
-
listAllOperationalTemplates
public List<TemplateMetaData> listAllOperationalTemplates()
Description copied from interface:TemplateStorageList all Templates in the store;- Specified by:
listAllOperationalTemplatesin interfaceTemplateStorage- Returns:
-
findAllTemplateIds
public Set<String> findAllTemplateIds()
Description copied from interface:TemplateStorageFind all templates ids in the store;- Specified by:
findAllTemplateIdsin interfaceTemplateStorage- Returns:
- the list of template ids
-
storeTemplate
public void storeTemplate(org.openehr.schemas.v1.OPERATIONALTEMPLATE template)
Description copied from interface:TemplateStorageSave a template in the store- Specified by:
storeTemplatein interfaceTemplateStorage
-
readOperationaltemplate
public Optional<org.openehr.schemas.v1.OPERATIONALTEMPLATE> readOperationaltemplate(String templateId)
Description copied from interface:TemplateStorageFind and return a saved Template by templateId- Specified by:
readOperationaltemplatein interfaceTemplateStorage- Returns:
- the template @see
OPERATIONALTEMPLATEorOptional.empty()if not found.
-
adminUpdateTemplate
public String adminUpdateTemplate(org.openehr.schemas.v1.OPERATIONALTEMPLATE template)
Replaces the content of an existing template with the same id as in the provided template with the new content from provided one. Check that the old template is no longer referenced to avoid data inconsistencies- Specified by:
adminUpdateTemplatein interfaceTemplateStorage- Parameters:
template- - Template with new data and id of target to be replaced- Returns:
- - XML content of the updated template
-
deleteTemplate
public boolean deleteTemplate(String templateId)
Deletes an operational template from template storage. The template will be removed physically so ensure that there are no compositions referencing the template.- Specified by:
deleteTemplatein interfaceTemplateStorage- Parameters:
templateId- - Template id to delete from storage, e.g. "IDCR Allergies List.v0"- Returns:
- - Deletion was successful or not
-
adminDeleteAllTemplates
public int adminDeleteAllTemplates(List<TemplateMetaData> templateMetaDataList)
Removes all templates from template storage and returns the number of deleted entries.- Specified by:
adminDeleteAllTemplatesin interfaceTemplateStorage- Returns:
- - Count of deleted templates
-
getDataAccess
protected I_DomainAccess getDataAccess()
-
-