コード例 #1
0
  @Override
  public void initialize(List<Parameter> parameterList) throws WorkflowImplException {

    if (!validateParams(parameterList)) {
      throw new WorkflowRuntimeException(
          "Workflow initialization failed, required parameter is missing");
    }

    Parameter wfNameParameter =
        WorkflowManagementUtil.getParameter(
            parameterList,
            WFConstant.ParameterName.WORKFLOW_NAME,
            WFConstant.ParameterHolder.WORKFLOW_IMPL);

    if (wfNameParameter != null) {
      processName = StringUtils.deleteWhitespace(wfNameParameter.getParamValue());
      role =
          WorkflowManagementUtil.createWorkflowRoleName(
              StringUtils.deleteWhitespace(wfNameParameter.getParamValue()));
    }

    int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();
    String tenantDomain = CarbonContext.getThreadLocalCarbonContext().getTenantDomain();
    if (!MultitenantConstants.SUPER_TENANT_DOMAIN_NAME.equals(tenantDomain)) {
      tenantContext = "t/" + tenantDomain + "/";
    }

    Parameter bpsProfileParameter =
        WorkflowManagementUtil.getParameter(
            parameterList,
            WFImplConstant.ParameterName.BPS_PROFILE,
            WFConstant.ParameterHolder.WORKFLOW_IMPL);
    if (bpsProfileParameter != null) {
      String bpsProfileName = bpsProfileParameter.getParamValue();
      bpsProfile =
          WorkflowImplServiceDataHolder.getInstance()
              .getWorkflowImplService()
              .getBPSProfile(bpsProfileName, tenantId);
    }
    htName = processName + BPELDeployer.Constants.HT_SUFFIX;

    generateAndDeployArtifacts();
  }
コード例 #2
0
 @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);
   }
 }
コード例 #3
0
  @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());
  }