Package org.ehrbase.service
Class KnowledgeCacheService
- java.lang.Object
-
- org.ehrbase.service.KnowledgeCacheService
-
- All Implemented Interfaces:
I_KnowledgeCache,IntrospectService
@Service @Transactional 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
-
-
Field Summary
Fields Modifier and Type Field Description static StringELEMENT-
Fields inherited from interface org.ehrbase.ehr.knowledge.I_KnowledgeCache
TEMPLATE_ID
-
-
Constructor Summary
Constructors Constructor Description KnowledgeCacheService(TemplateStorage templateStorage, org.springframework.cache.CacheManager cacheManager, CacheOptions cacheOptions)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringaddOperationalTemplate(InputStream inputStream)Adds operational template to system and also in current cache.StringaddOperationalTemplate(org.openehr.schemas.v1.OPERATIONALTEMPLATE template)StringaddOperationalTemplateIntern(org.openehr.schemas.v1.OPERATIONALTEMPLATE template, boolean overwrite)StringadminUpdateOperationalTemplate(InputStream content)intdeleteAllOperationalTemplates()booleandeleteOperationalTemplate(org.openehr.schemas.v1.OPERATIONALTEMPLATE template)Deletes a given operational template physically from cache and from template storage and from cache.Set<String>getAllTemplateIds()ItemInfogetInfo(String templateId, String aql)I_KnowledgeCachegetKnowledge()org.ehrbase.webtemplate.model.WebTemplategetQueryOptMetaData(String templateId)org.ehrbase.webtemplate.model.WebTemplategetQueryOptMetaData(UUID uuid)voidinitializeCaches()List<TemplateMetaData>listAllOperationalTemplates()List<String>multiValued(String templateId)JsonPathQueryResultresolveForTemplate(String templateId, Collection<org.ehrbase.webtemplate.parser.NodeId> nodeIds)Optional<org.openehr.schemas.v1.OPERATIONALTEMPLATE>retrieveOperationalTemplate(String key)retrieve an operational template document instanceOptional<org.openehr.schemas.v1.OPERATIONALTEMPLATE>retrieveOperationalTemplate(UUID uuid)retrieve a cached operational template document instance using its unique Id
-
-
-
Field Detail
-
ELEMENT
public static final String ELEMENT
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
KnowledgeCacheService
public KnowledgeCacheService(TemplateStorage templateStorage, org.springframework.cache.CacheManager cacheManager, CacheOptions cacheOptions)
-
-
Method Detail
-
initializeCaches
public void initializeCaches()
-
getAllTemplateIds
public Set<String> getAllTemplateIds()
- Specified by:
getAllTemplateIdsin interfaceI_KnowledgeCache
-
addOperationalTemplate
public String addOperationalTemplate(InputStream inputStream)
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)
- Specified by:
addOperationalTemplatein interfaceI_KnowledgeCache
-
addOperationalTemplateIntern
public String addOperationalTemplateIntern(org.openehr.schemas.v1.OPERATIONALTEMPLATE template, boolean overwrite)
-
adminUpdateOperationalTemplate
public String adminUpdateOperationalTemplate(InputStream content)
-
listAllOperationalTemplates
public List<TemplateMetaData> listAllOperationalTemplates()
- Specified by:
listAllOperationalTemplatesin interfaceI_KnowledgeCache
-
retrieveOperationalTemplate
public Optional<org.openehr.schemas.v1.OPERATIONALTEMPLATE> retrieveOperationalTemplate(String key)
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
public Optional<org.openehr.schemas.v1.OPERATIONALTEMPLATE> retrieveOperationalTemplate(UUID uuid)
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
public org.ehrbase.webtemplate.model.WebTemplate getQueryOptMetaData(UUID uuid)
- Specified by:
getQueryOptMetaDatain interfaceIntrospectService
-
getQueryOptMetaData
public org.ehrbase.webtemplate.model.WebTemplate getQueryOptMetaData(String templateId)
- 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
public ItemInfo getInfo(String templateId, String aql)
- Specified by:
getInfoin interfaceIntrospectService
-
multiValued
public List<String> multiValued(String templateId)
- Specified by:
multiValuedin interfaceIntrospectService
-
getKnowledge
public I_KnowledgeCache getKnowledge()
- Specified by:
getKnowledgein interfaceIntrospectService
-
-