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

Examples of com.founder.fix.fixflow.core.task.TaskQuery


    String leftJoinStr = "";

    QueryExpandTo queryExpandTo = new QueryExpandTo();
   
    try {
      TaskQuery tq = engine.getTaskService().createTaskQuery();
     
      tq.taskAssignee(StringUtil.getString(filter.get("userId")));
      tq.taskCandidateUser(StringUtil.getString(filter.get("userId")));
//      tq.processDefinitionKey(StringUtil.getString(filter.get("pdkey")));
     
      String descritpion = StringUtil.getString(filter.get("title"));
      if(StringUtil.isNotEmpty(descritpion))
        tq.taskDescriptionLike(descritpion);
     
      String initor     = StringUtil.getString(filter.get("initor"));
      if(StringUtil.isNotEmpty(initor))
        tq.initiator(initor);
     
      //发起人模糊匹配
      String initorName = StringUtil.getString(filter.get("initorName"));
      if (StringUtil.isNotEmpty(initorName)) {
        initorName = initorName.replace("'", "");
        ProcessEngine processEngine = ProcessEngineManagement
            .getDefaultProcessEngine();
        AllUserInfo userInfoConfig = processEngine
            .getProcessEngineConfiguration().getUserDefinition()
            .getUserInfoConfig();
        leftJoinStr += " LEFT JOIN (" + userInfoConfig.getSqlText()
            + ") UT on UT." + userInfoConfig.getUserIdField()
            + " = P.INITIATOR ";
        whereSql += " and (UT." + userInfoConfig.getUserNameField()
            + " LIKE '%" + initorName + "%'  or UT."
            + userInfoConfig.getUserIdField() + " = '"
            + initorName + "')";
      }

     
      String bizKey     = StringUtil.getString(filter.get("bizKey"));
      if(StringUtil.isNotEmpty(bizKey))
        tq.businessKeyLike(bizKey);
     
      String processDefinitionName     = StringUtil.getString(filter.get("processDefinitionName"));
      if(StringUtil.isNotEmpty(processDefinitionName))
        tq.processDefinitionNameLike(processDefinitionName);
     
      Date dates = null;
      Date datee = null;
      String dss = StringUtil.getString(filter.get("arrivalTimeS"));
      String dse = StringUtil.getString(filter.get("arrivalTimeE"));
      if(StringUtil.isNotEmpty(dss)){
        dates = DateUtil.stringToDate(dss,"yyyy-MM-dd");
      }
      if(StringUtil.isNotEmpty(dse)){
        String endTime = "235959999";
        dse += endTime;
        datee = DateUtil.stringToDate(dse,"yyyy-MM-ddHHmmssSSS");
      }
      if(dates!=null)
        tq.taskCreatedAfter(datee);
     
      if(datee!=null)
        tq.taskCreatedBefore(dates);
     
      String pageI = StringUtil.getString(filter.get("pageIndex"));
      String rowI = StringUtil.getString(filter.get("pageSize"));
     
      int pageIndex=1;
      int rowNum   =15;
      if(StringUtil.isNotEmpty(pageI)){
        pageIndex = Integer.valueOf(pageI);
      }
      if(StringUtil.isNotEmpty(rowI)){
        rowNum = Integer.valueOf(rowI);
      }
     
      if(filter.get("ended")==null)
        tq.taskNotEnd();
     
      if(StringUtil.isNotEmpty(StringUtil.getString(filter.get("agentUserId")))){
        tq.isAgent(true);
        if(filter.get("agentType").equals("1")){
          tq.taskAssignee(StringUtil.getString(filter.get("userId")));
          tq.taskCandidateUser(StringUtil.getString(filter.get("userId")));
          tq.agentId(StringUtil.getString(filter.get("agentUserId")));
        }else{
          tq.taskAssignee(StringUtil.getString(filter.get("agentUserId")));
          tq.taskCandidateUser(StringUtil.getString(filter.get("agentUserId")));
          tq.agentId(StringUtil.getString(filter.get("userId")));
        }
      }else{
        tq.taskAssignee(StringUtil.getString(filter.get("userId")));
        tq.taskCandidateUser(StringUtil.getString(filter.get("userId")));
      }
     
     
      if (StringUtil.isNotEmpty(leftJoinStr)) {
        queryExpandTo.setLeftJoinSql(leftJoinStr);
      }
      queryExpandTo.setWhereSql(whereSql);
      tq.queryExpandTo(queryExpandTo);
     
      List<TaskInstance> lts = tq.orderByTaskCreateTime().desc().listPagination(pageIndex, rowNum);
      Long count = tq.count();
      List<Map<String,Object>> instanceMaps = new ArrayList<Map<String,Object>>();
     
      Pagination page = new Pagination(pageIndex,rowNum);
      page.setTotal(count.intValue());
      IdentityService identsvz = engine.getIdentityService();
View Full Code Here


      String userId = (String) filter.get("userId");
      ProcessEngine engine = getProcessEngine(userId);
      ProcessInstance processInstance = engine.getRuntimeService().getProcessInstance(processInstanceId);
      String processName = processInstance.getProcessDefinition().getName();
      try{
        TaskQuery tq = engine.getTaskService().createTaskQuery();
        IdentityService identityService = engine.getIdentityService();
        tq.processInstanceId(processInstanceId);
        tq.taskIsEnd().orderByEndTime().asc();
        List<TaskInstance> instances = tq.list();
        List<Map<String,Object>> instanceMaps = new ArrayList<Map<String,Object>>();
        for(TaskInstance tmp:instances){
          Map<String,Object> instanceMap = tmp.getPersistentState();
          String assigneeUserId = tmp.getAssignee();
          if(StringUtil.isNotEmpty(assigneeUserId)){
            UserTo tmpUser = identityService.getUserTo(assigneeUserId);
            if(tmpUser!=null){
              instanceMap.put("assgneeUserName", tmpUser.getUserName());
            }
          }else{
            instanceMap.put("assgneeUserName", "(空用户名)");
          }
          instanceMaps.add(instanceMap);
        }
        tq.taskNotEnd().orderByTaskCreateTime().asc();
        List<TaskInstance> instancesNotEnd = tq.list();
       
        List<Map<String,Object>> notEndInstanceMaps = new ArrayList<Map<String,Object>>();
        for(TaskInstance tmp:instancesNotEnd){
          Map<String,Object> instanceMap = tmp.getPersistentState();
          String assigneeUserId = tmp.getAssignee();
View Full Code Here

    //拿到流程实例ID
    String processInstanceId = processInstance.getId();
    // 验证是否成功启动
    assertNotNull(processInstanceId);
   
    TaskQuery taskQuery = taskService.createTaskQuery();
    // 查找 1200119390 的这个流程实例的当前独占任务
    List<TaskInstance> taskInstances = taskQuery.taskAssignee("1200119390").processInstanceId(processInstanceId).taskNotEnd().list();

    //任务主题流程默认给了人工任务测试流程,那就是人工任务测试流程
//    assertEquals("人工任务测试流程", taskInstances.get(0).getDescription());
    //如果有节点上设置的主题,那就用节点上设置的主题
    assertEquals("节点主题", taskInstances.get(0).getDescription());
View Full Code Here

    //拿到流程实例ID
    String processInstanceId = processInstance.getId();
    // 验证是否成功启动
    assertNotNull(processInstanceId);
   
    TaskQuery taskQuery = taskService.createTaskQuery();
    // 查找 1200119390 的这个流程实例的当前独占任务
    List<TaskInstance> taskInstances = taskQuery.taskAssignee("1200119390").processInstanceId(processInstanceId).taskNotEnd().list();
    //直接跳到任务节点UserTask_4上
    assertEquals("UserTask_4", taskInstances.get(0).getNodeId());
    //查询已经完成的任务
    List<TaskInstance> taskInstances2 = taskQuery.taskAssignee("1200119390").processInstanceId(processInstanceId).taskIsEnd().list();
    for (TaskInstance taskInstance : taskInstances2) {
      //循环,查询任务类型是FIXBPMTASK的
      if(taskInstance.getTaskInstanceType().toString().equals("FIXBPMTASK")) {
        //查看处理命令类型是不是自动跳过
        assertEquals("skipNode", taskInstance.getCommandType());
View Full Code Here

    ExpandClassConfig expandClassConfig=processEngineConfiguration.getExpandClassConfig();
    List<ExpandClass>  expandClasses=expandClassConfig.getExpandClass();
    for (ExpandClass expandClass : expandClasses) {
      if(expandClass.getClassId().equals("TaskQuery")){
        Object[] objTemp = new Object[] {commandExecutor}
        TaskQuery taskQuery =(TaskQuery) ReflectUtil.instantiate(expandClass.getClassImpl(),objTemp);
        return taskQuery;
      }
    }
    throw new FixFlowException("流程引擎扩展配置里的TaskQuery实现类指定错误");
  }
View Full Code Here

      throws Exception {
    Map<String,Object> result = new HashMap<String,Object>();
    ProcessEngine engine = getProcessEngine(filter
        .get("userId"));
    try {
      TaskQuery tq = engine.getTaskService().createTaskQuery();
      String descritpion = StringUtil.getString(filter.get("title"));
      if(StringUtil.isNotEmpty(descritpion))
        tq.taskDescriptionLike(descritpion);
     
      String initor     = StringUtil.getString(filter.get("initor"));
      if(StringUtil.isNotEmpty(initor))
        tq.initiatorLike(initor);
     
      String bizKey     = StringUtil.getString(filter.get("bizKey"));
      if(StringUtil.isNotEmpty(bizKey))
        tq.businessKeyLike(bizKey);
     
      String processDefinitionName     = StringUtil.getString(filter.get("processDefinitionName"));
      if(StringUtil.isNotEmpty(processDefinitionName))
        tq.processDefinitionNameLike(processDefinitionName);
     
      Date dates = null;
      Date datee = null;
      String dss = StringUtil.getString(filter.get("arrivalTimeS"));
      String dse = StringUtil.getString(filter.get("arrivalTimeE"));
      if(StringUtil.isNotEmpty(dss)){
        dates = DateUtil.stringToDate(dss,"yyyy-MM-dd");
      }
      if(StringUtil.isNotEmpty(dse)){
        String endTime = "235959999";
        dse += endTime;
        datee = DateUtil.stringToDate(dse,"yyyy-MM-ddHHmmssSSS");
      }
      if(dates!=null)
        tq.taskCreatedAfter(datee);
     
      if(datee!=null)
        tq.taskCreatedBefore(dates);
     
      String pageI = StringUtil.getString(filter.get("pageIndex"));
      String rowI = StringUtil.getString(filter.get("pageSize"));
     
      int pageIndex=1;
      int rowNum   =15;
      if(StringUtil.isNotEmpty(pageI)){
        pageIndex = Integer.valueOf(pageI);
      }
      if(StringUtil.isNotEmpty(rowI)){
        rowNum = Integer.valueOf(rowI);
      }
     
      if(filter.get("ended")==null)
        tq.taskNotEnd();
      tq.orderByTaskCreateTime().desc();
      List<TaskInstance> lts = tq.listPagination(pageIndex, rowNum);
      Long count = tq.count();
      List<Map<String,Object>> instanceMaps = new ArrayList<Map<String,Object>>();
     
      Pagination page = new Pagination(pageIndex,rowNum);
      page.setTotal(count.intValue());
      IdentityService identsvz = engine.getIdentityService();
View Full Code Here

      if (processInstanceQueryTo.getEndTime() != null) {
        return "完成";
      }

      List<TaskInstance> taskInstanceQueryTos = new ArrayList<TaskInstance>();
      TaskQuery tq = engine.getTaskService().createTaskQuery();
      tq.processInstanceId(processInstanceId);
      tq.taskNotEnd();
      taskInstanceQueryTos = tq.list();
      for (TaskInstance taskInstanceQueryTo2 : taskInstanceQueryTos) {
        if (taskInfo.equals("") && taskInstanceQueryTos.size() == 1) {
          taskInfo = taskInfo + processState(taskInstanceQueryTo2,engine);
        } else {
          taskInfo = taskInfo + "<div>"
View Full Code Here


   

    ProcessEngine processEngine = ProcessEngineManagement.getDefaultProcessEngine();
    TaskQuery taskQuery = processEngine.getTaskService().createTaskQuery();
    List<TaskInstance> taskInstancesEnd = taskQuery.processInstanceId(taskInstanceQuery.getProcessInstanceId())
        .taskAssignee(Authentication.getAuthenticatedUserId()).addTaskType(TaskInstanceType.FIXFLOWTASK).addTaskType(TaskInstanceType.FIXNOTICETASK).taskIsEnd().list();

    String tokenId = taskInstanceQuery.getTokenId();
    String nodeId = taskInstanceQuery.getNodeId();
    String processDefinitionId = taskInstanceQuery.getProcessDefinitionId();
View Full Code Here

    Map<String,FlowNode> flowNodes=CoreUtil.getBeforeFlowNode(token.getFlowNode());
   
    //获取这个令牌自己和爸爸相关的所有任务

   
    TaskQuery taskQuery=new TaskQueryImpl(Context.getCommandContext());


    List<TaskInstance> taskInstanceQueryToList = new ArrayList<TaskInstance>();


    taskQuery.processInstanceId(processInstanceId);
    taskQuery.taskIsEnd().orderByEndTime().asc().orderByTaskCreateTime().asc();
    taskInstanceQueryToList = taskQuery.list();
   
   
   
    List<String> processInstanceIdList=new ArrayList<String>();
    processInstanceIdList.add(token.getProcessInstanceId());
View Full Code Here

    ProcessInstance processInstance = (ProcessInstance)taskService.expandTaskComplete(expandTaskCommand, null);
    String processInstanceId = processInstance.getId();
    //验证是否成功启动
    assertNotNull(processInstanceId);
   
    TaskQuery taskQuery = taskService.createTaskQuery();
   
    /**********************本例子通过扩展查询的方法获取TaskServiceNewTest流程的nodeid = UserTask_1的任务实例***************************/
    QueryExpandTo queryExpandTo = new QueryExpandTo();
    //常见扩展查询的参数列表
    List<Object> whereSqlObj = new ArrayList<Object>();
    //添加扩展wheresql语句    (本例子扩展方法查询正在运行的流程实例)
    queryExpandTo.setWhereSql("NODE_ID = ?");
    //增加扩展wheresql的参数
    whereSqlObj.add("UserTask_1");
    queryExpandTo.setWhereSqlObj(whereSqlObj);
    //增加扩展查询
    taskQuery.queryExpandTo(queryExpandTo);
    //查询TaskServiceNewTest经过扩展查询后的结果
    taskQuery.processDefinitionKey("TaskServiceNewTest");
    List<TaskInstance> list = taskQuery.list();
    //验证是否为1个
    assertEquals(1, list.size());
    //获取得到的任务实例
    TaskInstance taskInstance = list.get(0);
    //验证得到的任务实例nodeid是否正确
    assertEquals("UserTask_1", taskInstance.getNodeId());
   
    /**********************本例子通过扩展查询的方法获取流程定义表中的procecss_name和resource_name字段***************************/
    //重置流程实例查询
    taskQuery = taskService.createTaskQuery();
    //创建扩展查询
    queryExpandTo = new QueryExpandTo();
    //添加扩展的字段
    queryExpandTo.setFieldSql("fixflow_def_processdefinition.PROCESS_NAME,fixflow_def_processdefinition.RESOURCE_NAME");
    //增加扩展查询的left join语句(taskinstance持久化层的别名是“T”所以连接时需要加上,否则可能出现“未明确定义列”)
    queryExpandTo.setLeftJoinSql("left join fixflow_def_processdefinition on T.processdefinition_id = fixflow_def_processdefinition.process_id");
    //增加扩展查询
    taskQuery.queryExpandTo(queryExpandTo);
    //查询TaskServiceNewTest经过扩展查询后的结果
    taskQuery.processDefinitionKey("TaskServiceNewTest");
    list = taskQuery.list();
    //获取第一个流程实例结果
    taskInstance = list.get(0);
    //获取扩展查询的字段
    String process_name = (String)taskInstance.getExtensionField("PROCESS_NAME");
    String RESOURCE_NAME = (String)taskInstance.getExtensionField("RESOURCE_NAME");
View Full Code Here

TOP

Related Classes of com.founder.fix.fixflow.core.task.TaskQuery

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.