public void removeDeployment(String deploymentId, boolean cascade) { DeploymentEntity deployment = deploymentEntityManager.findById(deploymentId); if (deployment == 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().deploymentId(deploymentId).list(); ActivitiEventDispatcher eventDispatcher = Context.getProcessEngineConfiguration().getEventDispatcher(); for (ProcessDefinition processDefinition : processDefinitions) { // Since all process definitions are deleted by a single query, we should dispatch the events in this loop if (eventDispatcher.isEnabled()) { eventDispatcher.dispatchEvent(ActivitiEventBuilder.createEntityEvent(ActivitiEventType.ENTITY_DELETED, processDefinition)); } } // Delete data deploymentEntityManager.deleteDeployment(deploymentId, cascade); // Since we use a delete by query, delete-events are not automatically dispatched if (eventDispatcher.isEnabled()) { eventDispatcher.dispatchEvent(ActivitiEventBuilder.createEntityEvent(ActivitiEventType.ENTITY_DELETED, deployment)); } for (ProcessDefinition processDefinition : processDefinitions) { processDefinitionCache.remove(processDefinition.getId()); } }
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); }
public void removeDeployment(String deploymentId, boolean cascade) { DeploymentEntity deployment = deploymentEntityManager.findById(deploymentId); if (deployment == null) { throw new ActivitiObjectNotFoundException("Could not find a deployment with id '" + deploymentId + "'.", DeploymentEntity.class); } if (processEngineConfiguration.isActiviti5CompatibilityEnabled() && Activiti5CompatibilityHandler.ACTIVITI_5_ENGINE_TAG.equals(deployment.getEngineVersion())) { processEngineConfiguration.getActiviti5CompatibilityHandler().deleteDeployment(deploymentId, cascade); return; } // Remove any process definition from the cache List<ProcessDefinition> processDefinitions = new ProcessDefinitionQueryImpl().deploymentId(deploymentId).list(); ActivitiEventDispatcher eventDispatcher = Context.getProcessEngineConfiguration().getEventDispatcher(); for (ProcessDefinition processDefinition : processDefinitions) { // Since all process definitions are deleted by a single query, we should dispatch the events in this loop if (eventDispatcher.isEnabled()) { eventDispatcher.dispatchEvent(ActivitiEventBuilder.createEntityEvent(ActivitiEventType.ENTITY_DELETED, processDefinition)); } } // Delete data deploymentEntityManager.deleteDeployment(deploymentId, cascade); // Since we use a delete by query, delete-events are not automatically dispatched if (eventDispatcher.isEnabled()) { eventDispatcher.dispatchEvent(ActivitiEventBuilder.createEntityEvent(ActivitiEventType.ENTITY_DELETED, deployment)); } for (ProcessDefinition processDefinition : processDefinitions) { processDefinitionCache.remove(processDefinition.getId()); } }
deploymentEntityManager.deleteDeployment(deploymentId, cascade);