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

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


        .get("userId"));
   
    String whereSql = " 1=1 ";
    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>>();
View Full Code Here


    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();
View Full Code Here

       
    /**********************本例子通过扩展查询的方法获取ProcessVariablesTest流程的查询变量queryVariable =查询变量1 的流程实例***************************/
    //重置任务查询
    taskQuery = taskService.createTaskQuery();
    //创建扩展查询
    QueryExpandTo queryExpandTo = new QueryExpandTo();
    //常见扩展查询的参数列表
    List<Object> whereSqlObj = new ArrayList<Object>();
    //添加扩展wheresql语句    (本例子扩展方法查询正在运行的流程实例)
    queryExpandTo.setWhereSql("T.PROCESSINSTANCE_ID  IN (SELECT PROCESSINSTANCE_ID FROM "+QueryTableUtil.getDefaultTableName("fixflow_run_variable")+" WHERE VARIABLE_KEY = ? AND BIZ_DATA = ?)");
    //增加扩展wheresql的参数
    whereSqlObj.add("queryVariable");
    whereSqlObj.add("查询变量1");
    queryExpandTo.setWhereSqlObj(whereSqlObj);
    //增加扩展查询
    taskQuery.queryExpandTo(queryExpandTo);
    //查询TaskServiceNewTest经过扩展查询后的结果
    taskQuery.processDefinitionKey("ProcessVariablesTest");
    taskInstances = taskQuery.list();
View Full Code Here

   
    /**********************本例子通过扩展查询的方法获取TaskServiceNewTest流程的INSTANCE_STATUS = RUNNING的流程实例***************************/
    //重置流程实例查询
    processInstanceQuery = runtimeService.createProcessInstanceQuery();
    //创建扩展查询
    QueryExpandTo queryExpandTo = new QueryExpandTo();
    //常见扩展查询的参数列表
    List<Object> whereSqlObj = new ArrayList<Object>();
    //添加扩展wheresql语句    (本例子扩展方法查询正在运行的流程实例)
    queryExpandTo.setWhereSql("INSTANCE_STATUS = ?");
    //增加扩展wheresql的参数
    whereSqlObj.add("RUNNING");
    queryExpandTo.setWhereSqlObj(whereSqlObj);
    //增加扩展查询
    processInstanceQuery.queryExpandTo(queryExpandTo);
    //查询TaskServiceNewTest经过扩展查询后的结果
    processInstanceQuery.processDefinitionKey("TaskServiceNewTest");
    list = processInstanceQuery.list();
    //验证是否为1个
    assertEquals(1, list.size());
   
    /**********************本例子通过扩展查询的方法获取流程定义表中的procecss_name和resource_name字段***************************/
    //重置流程实例查询
    processInstanceQuery = runtimeService.createProcessInstanceQuery();
    //创建扩展查询
    queryExpandTo = new QueryExpandTo();
    //添加扩展的字段
    queryExpandTo.setFieldSql("fixflow_def_processdefinition.PROCESS_NAME,fixflow_def_processdefinition.RESOURCE_NAME");
    //增加扩展查询的left join语句
    queryExpandTo.setLeftJoinSql("left join fixflow_def_processdefinition on processdefinition_id = fixflow_def_processdefinition.process_id");
    //增加扩展查询
    processInstanceQuery.queryExpandTo(queryExpandTo);
    //查询TaskServiceNewTest经过扩展查询后的结果
    processInstanceQuery.processDefinitionKey("TaskServiceNewTest");
    list = processInstanceQuery.list();
View Full Code Here

   
    /**********************本例子通过扩展查询的方法获取ProcessVariablesTest流程的查询变量queryVariable =查询变量1 的流程实例***************************/
    //重置流程实例查询
    processInstanceQuery = runtimeService.createProcessInstanceQuery();
    //创建扩展查询
    QueryExpandTo queryExpandTo = new QueryExpandTo();
    //常见扩展查询的参数列表
    List<Object> whereSqlObj = new ArrayList<Object>();
    //添加扩展wheresql语句    (本例子扩展方法查询正在运行的流程实例)
    queryExpandTo.setWhereSql("PROCESSINSTANCE_ID  IN (SELECT PROCESSINSTANCE_ID FROM "+QueryTableUtil.getDefaultTableName("fixflow_run_variable")+" WHERE VARIABLE_KEY = ? AND BIZ_DATA = ?)");
    //增加扩展wheresql的参数
    whereSqlObj.add("queryVariable");
    whereSqlObj.add("查询变量1");
    queryExpandTo.setWhereSqlObj(whereSqlObj);
    //增加扩展查询
    processInstanceQuery.queryExpandTo(queryExpandTo);
    //查询TaskServiceNewTest经过扩展查询后的结果
    processInstanceQuery.processDefinitionKey("ProcessVariablesTest");
    processInstances = processInstanceQuery.list();
View Full Code Here

TOP

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

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.