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


Java HistoricTaskInstance类代码示例

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


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

示例1: withdrawTask

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

import org.activiti.engine.history.HistoricTaskInstance; //导入依赖的package包/类
private List<WorkflowTask> queryHistoricTasks(WorkflowTaskQuery query)
{
    HistoricTaskInstanceQuery historicQuery = createHistoricTaskQuery(query);

   List<HistoricTaskInstance> results;
   int limit = query.getLimit();
   if (limit > 0)
   {
       results = historicQuery.listPage(0, limit);
   }
   else
   {
       results = historicQuery.list();
   }
   return getValidHistoricTasks(results);
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:17,代码来源:ActivitiWorkflowEngine.java

示例3: getWorkflowPath

import org.activiti.engine.history.HistoricTaskInstance; //导入依赖的package包/类
public WorkflowPath getWorkflowPath(HistoricTaskInstance historicTaskInstance)
{
	 WorkflowPath path = null;
     // Check to see if the instance is still running
     Execution execution = activitiUtil.getExecution(historicTaskInstance.getExecutionId());
     
     if(execution != null)
     {
         // Process execution still running
         path  = convert(execution);
     }
     else
     {
         // Process execution is historic
         path  = buildCompletedPath(historicTaskInstance.getExecutionId(), historicTaskInstance.getProcessInstanceId());
     }
     return path;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:19,代码来源:ActivitiTypeConverter.java

示例4: LazyActivitiWorkflowTask

import org.activiti.engine.history.HistoricTaskInstance; //导入依赖的package包/类
@SuppressWarnings("deprecation")
public LazyActivitiWorkflowTask(HistoricTaskInstance historicTask, ActivitiTypeConverter typeConverter, TenantService tenantService) 
{
	super(BPMEngineRegistry.createGlobalId(ActivitiConstants.ENGINE_ID, historicTask.getId()), null, null, null, null, null, null, null);
	this.historicTask = historicTask;
	this.activitiTypeConverter = typeConverter;
	this.lazyPropertiesMap = new LazyPropertiesMap();
	
	// Fetch task-definition and a partially-initialized WorkflowTask (not including properties and path)
	WorkflowTaskDefinition taskDefinition = activitiTypeConverter.getTaskDefinition(historicTask.getTaskDefinitionKey(), historicTask.getProcessDefinitionId());
	
	String workflowDefinitionName = activitiTypeConverter.getWorkflowDefinitionName(historicTask.getProcessDefinitionId());
	workflowDefinitionName = tenantService.getBaseName(workflowDefinitionName);
	
	WorkflowTask partiallyInitialized = typeConverter.getWorkflowObjectFactory().createTask(historicTask.getId(), taskDefinition, taskDefinition.getId(), historicTask.getName(),
			historicTask.getDescription(), WorkflowTaskState.COMPLETED, null, workflowDefinitionName , lazyPropertiesMap);
	
	this.definition = taskDefinition;
	this.name = taskDefinition.getId();
	this.title = partiallyInitialized.getTitle();
	this.description = partiallyInitialized.getDescription();
	this.state = partiallyInitialized.getState();
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:24,代码来源:LazyActivitiWorkflowTask.java

示例5: execute

import org.activiti.engine.history.HistoricTaskInstance; //导入依赖的package包/类
public void execute(Map<String, Object> processInstance) throws Exception {

		logger.debug(processInstance.toString());

		Map<String, Object> processInstanceData = createProcessMetaData(processInstance);

		// Fetch & Set Process Event Data
		List<Map<String, Object>> processEvents = fetchProcessInstanceEventData(processInstanceData);

		// Create Process Doc
		Map<String, Object> processMap = createAndPublishProcessDocument(processInstanceData, processEvents);

		// Create Task List
		List<HistoricTaskInstance> taskInstances = historyService.createHistoricTaskInstanceQuery()
				.processInstanceId(processInstance.get("processInstanceId").toString()).list();

		// Create Task Docs
		if (taskInstances.size() > 0) {
			for (HistoricTaskInstance taskInstance : taskInstances) {
				createAndPublishTaskDocument(processMap, processEvents, taskInstance);
			}
		}

	}
 
开发者ID:cijujoseph,项目名称:activiti-analytics-spring-boot,代码行数:25,代码来源:GenerateProcessAndTaskDocs.java

示例6: testSetOutcome

import org.activiti.engine.history.HistoricTaskInstance; //导入依赖的package包/类
@Test
@SuppressWarnings("unchecked")
public void testSetOutcome() throws Exception
{
    RequestContext requestContext = initApiClientWithTestUser();
    ProcessInfo processInf = startReviewPooledProcess(requestContext);
    Task task = activitiProcessEngine.getTaskService().createTaskQuery().processInstanceId(processInf.getId()).singleResult();
    TasksClient tasksClient = publicApiClient.tasksClient();
    activitiProcessEngine.getTaskService().saveTask(task);
    Map<String, String> params = new HashMap<String, String>();
    params.put("select", "state,variables");
    HttpResponse response = tasksClient.update("tasks",
                    task.getId(),
                    null,
                    null,
                    "{\"state\":\"completed\",\"variables\":[{\"name\":\"wf_reviewOutcome\",\"value\":\"Approve\",\"scope\":\"local\"},{\"name\":\"bpm_comment\",\"value\":\"approved by me\",\"scope\":\"local\"}]}",
                    params,
                    "Failed to update task",
                    200);
    HistoricTaskInstance historyTask = activitiProcessEngine.getHistoryService().createHistoricTaskInstanceQuery().taskId(task.getId()).includeProcessVariables().includeTaskLocalVariables().singleResult();
    String outcome = (String) historyTask.getTaskLocalVariables().get("bpm_outcome");
    assertEquals("Approve", outcome);
}
 
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:24,代码来源:TaskWorkflowApiTest.java

示例7: localize

import org.activiti.engine.history.HistoricTaskInstance; //导入依赖的package包/类
protected void localize(HistoricTaskInstance task) {
    task.setLocalizedName(null);
    task.setLocalizedDescription(null);

    if (locale != null) {
        String processDefinitionId = task.getProcessDefinitionId();
        if (processDefinitionId != null) {
            ObjectNode languageNode = Context.getLocalizationElementProperties(locale, task.getTaskDefinitionKey(), processDefinitionId, withLocalizationFallback);
            if (languageNode != null) {
                JsonNode languageNameNode = languageNode.get(DynamicBpmnConstants.LOCALIZATION_NAME);
                if (languageNameNode != null && !languageNameNode.isNull()) {
                    task.setLocalizedName(languageNameNode.asText());
                }

                JsonNode languageDescriptionNode = languageNode.get(DynamicBpmnConstants.LOCALIZATION_DESCRIPTION);
                if (languageDescriptionNode != null && !languageDescriptionNode.isNull()) {
                    task.setLocalizedDescription(languageDescriptionNode.asText());
                }
            }
        }
    }
}
 
开发者ID:flowable,项目名称:flowable-engine,代码行数:23,代码来源:HistoricTaskInstanceQueryImpl.java

示例8: checkFinished

import org.activiti.engine.history.HistoricTaskInstance; //导入依赖的package包/类
private void checkFinished(ProcessInstance processInstance) {
    // 验证流程已结束
    HistoricProcessInstance historicProcessInstance = historyService.createHistoricProcessInstanceQuery()
            .processInstanceId(processInstance.getProcessInstanceId()).singleResult();
    assertNotNull(historicProcessInstance.getEndTime());

    // 查询历史任务
    List<HistoricTaskInstance> list = historyService.createHistoricTaskInstanceQuery().list();
    for (HistoricTaskInstance hti : list) {
        System.out.println(hti.getName() + "  " + hti.getDeleteReason());
    }

    // 流程结束后校验监听器设置的变量
    HistoricVariableInstance variableInstance = historyService.createHistoricVariableInstanceQuery().variableName("settedOnEnd").singleResult();
    assertEquals(true, variableInstance.getValue());
}
 
开发者ID:shawn-gogh,项目名称:myjavacode,代码行数:17,代码来源:TerminateEndEventWithSubprocess.java

示例9: initParentTaskLink

import org.activiti.engine.history.HistoricTaskInstance; //导入依赖的package包/类
protected void initParentTaskLink() {
  if (historicTask.getParentTaskId() != null) {
    final HistoricTaskInstance parentTask = historyService.createHistoricTaskInstanceQuery()
      .taskId(historicTask.getParentTaskId())
      .singleResult();
      
    Button showParentTaskButton = new Button(i18nManager.getMessage(
            Messages.TASK_SUBTASK_OF_PARENT_TASK, parentTask.getName()));
    showParentTaskButton.addStyleName(Reindeer.BUTTON_LINK);
    showParentTaskButton.addListener(new ClickListener() {
      public void buttonClick(ClickEvent event) {
        viewManager.showTaskPage(parentTask.getId());
      }
    });
    
    centralLayout.addComponent(showParentTaskButton);
  }
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:19,代码来源:HistoricTaskDetailPanel.java

示例10: initSubTasks

import org.activiti.engine.history.HistoricTaskInstance; //导入依赖的package包/类
protected void initSubTasks() {
  subTasksLayout = new VerticalLayout();
  subTasksLayout.addStyleName(ExplorerLayout.STYLE_DETAIL_BLOCK);
  addComponent(subTasksLayout);
  initSubTaskTitle();
  
  List<HistoricTaskInstance> subTasks = historyService.createHistoricTaskInstanceQuery()
  .taskParentTaskId(historicTask.getId())
  .list();
  
  if (subTasks.size() > 0) {
    initSubTaskGrid();
    populateSubTasks(subTasks);
  } else {
    initNoSubTasksLabel();
  }
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:18,代码来源:HistoricTaskDetailPanel.java

示例11: populateSubTasks

import org.activiti.engine.history.HistoricTaskInstance; //导入依赖的package包/类
protected void populateSubTasks(List<HistoricTaskInstance> subTasks) {
  for (final HistoricTaskInstance subTask : subTasks) {
    // icon
    Embedded icon = new Embedded(null, Images.TASK_22);
    icon.setWidth(22, UNITS_PIXELS);
    icon.setWidth(22, UNITS_PIXELS);
    subTaskGrid.addComponent(icon);
    
    // Link to subtask
    Button subTaskLink = new Button(subTask.getName());
    subTaskLink.addStyleName(Reindeer.BUTTON_LINK);
    subTaskLink.addListener(new ClickListener() {
      public void buttonClick(ClickEvent event) {
        ExplorerApp.get().getViewManager().showTaskPage(subTask.getId());
      }
    });
    subTaskGrid.addComponent(subTaskLink);
    subTaskGrid.setComponentAlignment(subTaskLink, Alignment.MIDDLE_LEFT);
  }
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:21,代码来源:HistoricTaskDetailPanel.java

示例12: testHistoricTaskInstanceUpdate

import org.activiti.engine.history.HistoricTaskInstance; //导入依赖的package包/类
@Deployment
public void testHistoricTaskInstanceUpdate() {
  runtimeService.startProcessInstanceByKey("HistoricTaskInstanceTest").getId();
  
  Task task = taskService.createTaskQuery().singleResult();
  
  // Update and save the task's fields before it is finished
  task.setPriority(12345);
  task.setDescription("Updated description");
  task.setName("Updated name");
  task.setAssignee("gonzo");
  taskService.saveTask(task);   

  taskService.complete(task.getId());
  assertEquals(1, historyService.createHistoricTaskInstanceQuery().count());

  HistoricTaskInstance historicTaskInstance = historyService.createHistoricTaskInstanceQuery().singleResult();
  assertEquals("Updated name", historicTaskInstance.getName());
  assertEquals("Updated description", historicTaskInstance.getDescription());
  assertEquals("gonzo", historicTaskInstance.getAssignee());
  assertEquals("task", historicTaskInstance.getTaskDefinitionKey());
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:23,代码来源:HistoricTaskInstanceUpdateTest.java

示例13: testSetOutcome

import org.activiti.engine.history.HistoricTaskInstance; //导入依赖的package包/类
@Test
@SuppressWarnings("unchecked")
public void testSetOutcome() throws Exception
{
    RequestContext requestContext = initApiClientWithTestUser();
    ProcessInfo processInf = startReviewPooledProcess(requestContext);
    Task task = activitiProcessEngine.getTaskService().createTaskQuery().processInstanceId(processInf.getId()).singleResult();
    TasksClient tasksClient = publicApiClient.tasksClient();
    activitiProcessEngine.getTaskService().saveTask(task);
    Map<String, String> params = new HashMap<String, String>();
    params.put("select", "state,variables");
    HttpResponse response = tasksClient.update("tasks",
                    task.getId(),
                    null,
                    null,
                    "{\"state\":\"completed\",\"variables\":[{\"name\":\"wf_reviewOutcome\",\"value\":\"Approve\",\"scope\":\"local\"},{\"name\":\"bpm_comment\",\"value\":\"approved by me\",\"scope\":\"local\"}]}",
                    "Failed to update task", params);
    assertEquals(200, response.getStatusCode());
    HistoricTaskInstance historyTask = activitiProcessEngine.getHistoryService().createHistoricTaskInstanceQuery().taskId(task.getId()).includeProcessVariables().includeTaskLocalVariables().singleResult();
    String outcome = (String) historyTask.getTaskLocalVariables().get("bpm_outcome");
    assertEquals("Approve", outcome);
}
 
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:23,代码来源:TaskWorkflowApiTest.java

示例14: getAttachments

import org.activiti.engine.history.HistoricTaskInstance; //导入依赖的package包/类
@GET
@Path("/{taskId}/attachments")
@Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
public Response getAttachments(@PathParam("taskId") String taskId) {
    List<AttachmentResponse> result = new ArrayList<AttachmentResponse>();
    HistoricTaskInstance task = getHistoricTaskFromRequest(taskId);

    TaskService taskService = BPMNOSGIService.getTaskService();

    RestResponseFactory restResponseFactory = new RestResponseFactory();
    String baseUri = uriInfo.getBaseUri().toString();

    for (Attachment attachment : taskService.getProcessInstanceAttachments(task.getProcessInstanceId())) {
        result.add(restResponseFactory.createAttachmentResponse(attachment, baseUri));
    }

    AttachmentResponseCollection attachmentResponseCollection = new AttachmentResponseCollection();
    attachmentResponseCollection.setAttachmentResponseList(result);

    return Response.ok().entity(attachmentResponseCollection).build();
}
 
开发者ID:wso2,项目名称:carbon-business-process,代码行数:22,代码来源:WorkflowTaskService.java

示例15: getAttachment

import org.activiti.engine.history.HistoricTaskInstance; //导入依赖的package包/类
@GET
@Path("/{taskId}/attachments/{attachmentId}")
@Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
public Response getAttachment(@PathParam("taskId") String taskId,
                              @PathParam("attachmentId") String attachmentId) {

    HistoricTaskInstance task = getHistoricTaskFromRequest(taskId);
    TaskService taskService = BPMNOSGIService.getTaskService();

    Attachment attachment = taskService.getAttachment(attachmentId);
    if (attachment == null) {
        throw new ActivitiObjectNotFoundException("Task '" + task.getId() + "' doesn't have an attachment with id '" + attachmentId + "'.", Comment.class);
    }

    return Response.ok().entity(new RestResponseFactory().createAttachmentResponse(attachment, uriInfo.getBaseUri
            ().toString())).build();
}
 
开发者ID:wso2,项目名称:carbon-business-process,代码行数:18,代码来源:WorkflowTaskService.java


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