public static BpmnModel getBpmnModelFromCache(String processDefinitionId) { ProcessDefinitionCacheEntry cacheEntry = Context.getProcessEngineConfiguration().getProcessDefinitionCache().get(processDefinitionId); if (cacheEntry != null) { return cacheEntry.getBpmnModel(); } return null; }
/** * Resolving the process definition will fetch the BPMN 2.0, parse it and store the {@link BpmnModel} in memory. */ public ProcessDefinitionCacheEntry resolveProcessDefinition(ProcessDefinition processDefinition) { String processDefinitionId = processDefinition.getId(); String deploymentId = processDefinition.getDeploymentId(); ProcessDefinitionCacheEntry cachedProcessDefinition = processDefinitionCache.get(processDefinitionId); if (cachedProcessDefinition == null) { CommandContext commandContext = Context.getCommandContext(); DeploymentEntity deployment = deploymentEntityManager.findById(deploymentId); deployment.setNew(false); deploy(deployment, null); cachedProcessDefinition = processDefinitionCache.get(processDefinitionId); if (cachedProcessDefinition == null) { throw new ActivitiException("deployment '" + deploymentId + "' didn't put process definition '" + processDefinitionId + "' in the cache"); } } return cachedProcessDefinition; }
public static ProcessDefinition getProcessDefinition(String processDefinitionId, boolean checkCacheOnly) { ProcessEngineConfigurationImpl processEngineConfiguration = Context.getProcessEngineConfiguration(); if (checkCacheOnly) { ProcessDefinitionCacheEntry cacheEntry = processEngineConfiguration.getProcessDefinitionCache().get(processDefinitionId); if (cacheEntry != null) { return cacheEntry.getProcessDefinition(); } return null; } else { // This will check the cache in the findDeployedProcessDefinitionById method return processEngineConfiguration.getDeploymentManager().findDeployedProcessDefinitionById(processDefinitionId); } }
public ProcessDefinition findDeployedProcessDefinitionById(String processDefinitionId) { if (processDefinitionId == null) { throw new ActivitiIllegalArgumentException("Invalid process definition id : null"); } // first try the cache ProcessDefinitionCacheEntry cacheEntry = processDefinitionCache.get(processDefinitionId); ProcessDefinition processDefinition = cacheEntry != null ? cacheEntry.getProcessDefinition() : null; if (processDefinition == null) { processDefinition = processDefinitionEntityManager.findById(processDefinitionId); if (processDefinition == null) { throw new ActivitiObjectNotFoundException("no deployed process definition found with id '" + processDefinitionId + "'", ProcessDefinition.class); } processDefinition = resolveProcessDefinition(processDefinition).getProcessDefinition(); } return processDefinition; }
public static BpmnModel getBpmnModelFromCache(String processDefinitionId) { ProcessDefinitionCacheEntry cacheEntry = Context.getProcessEngineConfiguration().getProcessDefinitionCache().get(processDefinitionId); if (cacheEntry != null) { return cacheEntry.getBpmnModel(); } return null; }
public Object getInstance(String deploymentId, String resource) { // First find in cache DeploymentCache<Object> deploymentCache = cacheInstance.get(deploymentId); if (deploymentCache == null) { deploymentCache = new DefaultDeploymentCache<Object>(); cacheInstance.put(deploymentId, deploymentCache); } Object instance = deploymentCache.get(resource); if (instance == null) { @SuppressWarnings("rawtypes") ProjectEngineFactory projectEngineFactory = get(deploymentId, resource); try { instance = projectEngineFactory.newInstance(); } catch (Exception e) { throw new ResourceCompileException( "Resource with name '" + resource + "' in deployment with id '" + deploymentId + "' compilation has been failed"); } deploymentCache.add(resource, instance); } return instance; }
public Object getInstance(String deploymentId, String resource) { // First find in cache DeploymentCache<Object> deploymentCache = cacheInstance.get(deploymentId); if (deploymentCache == null) { deploymentCache = new DefaultDeploymentCache<Object>(); cacheInstance.put(deploymentId, deploymentCache); } Object instance = deploymentCache.get(resource); if (instance == null) { @SuppressWarnings("rawtypes") ProjectEngineFactory projectEngineFactory = get(deploymentId, resource); try { instance = projectEngineFactory.newInstance(); } catch (Exception e) { throw new ResourceCompileException( "Resource with name '" + resource + "' in deployment with id '" + deploymentId + "' compilation has been failed"); } deploymentCache.add(resource, instance); } return instance; }
public ProcessDefinitionEntity resolveProcessDefinition(ProcessDefinitionEntity processDefinition) { String processDefinitionId = processDefinition.getId(); String deploymentId = processDefinition.getDeploymentId(); processDefinition = processDefinitionCache.get(processDefinitionId); if (processDefinition==null) { DeploymentEntity deployment = Context .getCommandContext() .getDeploymentEntityManager() .findDeploymentById(deploymentId); deployment.setNew(false); deploy(deployment); processDefinition = processDefinitionCache.get(processDefinitionId); if (processDefinition==null) { throw new ActivitiException("deployment '"+deploymentId+"' didn't put process definition '"+processDefinitionId+"' in the cache"); } } return processDefinition; }
public static ProcessDefinition getProcessDefinition(String processDefinitionId, boolean checkCacheOnly) { ProcessEngineConfigurationImpl processEngineConfiguration = Context.getProcessEngineConfiguration(); if (checkCacheOnly) { ProcessDefinitionCacheEntry cacheEntry = processEngineConfiguration.getProcessDefinitionCache().get(processDefinitionId); if (cacheEntry != null) { return cacheEntry.getProcessDefinition(); } return null; } else { // This will check the cache in the findDeployedProcessDefinitionById method return processEngineConfiguration.getDeploymentManager().findDeployedProcessDefinitionById(processDefinitionId); } }
ProcessDefinitionCacheEntry cacheEntry = processEngineConfiguration.getProcessDefinitionCache().get(processDefinitionId); if (cacheEntry != null) { ProcessDefinition processDefinition = cacheEntry.getProcessDefinition();
public static KnowledgeBase findKnowledgeBaseByDeploymentId(String deploymentId) { DeploymentCache<Object> knowledgeBaseCache = Context.getProcessEngineConfiguration().getDeploymentManager().getKnowledgeBaseCache(); KnowledgeBase knowledgeBase = (KnowledgeBase) knowledgeBaseCache.get(deploymentId); if (knowledgeBase == null) { DeploymentEntity deployment = Context.getCommandContext().getDeploymentEntityManager().findById(deploymentId); if (deployment == null) { throw new ActivitiObjectNotFoundException("no deployment with id " + deploymentId, Deployment.class); } Context.getProcessEngineConfiguration().getDeploymentManager().deploy(deployment); knowledgeBase = (KnowledgeBase) knowledgeBaseCache.get(deploymentId); if (knowledgeBase == null) { throw new ActivitiException("deployment " + deploymentId + " doesn't contain any rules"); } } return knowledgeBase; } }
public ProcessDefinition findDeployedProcessDefinitionById(String processDefinitionId) { if (processDefinitionId == null) { throw new ActivitiIllegalArgumentException("Invalid process definition id : null"); } // first try the cache ProcessDefinitionCacheEntry cacheEntry = processDefinitionCache.get(processDefinitionId); ProcessDefinition processDefinition = cacheEntry != null ? cacheEntry.getProcessDefinition() : null; if (processDefinition == null) { processDefinition = processDefinitionEntityManager.findById(processDefinitionId); if (processDefinition == null) { throw new ActivitiObjectNotFoundException("no deployed process definition found with id '" + processDefinitionId + "'", ProcessDefinition.class); } processDefinition = resolveProcessDefinition(processDefinition).getProcessDefinition(); } return processDefinition; }
public static KnowledgeBase findKnowledgeBaseByDeploymentId(String deploymentId) { DeploymentCache<Object> knowledgeBaseCache = Context .getProcessEngineConfiguration() .getDeploymentManager() .getKnowledgeBaseCache(); KnowledgeBase knowledgeBase = (KnowledgeBase) knowledgeBaseCache.get(deploymentId); if (knowledgeBase==null) { DeploymentEntity deployment = Context .getCommandContext() .getDeploymentEntityManager() .findDeploymentById(deploymentId); if (deployment==null) { throw new ActivitiObjectNotFoundException("no deployment with id "+deploymentId, Deployment.class); } Context .getProcessEngineConfiguration() .getDeploymentManager() .deploy(deployment); knowledgeBase = (KnowledgeBase) knowledgeBaseCache.get(deploymentId); if (knowledgeBase==null) { throw new ActivitiException("deployment "+deploymentId+" doesn't contain any rules"); } } return knowledgeBase; } }
/** * Resolving the process definition will fetch the BPMN 2.0, parse it and store the {@link BpmnModel} in memory. */ public ProcessDefinitionCacheEntry resolveProcessDefinition(ProcessDefinition processDefinition) { String processDefinitionId = processDefinition.getId(); String deploymentId = processDefinition.getDeploymentId(); ProcessDefinitionCacheEntry cachedProcessDefinition = processDefinitionCache.get(processDefinitionId); if (cachedProcessDefinition == null) { CommandContext commandContext = Context.getCommandContext(); if (commandContext.getProcessEngineConfiguration().isActiviti5CompatibilityEnabled() && Activiti5Util.isActiviti5ProcessDefinition(Context.getCommandContext(), processDefinition)) { return Activiti5Util.getActiviti5CompatibilityHandler().resolveProcessDefinition(processDefinition); } DeploymentEntity deployment = deploymentEntityManager.findById(deploymentId); deployment.setNew(false); deploy(deployment, null); cachedProcessDefinition = processDefinitionCache.get(processDefinitionId); if (cachedProcessDefinition == null) { throw new ActivitiException("deployment '" + deploymentId + "' didn't put process definition '" + processDefinitionId + "' in the cache"); } } return cachedProcessDefinition; }
cache.put(deploymentId, deploymentCache); ProjectEngineFactory<Object> projectEngineFactory = deploymentCache.get(resource); if (projectEngineFactory != null) { return projectEngineFactory;
cache.put(deploymentId, deploymentCache); ProjectEngineFactory<Object> projectEngineFactory = deploymentCache.get(resource); if (projectEngineFactory != null) { return projectEngineFactory;