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


Java Task.getProcessInstanceId方法代码示例

本文整理汇总了Java中org.activiti.engine.task.Task.getProcessInstanceId方法的典型用法代码示例。如果您正苦于以下问题:Java Task.getProcessInstanceId方法的具体用法?Java Task.getProcessInstanceId怎么用?Java Task.getProcessInstanceId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.activiti.engine.task.Task的用法示例。


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

示例1: TaskVo

import org.activiti.engine.task.Task; //导入方法依赖的package包/类
public TaskVo(Task task) {
	this.id = task.getId();
	this.name = task.getName();
	this.title = task.getDescription();
	this.priority = task.getPriority();
	this.owner = task.getOwner();
	this.assignee = task.getAssignee();
	this.processInstanceId = task.getProcessInstanceId();
	this.executionId = task.getExecutionId();
	this.processDefinitionId = task.getProcessDefinitionId();
	this.createTime = task.getCreateTime();
	this.taskDefinitionKey = task.getTaskDefinitionKey();
	this.dueDate = task.getDueDate();
	this.category = task.getCategory();
	this.parentTaskId = task.getParentTaskId();
	this.tenantId = task.getTenantId();
	this.formKey = task.getFormKey();
	this.suspended = task.isSuspended();
}
 
开发者ID:KayuraTeam,项目名称:kayura-activiti,代码行数:20,代码来源:TaskVo.java

示例2: testGetStartTaskById

import org.activiti.engine.task.Task; //导入方法依赖的package包/类
@Test
public void testGetStartTaskById() throws Exception
{
  
    WorkflowTask result = workflowEngine.getTaskById(ActivitiConstants.ENGINE_ID + "$Foo");
    assertNull("Should not find any result for fake (but valid) Id.", result);
    
    WorkflowPath path = workflowEngine.startWorkflow(workflowDef.getId(), new HashMap<QName, Serializable>());
   
    Task task = taskService.createTaskQuery()
        .executionId(BPMEngineRegistry.getLocalId(path.getId()))
        .singleResult();
    
    // A start task should be available for the process instance
    String startTaskId = ActivitiConstants.START_TASK_PREFIX + task.getProcessInstanceId();
    
    String taskId = createGlobalId(startTaskId);
    WorkflowTask wfTask = workflowEngine.getTaskById(taskId);
    assertNotNull(wfTask);
    assertEquals(createGlobalId(task.getProcessInstanceId()), wfTask.getPath().getId());
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:22,代码来源:ActivitiTaskComponentTest.java

示例3: findTodoTasks

import org.activiti.engine.task.Task; //导入方法依赖的package包/类
/**
 * 查询待办任务
 * @param userId 用户ID
 * @return
 */
public List<Leave> findTodoTasks(String userId) {
	
	List<Leave> results = new ArrayList<Leave>();
	List<Task> tasks = new ArrayList<Task>();
	// 根据当前人的ID查询
	List<Task> todoList = taskService.createTaskQuery().processDefinitionKey(ActUtils.PD_LEAVE[0]).taskAssignee(userId).active().orderByTaskPriority().desc().orderByTaskCreateTime().desc().list();
	// 根据当前人未签收的任务
	List<Task> unsignedTasks = taskService.createTaskQuery().processDefinitionKey(ActUtils.PD_LEAVE[0]).taskCandidateUser(userId).active().orderByTaskPriority().desc().orderByTaskCreateTime().desc().list();
	// 合并
	tasks.addAll(todoList);
	tasks.addAll(unsignedTasks);
	// 根据流程的业务ID查询实体并关联
	for (Task task : tasks) {
		String processInstanceId = task.getProcessInstanceId();
		ProcessInstance processInstance = runtimeService.createProcessInstanceQuery().processInstanceId(processInstanceId).active().singleResult();
		String businessKey = processInstance.getBusinessKey();
		Leave leave = leaveDao.get(businessKey);
		leave.setTask(task);
		leave.setProcessInstance(processInstance);
		leave.setProcessDefinition(repositoryService.createProcessDefinitionQuery().processDefinitionId((processInstance.getProcessDefinitionId())).singleResult());
		results.add(leave);
	}
	return results;
}
 
开发者ID:EleTeam,项目名称:Shop-for-JavaWeb,代码行数:30,代码来源:LeaveService.java

示例4: TaskExtract

import org.activiti.engine.task.Task; //导入方法依赖的package包/类
TaskExtract(Task task, Map<String, Object> processVariables, List<IdentityLink> taskIdentityLinks) {
	id = task.getId();
	assignee = task.getAssignee();
	name = task.getName();
	processInstanceId = task.getProcessInstanceId();
	createTime = task.getCreateTime();
	dueDate = task.getDueDate();
	owner = task.getOwner();
	executionId = task.getExecutionId();
	variables = new HashMap<>();
	if (task.getProcessVariables() != null) {
		variables.putAll(task.getProcessVariables());
	}
	if (task.getTaskLocalVariables() != null) {
		variables.putAll(task.getTaskLocalVariables());
	}
	candidateUsers = new ArrayList<>();
	candidateGroups = new ArrayList<>();
	for (IdentityLink link : taskIdentityLinks) {
		if (IdentityLinkType.CANDIDATE.equals(link.getType())) {
			if (link.getUserId() != null) {
				candidateUsers.add(link.getUserId());
			} else if (link.getGroupId() != null) {
				candidateGroups.add(link.getGroupId());
			}
		}
	}
	addProcessVariables(processVariables);
	this.taskIdentityLinks = taskIdentityLinks;
}
 
开发者ID:Pardus-Engerek,项目名称:engerek,代码行数:31,代码来源:WorkItemProvider.java

示例5: deleteAttachmentsByTaskId

import org.activiti.engine.task.Task; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public void deleteAttachmentsByTaskId(String taskId) {
    checkHistoryEnabled();
    List<AttachmentEntity> attachments = getDbSqlSession().selectList("selectAttachmentsByTaskId", taskId);
    boolean dispatchEvents = getProcessEngineConfiguration().getEventDispatcher().isEnabled();

    String processInstanceId = null;
    String processDefinitionId = null;
    String executionId = null;

    if (dispatchEvents && attachments != null && !attachments.isEmpty()) {
        // Forced to fetch the task to get hold of the process definition for event-dispatching, if available
        Task task = getTaskManager().findTaskById(taskId);
        if (task != null) {
            processDefinitionId = task.getProcessDefinitionId();
            processInstanceId = task.getProcessInstanceId();
            executionId = task.getExecutionId();
        }
    }

    for (AttachmentEntity attachment : attachments) {
        String contentId = attachment.getContentId();
        if (contentId != null) {
            getByteArrayManager().deleteByteArrayById(contentId);
        }
        getDbSqlSession().delete(attachment);
        if (dispatchEvents) {
            getProcessEngineConfiguration().getEventDispatcher().dispatchEvent(
                    ActivitiEventBuilder.createEntityEvent(FlowableEngineEventType.ENTITY_DELETED, attachment, executionId, processInstanceId, processDefinitionId));
        }
    }
}
 
开发者ID:flowable,项目名称:flowable-engine,代码行数:33,代码来源:AttachmentEntityManager.java

示例6: findTodoTasks

import org.activiti.engine.task.Task; //导入方法依赖的package包/类
/**
 * 查询待办任务
 */
@Transactional(readOnly = true)
public List<Leave> findTodoTasks(String userId) {
    List<Leave> results = new ArrayList<Leave>();
    List<Task> tasks = new ArrayList<Task>();

    // 根据当前人的ID查询
    List<Task> todoList = taskService.createTaskQuery().processDefinitionKey("leave").taskAssignee(userId).list();

    // 根据当前人未签收的任务
    List<Task> unsignedTasks = taskService.createTaskQuery().processDefinitionKey("leave").taskCandidateUser(userId).list();

    // 合并
    tasks.addAll(todoList);
    tasks.addAll(unsignedTasks);

    // 根据流程的业务ID查询实体并关联
    for (Task task : tasks) {
        String processInstanceId = task.getProcessInstanceId();
        ProcessInstance processInstance = runtimeService.createProcessInstanceQuery().processInstanceId(processInstanceId).singleResult();
        String businessKey = processInstance.getBusinessKey();
        Leave leave = leaveManager.get(new Long(businessKey));
        leave.setTask(task);
        leave.setProcessInstance(processInstance);
        String processDefinitionId = processInstance.getProcessDefinitionId();
        ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().processDefinitionId(processDefinitionId).singleResult();
        leave.setProcessDefinition(processDefinition);
        results.add(leave);
    }
    return results;
}
 
开发者ID:barudisshu,项目名称:activiti-in-action-codes,代码行数:34,代码来源:LeaveWorkflowService.java

示例7: testTaskWithExecutionVariables

import org.activiti.engine.task.Task; //导入方法依赖的package包/类
public void testTaskWithExecutionVariables() {
  Task task = taskService
    .createTaskQuery()
    .taskName("taskWithExecutionVariables")
    .singleResult();

  String taskId = task.getId();

  assertNotNull(task);

  String processInstanceId = task.getProcessInstanceId();
  
  Map<String, Object> expectedVariables = new HashMap<String, Object>();
  assertEquals(expectedVariables, taskService.getVariablesLocal(taskId));

  expectedVariables.put("instrument", "trumpet");
  expectedVariables.put("player", "gonzo");

  assertEquals(expectedVariables, taskService.getVariables(taskId));

  taskService.complete(taskId);

  assertEquals(0, runtimeService
    .createExecutionQuery()
    .processInstanceId(processInstanceId)
    .list()
    .size());
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:29,代码来源:UserTaskAfterTest.java

示例8: findTodoTasks

import org.activiti.engine.task.Task; //导入方法依赖的package包/类
/**
 * 查询待办任务
 */
@Transactional(readOnly = true)
public List<Leave> findTodoTasks(String userId) {
    List<Leave> results = new ArrayList<Leave>();
    List<Task> tasks = new ArrayList<Task>();

    // 根据当前人的ID查询
    List<Task> todoList = taskService.createTaskQuery().processDefinitionKey("leave").taskAssignee(userId).active().list();

    // 根据当前人未签收的任务
    List<Task> unsignedTasks = taskService.createTaskQuery().processDefinitionKey("leave").taskCandidateUser(userId).active().list();

    // 合并
    tasks.addAll(todoList);
    tasks.addAll(unsignedTasks);

    // 根据流程的业务ID查询实体并关联
    for (Task task : tasks) {
        String processInstanceId = task.getProcessInstanceId();
        ProcessInstance processInstance = runtimeService.createProcessInstanceQuery().processInstanceId(processInstanceId).singleResult();
        String businessKey = processInstance.getBusinessKey();
        Leave leave = leaveManager.get(new Long(businessKey));
        leave.setTask(task);
        leave.setProcessInstance(processInstance);
        String processDefinitionId = processInstance.getProcessDefinitionId();
        ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().processDefinitionId(processDefinitionId).singleResult();
        leave.setProcessDefinition(processDefinition);
        results.add(leave);
    }
    return results;
}
 
开发者ID:barudisshu,项目名称:activiti-in-action-codes,代码行数:34,代码来源:LeaveWorkflowService.java

示例9: showTaskView

import org.activiti.engine.task.Task; //导入方法依赖的package包/类
/**
 * 任务列表
 *
 * @param leave
 */
@RequestMapping(value = "task/view/{taskId}")
public ModelAndView showTaskView(@PathVariable("taskId") String taskId) {
    Task task = taskService.createTaskQuery().taskId(taskId).singleResult();
    String processInstanceId = task.getProcessInstanceId();
    ProcessInstance processInstance = runtimeService.createProcessInstanceQuery().processInstanceId(processInstanceId).singleResult();
    Leave leave = leaveManager.get(new Long(processInstance.getBusinessKey()));
    ModelAndView mav = new ModelAndView("/chapter7/leave/task-" + task.getTaskDefinitionKey());
    mav.addObject("leave", leave);
    mav.addObject("task", task);
    return mav;
}
 
开发者ID:barudisshu,项目名称:activiti-in-action-codes,代码行数:17,代码来源:LeaveController.java

示例10: testSimplestTask

import org.activiti.engine.task.Task; //导入方法依赖的package包/类
public void testSimplestTask() {
  Task task = taskService
    .createTaskQuery()
    .taskName("simpleTask2")
    .singleResult();
  
  String processInstanceId = task.getProcessInstanceId();
  
  long expectedHistoryTaskInstances = -1;
  String schemaHistory = managementService.getProperties().get("schema.history");
  if (schemaHistory.startsWith("create(5.0)")) {
    expectedHistoryTaskInstances = 0;
  } else {
    expectedHistoryTaskInstances = 2;
  }
  
  assertEquals(expectedHistoryTaskInstances, 
    historyService.createHistoricTaskInstanceQuery()
      .processInstanceId(processInstanceId)
      .orderByTaskName().asc()
      .count());
    
  taskService.complete(task.getId());
  
  assertEquals(1, runtimeService
          .createExecutionQuery()
          .processInstanceId(processInstanceId)
          .list()
          .size());

  assertEquals(expectedHistoryTaskInstances+1, 
          historyService.createHistoricTaskInstanceQuery()
            .processInstanceId(processInstanceId)
            .orderByTaskName().asc()
            .count());
          
  task = taskService
    .createTaskQuery()
    .taskName("simpleTask3")
    .singleResult();

  taskService.complete(task.getId());

  assertEquals(0, runtimeService
          .createExecutionQuery()
          .processInstanceId(processInstanceId)
          .list()
          .size());

  assertEquals(expectedHistoryTaskInstances+1, 
          historyService.createHistoricTaskInstanceQuery()
            .processInstanceId(processInstanceId)
            .orderByTaskName().asc()
            .count());
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:56,代码来源:UserTaskAfterTest.java


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