public void removeDeployment(String deploymentId, boolean cascade) { CmmnDeploymentEntity deployment = deploymentEntityManager.findById(deploymentId); if (deployment == null) { throw new FlowableObjectNotFoundException("Could not find a deployment with id '" + deploymentId + "'.", CmmnDeploymentEntity.class); } for (CaseDefinition caseDefinition : new CaseDefinitionQueryImpl().deploymentId(deploymentId).list()) { caseDefinitionCache.remove(caseDefinition.getId()); } deploymentEntityManager.deleteDeploymentAndRelatedData(deploymentId, cascade); }
public void removeDeployment(String deploymentId, boolean cascade) { AppDeploymentEntity deployment = deploymentEntityManager.findById(deploymentId); if (deployment == null) { throw new FlowableObjectNotFoundException("Could not find a deployment with id '" + deploymentId + "'.", AppDeploymentEntity.class); } for (AppDefinition appDefinition : new AppDefinitionQueryImpl().deploymentId(deploymentId).list()) { appDefinitionCache.remove(appDefinition.getId()); } deploymentEntityManager.deleteDeploymentAndRelatedData(deploymentId, cascade); }
public void removeDeployment(String deploymentId) { DmnDeploymentEntity deployment = deploymentEntityManager.findById(deploymentId); if (deployment == null) { throw new FlowableObjectNotFoundException("Could not find a deployment with id '" + deploymentId + "'."); } // Remove any dmn definition from the cache List<DmnDecisionTable> decisionTables = new DecisionTableQueryImpl().deploymentId(deploymentId).list(); // Delete data deploymentEntityManager.deleteDeployment(deploymentId); for (DmnDecisionTable decisionTable : decisionTables) { decisionCache.remove(decisionTable.getId()); } }
public void removeDeployment(String deploymentId) { FormDeploymentEntity deployment = deploymentEntityManager.findById(deploymentId); if (deployment == null) { throw new FlowableObjectNotFoundException("Could not find a deployment with id '" + deploymentId + "'."); } // Remove any form definition from the cache List<FormDefinition> forms = new FormDefinitionQueryImpl().deploymentId(deploymentId).list(); // Delete data deploymentEntityManager.deleteDeployment(deploymentId); for (FormDefinition form : forms) { formCache.remove(form.getId()); } }
protected void changeProcessDefinitionState(CommandContext commandContext, List<ProcessDefinitionEntity> processDefinitions) { for (ProcessDefinitionEntity processDefinition : processDefinitions) { SuspensionStateUtil.setSuspensionState(processDefinition, getProcessDefinitionSuspensionState()); // Evict cache commandContext .getProcessEngineConfiguration() .getDeploymentManager() .getProcessDefinitionCache() .remove(processDefinition.getId()); // Suspend process instances (if needed) if (includeProcessInstances) { int currentStartIndex = 0; List<ProcessInstance> processInstances = fetchProcessInstancesPage(commandContext, processDefinition, currentStartIndex); while (!processInstances.isEmpty()) { for (ProcessInstance processInstance : processInstances) { AbstractSetProcessInstanceStateCmd processInstanceCmd = getProcessInstanceChangeStateCmd(processInstance); processInstanceCmd.execute(commandContext); } // Fetch new batch of process instances currentStartIndex += processInstances.size(); processInstances = fetchProcessInstancesPage(commandContext, processDefinition, currentStartIndex); } } } }
protected void changeProcessDefinitionState(CommandContext commandContext, List<ProcessDefinitionEntity> processDefinitions) { for (ProcessDefinitionEntity processDefinition : processDefinitions) { if (Flowable5Util.isFlowable5ProcessDefinition(processDefinition, commandContext)) continue; SuspensionStateUtil.setSuspensionState(processDefinition, getProcessDefinitionSuspensionState()); // Evict cache CommandContextUtil.getProcessEngineConfiguration(commandContext).getDeploymentManager().getProcessDefinitionCache().remove(processDefinition.getId()); // Suspend process instances (if needed) if (includeProcessInstances) { int currentStartIndex = 0; List<ProcessInstance> processInstances = fetchProcessInstancesPage(commandContext, processDefinition, currentStartIndex); while (!processInstances.isEmpty()) { for (ProcessInstance processInstance : processInstances) { AbstractSetProcessInstanceStateCmd processInstanceCmd = getProcessInstanceChangeStateCmd(processInstance); processInstanceCmd.execute(commandContext); } // Fetch new batch of process instances currentStartIndex += processInstances.size(); processInstances = fetchProcessInstancesPage(commandContext, processDefinition, currentStartIndex); } } } }
@Override public Void execute(CommandContext commandContext) { if (appDefinitionId == null) { throw new FlowableIllegalArgumentException("App definition id is null"); } AppDefinitionEntity appDefinition = CommandContextUtil.getAppDefinitionEntityManager(commandContext).findById(appDefinitionId); if (appDefinition == null) { throw new FlowableObjectNotFoundException("No app definition found for id = '" + appDefinitionId + "'", AppDefinition.class); } // Update category appDefinition.setCategory(category); // Remove app definition from cache, it will be refetched later DeploymentCache<AppDefinitionCacheEntry> appDefinitionCache = CommandContextUtil.getAppEngineConfiguration(commandContext).getAppDefinitionCache(); if (appDefinitionCache != null) { appDefinitionCache.remove(appDefinitionId); } return null; }
@Override public Void execute(CommandContext commandContext) { if (caseDefinitionId == null) { throw new FlowableIllegalArgumentException("Case definition id is null"); } CaseDefinitionEntity caseDefinition = CommandContextUtil.getCaseDefinitionEntityManager(commandContext).findById(caseDefinitionId); if (caseDefinition == null) { throw new FlowableObjectNotFoundException("No case definition found for id = '" + caseDefinitionId + "'", CaseDefinition.class); } // Update category caseDefinition.setCategory(category); // Remove case definition from cache, it will be refetched later DeploymentCache<CaseDefinitionCacheEntry> caseDefinitionCache = CommandContextUtil.getCmmnEngineConfiguration(commandContext).getCaseDefinitionCache(); if (caseDefinitionCache != null) { caseDefinitionCache.remove(caseDefinitionId); } return null; }
@Override public Void execute(CommandContext commandContext) { if (decisionTableId == null) { throw new FlowableIllegalArgumentException("Decision table id is null"); } DecisionTableEntity decisionTable = CommandContextUtil.getDecisionTableEntityManager(commandContext).findById(decisionTableId); if (decisionTable == null) { throw new FlowableObjectNotFoundException("No decision table found for id = '" + decisionTableId + "'"); } // Update category decisionTable.setCategory(category); // Remove process definition from cache, it will be refetched later DeploymentCache<DecisionTableCacheEntry> decisionTableCache = CommandContextUtil.getDmnEngineConfiguration().getDecisionCache(); if (decisionTableCache != null) { decisionTableCache.remove(decisionTableId); } CommandContextUtil.getDecisionTableEntityManager(commandContext).update(decisionTable); return null; }
@Override public Void execute(CommandContext commandContext) { if (formDefinitionId == null) { throw new FlowableIllegalArgumentException("Form definition id is null"); } FormDefinitionEntity formDefinition = CommandContextUtil.getFormDefinitionEntityManager(commandContext).findById(formDefinitionId); if (formDefinition == null) { throw new FlowableObjectNotFoundException("No form definition found for id = '" + formDefinitionId + "'"); } // Update category formDefinition.setCategory(category); // Remove form from cache, it will be refetched later DeploymentCache<FormDefinitionCacheEntry> formDefinitionCache = CommandContextUtil.getFormEngineConfiguration().getFormDefinitionCache(); if (formDefinitionCache != null) { formDefinitionCache.remove(formDefinitionId); } CommandContextUtil.getFormDefinitionEntityManager(commandContext).update(formDefinition); return null; }
@Override public Void execute(CommandContext commandContext) { if (processDefinitionId == null) { throw new ActivitiIllegalArgumentException("Process definition id is null"); } ProcessDefinitionEntity processDefinition = commandContext .getProcessDefinitionEntityManager() .findProcessDefinitionById(processDefinitionId); if (processDefinition == null) { throw new ActivitiObjectNotFoundException("No process definition found for id = '" + processDefinitionId + "'", ProcessDefinition.class); } // Update category processDefinition.setCategory(category); // Remove process definition from cache, it will be refetched later DeploymentCache<ProcessDefinitionCacheEntry> processDefinitionCache = commandContext.getProcessEngineConfiguration().getProcessDefinitionCache(); if (processDefinitionCache != null) { processDefinitionCache.remove(processDefinitionId); } if (commandContext.getEventDispatcher().isEnabled()) { commandContext.getEventDispatcher().dispatchEvent( ActivitiEventBuilder.createEntityEvent(FlowableEngineEventType.ENTITY_UPDATED, processDefinition)); } return null; }
@Override public Void execute(CommandContext commandContext) { if (deploymentId == null) { throw new FlowableIllegalArgumentException("deploymentId is null"); } // Update all entities DmnDeploymentEntity deployment = CommandContextUtil.getDeploymentEntityManager(commandContext).findById(deploymentId); if (deployment == null) { throw new FlowableObjectNotFoundException("Could not find deployment with id " + deploymentId); } deployment.setTenantId(newTenantId); // Doing process instances, executions and tasks with direct SQL updates // (otherwise would not be performant) CommandContextUtil.getDecisionTableEntityManager(commandContext).updateDecisionTableTenantIdForDeployment(deploymentId, newTenantId); // Doing decision tables in memory, cause we need to clear the decision table cache List<DmnDecisionTable> decisionTables = new DecisionTableQueryImpl().deploymentId(deploymentId).list(); for (DmnDecisionTable decisionTable : decisionTables) { CommandContextUtil.getDmnEngineConfiguration().getDecisionCache().remove(decisionTable.getId()); } CommandContextUtil.getDeploymentEntityManager(commandContext).update(deployment); return null; }
@Override public Void execute(CommandContext commandContext) { if (deploymentId == null) { throw new FlowableIllegalArgumentException("deploymentId is null"); } // Update all entities FormDeploymentEntity deployment = CommandContextUtil.getDeploymentEntityManager(commandContext).findById(deploymentId); if (deployment == null) { throw new FlowableObjectNotFoundException("Could not find deployment with id " + deploymentId); } deployment.setTenantId(newTenantId); CommandContextUtil.getFormDefinitionEntityManager(commandContext).updateFormDefinitionTenantIdForDeployment(deploymentId, newTenantId); // Doing decision tables in memory, cause we need to clear the decision table cache List<FormDefinition> formDefinitions = new FormDefinitionQueryImpl().deploymentId(deploymentId).list(); for (FormDefinition formDefinition : formDefinitions) { CommandContextUtil.getFormEngineConfiguration().getFormDefinitionCache().remove(formDefinition.getId()); } CommandContextUtil.getDeploymentEntityManager(commandContext).update(deployment); return null; }
@Override public Void execute(CommandContext commandContext) { if (processDefinitionId == null) { throw new FlowableIllegalArgumentException("Process definition id is null"); } ProcessDefinitionEntity processDefinition = CommandContextUtil.getProcessDefinitionEntityManager(commandContext).findById(processDefinitionId); if (processDefinition == null) { throw new FlowableObjectNotFoundException("No process definition found for id = '" + processDefinitionId + "'", ProcessDefinition.class); } if (Flowable5Util.isFlowable5ProcessDefinition(processDefinition, commandContext)) { Flowable5CompatibilityHandler compatibilityHandler = Flowable5Util.getFlowable5CompatibilityHandler(); compatibilityHandler.setProcessDefinitionCategory(processDefinitionId, category); return null; } // Update category processDefinition.setCategory(category); // Remove process definition from cache, it will be refetched later DeploymentCache<ProcessDefinitionCacheEntry> processDefinitionCache = CommandContextUtil.getProcessEngineConfiguration(commandContext).getProcessDefinitionCache(); if (processDefinitionCache != null) { processDefinitionCache.remove(processDefinitionId); } if (CommandContextUtil.getEventDispatcher().isEnabled()) { CommandContextUtil.getEventDispatcher().dispatchEvent(FlowableEventBuilder.createEntityEvent(FlowableEngineEventType.ENTITY_UPDATED, processDefinition)); } return null; }
processDefinitionCache.remove(processDefinition.getId());
CommandContextUtil.getProcessEngineConfiguration(commandContext).getProcessDefinitionCache().remove(processDefinition.getId());
.deploymentId(deploymentId).list(); for (ProcessDefinition processDefinition : processDefinitions) { commandContext.getProcessEngineConfiguration().getProcessDefinitionCache().remove(processDefinition.getId());