Class 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
    • Constructor Detail

      • KnowledgeCacheService

        public KnowledgeCacheService​(TemplateStorage templateStorage,
                                     org.springframework.cache.CacheManager cacheManager,
                                     CacheOptions cacheOptions)
    • Method Detail

      • initializeCaches

        public void initializeCaches()
      • addOperationalTemplate

        public String addOperationalTemplate​(byte[] content)
        Description copied from interface: I_KnowledgeCache
        Adds operational template to system and also in current cache.
        Specified by:
        addOperationalTemplate in interface I_KnowledgeCache
        Parameters:
        content - operational template input
        Returns:
        resulting template ID, when successful
      • addOperationalTemplateIntern

        public String addOperationalTemplateIntern​(byte[] content,
                                                   boolean overwrite)
      • adminUpdateOperationalTemplate

        public String adminUpdateOperationalTemplate​(byte[] content)
      • retrieveOperationalTemplate

        public Optional<org.openehr.schemas.v1.OPERATIONALTEMPLATE> retrieveOperationalTemplate​(String key)
        Description copied from interface: I_KnowledgeCache
        retrieve an operational template document instance
        Specified by:
        retrieveOperationalTemplate in interface I_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_KnowledgeCache
        retrieve a cached operational template document instance using its unique Id
        Specified by:
        retrieveOperationalTemplate in interface I_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:
        deleteOperationalTemplate in interface I_KnowledgeCache
        Parameters:
        template - - The template instance to delete
        Returns:
        - Template has been deleted
      • deleteAllOperationalTemplates

        public int deleteAllOperationalTemplates()