Package com.founder.fix.fixflow.core.impl.task

Examples of com.founder.fix.fixflow.core.impl.task.TaskInstanceEntity


      // 执行处理命令中的开发人员设置的表达式
      runCommandExpression();

      // 获取正在操作的任务实例对象
      TaskInstanceEntity taskInstance = getTaskInstanceEntity();

      // 获取正在操作的任务命令对象实例
      TaskCommandInst taskCommand = getTaskCommandInst();

      taskInstance.customEnd(taskCommand, taskComment);

      // 拷贝出一个新的任务
      TaskInstanceEntity taskInstanceNew = taskInstance.clone();

      taskInstanceNew.setId(GuidUtil.CreateGuid());
      taskInstanceNew.setAssignee(transferUserId);
      taskInstanceNew.setCreateTime(ClockUtil.getCurrentTime());
      taskInstanceNew.setEndTime(null);
      taskInstanceNew.setCommandId(null);
      taskInstanceNew.setCommandType(null);
      taskInstanceNew.setCommandMessage(null);
      taskInstanceNew.setTaskComment(null);
      taskInstanceNew.setAgent(null);
      taskInstanceNew.setAdmin(null);
      taskInstanceNew.setDraft(false);

      // 获取当前正在操作的流程实例对象
      ProcessInstanceEntity processInstance = getProcessInstance();
      // 将新创建的出的任务插入任务管理器中
      processInstance.getTaskMgmtInstance().addTaskInstanceEntity(taskInstanceNew);
View Full Code Here


    // 执行处理命令中的开发人员设置的表达式
    runCommandExpression();

    // 获取正在操作的任务实例对象
    TaskInstanceEntity taskInstance = getTaskInstanceEntity();

    // 获取正在操作的任务命令对象实例
    TaskCommandInst taskCommand = getTaskCommandInst();
   
    ProcessInstanceEntity processInstanceImpl=getProcessInstance();
   
    ProcessDefinitionBehavior processDefinition=processInstanceImpl.getProcessDefinition();


    if (businessKey != null) {
      processInstanceImpl.setBizKeyWithoutCascade(this.businessKey);
    }

    if (initiator != null) {
      processInstanceImpl.setInitiatorWithoutCascade(this.initiator);
    }

    if (processDefinition.getTaskSubject() != null && processDefinition.getTaskSubject().getExpressionValue() != null) {

      Object result = ExpressionMgmt.execute(processDefinition.getTaskSubject().getExpressionValue(), getExecutionContext());

      if (result != null) {
        processInstanceImpl.setSubject(result.toString());
      }
    } else {
      processInstanceImpl.setSubject(processDefinition.getName());
    }

   
    TaskInstanceEntity taskInstanceImpl = getTaskInstanceEntity();

   


    if (taskInstanceImpl != null) {
View Full Code Here

    if (taskId == null||taskId.equals("")) {
      throw new FixFlowException("任务编号为空!");
    }


    TaskInstanceEntity task = Context.getCommandContext().getTaskManager()
        .findTaskById(taskId);

    if (task == null) {
      throw new FixFlowException("无法找到编号为: " + taskId + " 的任务!");
    }
    if (Authentication.getAuthenticatedUserId() != null) {
      if (task.getAssignee() != null) {
        if (!task.getAssignee().equals(Authentication.getAuthenticatedUserId())) {
          // 当任务已经被另一个不是自己的用户占有,则抛出异常。
          throw new FixFlowException("任务 " + taskId + " 已经被另一个用户领取!您不能做还回操作!");
        }
        else{
         
          if(task.getIdentityLinkQueryToList().size()>0){
            task.setAssignee(null);
            task.setClaimTime(null);
            Context.getCommandContext().getTaskManager()
                .saveTaskInstanceEntity(task);
          }
          else{
            throw new FixFlowBizException("任务 " + taskId + " 没有候选处理者不能被释放!");
View Full Code Here

    // 执行处理命令中的开发人员设置的表达式
    runCommandExpression();

    // 获取当前正在操作的任务对象
    TaskInstanceEntity taskInstance = getTaskInstanceEntity();

    // 获取当前正在操作的任务命令
    TaskCommandInst taskCommand = getTaskCommandInst();

    String owner = taskInstance.getOwner();


    taskInstance.customEnd(taskCommand, taskComment);

    taskInstance.setDelegationState(DelegationState.RESOLVED);

    // 拷贝出一个新的任务
    TaskInstanceEntity taskInstanceNew = taskInstance.clone();

    taskInstanceNew.setId(GuidUtil.CreateGuid());
    taskInstanceNew.setAssignee(owner);
    taskInstanceNew.setCreateTime(ClockUtil.getCurrentTime());

    taskInstanceNew.setEndTime(null);
    taskInstanceNew.setCommandId(null);
    taskInstanceNew.setCommandType(null);
    taskInstanceNew.setCommandMessage(null);
    taskInstanceNew.setTaskComment(null);
    taskInstanceNew.setAgent(null);
    taskInstanceNew.setAdmin(null);
    taskInstanceNew.setDelegationState(null);

    if (taskInstanceNew.getPendingTaskId() == null) {

    } else {
      TaskInstanceEntity resolvedTask = Context.getCommandContext().getTaskManager().findTaskById(taskInstanceNew.getPendingTaskId());

      taskInstanceNew.setFormUri(resolvedTask.getFormUri());
    }

    // 获取当前正在操作的流程实例对象
    ProcessInstanceEntity processInstance = getProcessInstance();
    // 将新创建的出的任务插入任务管理器中
View Full Code Here

import com.founder.fix.fixflow.expand.database.TableUtil;

public class InsertTaskInstance implements InsertRulesScript {

  public void execute(Object parameter, SqlCommand sqlCommand, ProcessEngineConfigurationImpl processEngineConfiguration) {
    TaskInstanceEntity taskInstance=(TaskInstanceEntity)parameter;
    sqlCommand.insert(TableUtil.getTaskInstanceRunTableName(), taskInstance.getPersistentDbMap());
  }
View Full Code Here

    if (taskId == null||taskId.equals("")) {
      throw new FixFlowException("任务编号为空!");
    }


    TaskInstanceEntity task = Context.getCommandContext().getTaskManager()
        .findTaskById(taskId);
   
    if (task == null) {
      throw new FixFlowException("无法找到编号为: " + taskId + " 的任务!");
    }
    if(task.hasEnded()){
      throw new FixFlowBizException("当前的任务已经结束,无法继续处理!");
    }
   
    if (Authentication.getAuthenticatedUserId() != null) {
     
     
      if(this.agent!=null&&!this.agent.equals("")){
       
        if (task.getAssignee() != null) {
          if (!task.getAssignee().equals(this.agent)) {
            // 当任务已经被另一个不是自己的用户占有,则抛出异常。
            throw new FixFlowException("任务 " + taskId + " 已经被另一个用户领取!");
          }
        } else {
         
          task.setAssignee(this.agent);
          task.setClaimTime(ClockUtil.getCurrentTime());
          Context.getCommandContext().getTaskManager()
              .saveTaskInstanceEntity(task);
         
        }
   
       
      }
      else{

          if (task.getAssignee() != null) {
            if (!task.getAssignee().equals(Authentication.getAuthenticatedUserId())) {
              // 当任务已经被另一个不是自己的用户占有,则抛出异常。
              throw new FixFlowException("任务 " + taskId + " 已经被另一个用户领取!");
            }
          } else {
           
            task.setAssignee(Authentication.getAuthenticatedUserId() );
            task.setClaimTime(ClockUtil.getCurrentTime());
            Context.getCommandContext().getTaskManager()
                .saveTaskInstanceEntity(task);
           
          }
     
      }
     
     
     
    }
    else{
      // 当用户编号为空的时候则将该任务设置为任何人都可以获取
      task.setAssignee(null);
      Context.getCommandContext().getTaskManager()
          .saveTaskInstanceEntity(task);
    }
   
   
View Full Code Here

    // 执行处理命令中的开发人员设置的表达式
    runCommandExpression();

    // 获取正在操作的任务实例对象
    TaskInstanceEntity taskInstance = getTaskInstanceEntity();

    // 获取正在操作的任务命令对象实例
    TaskCommandInst taskCommand = getTaskCommandInst();

    try {

      UserTaskBehavior backNodeUserTask = (UserTaskBehavior) getExecutionContext().getProcessDefinition().getDefinitions().getElement(rollBackNodeId);
      taskInstance.toFlowNodeEnd(taskCommand, taskComment, backNodeUserTask, null);

    } catch (Exception e) {

      throw new FixFlowException("任务: " + taskId + " 退回失败!", e);
    }
View Full Code Here

    // 执行处理命令中的开发人员设置的表达式
    // runCommandExpression();

    // 获取正在操作的任务实例对象
    TaskInstanceEntity taskInstance = getTaskInstanceEntity();

    // 获取正在操作的任务命令对象实例
    TaskCommandInst taskCommand = getTaskCommandInst();
   
   
   
   
   
   

   

    if (taskInstance != null) {
      // 结束任务
      taskInstance.customEnd(taskCommand, this.taskComment);

    }

    ProcessInstanceEntity processInstanceImpl = getProcessInstance();
   
    String parentProcessTokenId=processInstanceImpl.getParentProcessInstanceTokenId();
    if(StringUtil.isEmpty(parentProcessTokenId)){
      throw new FixFlowException("流程实例没有父流程");
    }
   
    // 终止流程实例
    processInstanceImpl.termination();

    saveProcessInstance(commandContext);

    ProcessInstanceEntity parentProcessInstance = processInstanceImpl.getParentProcessInstance();

    parentProcessInstance.terminationSubProcess(parentProcessTokenId);
   
   

   

    ExecutionContext subExecutionContext = getExecutionContext();

    Object expressionValue = null;
    if (taskCommand != null && taskCommand.getExpression() != null) {
      try {

        expressionValue = ExpressionMgmt.execute(taskCommand.getExpression(), subExecutionContext);

      } catch (Exception e) {
        throw new FixFlowException(taskInstance.getToken().getFlowNode().getName() + " 节点,用户命令表达式执行异常!", e);
      }
    }
    String rollBackNodeId = null;
    if (expressionValue != null && !expressionValue.equals("")) {
      rollBackNodeId = expressionValue.toString();
View Full Code Here

    TokenEntity parentToken=parentProcessInstance.getTokenMap().get(parentProcessTokenId);
   
    ExecutionContext parentExecutionContext=ProcessObjectFactory.FACTORYINSTANCE.createExecutionContext(parentToken);
   
   
    TaskInstanceEntity taskInstanceCallAct = (TaskInstanceEntity) processEngine.getTaskService().createTaskQuery()
        .callActivityInstanceId(subProcessInstanceId).taskNotEnd().singleResult();
   
    // 获取正在操作的任务命令对象实例
    TaskCommandInst taskCommand = getTaskCommandInst();
    taskInstanceCallAct.customEnd(taskCommand, this.taskComment);
    taskInstanceCallAct.setAssignee(Authentication.getAuthenticatedUserId());
    Context.getCommandContext().getTaskManager().saveTaskInstanceEntity((TaskInstanceEntity) taskInstanceCallAct);

   
    List<TaskInstance> taskInstanceQueryTos = (new GetRollBackTaskCmd(taskInstanceCallAct.getId())).execute(commandContext);
   
    TaskInstance taskInstanceQueryRollBack = null;

    for (TaskInstance taskInstanceQueryTo : taskInstanceQueryTos) {
      if (taskInstanceQueryTo.getNodeId().equals(rollBackNodeId)) {
View Full Code Here

      if (mailInfoObj == null) {
        throw new FixFlowException("系统邮件配置错误请检查流程邮件配置!");
      }

      // 获取到当前任务
      TaskInstanceEntity taskInstance = (TaskInstanceEntity) executionContext.getTaskInstance();
      String flowNameString = taskInstance.getProcessDefinition().getName();
      String taskUrl = "http://localhost:8080/fixweb/";
      if (mailTitle == null || mailTitle.equals("")) {
        mailTitle = "[" + flowNameString + "] " + taskInstance.getDescription() + " is pending for your approval or handle";
      }

      String Fix_BizName = StringUtil.getString(Context.getAbstractScriptLanguageMgmt().execute("${Fix_BizName}", executionContext));
      String Fix_BizKeyFile = StringUtil.getString(Context.getAbstractScriptLanguageMgmt().execute("${Fix_BizKeyFile}", executionContext));
      if (Fix_BizName == null || Fix_BizName.equals("")) {
        throw new FixFlowException("数据变量${Fix_BizName}未空");
      }
      if (Fix_BizKeyFile == null || Fix_BizKeyFile.equals("")) {
        throw new FixFlowException("数据变量${Fix_BizKeyFile}未空");
      }
      String taskType="view";
      if(taskInstance.getAssignee()!=null){
        taskType="modify";
      }

      taskUrl = "http://localhost:8080/fixweb/framework.html?" + "_openMethod=tab&_title=view&_url='%2e%2e/%2e%2e/"
          + taskInstance.getFormUri() + "?_objName=" + Fix_BizName + "%26_defKey=" + taskInstance.getProcessDefinitionKey() + "%26_defId="
          + taskInstance.getProcessDefinitionId().replace(":", "%3A") + "%26_instId=" + taskInstance.getProcessInstanceId() + "%26_taskId="
          + taskInstance.getId() + "%26_nodeId=" + taskInstance.getNodeId() + "%26_agent=%26_pk=" + Fix_BizKeyFile + "%26_pkValue="
          + taskInstance.getBizKey() + "%26_useType="+taskType+"'";

      //taskUrl=java.net.URLEncoder.encode(taskUrl,"UTF-8");
      if (mailContent == null || mailContent.equals("")) {
        mailContent = "<br>Hello,<br>你好,<br><br> " + mailTitle + "+<br><br>"
            + "Please click url to deal with job: <br>请访问此链接地址进入任务:<br> <a href=" + taskUrl + ">"
            + "http://localhost:8080/fixweb/</a><br><br>"
            + "Best Regards!<br>诚挚问候!<br>Note: Please do not reply to this email , This mailbox does not allow incoming messages."
            + "<br>注意: 本邮件为工作流系统发送,请勿回复。 ";

      }

      UserDefinition userDefinition = Context.getProcessEngineConfiguration().getUserDefinition();

      List<GroupDefinition> groupDefinitions = Context.getProcessEngineConfiguration().getGroupDefinitions();

      if (taskInstance.getAssignee() != null) {
        String to = taskInstance.getAssignee();
        if (!to.equals("")) {
          UserTo userTo = userDefinition.findUserByUserId(to);
          if (userTo != null) {
            String eamil = StringUtil.getString(userTo.getPropertyValue("EMAIL"));
            if (eamil != null && !eamil.equals("")) {
              sendMail(eamil, mailTitle, mailContent,taskInstance);
            }
          }
        }

      } else {

        String to = "";

        for (IdentityLink identityLink : taskInstance.getTaskIdentityLinks()) {

          if (identityLink.getUserId() != null) {
            UserTo userTo = Authentication.findUserInfoByUserId(identityLink.getUserId());
            if (userTo != null) {
              String eamil = StringUtil.getString(userTo.getPropertyValue("EMAIL"));
View Full Code Here

TOP

Related Classes of com.founder.fix.fixflow.core.impl.task.TaskInstanceEntity

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.