Search in sources :

Example 1 with ApplyTemplateMethod

use of org.alfresco.repo.virtual.template.ApplyTemplateMethod in project alfresco-repository by Alfresco.

the class VirtualStoreImpl method resolveVirtualFolderDefinition.

public VirtualFolderDefinition resolveVirtualFolderDefinition(final Reference reference) throws VirtualizationException {
    ServiceRegistry serviceRegistry = ((AlfrescoEnviroment) environment).getServiceRegistry();
    RetryingTransactionHelper transactionHelper = serviceRegistry.getRetryingTransactionHelper();
    return transactionHelper.doInTransaction(new RetryingTransactionCallback<VirtualFolderDefinition>() {

        @Override
        public VirtualFolderDefinition execute() throws Throwable {
            NodeRef key = reference.toNodeRef();
            Map<NodeRef, VirtualFolderDefinition> definitionsCache = TransactionalResourceHelper.getMap(VIRTUAL_FOLDER_DEFINITION);
            VirtualFolderDefinition virtualFolderDefinition = definitionsCache.get(key);
            if (virtualFolderDefinition == null) {
                virtualFolderDefinition = reference.execute(new ApplyTemplateMethod(environment));
                definitionsCache.put(key, virtualFolderDefinition);
            }
            return virtualFolderDefinition;
        }
    }, true, false);
}
Also used : NodeRef(org.alfresco.service.cmr.repository.NodeRef) RetryingTransactionHelper(org.alfresco.repo.transaction.RetryingTransactionHelper) ApplyTemplateMethod(org.alfresco.repo.virtual.template.ApplyTemplateMethod) ServiceRegistry(org.alfresco.service.ServiceRegistry) AlfrescoEnviroment(org.alfresco.repo.virtual.AlfrescoEnviroment) Map(java.util.Map) HashMap(java.util.HashMap) VirtualFolderDefinition(org.alfresco.repo.virtual.template.VirtualFolderDefinition)

Aggregations

HashMap (java.util.HashMap)1 Map (java.util.Map)1 RetryingTransactionHelper (org.alfresco.repo.transaction.RetryingTransactionHelper)1 AlfrescoEnviroment (org.alfresco.repo.virtual.AlfrescoEnviroment)1 ApplyTemplateMethod (org.alfresco.repo.virtual.template.ApplyTemplateMethod)1 VirtualFolderDefinition (org.alfresco.repo.virtual.template.VirtualFolderDefinition)1 ServiceRegistry (org.alfresco.service.ServiceRegistry)1 NodeRef (org.alfresco.service.cmr.repository.NodeRef)1