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


Java HistoricProcessInstance类代码示例

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


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

示例1: withdrawTask

import org.activiti.engine.history.HistoricProcessInstance; //导入依赖的package包/类
/**
 * 流程撤回  TODO MESSAGE 流程撤回需要给相关人员发送消息提醒
 *
 * @param instanceId 历史流程实例ID
 * @param userId     用户ID
 * @return
 */
@Override
public Result withdrawTask(String instanceId, String userId) {
    HistoricProcessInstance processInstance = historyService.createHistoricProcessInstanceQuery().processInstanceId
            (instanceId).singleResult();
    Result result = this.canWithdraw(processInstance, userId);
    if (!result.isSuccess()) {
        return new Result(false, "不可撤回", "该任务已经被签收或者办理,无法撤回,请查看流程明细");
    } else {
        HistoricTaskInstance taskInstance = (HistoricTaskInstance) result.getData();
        final TaskEntity task = (TaskEntity) taskService.createTaskQuery().processInstanceId(instanceId).singleResult();
        try {
            this.jumpTask(task, taskInstance.getTaskDefinitionKey());
            //删除历史记录,填充签收人
            this.deleteCurrentTaskInstance(task.getId(), taskInstance);
            return new Result(true);
        } catch (Exception ex) {
            return new Result(false, "撤回异常", "任务撤回发生异常,异常原因:" + ex.getMessage());
        }

    }
}
 
开发者ID:bill1012,项目名称:AdminEAP,代码行数:29,代码来源:TaskPageServiceImpl.java

示例2: getWorkflowsInternal

import org.activiti.engine.history.HistoricProcessInstance; //导入依赖的package包/类
@SuppressWarnings("unchecked")
private List<WorkflowInstance> getWorkflowsInternal(WorkflowInstanceQuery workflowInstanceQuery, boolean isActive, int maxItems, int skipCount)
{
    // MNT-9074 My Tasks fails to render if tasks quantity is excessive
    HistoricProcessInstanceQuery query = createQuery(workflowInstanceQuery, isActive);

    LinkedList<WorkflowInstance> results = new LinkedList<WorkflowInstance>();

    List<HistoricProcessInstance> completedInstances;
    if (maxItems > 0)
    {
        completedInstances = query.orderByProcessInstanceDuration().desc().listPage(skipCount, maxItems);
    }
    else
    {
        completedInstances = query.list();
    }

    List<WorkflowInstance> completedResults = typeConverter.doSpecialTenantFilterAndSafeConvert(completedInstances, new Function<HistoricProcessInstance, String>()
    {
        public String apply(HistoricProcessInstance historicProcessInstance)
        {
            ProcessDefinition procDef = activitiUtil.getProcessDefinition(historicProcessInstance.getProcessDefinitionId());
            return procDef.getKey();
        }
    });

    results.addAll(completedResults);
    return results;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:31,代码来源:ActivitiWorkflowEngine.java

示例3: getStartVariables

import org.activiti.engine.history.HistoricProcessInstance; //导入依赖的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

示例4: buildCompletedPath

import org.activiti.engine.history.HistoricProcessInstance; //导入依赖的package包/类
public WorkflowPath buildCompletedPath(String executionId, String processInstanceId)
{
    WorkflowInstance wfInstance = null;
    ProcessInstance processInstance = activitiUtil.getProcessInstance(processInstanceId);
    if(processInstance != null)
    {
        wfInstance = convert(processInstance);
    } 
    else
    {
        HistoricProcessInstance historicProcessInstance = activitiUtil.getHistoricProcessInstance(processInstanceId);
        if(historicProcessInstance!= null)
            wfInstance = convert(historicProcessInstance);
    }
    if(wfInstance == null)
    {
    	// When workflow is cancelled or deleted, WorkflowPath should not be returned
    	return null;
    }
    WorkflowNode node = null;
    return factory.createPath(executionId, wfInstance, node, false);
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:23,代码来源:ActivitiTypeConverter.java

示例5: convertToInstanceAndSetVariables

import org.activiti.engine.history.HistoricProcessInstance; //导入依赖的package包/类
public WorkflowInstance convertToInstanceAndSetVariables(HistoricProcessInstance historicProcessInstance, Map<String, Object> collectedVariables)
{
    String processInstanceId = historicProcessInstance.getId();
    String id = processInstanceId;
    ProcessDefinition procDef = activitiUtil.getProcessDefinition(historicProcessInstance.getProcessDefinitionId());
    WorkflowDefinition definition = convert(procDef);
    
    // Set process variables based on historic detail query
    Map<String, Object> variables = propertyConverter.getHistoricProcessVariables(processInstanceId);
    
    Date startDate = historicProcessInstance.getStartTime();
    Date endDate = historicProcessInstance.getEndTime();

    // Copy all variables to map, if not null
    if(collectedVariables != null)
    {
    	collectedVariables.putAll(variables);
    }
    boolean isActive = endDate == null;
    return factory.createInstance(id, definition, variables, isActive, startDate, endDate);
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:22,代码来源:ActivitiTypeConverter.java

示例6: testBuildWorkflowWithNoUserTasks

import org.activiti.engine.history.HistoricProcessInstance; //导入依赖的package包/类
public void testBuildWorkflowWithNoUserTasks() throws Exception 
{
    // Deploy a definition containing only a service task
    WorkflowDefinition testDefinition = deployDefinition("activiti/testWorkflowNoUserTasks.bpmn20.xml");
    WorkflowBuilder builder = new WorkflowBuilder(testDefinition, workflowService, nodeService, null);
    // Build a workflow
    WorkflowInstance builtInstance = builder.build();
    assertNotNull(builtInstance);
    
    // Check that there is no active workflow for the deployed definition(it should have finished already due to absence of user tasks)
    List<WorkflowInstance> activeInstances = workflowService.getActiveWorkflows(testDefinition.getId());
    assertNotNull(activeInstances);
    assertEquals(0, activeInstances.size());
    
    // Check that there's a historic record of our 'only service task' workflow being run.
    HistoricProcessInstance historicProcessInstance = historyService.createHistoricProcessInstanceQuery()
            .finishedAfter(builtInstance.getStartDate())
            .singleResult();
    assertNotNull(historicProcessInstance);
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:21,代码来源:ActivitiWorkflowServiceIntegrationTest.java

示例7: findCompletedProcessInstances

import org.activiti.engine.history.HistoricProcessInstance; //导入依赖的package包/类
/**
 * 已结流程.
 */
public Page findCompletedProcessInstances(String userId, String tenantId,
        Page page) {
    HistoryService historyService = processEngine.getHistoryService();

    long count = historyService.createHistoricProcessInstanceQuery()
            .processInstanceTenantId(tenantId).startedBy(userId).finished()
            .count();
    List<HistoricProcessInstance> historicProcessInstances = historyService
            .createHistoricProcessInstanceQuery().startedBy(userId)
            .processInstanceTenantId(tenantId).finished()
            .listPage((int) page.getStart(), page.getPageSize());

    page.setResult(historicProcessInstances);
    page.setTotalCount(count);

    return page;
}
 
开发者ID:zhaojunfei,项目名称:lemon,代码行数:21,代码来源:ProcessConnectorImpl.java

示例8: findInvolvedProcessInstances

import org.activiti.engine.history.HistoricProcessInstance; //导入依赖的package包/类
/**
 * 参与流程.
 */
public Page findInvolvedProcessInstances(String userId, String tenantId,
        Page page) {
    HistoryService historyService = processEngine.getHistoryService();

    // TODO: finished(), unfinished()
    long count = historyService.createHistoricProcessInstanceQuery()
            .processInstanceTenantId(tenantId).involvedUser(userId).count();
    List<HistoricProcessInstance> historicProcessInstances = historyService
            .createHistoricProcessInstanceQuery()
            .processInstanceTenantId(tenantId).involvedUser(userId)
            .listPage((int) page.getStart(), page.getPageSize());

    page.setResult(historicProcessInstances);
    page.setTotalCount(count);

    return page;
}
 
开发者ID:zhaojunfei,项目名称:lemon,代码行数:21,代码来源:ProcessConnectorImpl.java

示例9: traceProcessInstance

import org.activiti.engine.history.HistoricProcessInstance; //导入依赖的package包/类
public List<NodeDTO> traceProcessInstance(String processInstanceId) {
    HistoricProcessInstance historicProcessInstance = processEngine
            .getHistoryService().createHistoricProcessInstanceQuery()
            .processInstanceId(processInstanceId).singleResult();
    GetBpmnModelCmd getBpmnModelCmd = new GetBpmnModelCmd(
            historicProcessInstance.getProcessDefinitionId());
    BpmnModel bpmnModel = processEngine.getManagementService()
            .executeCommand(getBpmnModelCmd);

    Map<String, GraphicInfo> graphicInfoMap = bpmnModel.getLocationMap();

    List<NodeDTO> nodeDtos = new ArrayList<NodeDTO>();

    for (Map.Entry<String, GraphicInfo> entry : graphicInfoMap.entrySet()) {
        String key = entry.getKey();
        GraphicInfo graphicInfo = entry.getValue();
        nodeDtos.add(this.convertNodeDto(graphicInfo,
                bpmnModel.getFlowElement(key), key, bpmnModel));
    }

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

示例10: createHumanTask

import org.activiti.engine.history.HistoricProcessInstance; //导入依赖的package包/类
/**
 * 创建humanTask.
 */
public HumanTaskDTO createHumanTask(DelegateTask delegateTask,
        HistoricTaskInstanceEntity historicTaskInstanceEntity)
        throws Exception {
    HumanTaskConnector humanTaskConnector = ApplicationContextHelper
            .getBean(HumanTaskConnector.class);
    HumanTaskDTO humanTaskDto = new HumanTaskBuilder().setDelegateTask(
            delegateTask).build();

    if ("发起流程".equals(historicTaskInstanceEntity.getDeleteReason())) {
        humanTaskDto.setCatalog(HumanTaskConstants.CATALOG_START);
    }

    HistoricProcessInstance historicProcessInstance = Context
            .getCommandContext()
            .getHistoricProcessInstanceEntityManager()
            .findHistoricProcessInstance(
                    delegateTask.getProcessInstanceId());
    humanTaskDto
            .setProcessStarter(historicProcessInstance.getStartUserId());
    humanTaskDto = humanTaskConnector.saveHumanTask(humanTaskDto);

    return humanTaskDto;
}
 
开发者ID:zhaojunfei,项目名称:lemon,代码行数:27,代码来源:RollbackTaskCmd.java

示例11: createHumanTask

import org.activiti.engine.history.HistoricProcessInstance; //导入依赖的package包/类
public HumanTaskDTO createHumanTask(DelegateTask delegateTask,
        HistoricTaskInstanceEntity historicTaskInstanceEntity)
        throws Exception {
    HumanTaskConnector humanTaskConnector = ApplicationContextHelper
            .getBean(HumanTaskConnector.class);
    HumanTaskDTO humanTaskDto = new HumanTaskBuilder().setDelegateTask(
            delegateTask).build();

    if ("发起流程".equals(historicTaskInstanceEntity.getDeleteReason())) {
        humanTaskDto.setCatalog(HumanTaskConstants.CATALOG_START);
    }

    HistoricProcessInstance historicProcessInstance = Context
            .getCommandContext()
            .getHistoricProcessInstanceEntityManager()
            .findHistoricProcessInstance(
                    delegateTask.getProcessInstanceId());
    humanTaskDto
            .setProcessStarter(historicProcessInstance.getStartUserId());
    humanTaskDto = humanTaskConnector.saveHumanTask(humanTaskDto);

    return humanTaskDto;
}
 
开发者ID:zhaojunfei,项目名称:lemon,代码行数:24,代码来源:WithdrawTaskCmd.java

示例12: getProcess

import org.activiti.engine.history.HistoricProcessInstance; //导入依赖的package包/类
@Override
public ProcessInfo getProcess(String processId)
{
    if (processId == null) 
    {
        throw new InvalidArgumentException("processId is required to get the process info");
    }
    
    HistoricProcessInstance processInstance = activitiProcessEngine
            .getHistoryService()
            .createHistoricProcessInstanceQuery()
            .processInstanceId(processId)
            .singleResult();
    
    if (processInstance == null) 
    {
        throw new EntityNotFoundException(processId);
    }

    return createProcessInfo(processInstance);
}
 
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:22,代码来源:ProcessesImpl.java

示例13: find

import org.activiti.engine.history.HistoricProcessInstance; //导入依赖的package包/类
public Page<Leave> find(Page<Leave> page, Leave leave) {

		leave.getSqlMap().put("dsf", dataScopeFilter(leave.getCurrentUser(), "o", "u"));
		
		leave.setPage(page);
		page.setList(leaveDao.findList(leave));
		
		for(Leave item : page.getList()) {
			String processInstanceId = item.getProcessInstanceId();
			Task task = taskService.createTaskQuery().processInstanceId(processInstanceId).active().singleResult();
			item.setTask(task);
			HistoricProcessInstance historicProcessInstance = historyService.createHistoricProcessInstanceQuery().processInstanceId(processInstanceId).singleResult();
			if(historicProcessInstance!=null) {
				item.setHistoricProcessInstance(historicProcessInstance);
				item.setProcessDefinition(repositoryService.createProcessDefinitionQuery().processDefinitionId(historicProcessInstance.getProcessDefinitionId()).singleResult());
			} else {
				ProcessInstance processInstance = runtimeService.createProcessInstanceQuery().processInstanceId(processInstanceId).active().singleResult();
				if (processInstance != null){
					item.setProcessInstance(processInstance);
					item.setProcessDefinition(repositoryService.createProcessDefinitionQuery().processDefinitionId(processInstance.getProcessDefinitionId()).singleResult());
				}
			}
		}
		return page;
	}
 
开发者ID:EleTeam,项目名称:Shop-for-JavaWeb,代码行数:26,代码来源:LeaveService.java

示例14: getActivitiToMidpoint

import org.activiti.engine.history.HistoricProcessInstance; //导入依赖的package包/类
private Map<String, String> getActivitiToMidpoint(Set<String> activeProcessInstances, OperationResult result) {
	Map<String,String> rv = new HashMap<>();
	int processWithoutTaskOidCount = 0;
	HistoricProcessInstanceQuery query = activitiEngine.getHistoryService().createHistoricProcessInstanceQuery()
			.includeProcessVariables()
			.excludeSubprocesses(true);
	List<HistoricProcessInstance> processes = query.list();
	for (HistoricProcessInstance process : processes) {
		String taskOid = (String) process.getProcessVariables().get(CommonProcessVariableNames.VARIABLE_MIDPOINT_TASK_OID);
		rv.put(process.getId(), taskOid);
		if (taskOid == null) {
			processWithoutTaskOidCount++;
		}
		if (process.getEndTime() == null) {
			activeProcessInstances.add(process.getId());
		}
	}
	LOGGER.info("Found {} processes; among these, {} have no task OID. Active processes: {}",
			rv.size(), processWithoutTaskOidCount, activeProcessInstances.size());
	return rv;
}
 
开发者ID:Pardus-Engerek,项目名称:engerek,代码行数:22,代码来源:ProcessInstanceManager.java

示例15: executeList

import org.activiti.engine.history.HistoricProcessInstance; //导入依赖的package包/类
@Override
public List<HistoricProcessInstance> executeList(CommandContext commandContext, Page page) {
    checkQueryOk();
    ensureVariablesInitialized();
    List<HistoricProcessInstance> results = null;
    if (includeProcessVariables) {
        results = commandContext.getHistoricProcessInstanceEntityManager().findHistoricProcessInstancesAndVariablesByQueryCriteria(this);
    } else {
        results = commandContext.getHistoricProcessInstanceEntityManager().findHistoricProcessInstancesByQueryCriteria(this);
    }

    for (HistoricProcessInstance processInstance : results) {
        localize(processInstance, commandContext);
    }

    return results;
}
 
开发者ID:flowable,项目名称:flowable-engine,代码行数:18,代码来源:HistoricProcessInstanceQueryImpl.java


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