Examples of ProcessInstanceQuery


Examples of com.founder.fix.fixflow.core.runtime.ProcessInstanceQuery

        pageIndex = Integer.valueOf(pageI);
      }
      if(StringUtil.isNotEmpty(rowI)){
        rowNum = Integer.valueOf(rowI);
      }
      ProcessInstanceQuery processInstanceQuery = runtimeService.createProcessInstanceQuery();
      if(StringUtil.isNotEmpty(processDefinitionKey))
        processInstanceQuery.processDefinitionKey(processDefinitionKey);
      if(StringUtil.isNotEmpty(processInstanceId))
        processInstanceQuery.processInstanceId(processInstanceId);
      if(StringUtil.isNotEmpty(title))
        processInstanceQuery.subjectLike(title);
      if(StringUtil.isNotEmpty(bizKey))
        processInstanceQuery.processInstanceBusinessKeyLike(bizKey);
      if(processInstanceStatus !=null){
        processInstanceQuery.processInstanceStatus(processInstanceStatus);
      }
      if(StringUtil.isNotEmpty(initor))
        processInstanceQuery.initiator(initor);
     
     
      if(StringUtil.isNotEmpty(processType)){
        if(processType.equals("initor"))
          processInstanceQuery.initiator(userId);
        else
          processInstanceQuery.taskParticipants(userId);
      }
     
      String processDefinitionName     = StringUtil.getString(filter.get("processDefinitionName"));
      if(StringUtil.isNotEmpty(processDefinitionName))
        processInstanceQuery.processDefinitionNameLike(processDefinitionName);
     
      processInstanceQuery.orderByUpdateTime().desc();
      Date dates = null;
      Date datee = null;
      String dss = StringUtil.getString(filter.get("startTimeS"));
      String dse = StringUtil.getString(filter.get("startTimeE"));
      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)
        processInstanceQuery.startTimeBefore(dates);
     
      if(datee!=null)
        processInstanceQuery.startTimeAfter(datee);
     
     
      List<ProcessInstance> processInstances = processInstanceQuery.listPagination(pageIndex, rowNum);
     
      List<Map<String,Object>> instanceMaps = new ArrayList<Map<String,Object>>();
      for(ProcessInstance tmp: processInstances){
        Map<String, Object> persistentState = tmp.getPersistentState();
        String processDefinitionId = tmp.getProcessDefinitionId();
        ProcessDefinitionBehavior processDefinitionBehavior = engine.getModelService().getProcessDefinition(processDefinitionId);
        String processDefinitionName1 = processDefinitionBehavior.getName();
        persistentState.put("processDefinitionName", processDefinitionName1);
        String nowNodeInfo = flowUtil.getShareTaskNowNodeInfo(tmp.getId());
        persistentState.put("nowNodeInfo", nowNodeInfo);
        UserTo user = identityService.getUserTo(tmp.getStartAuthor());
        if(user !=null){
          persistentState.put("startAuthorName", user.getUserName());
        }else{
          persistentState.put("startAuthorName", tmp.getStartAuthor());
        }
        instanceMaps.add(persistentState);
      }
      Long count = processInstanceQuery.count();
      Pagination page = new Pagination(pageIndex,rowNum);
      page.setTotal(count.intValue());
      resultMap.put("dataList", instanceMaps);
      resultMap.put("pageInfo", page);
    }finally{
View Full Code Here

Examples of org.activiti.engine.runtime.ProcessInstanceQuery

  @SuppressWarnings("unchecked")
  public ListPage<ProcessInstance> listProcessInstance( ListPage<ProcessInstance> page ){
    if( page == null )
      page = new ListPage<ProcessInstance>();
   
    ProcessInstanceQuery query = runtimeService
      .createProcessInstanceQuery();
   
    OrderBy orderBy = page.getOrderBy();
    if( orderBy != null ){
      if( "businessKey".equals(orderBy.getProperty()) )
        query.orderByProcessDefinitionKey();
      else if( "processDefinitionId".equals(orderBy.getProperty()) )
        query.orderByProcessDefinitionId();
      else if( "processInstanceId".equals(orderBy.getProperty()) )
        query.orderByProcessInstanceId();
    }
   
    return (ListPage<ProcessInstance>)query(query,page);
  }
View Full Code Here

Examples of org.camunda.bpm.engine.runtime.ProcessInstanceQuery

  }

  private void createProcessInstanceMock() {
    ProcessInstance mockInstance = MockProvider.createMockInstance();

    ProcessInstanceQuery mockInstanceQuery = mock(ProcessInstanceQuery.class);
    when(mockInstanceQuery.processInstanceId(eq(MockProvider.EXAMPLE_PROCESS_INSTANCE_ID))).thenReturn(mockInstanceQuery);
    when(mockInstanceQuery.singleResult()).thenReturn(mockInstance);
    when(mockRuntimeService.createProcessInstanceQuery()).thenReturn(mockInstanceQuery);
  }
View Full Code Here

Examples of org.camunda.bpm.engine.runtime.ProcessInstanceQuery

    // After process start, there should be timer created
    JobQuery jobQuery = managementService.createJobQuery();
    assertEquals(1, jobQuery.count());

    final ProcessInstanceQuery piq = runtimeService.createProcessInstanceQuery().processDefinitionKey("startTimerEventExample");

    assertEquals(0, piq.count());

    moveByMinutes(5);
    executeAllJobs();
    assertEquals(1, piq.count());
    assertEquals(1, jobQuery.count());

    moveByMinutes(5);
    executeAllJobs();
    assertEquals(1, piq.count());

    assertEquals(1, jobQuery.count());
    // have to manually delete pending timer
    cleanDB();
View Full Code Here

Examples of org.camunda.bpm.engine.runtime.ProcessInstanceQuery

    // ensure that the deployment Id is set on the new job
    Job job = jobQuery.singleResult();
    assertNotNull(job.getDeploymentId());

    final ProcessInstanceQuery piq = runtimeService.createProcessInstanceQuery().processDefinitionKey("startTimerEventExampleCycle");

    assertEquals(0, piq.count());

    moveByMinutes(5);
    executeAllJobs();
    assertEquals(1, piq.count());
    assertEquals(1, jobQuery.count());

    // ensure that the deployment Id is set on the new job
    job = jobQuery.singleResult();
    assertNotNull(job.getDeploymentId());

    moveByMinutes(5);
    executeAllJobs();
    assertEquals(2, piq.count());
    assertEquals(0, jobQuery.count());

  }
View Full Code Here

Examples of org.camunda.bpm.engine.runtime.ProcessInstanceQuery

    // check if execution doesn't exist because timer start event is
    // interrupting
    assertEquals(0, executionQuery.count());

    ProcessInstanceQuery processInstanceQuery = runtimeService.createProcessInstanceQuery().processInstanceId(processInstance.getId());
    assertEquals(0, processInstanceQuery.count());
  }
View Full Code Here

Examples of org.camunda.bpm.engine.runtime.ProcessInstanceQuery

    // check if execution still exists because timer start event is non
    // interrupting
    assertEquals(1, executionQuery.count());

    ProcessInstanceQuery processInstanceQuery = runtimeService.createProcessInstanceQuery().processInstanceId(processInstance.getId());
    assertEquals(1, processInstanceQuery.count());
  }
View Full Code Here

Examples of org.camunda.bpm.engine.runtime.ProcessInstanceQuery

    // check if execution doesn't exist because timer start event is
    // interrupting
    assertEquals(0, executionQuery.count());

    ProcessInstanceQuery processInstanceQuery = runtimeService.createProcessInstanceQuery().processInstanceId(processInstance.getId());
    assertEquals(0, processInstanceQuery.count());

  }
View Full Code Here

Examples of org.camunda.bpm.engine.runtime.ProcessInstanceQuery

    // check if execution still exists because timer start event is non
    // interrupting
    assertEquals(2, executionQuery.count());

    ProcessInstanceQuery processInstanceQuery = runtimeService.createProcessInstanceQuery().processInstanceId(processInstance.getId());
    assertEquals(1, processInstanceQuery.count());

  }
View Full Code Here

Examples of org.camunda.bpm.engine.runtime.ProcessInstanceQuery

    // interrupting
    assertEquals(0, executionQuery.count());

    // check if process instance doesn't exist because timer start event is
    // interrupting
    ProcessInstanceQuery processInstanceQuery = runtimeService.createProcessInstanceQuery().processInstanceId(processInstance.getId());
    assertEquals(0, processInstanceQuery.count());

  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.