public void initProcessDefinitionCache() { if (processDefinitionCache == null) { if (processDefinitionCacheLimit <= 0) { processDefinitionCache = new DefaultDeploymentCache<ProcessDefinitionCacheEntry>(); } else { processDefinitionCache = new DefaultDeploymentCache<ProcessDefinitionCacheEntry>(processDefinitionCacheLimit); } } }
@Override public ProcessDefinitionInfoCacheObject execute(CommandContext commandContext) { return retrieveProcessDefinitionInfoCacheObject(processDefinitionId, commandContext); } };
public void deploy(DeploymentEntity deployment, Map<String, Object> deploymentSettings) { for (Deployer deployer : deployers) { deployer.deploy(deployment, deploymentSettings); } }
public ObjectNode execute(CommandContext commandContext) { if (processDefinitionId == null) { throw new ActivitiIllegalArgumentException("process definition id is null"); } ObjectNode resultNode = null; DeploymentManager deploymentManager = commandContext.getProcessEngineConfiguration().getDeploymentManager(); // make sure the process definition is in the cache ProcessDefinition processDefinition = deploymentManager.findDeployedProcessDefinitionById(processDefinitionId); ProcessDefinitionInfoCacheObject definitionInfoCacheObject = deploymentManager.getProcessDefinitionInfoCache().get(processDefinitionId); if (definitionInfoCacheObject != null) { resultNode = definitionInfoCacheObject.getInfoNode(); } return resultNode; }
public static BpmnModel getBpmnModel(String processDefinitionId) { DeploymentManager deploymentManager = Context.getProcessEngineConfiguration().getDeploymentManager(); // This will check the cache in the findDeployedProcessDefinitionById and resolveProcessDefinition method ProcessDefinition processDefinitionEntity = deploymentManager.findDeployedProcessDefinitionById(processDefinitionId); return deploymentManager.resolveProcessDefinition(processDefinitionEntity).getBpmnModel(); }
public static Process getProcess(String processDefinitionId) { DeploymentManager deploymentManager = Context.getProcessEngineConfiguration().getDeploymentManager(); // This will check the cache in the findDeployedProcessDefinitionById and resolveProcessDefinition method ProcessDefinition processDefinitionEntity = deploymentManager.findDeployedProcessDefinitionById(processDefinitionId); return deploymentManager.resolveProcessDefinition(processDefinitionEntity).getProcess(); }
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 ProcessDefinition findDeployedLatestProcessDefinitionByKeyAndTenantId(String processDefinitionKey, String tenantId) { ProcessDefinition processDefinition = processDefinitionEntityManager.findLatestProcessDefinitionByKeyAndTenantId(processDefinitionKey, tenantId); if (processDefinition == null) { throw new ActivitiObjectNotFoundException("no processes deployed with key '" + processDefinitionKey + "' for tenant identifier '" + tenantId + "'", ProcessDefinition.class); } processDefinition = resolveProcessDefinition(processDefinition).getProcessDefinition(); return processDefinition; }
protected static ObjectNode getProcessDefinitionInfoNode(String processDefinitionId) { Map<String, ObjectNode> bpmnOverrideMap = getBpmnOverrideContext(); if (!bpmnOverrideMap.containsKey(processDefinitionId)) { ProcessDefinitionInfoCacheObject cacheObject = getProcessEngineConfiguration().getDeploymentManager() .getProcessDefinitionInfoCache() .get(processDefinitionId); addBpmnOverrideElement(processDefinitionId, cacheObject.getInfoNode()); } return getBpmnOverrideContext().get(processDefinitionId); }
public ProcessDefinition execute(CommandContext commandContext) { return commandContext.getProcessEngineConfiguration().getDeploymentManager().findDeployedProcessDefinitionById(processDefinitionId); } }
public static BpmnModel getBpmnModelFromCache(String processDefinitionId) { ProcessDefinitionCacheEntry cacheEntry = Context.getProcessEngineConfiguration().getProcessDefinitionCache().get(processDefinitionId); if (cacheEntry != null) { return cacheEntry.getBpmnModel(); } return null; }
public void deploy(DeploymentEntity deployment) { deploy(deployment, null); }
public void initProcessDefinitionInfoCache() { if (processDefinitionInfoCache == null) { if (processDefinitionInfoCacheLimit <= 0) { processDefinitionInfoCache = new ProcessDefinitionInfoCache(commandExecutor); } else { processDefinitionInfoCache = new ProcessDefinitionInfoCache(commandExecutor, processDefinitionInfoCacheLimit); } } }
protected boolean removeEldestEntry(Map.Entry<String, ProcessDefinitionInfoCacheObject> eldest) { boolean removeEldest = size() > limit; if (removeEldest) { logger.trace("Cache limit is reached, {} will be evicted", eldest.getKey()); } return removeEldest; }
protected boolean removeEldestEntry(Map.Entry<String, T> eldest) { boolean removeEldest = size() > limit; if (removeEldest && logger.isTraceEnabled()) { logger.trace("Cache limit is reached, {} will be evicted", eldest.getKey()); } return removeEldest; }
public ProcessDefinition findDeployedProcessDefinitionByKeyAndVersionAndTenantId(String processDefinitionKey, Integer processDefinitionVersion, String tenantId) { ProcessDefinition processDefinition = (ProcessDefinitionEntity) processDefinitionEntityManager .findProcessDefinitionByKeyAndVersionAndTenantId(processDefinitionKey, processDefinitionVersion, tenantId); if (processDefinition == null) { throw new ActivitiObjectNotFoundException("no processes deployed with key = '" + processDefinitionKey + "' and version = '" + processDefinitionVersion + "'", ProcessDefinition.class); } processDefinition = resolveProcessDefinition(processDefinition).getProcessDefinition(); return processDefinition; }
public void initKnowledgeBaseCache() { if (knowledgeBaseCache == null) { if (knowledgeBaseCacheLimit <= 0) { knowledgeBaseCache = new DefaultDeploymentCache<Object>(); } else { knowledgeBaseCache = new DefaultDeploymentCache<Object>(knowledgeBaseCacheLimit); } } }
public ProcessDefinitionInfoCacheObject get(final String processDefinitionId) { ProcessDefinitionInfoCacheObject infoCacheObject = null; Command<ProcessDefinitionInfoCacheObject> cacheCommand = new Command<ProcessDefinitionInfoCacheObject>() { @Override public ProcessDefinitionInfoCacheObject execute(CommandContext commandContext) { return retrieveProcessDefinitionInfoCacheObject(processDefinitionId, commandContext); } }; if (Context.getCommandContext() != null) { infoCacheObject = retrieveProcessDefinitionInfoCacheObject(processDefinitionId, Context.getCommandContext()); } else { infoCacheObject = commandExecutor.execute(cacheCommand); } return infoCacheObject; }
public ProcessDefinition findDeployedLatestProcessDefinitionByKey(String processDefinitionKey) { ProcessDefinition processDefinition = processDefinitionEntityManager.findLatestProcessDefinitionByKey(processDefinitionKey); if (processDefinition == null) { throw new ActivitiObjectNotFoundException("no processes deployed with key '" + processDefinitionKey + "'", ProcessDefinition.class); } processDefinition = resolveProcessDefinition(processDefinition).getProcessDefinition(); return processDefinition; }