public DeploymentEntity getDeployment() { String deploymentId = getProcessDefinition().getDeploymentId(); DeploymentEntity deployment = Context .getCommandContext() .getDeploymentEntityManager() .findDeploymentById(deploymentId); return deployment; } }
public DeploymentEntity getDeployment() { String deploymentId = getProcessDefinition().getDeploymentId(); DeploymentEntity deployment = Context .getCommandContext() .getDeploymentEntityManager() .findDeploymentById(deploymentId); return deployment; } }
@Override public InputStream execute(CommandContext commandContext) { if (deploymentId == null) { throw new ActivitiIllegalArgumentException("deploymentId is null"); } if (resourceName == null) { throw new ActivitiIllegalArgumentException("resourceName is null"); } ResourceEntity resource = commandContext .getResourceEntityManager() .findResourceByDeploymentIdAndResourceName(deploymentId, resourceName); if (resource == null) { if (commandContext.getDeploymentEntityManager().findDeploymentById(deploymentId) == null) { throw new ActivitiObjectNotFoundException("deployment does not exist: " + deploymentId, Deployment.class); } else { throw new ActivitiObjectNotFoundException("no resource found with name '" + resourceName + "' in deployment '" + deploymentId + "'", InputStream.class); } } return new ByteArrayInputStream(resource.getBytes()); }
public InputStream execute(CommandContext commandContext) { if (deploymentId == null) { throw new ActivitiIllegalArgumentException("deploymentId is null"); } if(resourceName == null) { throw new ActivitiIllegalArgumentException("resourceName is null"); } ResourceEntity resource = commandContext .getResourceEntityManager() .findResourceByDeploymentIdAndResourceName(deploymentId, resourceName); if(resource == null) { if(commandContext.getDeploymentEntityManager().findDeploymentById(deploymentId) == null) { throw new ActivitiObjectNotFoundException("deployment does not exist: " + deploymentId, Deployment.class); } else { throw new ActivitiObjectNotFoundException("no resource found with name '" + resourceName + "' in deployment '" + deploymentId + "'", InputStream.class); } } return new ByteArrayInputStream(resource.getBytes()); }
DeploymentEntityManager deploymentEntityManager = Context.getCommandContext().getDeploymentEntityManager(); DeploymentEntity deployment = deploymentEntityManager.findDeploymentById(deploymentId); if (deployment == null) throw new ActivitiObjectNotFoundException("Deployment with id '" + deploymentId + "' hasn't been found.",
DeploymentEntityManager deploymentEntityManager = Context.getCommandContext().getDeploymentEntityManager(); DeploymentEntity deployment = deploymentEntityManager.findDeploymentById(deploymentId); if (deployment == null) throw new ActivitiObjectNotFoundException("Deployment with id '" + deploymentId + "' hasn't been found.",
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 ProcessDefinitionCacheEntry resolveProcessDefinition(ProcessDefinition processDefinition) { String processDefinitionId = processDefinition.getId(); String deploymentId = processDefinition.getDeploymentId(); ProcessDefinitionCacheEntry cachedProcessDefinition = processDefinitionCache.get(processDefinitionId); if (cachedProcessDefinition == null) { DeploymentEntity deployment = Context .getCommandContext() .getDeploymentEntityManager() .findDeploymentById(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 void removeDeployment(String deploymentId, boolean cascade) { DeploymentEntityManager deploymentEntityManager = Context .getCommandContext() .getDeploymentEntityManager(); if(deploymentEntityManager.findDeploymentById(deploymentId) == null) throw new ActivitiObjectNotFoundException("Could not find a deployment with id '" + deploymentId + "'.", DeploymentEntity.class); // Remove any process definition from the cache List<ProcessDefinition> processDefinitions = new ProcessDefinitionQueryImpl(Context.getCommandContext()) .deploymentId(deploymentId) .list(); for (ProcessDefinition processDefinition : processDefinitions) { processDefinitionCache.remove(processDefinition.getId()); } // Delete data deploymentEntityManager.deleteDeployment(deploymentId, cascade); }
@Override public Void execute(CommandContext commandContext) { if (deploymentId == null) { throw new ActivitiIllegalArgumentException("Deployment id is null"); } DeploymentEntity deployment = commandContext .getDeploymentEntityManager() .findDeploymentById(deploymentId); if (deployment == null) { throw new ActivitiObjectNotFoundException("No deployment found for id = '" + deploymentId + "'", Deployment.class); } // Update category deployment.setCategory(category); if (commandContext.getProcessEngineConfiguration().getEventDispatcher().isEnabled()) { commandContext.getProcessEngineConfiguration().getEventDispatcher().dispatchEvent( ActivitiEventBuilder.createEntityEvent(FlowableEngineEventType.ENTITY_UPDATED, deployment)); } return null; }
public static KieBase findKnowledgeBaseByDeploymentId(String deploymentId) { DeploymentCache<Object> knowledgeBaseCache = Context .getProcessEngineConfiguration() .getDeploymentManager() .getKnowledgeBaseCache(); KieBase knowledgeBase = (KieBase) 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 = (KieBase) knowledgeBaseCache.get(deploymentId); if (knowledgeBase == null) { throw new ActivitiException("deployment " + deploymentId + " doesn't contain any rules"); } } return knowledgeBase; } }
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; } }
public BpmnModel execute(CommandContext commandContext) { if (processDefinitionId == null) { throw new ActivitiIllegalArgumentException("processDefinitionId is null"); } // Find the bpmn 2.0 xml resource name which is stored on the process definition ProcessDefinitionEntity processDefinitionEntity = commandContext .getProcessDefinitionEntityManager() .findProcessDefinitionById(processDefinitionId); if (processDefinitionEntity == null) { throw new ActivitiObjectNotFoundException("Process definition does not exist: " + processDefinitionId, ProcessDefinitionEntity.class); } // Fetch the resource String resourceName = processDefinitionEntity.getResourceName(); ResourceEntity resource = commandContext.getResourceEntityManager() .findResourceByDeploymentIdAndResourceName(processDefinitionEntity.getDeploymentId(), resourceName); if (resource == null) { if (commandContext.getDeploymentEntityManager().findDeploymentById(processDefinitionEntity.getDeploymentId()) == null) { throw new ActivitiObjectNotFoundException("deployment for process definition does not exist: " + processDefinitionEntity.getDeploymentId(), Deployment.class); } else { throw new ActivitiObjectNotFoundException("no resource found with name '" + resourceName + "' in deployment '" + processDefinitionEntity.getDeploymentId() + "'", InputStream.class); } } // Convert the bpmn 2.0 xml to a bpmn model BpmnXMLConverter bpmnXMLConverter = new BpmnXMLConverter(); return bpmnXMLConverter.convertToBpmnModel(new BytesStreamSource(resource.getBytes()), false, false); // no need to validate schema, it was already validated on deploy }
.getDeploymentEntityManager(); DeploymentEntity deployment = deploymentEntityManager.findDeploymentById(deploymentId); if (deployment == null) { throw new ActivitiObjectNotFoundException("Could not find a deployment with id '" + deploymentId + "'.", DeploymentEntity.class);
.findResourceByDeploymentIdAndResourceName(processDefinition.getDeploymentId(), resourceName); if (resource == null) { if (Context.getCommandContext().getDeploymentEntityManager().findDeploymentById(processDefinition.getDeploymentId()) == null) { throw new ActivitiObjectNotFoundException("deployment for process definition does not exist: " + processDefinition.getDeploymentId(), Deployment.class);
DeploymentEntity deployment = commandContext.getDeploymentEntityManager().findDeploymentById(deploymentId); if (deployment == null) { throw new ActivitiObjectNotFoundException("Could not find deployment with id " + deploymentId, Deployment.class);