@Override public void removeWorkflow(String workflowId) throws WorkflowException { Workflow workflow = workflowDAO.getWorkflow(workflowId); // Deleting the role that is created for per workflow if (workflow != null) { WorkflowManagementUtil.deleteWorkflowRole( StringUtils.deleteWhitespace(workflow.getWorkflowName())); workflowDAO.removeWorkflowParams(workflowId); workflowDAO.removeWorkflow(workflowId); } }
@Override public void addWorkflow(Workflow workflow, List<Parameter> parameterList, int tenantId) throws WorkflowException { // TODO:Workspace Name may contain spaces , so we need to remove spaces and prepare process for // that Parameter workflowNameParameter = new Parameter( workflow.getWorkflowId(), WFConstant.ParameterName.WORKFLOW_NAME, workflow.getWorkflowName(), WFConstant.ParameterName.WORKFLOW_NAME, WFConstant.ParameterHolder.WORKFLOW_IMPL); if (!parameterList.contains(workflowNameParameter)) { parameterList.add(workflowNameParameter); } else { workflowNameParameter = parameterList.get(parameterList.indexOf(workflowNameParameter)); } if (!workflowNameParameter.getParamValue().equals(workflow.getWorkflowName())) { workflowNameParameter.setParamValue(workflow.getWorkflowName()); // TODO:Since the user has changed the workflow name, we have to undeploy bpel package that is // already // deployed using previous workflow name. } AbstractWorkflow abstractWorkflow = WorkflowServiceDataHolder.getInstance() .getWorkflowImpls() .get(workflow.getTemplateId()) .get(workflow.getWorkflowImplId()); // deploying the template abstractWorkflow.deploy(parameterList); // add workflow to the database if (workflowDAO.getWorkflow(workflow.getWorkflowId()) == null) { workflowDAO.addWorkflow(workflow, tenantId); WorkflowManagementUtil.createAppRole( StringUtils.deleteWhitespace(workflow.getWorkflowName())); } else { workflowDAO.removeWorkflowParams(workflow.getWorkflowId()); workflowDAO.updateWorkflow(workflow); } workflowDAO.addWorkflowParams(parameterList, workflow.getWorkflowId()); }
/** * Removes BPS artifacts of a particular workflow. * * @param workflow Workflow request to be deleted. * @throws WorkflowImplException */ public void removeBPSPackage(Workflow workflow) throws WorkflowImplException { try { WorkflowImplService workflowImplService = WorkflowImplServiceDataHolder.getInstance().getWorkflowImplService(); if (workflowImplService == null) { log.error("Error while initialising WorkflowImplService"); throw new WorkflowImplException( "Error when removing BPS artifacts of: " + workflow.getWorkflowName()); } workflowImplService.removeBPSPackage(workflow); } catch (WorkflowImplException e) { log.error("Error when removing BPS artifacts of: " + workflow.getWorkflowName(), e); throw new WorkflowImplException(e.getMessage()); } }