当前位置: 首页>>代码示例>>Java>>正文


Java HistoricActivityInstance类代码示例

本文整理汇总了Java中org.activiti.engine.history.HistoricActivityInstance的典型用法代码示例。如果您正苦于以下问题:Java HistoricActivityInstance类的具体用法?Java HistoricActivityInstance怎么用?Java HistoricActivityInstance使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


HistoricActivityInstance类属于org.activiti.engine.history包,在下文中一共展示了HistoricActivityInstance类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getStartVariables

import org.activiti.engine.history.HistoricActivityInstance; //导入依赖的package包/类
/**
 * @param historicProcessInstance HistoricProcessInstance
 * @return Map
 */
public Map<String, Object> getStartVariables(HistoricProcessInstance historicProcessInstance)
{
    if (historicProcessInstance.getStartActivityId() == null)
    {
        return Collections.emptyMap();
    }
    // Get historic variable values for start-event
    HistoricActivityInstance startEvent = activitiUtil.getHistoryService()
        .createHistoricActivityInstanceQuery()
        .processInstanceId(historicProcessInstance.getId())
        .activityId(historicProcessInstance.getStartActivityId())
        .singleResult();
    
    Map<String, Object> variables = getHistoricActivityVariables(startEvent.getId());
    return variables;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:21,代码来源:ActivitiPropertyConverter.java

示例2: getHighLightedFlows

import org.activiti.engine.history.HistoricActivityInstance; //导入依赖的package包/类
private List<String> getHighLightedFlows(
        ProcessDefinitionEntity processDefinition, String processInstanceId) {
    List<HistoricActivityInstance> historicActivityInstances = historyService
            .createHistoricActivityInstanceQuery()
            .processInstanceId(processInstanceId)
            .orderByHistoricActivityInstanceStartTime().asc() /* .orderByActivityId().asc() */
            .list();

    for (HistoricActivityInstance hai : historicActivityInstances) {
        historicActivityInstanceList.add(hai.getActivityId());
    }

    // add current activities to list
    highLightedActivities = runtimeService
            .getActiveActivityIds(processInstanceId);
    historicActivityInstanceList.addAll(highLightedActivities);

    // activities and their sequence-flows
    getHighlightedFlows(processDefinition.getActivities());

    return highLightedFlows;
}
 
开发者ID:zhaojunfei,项目名称:lemon,代码行数:23,代码来源:BpmResource.java

示例3: getApproveMap

import org.activiti.engine.history.HistoricActivityInstance; //导入依赖的package包/类
/**
 * 获取历史审批结果和审批意见
 *
 * @param activityInstance 历史任务节点
 * @return
 */
public Map<String, String> getApproveMap(HistoricActivityInstance activityInstance) {
    //审批结果和审批意见为Local变量
    Map<String, String> map = new HashMap<>();
    if (StrUtil.isEmpty(activityInstance.getTaskId()))
        return map;
    List<HistoricVariableInstance> variableInstances = historyService.createHistoricVariableInstanceQuery()
            .processInstanceId(activityInstance.getProcessInstanceId()).taskId(activityInstance.getTaskId()).list();
    for (HistoricVariableInstance variableInstance : variableInstances) {
        if (variableInstance.getVariableName().equals(Constants.APPROVE_RESULT)) {
            map.put(Constants.APPROVE_RESULT, variableInstance.getValue().toString());
        } else {
            map.put(Constants.APPROVE_SUGGESTION, variableInstance.getValue().toString());
        }
    }
    return map;
}
 
开发者ID:bill1012,项目名称:AdminEAP,代码行数:23,代码来源:RuntimePageServiceImpl.java

示例4: testGetHistoricActivityInstancesByProcessInstanceId

import org.activiti.engine.history.HistoricActivityInstance; //导入依赖的package包/类
@Test
public void testGetHistoricActivityInstancesByProcessInstanceId()
{
    String processInstanceId = "processInstanceId";
    HistoricActivityInstanceQuery historicActivityInstanceQuery = mock(HistoricActivityInstanceQuery.class);
    when(activitiHistoryService.createHistoricActivityInstanceQuery()).thenReturn(historicActivityInstanceQuery);
    when(historicActivityInstanceQuery.processInstanceId(processInstanceId)).thenReturn(historicActivityInstanceQuery);
    when(historicActivityInstanceQuery.orderByHistoricActivityInstanceStartTime()).thenReturn(historicActivityInstanceQuery);
    when(historicActivityInstanceQuery.asc()).thenReturn(historicActivityInstanceQuery);
    when(historicActivityInstanceQuery.orderByHistoricActivityInstanceEndTime()).thenReturn(historicActivityInstanceQuery);
    when(historicActivityInstanceQuery.asc()).thenReturn(historicActivityInstanceQuery);
    List<HistoricActivityInstance> expectedHistoricActivityInstances = new ArrayList<>();
    when(historicActivityInstanceQuery.list()).thenReturn(expectedHistoricActivityInstances);
    List<HistoricActivityInstance> actualHistoricActivityInstances = activitiService.getHistoricActivityInstancesByProcessInstanceId(processInstanceId);
    assertSame(expectedHistoricActivityInstances, actualHistoricActivityInstances);
    InOrder inOrder = inOrder(historicActivityInstanceQuery);
    inOrder.verify(historicActivityInstanceQuery).processInstanceId(processInstanceId);
    inOrder.verify(historicActivityInstanceQuery).orderByHistoricActivityInstanceStartTime();
    inOrder.verify(historicActivityInstanceQuery).asc();
    inOrder.verify(historicActivityInstanceQuery).orderByHistoricActivityInstanceEndTime();
    inOrder.verify(historicActivityInstanceQuery).asc();
    inOrder.verify(historicActivityInstanceQuery).list();
    inOrder.verifyNoMoreInteractions();
}
 
开发者ID:FINRAOS,项目名称:herd,代码行数:25,代码来源:ActivitiServiceTest.java

示例5: testSequentialScriptTasksHistory

import org.activiti.engine.history.HistoricActivityInstance; //导入依赖的package包/类
@Deployment(resources = {"org/activiti/engine/test/bpmn/multiinstance/MultiInstanceTest.testSequentialScriptTasks.bpmn20.xml"})
public void testSequentialScriptTasksHistory() {
  Map<String, Object> vars = new HashMap<String, Object>();
  vars.put("sum", 0);
  vars.put("nrOfLoops", 7);
  runtimeService.startProcessInstanceByKey("miSequentialScriptTask", vars);
  
  // Validate history
  if (processEngineConfiguration.getHistoryLevel() > ProcessEngineConfigurationImpl.HISTORYLEVEL_NONE) {
    List<HistoricActivityInstance> historicInstances = historyService.createHistoricActivityInstanceQuery().activityType("scriptTask").orderByActivityId().asc().list();
    assertEquals(7, historicInstances.size());
    for (int i=0; i<7; i++) {
      HistoricActivityInstance hai = historicInstances.get(i);
      assertEquals("scriptTask", hai.getActivityType());
      assertNotNull(hai.getStartTime());
      assertNotNull(hai.getEndTime());
    }
  }
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:20,代码来源:MultiInstanceTest.java

示例6: testParallelScriptTasksHistory

import org.activiti.engine.history.HistoricActivityInstance; //导入依赖的package包/类
@Deployment(resources = {"org/activiti/engine/test/bpmn/multiinstance/MultiInstanceTest.testParallelScriptTasks.bpmn20.xml"})
public void testParallelScriptTasksHistory() {
  Map<String, Object> vars = new HashMap<String, Object>();
  vars.put("sum", 0);
  vars.put("nrOfLoops", 4);
  runtimeService.startProcessInstanceByKey("miParallelScriptTask", vars);
  
  if (processEngineConfiguration.getHistoryLevel() > ProcessEngineConfigurationImpl.HISTORYLEVEL_NONE) {
    List<HistoricActivityInstance> historicActivityInstances = historyService.createHistoricActivityInstanceQuery().activityType("scriptTask").list();
    assertEquals(4, historicActivityInstances.size());
    for (HistoricActivityInstance hai : historicActivityInstances) {
      assertNotNull(hai.getStartTime());
      assertNotNull(hai.getStartTime());
    }
  }
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:17,代码来源:MultiInstanceTest.java

示例7: testParallelSubProcessHistory

import org.activiti.engine.history.HistoricActivityInstance; //导入依赖的package包/类
@Deployment(resources = {"org/activiti/engine/test/bpmn/multiinstance/MultiInstanceTest.testParallelSubProcess.bpmn20.xml"})
public void testParallelSubProcessHistory() {
  runtimeService.startProcessInstanceByKey("miParallelSubprocess");
  for (Task task : taskService.createTaskQuery().list()) {
    taskService.complete(task.getId());
  }
  
  // Validate history
  if (processEngineConfiguration.getHistoryLevel() > ProcessEngineConfigurationImpl.HISTORYLEVEL_NONE) {
    List<HistoricActivityInstance> historicActivityInstances = historyService.createHistoricActivityInstanceQuery().activityId("miSubProcess").list();
    assertEquals(2, historicActivityInstances.size());
    for (HistoricActivityInstance hai : historicActivityInstances) {
      assertNotNull(hai.getStartTime());
      assertNotNull(hai.getEndTime());
    }
  }
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:18,代码来源:MultiInstanceTest.java

示例8: testHistoricActivityInstanceNoop

import org.activiti.engine.history.HistoricActivityInstance; //导入依赖的package包/类
@Deployment
public void testHistoricActivityInstanceNoop() {
  ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("noopProcess");
  
  HistoricActivityInstance historicActivityInstance = historyService
    .createHistoricActivityInstanceQuery()
    .activityId("noop")
    .singleResult();
  
  assertEquals("noop", historicActivityInstance.getActivityId());
  assertEquals("serviceTask", historicActivityInstance.getActivityType());
  assertNotNull(historicActivityInstance.getProcessDefinitionId());
  assertEquals(processInstance.getId(), historicActivityInstance.getProcessInstanceId());
  assertEquals(processInstance.getId(), historicActivityInstance.getExecutionId());
  assertNotNull(historicActivityInstance.getStartTime());
  assertNotNull(historicActivityInstance.getEndTime());
  assertTrue(historicActivityInstance.getDurationInMillis() >= 0);
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:19,代码来源:HistoricActivityInstanceTest.java

示例9: findHistoricUserTask

import org.activiti.engine.history.HistoricActivityInstance; //导入依赖的package包/类
/** 
 * 查询指定任务节点的最新记录 
 *  
 * @param processInstance 
 *            流程实例 
 * @param activityId 
 * @return 
 */  
private static HistoricActivityInstance findHistoricUserTask(  
        ProcessInstance processInstance, String activityId) {  
    HistoricActivityInstance rtnVal = null;  
    // 查询当前流程实例审批结束的历史节点  
    List<HistoricActivityInstance> historicActivityInstances = historyService  
            .createHistoricActivityInstanceQuery().activityType("userTask")  
            .processInstanceId(processInstance.getId()).activityId(  
                    activityId).finished()  
            .orderByHistoricActivityInstanceEndTime().desc().list();  
    if (historicActivityInstances.size() > 0) {  
        rtnVal = historicActivityInstances.get(0);  
    }  
  
    return rtnVal;  
}
 
开发者ID:v5developer,项目名称:maven-framework-project,代码行数:24,代码来源:ProcessCustomService.java

示例10: findHistoricUserTask

import org.activiti.engine.history.HistoricActivityInstance; //导入依赖的package包/类
/**
* 查询指定任务节点的最新记录
* @param processInstance 流程实例
* @param activityId
* @return
*/
private HistoricActivityInstance findHistoricUserTask(ProcessInstance processInstance,
                                                      String activityId){
    HistoricActivityInstance rtnVal = null;
    //查询当前流程实例审批结束的历史节点
    List<HistoricActivityInstance> historicActivityInstances =historyService
            .createHistoricActivityInstanceQuery().activityType("userTask")
            .processInstanceId(processInstance.getId()).activityId(activityId)
            .finished().orderByHistoricActivityInstanceEndTime().desc().list();

    if(historicActivityInstances.size()>0){
        rtnVal = historicActivityInstances.get(0);
    }

    return rtnVal;
}
 
开发者ID:ameizi,项目名称:activiti-demo,代码行数:22,代码来源:ProcessExtensionServiceImpl.java

示例11: printActivityInstanceInfo

import org.activiti.engine.history.HistoricActivityInstance; //导入依赖的package包/类
protected void printActivityInstanceInfo(HistoricActivityInstance actInst) {

        LinkedHashMap<String, String> nvMap = new LinkedHashMap<String, String>();
        nvMap.put("Activity ID", actInst.getActivityId());
        if (!this.isQuiet()) {
            nvMap.put("Activity Type", actInst.getActivityType());
        }
        nvMap.put("Activity Name", actInst.getActivityName());
        if (!this.isQuiet()) {
            nvMap.put("Execution ID", actInst.getExecutionId());
        }
        nvMap.put("Start Time", Commands.UTIL.formatDate(actInst.getStartTime()));
        nvMap.put("End Time", Commands.UTIL.formatDate(actInst.getEndTime()));
        if (!this.isQuiet()) {
            nvMap.put("Duration", Commands.UTIL.formatDuration(actInst.getDurationInMillis()));
        }

        PrintWriter out = new PrintWriter(out(), true);
        Commands.UTIL.printNameValues(out, nvMap);
        // print activity vars
        this.getPrintHandler().printActivityData(out, this.isVerbose(), this.isQuiet(), actInst);
        out().println("-------------");
    }
 
开发者ID:apache,项目名称:incubator-provisionr,代码行数:24,代码来源:InfoActivitiCommand.java

示例12: printActivityData

import org.activiti.engine.history.HistoricActivityInstance; //导入依赖的package包/类
@Override
public void printActivityData(PrintWriter out, boolean verbose, boolean quite,
                              HistoricActivityInstance actInst) {
    this.setVerbose(verbose);
    this.setQuiet(quite);
    if (quite) {
        // don't print activity variable update per activity
        return;
    }
    List<HistoricDetail> varList = null;
    try {
        varList = this.processEngine.getHistoryService().createHistoricDetailQuery()
            .variableUpdates().activityInstanceId(actInst.getId()).orderByTime().desc().list();
    } catch (ActivitiException ex) {
        //silent about the error. and log it.
        LOG.log(Level.INFO, "Error in getting process variables. " + ex.getMessage(), ex);
    }

    if (varList != null && varList.size() > 0) {
        out.println("-------- Task Variables");
        printVariables(out, varList);
    } else {
        LOG.info("------ No Task Variables! for " + actInst.getActivityId());
    }
}
 
开发者ID:apache,项目名称:incubator-provisionr,代码行数:26,代码来源:AbstractActivitiPrintHandler.java

示例13: testSequentialScriptTasksHistory

import org.activiti.engine.history.HistoricActivityInstance; //导入依赖的package包/类
@Deployment(resources = {"org/activiti/engine/test/bpmn/multiinstance/MultiInstanceTest.testSequentialScriptTasks.bpmn20.xml"})
public void testSequentialScriptTasksHistory() {
  Map<String, Object> vars = new HashMap<String, Object>();
  vars.put("sum", 0);
  vars.put("nrOfLoops", 7);
  runtimeService.startProcessInstanceByKey("miSequentialScriptTask", vars);
  
  // Validate history
  if (processEngineConfiguration.getHistoryLevel().isAtLeast(HistoryLevel.ACTIVITY)) {
    List<HistoricActivityInstance> historicInstances = historyService.createHistoricActivityInstanceQuery().activityType("scriptTask").orderByActivityId().asc().list();
    assertEquals(7, historicInstances.size());
    for (int i=0; i<7; i++) {
      HistoricActivityInstance hai = historicInstances.get(i);
      assertEquals("scriptTask", hai.getActivityType());
      assertNotNull(hai.getStartTime());
      assertNotNull(hai.getEndTime());
    }
  }
}
 
开发者ID:springvelocity,项目名称:xbpm5,代码行数:20,代码来源:MultiInstanceTest.java

示例14: testParallelScriptTasksHistory

import org.activiti.engine.history.HistoricActivityInstance; //导入依赖的package包/类
@Deployment(resources = {"org/activiti/engine/test/bpmn/multiinstance/MultiInstanceTest.testParallelScriptTasks.bpmn20.xml"})
public void testParallelScriptTasksHistory() {
  Map<String, Object> vars = new HashMap<String, Object>();
  vars.put("sum", 0);
  vars.put("nrOfLoops", 4);
  runtimeService.startProcessInstanceByKey("miParallelScriptTask", vars);
  
  if (processEngineConfiguration.getHistoryLevel().isAtLeast(HistoryLevel.ACTIVITY)) {
    List<HistoricActivityInstance> historicActivityInstances = historyService.createHistoricActivityInstanceQuery().activityType("scriptTask").list();
    assertEquals(4, historicActivityInstances.size());
    for (HistoricActivityInstance hai : historicActivityInstances) {
      assertNotNull(hai.getStartTime());
      assertNotNull(hai.getStartTime());
    }
  }
}
 
开发者ID:springvelocity,项目名称:xbpm5,代码行数:17,代码来源:MultiInstanceTest.java

示例15: testParallelSubProcessHistory

import org.activiti.engine.history.HistoricActivityInstance; //导入依赖的package包/类
@Deployment(resources = {"org/activiti/engine/test/bpmn/multiinstance/MultiInstanceTest.testParallelSubProcess.bpmn20.xml"})
public void testParallelSubProcessHistory() {
  runtimeService.startProcessInstanceByKey("miParallelSubprocess");
  for (Task task : taskService.createTaskQuery().list()) {
    taskService.complete(task.getId());
  }
  
  // Validate history
  if (processEngineConfiguration.getHistoryLevel().isAtLeast(HistoryLevel.ACTIVITY)) {
    List<HistoricActivityInstance> historicActivityInstances = historyService.createHistoricActivityInstanceQuery().activityId("miSubProcess").list();
    assertEquals(2, historicActivityInstances.size());
    for (HistoricActivityInstance hai : historicActivityInstances) {
      assertNotNull(hai.getStartTime());
      assertNotNull(hai.getEndTime());
    }
  }
}
 
开发者ID:springvelocity,项目名称:xbpm5,代码行数:18,代码来源:MultiInstanceTest.java


注:本文中的org.activiti.engine.history.HistoricActivityInstance类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。