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()); } }
@Override public long executeCount(CommandContext commandContext) { checkQueryOk(); return commandContext.getDeploymentEntityManager().findDeploymentCountByQueryCriteria(this); }
@Override public List<Deployment> executeList(CommandContext commandContext, Page page) { checkQueryOk(); return commandContext.getDeploymentEntityManager().findDeploymentsByQueryCriteria(this, page); }
DeploymentEntity existingDeployment = commandContext.getDeploymentEntityManager().findLatestDeploymentByName(deployment.getName()); if (existingDeployment != null) { existingDeployments.add(existingDeployment); commandContext.getDeploymentEntityManager().insert(deployment);
public void deleteDeployment(String deploymentId, boolean cascade) { List<ProcessDefinition> processDefinitions = getDbSqlSession() .createProcessDefinitionQuery() .deploymentId(deploymentId) List<Model> models = getDbSqlSession() .createModelQueryImpl() .deploymentId(deploymentId) ModelEntity modelEntity = (ModelEntity) model; modelEntity.setDeploymentId(null); getModelManager().updateModel(modelEntity); getProcessInstanceManager() .deleteProcessInstancesByProcessDefinition(processDefinitionId, "deleted deployment", cascade); getIdentityLinkManager().deleteIdentityLinksByProcDef(processDefinitionId); List<EventSubscriptionEntity> eventSubscriptionEntities = getEventSubscriptionManager() getProcessDefinitionInfoManager().deleteProcessDefinitionInfo(processDefinitionId); getProcessDefinitionManager().deleteProcessDefinitionsByDeploymentId(deploymentId); ProcessDefinitionEntity latestProcessDefinition = findLatestProcessDefinition(processDefinition); ProcessDefinition previousProcessDefinition = findNewLatestProcessDefinitionAfterRemovalOf(processDefinition); if (previousProcessDefinition != null) { getResourceManager().deleteResourcesByDeploymentId(deploymentId);
public void deleteDeployment(String deploymentId, boolean cascade) { List<ProcessDefinition> processDefinitions = getDbSqlSession() .createProcessDefinitionQuery() .deploymentId(deploymentId) List<Model> models = getDbSqlSession() .createModelQueryImpl() .deploymentId(deploymentId) ModelEntity modelEntity = (ModelEntity) model; modelEntity.setDeploymentId(null); getModelManager().updateModel(modelEntity); String processDefinitionId = processDefinition.getId(); getProcessInstanceManager() .deleteProcessInstancesByProcessDefinition(processDefinitionId, "deleted deployment", cascade,"删除流程部署记录","删除流程部署记录时级联删除流程实例"); String processDefinitionId = processDefinition.getId(); getIdentityLinkManager().deleteIdentityLinksByProcDef(processDefinitionId); getProcessDefinitionManager() .deleteProcessDefinitionsByDeploymentId(deploymentId); getResourceManager() .deleteResourcesByDeploymentId(deploymentId); getDbSqlSession().delete("deleteDeployment", deploymentId);
public DeploymentEntity getDeployment() { String deploymentId = getProcessDefinition().getDeploymentId(); DeploymentEntity deployment = Context .getCommandContext() .getDeploymentEntityManager() .findDeploymentById(deploymentId); return deployment; } }
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); }
.getCommandContext() .getDeploymentEntityManager() .findLatestDeploymentByName(deployment.getName()); .getCommandContext() .getDeploymentEntityManager() .insertDeployment(deployment);
@SuppressWarnings("unchecked") public List<Deployment> findDeploymentsByNativeQuery(Map<String, Object> parameterMap, int firstResult, int maxResults) { return getDbSqlSession().selectListWithRawParameter("selectDeploymentByNativeQuery", parameterMap, firstResult, maxResults); }
public List execute(CommandContext commandContext) { if (deploymentId == null) { throw new ActivitiIllegalArgumentException("deploymentId is null"); } return commandContext.getDeploymentEntityManager().getDeploymentResourceNames(deploymentId); }
public void insertDeployment(DeploymentEntity deployment) { getDbSqlSession().insert(deployment); for (ResourceEntity resource : deployment.getResources().values()) { resource.setDeploymentId(deployment.getId()); getResourceManager().insertResource(resource); } }
public List<Deployment> executeList(CommandContext commandContext, Map<String, Object> parameterMap, int firstResult, int maxResults) { return commandContext.getDeploymentEntityManager().findDeploymentsByNativeQuery(parameterMap, firstResult, maxResults); }
public long executeCount(CommandContext commandContext, Map<String, Object> parameterMap) { return commandContext.getDeploymentEntityManager().findDeploymentCountByNativeQuery(parameterMap); }
public DeploymentEntity getDeployment() { String deploymentId = getProcessDefinition().getDeploymentId(); DeploymentEntity deployment = Context .getCommandContext() .getDeploymentEntityManager() .findDeploymentById(deploymentId); return deployment; } }
.getDeploymentEntityManager(); DeploymentEntity deployment = deploymentEntityManager.findDeploymentById(deploymentId); if (deployment == null) { throw new ActivitiObjectNotFoundException("Could not find a deployment with id '" + deploymentId + "'.", DeploymentEntity.class); deploymentEntityManager.deleteDeployment(deploymentId, cascade);
DeploymentEntity existingDeployment = commandContext .getDeploymentEntityManager() .findLatestDeploymentByName(deployment.getName()); if (existingDeployment != null) { existingDeployments.add(existingDeployment); .insertDeployment(deployment);
public DeploymentEntity findLatestDeploymentByName(String deploymentName) { List<?> list = getDbSqlSession().selectList("selectDeploymentsByName", deploymentName, 0, 1); if (list != null && !list.isEmpty()) { return (DeploymentEntity) list.get(0); } return null; }
public List execute(CommandContext commandContext) { if (deploymentId == null) { throw new ActivitiIllegalArgumentException("deploymentId is null"); } return commandContext.getDeploymentEntityManager().getDeploymentResourceNames(deploymentId); }
DeploymentEntity existingDeployment = commandContext.getDeploymentEntityManager().findLatestDeploymentByName(deployment.getName()); if (existingDeployment != null) { existingDeployments.add(existingDeployment); commandContext.getDeploymentEntityManager().insert(deployment);