Package org.ehrbase.service
Class KnowledgeCacheService
java.lang.Object
org.ehrbase.service.KnowledgeCacheService
- All Implemented Interfaces:
I_KnowledgeCache,IntrospectService
@Service
public class KnowledgeCacheService
extends Object
implements I_KnowledgeCache, IntrospectService
Look up and caching for archetypes, openEHR showTemplates and Operational Templates. Search in
path defined as
- 1. System environment ETHERCIS_ARCHETYPE_DIR, ETHERCIS_TEMPLATE_DIR, ETHERCIS_OPT_DIR
- 2. Application path %USER_HOME%/.ethercis/archetype, %USER_HOME%/.ethercis/template, %USER_HOME%/.ethercis/opt
- 3. User can also include a source directory by invoking addXYZPath method
The resources extensions are defined by the following default:
- ADL: archetype
- OET: openehr template
- OPT: operational template
- Author:
- C. Chevalley
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.ehrbase.ehr.knowledge.I_KnowledgeCache
I_KnowledgeCache.ConceptValue, I_KnowledgeCache.LanguageValue, I_KnowledgeCache.TerritoryValue -
Field Summary
FieldsFields inherited from interface org.ehrbase.ehr.knowledge.I_KnowledgeCache
TEMPLATE_ID -
Constructor Summary
ConstructorsConstructorDescriptionKnowledgeCacheService(TemplateStorage templateStorage, org.springframework.cache.CacheManager cacheManager, CacheOptions cacheOptions, TenantService tenantService) -
Method Summary
Modifier and TypeMethodDescriptionaddOperationalTemplate(InputStream inputStream, String tenantIdentifier) Adds operational template to system and also in current cache.addOperationalTemplate(org.openehr.schemas.v1.OPERATIONALTEMPLATE template, String tenantIdentifier) addOperationalTemplateIntern(org.openehr.schemas.v1.OPERATIONALTEMPLATE template, boolean overwrite, String tenantIdentifier) intbooleandeleteOperationalTemplate(org.openehr.schemas.v1.OPERATIONALTEMPLATE template) Deletes a given operational template physically from cache and from template storage and from cache.getConceptByConceptId(int conceptId, String language, BiFunction<Integer, String, I_KnowledgeCache.ConceptValue> provider) getConceptByDescription(String description, String language, BiFunction<String, String, I_KnowledgeCache.ConceptValue> provider) getConceptById(UUID id, Function<UUID, I_KnowledgeCache.ConceptValue> provider) getLanguageByCode(String languageCode, Function<String, I_KnowledgeCache.LanguageValue> provider) org.ehrbase.webtemplate.model.WebTemplategetQueryOptMetaData(String templateId) org.ehrbase.webtemplate.model.WebTemplategetQueryOptMetaData(UUID uuid) getTerritoryCodeByTwoLetterCode(String territoryAsString, Function<String, I_KnowledgeCache.TerritoryValue> provider) multiValued(String templateId) resolveForTemplate(String templateId, Collection<org.ehrbase.webtemplate.parser.NodeId> nodeIds) Optional<org.openehr.schemas.v1.OPERATIONALTEMPLATE>retrieve an operational template document instanceOptional<org.openehr.schemas.v1.OPERATIONALTEMPLATE>retrieve a cached operational template document instance using its unique Id
-
Field Details
-
ELEMENT
- See Also:
-
-
Constructor Details
-
KnowledgeCacheService
public KnowledgeCacheService(TemplateStorage templateStorage, org.springframework.cache.CacheManager cacheManager, CacheOptions cacheOptions, TenantService tenantService) throws InterruptedException - Throws:
InterruptedException
-
-
Method Details
-
getAllTemplateIds
- Specified by:
getAllTemplateIdsin interfaceI_KnowledgeCache
-
addOperationalTemplate
Description copied from interface:I_KnowledgeCacheAdds operational template to system and also in current cache.- Specified by:
addOperationalTemplatein interfaceI_KnowledgeCache- Parameters:
inputStream- operational template input- Returns:
- resulting template ID, when successful
-
addOperationalTemplate
public String addOperationalTemplate(org.openehr.schemas.v1.OPERATIONALTEMPLATE template, String tenantIdentifier) - Specified by:
addOperationalTemplatein interfaceI_KnowledgeCache
-
addOperationalTemplateIntern
-
adminUpdateOperationalTemplate
-
listAllOperationalTemplates
- Specified by:
listAllOperationalTemplatesin interfaceI_KnowledgeCache
-
retrieveOperationalTemplate
Description copied from interface:I_KnowledgeCacheretrieve an operational template document instance- Specified by:
retrieveOperationalTemplatein interfaceI_KnowledgeCache- Parameters:
key- the name of the operational template- Returns:
- an OPERATIONALTEMPLATE document instance or null
- See Also:
-
OPERATIONALTEMPLATE
-
retrieveOperationalTemplate
Description copied from interface:I_KnowledgeCacheretrieve a cached operational template document instance using its unique Id- Specified by:
retrieveOperationalTemplatein interfaceI_KnowledgeCache- Parameters:
uuid- the name of the operational template- Returns:
- an OPERATIONALTEMPLATE document instance or null
- See Also:
-
OPERATIONALTEMPLATE
-
deleteOperationalTemplate
public boolean deleteOperationalTemplate(org.openehr.schemas.v1.OPERATIONALTEMPLATE template) Deletes a given operational template physically from cache and from template storage and from cache. Should only be executed if the template is no longer referenced by any Composition. Make sure you check for references before deleting a template otherwise this causes inconsistencies and no longer deliverable Composition entries.- Specified by:
deleteOperationalTemplatein interfaceI_KnowledgeCache- Parameters:
template- - The template instance to delete- Returns:
- - Template has been deleted
-
getQueryOptMetaData
- Specified by:
getQueryOptMetaDatain interfaceIntrospectService
-
getQueryOptMetaData
- Specified by:
getQueryOptMetaDatain interfaceIntrospectService
-
deleteAllOperationalTemplates
public int deleteAllOperationalTemplates() -
resolveForTemplate
public JsonPathQueryResult resolveForTemplate(String templateId, Collection<org.ehrbase.webtemplate.parser.NodeId> nodeIds) - Specified by:
resolveForTemplatein interfaceI_KnowledgeCache
-
getInfo
- Specified by:
getInfoin interfaceIntrospectService
-
multiValued
- Specified by:
multiValuedin interfaceIntrospectService
-
getKnowledge
- Specified by:
getKnowledgein interfaceIntrospectService
-
getConceptByConceptId
public I_KnowledgeCache.ConceptValue getConceptByConceptId(int conceptId, String language, BiFunction<Integer, String, I_KnowledgeCache.ConceptValue> provider) - Specified by:
getConceptByConceptIdin interfaceI_KnowledgeCache
-
getConceptById
public I_KnowledgeCache.ConceptValue getConceptById(UUID id, Function<UUID, I_KnowledgeCache.ConceptValue> provider) - Specified by:
getConceptByIdin interfaceI_KnowledgeCache
-
getConceptByDescription
public I_KnowledgeCache.ConceptValue getConceptByDescription(String description, String language, BiFunction<String, String, I_KnowledgeCache.ConceptValue> provider) - Specified by:
getConceptByDescriptionin interfaceI_KnowledgeCache
-
getTerritoryCodeByTwoLetterCode
public I_KnowledgeCache.TerritoryValue getTerritoryCodeByTwoLetterCode(String territoryAsString, Function<String, I_KnowledgeCache.TerritoryValue> provider) - Specified by:
getTerritoryCodeByTwoLetterCodein interfaceI_KnowledgeCache
-
getLanguageByCode
public I_KnowledgeCache.LanguageValue getLanguageByCode(String languageCode, Function<String, I_KnowledgeCache.LanguageValue> provider) - Specified by:
getLanguageByCodein interfaceI_KnowledgeCache
-