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

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


  }
 
  public List<UserTo> execute(CommandContext commandContext) {
    // TODO 自动生成的方法存根
   
    TaskInstanceEntity taskInstanceEntity=commandContext.getTaskManager().findTaskById(taskId);
    List<IdentityLink> identityLinks=taskInstanceEntity.getIdentityLinkQueryToList();
    List<UserTo> userTos=new ArrayList<UserTo>();
   
   
   
   
   
    if(taskInstanceEntity.getAssignee()!=null){
     
      String userId=taskInstanceEntity.getAssignee();
      UserTo userTo=Authentication.findUserInfoByUserId(userId);
      userTos.add(userTo);
      return userTos;
    }
   
View Full Code Here


          throw new FixFlowException("用户命令表达式执行异常!", e);
        }
      }
     
     
      TaskInstanceEntity taskInstanceImpl=(TaskInstanceEntity)executionContext.getTaskInstance();
     
     
      if(taskInstanceImpl!=null){
       
        taskInstanceImpl.setAssignee(Authentication.getAuthenticatedUserId());
       
        taskInstanceImpl.end();
        taskInstanceImpl.setDueDate(new Date());
        taskInstanceImpl.setDraft(false);
        taskInstanceImpl.setCommandId(commandId);
        taskInstanceImpl.setCommandType(StringUtil.getString(taskCommandInst.getTaskCommandType()));
        taskInstanceImpl.setCommandMessage(taskCommandInst.getName());
        taskInstanceImpl.setTaskComment(this.opinion);
        taskInstanceImpl.setAgent(null);

       
      }
    }
   
View Full Code Here

    TaskInstanceType newTaskTaskInstanceType = TaskInstanceType.FIXCALLACTIVITYTASK;
    String newTaskProcessDefinitionName = executionContext.getProcessDefinition().getName();
    boolean isDraft = false;

    // 创建任务
    TaskInstance taskInstance = new TaskInstanceEntity();
    taskInstance.setId(newTaskId);
    taskInstance.setNodeName(newTaskNodeName);
    taskInstance.setProcessInstanceId(newTaskProcessInstanceId);
    taskInstance.setProcessDefinitionId(newTaskProcessDefinitionId);
    taskInstance.setTokenId(newTaskTokenId);
    taskInstance.setNodeId(newTaskNodeId);
    taskInstance.setName(newTaskNodeName);
    taskInstance.setDescription(newTaskDescription);
    taskInstance.setCreateTime(newTaskCreateTime);
    taskInstance.setPriority(newTaskPriority);
    taskInstance.setProcessDefinitionKey(newTaskProcessDefinitionKey);
    taskInstance.setTaskInstanceType(newTaskTaskInstanceType);
    taskInstance.setProcessDefinitionName(newTaskProcessDefinitionName);
    taskInstance.setDraft(isDraft);
    taskInstance.setCallActivityInstanceId(subProcessInstanceId);

    Context.getCommandContext().getTaskManager().saveTaskInstanceEntity((TaskInstanceEntity) taskInstance);

  }
View Full Code Here

  }

  public void endSubTask(String supProcessInstanceId) {

    ProcessEngine processEngine = ProcessEngineManagement.getDefaultProcessEngine();
    TaskInstanceEntity taskInstance = (TaskInstanceEntity) processEngine.getTaskService().createTaskQuery()
        .callActivityInstanceId(supProcessInstanceId).taskNotEnd().singleResult();
    Date newTaskEndTime = ClockUtil.getCurrentTime();
    // taskInstance.setAssigneeId("1200119390");
    taskInstance.setEndTime(newTaskEndTime);
    taskInstance.setCommandId(TaskCommandType.SUBPROCESSEND);
    taskInstance.setCommandType(TaskCommandType.SUBPROCESSEND);
    TaskCommandDef taskCommandDef = Context.getProcessEngineConfiguration().getTaskCommandDefMap().get(TaskCommandType.SUBPROCESSEND);
    if (taskCommandDef != null) {
      taskInstance.setCommandMessage(taskCommandDef.getName());
    }

    Context.getCommandContext().getTaskManager().saveTaskInstanceEntity(taskInstance);

  }
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

    TaskInstanceType newTaskTaskInstanceType = TaskInstanceType.INTERMEDIATECATCHEVENT;
    String newTaskProcessDefinitionName = executionContext.getProcessDefinition().getName();
    boolean isDraft = false;

    // 创建任务
    TaskInstance taskInstance = new TaskInstanceEntity();
    taskInstance.setId(newTaskId);
    taskInstance.setNodeName(newTaskNodeName);
    taskInstance.setProcessInstanceId(newTaskProcessInstanceId);
    taskInstance.setProcessDefinitionId(newTaskProcessDefinitionId);
    taskInstance.setTokenId(newTaskTokenId);
    taskInstance.setNodeId(newTaskNodeId);
    taskInstance.setName(newTaskNodeName);
    taskInstance.setDescription(newTaskDescription);
    taskInstance.setCreateTime(newTaskCreateTime);
    taskInstance.setPriority(newTaskPriority);
    taskInstance.setProcessDefinitionKey(newTaskProcessDefinitionKey);
    taskInstance.setTaskInstanceType(newTaskTaskInstanceType);
    taskInstance.setProcessDefinitionName(newTaskProcessDefinitionName);
    taskInstance.setDraft(isDraft);
    //taskInstance.setCallActivityInstanceId(subProcessInstanceId);
    Context.getCommandContext().getTaskManager().saveTaskInstanceEntity((TaskInstanceEntity) taskInstance);

  }
View Full Code Here

  @Override
  public void leaveClearData(ExecutionContext executionContext){

    ProcessEngine processEngine=ProcessEngineManagement.getDefaultProcessEngine();
    TaskInstanceEntity taskInstance=(TaskInstanceEntity)processEngine.getTaskService().createTaskQuery().tokenId(executionContext.getToken().getId()).addTaskType(TaskInstanceType.INTERMEDIATECATCHEVENT).taskNotEnd().singleResult();
    //当发现老任务,并没有创建等待接收任务的时候,不需要清理
    if(taskInstance==null){
      return;
    }
   
   
    Date newTaskEndTime=ClockUtil.getCurrentTime();
    //taskInstance.setAssigneeId("1200119390");
    taskInstance.setEndTime(newTaskEndTime);
    taskInstance.setCommandId(TaskCommandType.RECEIVEEND);
    taskInstance.setCommandType(TaskCommandType.RECEIVEEND);
    TaskCommandDef taskCommandDef=Context.getProcessEngineConfiguration().getTaskCommandDefMap().get(TaskCommandType.RECEIVEEND);
    if(taskCommandDef!=null){
      taskInstance.setCommandMessage(taskCommandDef.getName());
    }

    Context.getCommandContext().getTaskManager().saveTaskInstanceEntity(taskInstance);
   
View Full Code Here

  public Void execute(CommandContext commandContext) {
    if (pendingTaskId == null || pendingTaskId.equals("")) {
      throw new FixFlowException("转办的任务不能为空");
    }

    TaskInstanceEntity pendingTask = Context.getCommandContext().getTaskManager().findTaskById(pendingTaskId);

    // 初始化任务命令执行所需要的常用对象
    loadProcessParameter(commandContext);

    // 将外部变量注册到流程实例运行环境中
    addVariable();

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

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

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

    // 结束当前任务,但是不驱动令牌继续向下
    taskInstance.customEnd(taskCommand, taskComment);

    // 获取当前任务的处理者
    String assigneeId = taskInstance.getAssignee();

    // 将当前任务的设置为转办状态
    taskInstance.setDelegationState(DelegationState.PENDING);

    // 拷贝出一个新的任务
    TaskInstanceEntity taskInstanceNew = taskInstance.clone();
    // 设置新任务的GUID
    taskInstanceNew.setId(GuidUtil.CreateGuid());
    // 将新任务的处理者设置为需要转办的人
    taskInstanceNew.setAssignee(pendingTask.getAssignee());
    // 重置任务的创建时间
    taskInstanceNew.setCreateTime(ClockUtil.getCurrentTime());
    // 设置任务的原始拥有者,以便在还回的时候找到原始处理者
    taskInstanceNew.setOwner(assigneeId);
    // 将任务设置为还回状态
    taskInstanceNew.setDelegationState(DelegationState.RESOLVED);
    // 将新任务的结束时间设置为空
    taskInstanceNew.setEndTime(null);
    // 将新任务的任务命令的编号设置为空
    taskInstanceNew.setCommandId(null);
    // 将新任务的任务命令类型设置为空
    taskInstanceNew.setCommandType(null);
    // 将新任务的任务命令文本设置为空
    taskInstanceNew.setCommandMessage(null);
    // 将新任务的意见设置为空
    taskInstanceNew.setTaskComment(null);
    // 将新任务的代理人设置为空
    taskInstanceNew.setAgent(null);
    // 将新任务的管理员设置为空
    taskInstanceNew.setAdmin(null);
    //将新任务的表单设置为转办任务的表单
    taskInstanceNew.setFormUri(pendingTask.getFormUri());
    //将新任务的浏览表单设置为转办任务的浏览表单
    taskInstanceNew.setFormUriView(pendingTask.getFormUriView());

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

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

public class UpdateTaskInstance implements UpdateRulesScript {

  public void execute(Object parameter, SqlCommand sqlCommand, ProcessEngineConfigurationImpl processEngineConfiguration) {
    TaskInstanceEntity taskInstance=(TaskInstanceEntity)parameter;
    Object[] objectParamWhere = new Object[1];
    objectParamWhere[0]=taskInstance.getId() ;
    sqlCommand.update(TableUtil.getTaskInstanceRunTableName(),  taskInstance.getPersistentDbMap(), " TASKINSTANCE_ID=?",objectParamWhere);
 
  }
View Full Code Here

   
    //执行处理命令中的开发人员设置的表达式
    runCommandExpression();
   
    //获取正在操作的任务实例对象
    TaskInstanceEntity taskInstance=getTaskInstanceEntity();
   
    //获取正在操作的任务命令对象实例
    TaskCommandInst taskCommand=getTaskCommandInst();
   

    if(taskInstance!=null){
     
      //结束任务,并推动token运行
      taskInstance.end(taskCommand, this.taskComment);

    }
    else{
      throw new FixFlowException("没有找到id为: "+taskId+" 的任务");
    }
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.