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


Java Task类代码示例

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


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

示例1: createProcessInstanceStartResponse

import org.flowable.engine.task.Task; //导入依赖的package包/类
public ProcessInstanceStartResponse createProcessInstanceStartResponse(ProcessInstance processInstance, List<Task> tasks) {
	ProcessInstanceStartResponse result = new ProcessInstanceStartResponse();
	result.setId(processInstance.getId());
	result.setBusinessKey(processInstance.getBusinessKey());
	result.setProcessDefinitionId(processInstance.getProcessDefinitionId());
	// 接口有提供获取定义名称和key但是在启动api里面没有设置进去,只能通过获取定义获取
	// result.setProcessDefinitionName(((ExecutionEntity)processInstance).getProcessDefinition().getName());
	// result.setProcessDefinitionKey(((ExecutionEntity)processInstance).getProcessDefinition().getKey());

	result.setCurrentActivityId(processInstance.getActivityId());
	result.setTenantId(processInstance.getTenantId());
	List<Map<String, String>> taskInfo = new ArrayList<Map<String, String>>();
	for (Task task : tasks) {
		Map<String, String> taskMap = new HashMap<String, String>();
		taskMap.put("taskId", task.getId());
		taskMap.put("taskName", task.getName());
		taskMap.put("taskDefinitionKey", task.getTaskDefinitionKey());
		taskInfo.add(taskMap);
	}
	result.setTaskInfo(taskInfo);
	return result;
}
 
开发者ID:wengwh,项目名称:plumdo-work,代码行数:23,代码来源:RestResponseFactory.java

示例2: createTaskResponse

import org.flowable.engine.task.Task; //导入依赖的package包/类
private void createTaskResponse(TaskResponse result,Task taskInstance){
	result.setId(taskInstance.getId());
	result.setName(taskInstance.getName());
	result.setOwner(taskInstance.getOwner());
	result.setTaskDefinitionKey(taskInstance.getTaskDefinitionKey());
	result.setCreateTime(taskInstance.getCreateTime());
	result.setAssignee(taskInstance.getAssignee());
	result.setDescription(taskInstance.getDescription());
	result.setDueDate(taskInstance.getDueDate());
	result.setDelegationState(taskInstance.getDelegationState());
	result.setFormKey(taskInstance.getFormKey());
	result.setParentTaskId(taskInstance.getParentTaskId());
	result.setPriority(taskInstance.getPriority());
	result.setSuspended(taskInstance.isSuspended());
	result.setTenantId(taskInstance.getTenantId());
	result.setCategory(taskInstance.getCategory());
	result.setProcessDefinitionId(taskInstance.getProcessDefinitionId());
	result.setProcessInstanceId(taskInstance.getProcessInstanceId());
	
}
 
开发者ID:wengwh,项目名称:plumdo-work,代码行数:21,代码来源:RestResponseFactory.java

示例3: deleteIdentityLink

import org.flowable.engine.task.Task; //导入依赖的package包/类
@RequestMapping(value="/task/{taskId}/identity/{type}/{identityId}", method = RequestMethod.DELETE, name="任务候选人删除")
@ResponseStatus(value = HttpStatus.NO_CONTENT)
public void deleteIdentityLink(@PathVariable("taskId") String taskId, @PathVariable("identityId") String identityId, 
	      @PathVariable("type") String type) {
	Task task = getTaskFromRequest(taskId,false);
    
	validateIdentityLinkArguments(identityId, type);
	
	getIdentityLink(taskId, identityId, type);

    if (TaskIdentityRequest.AUTHORIZE_GROUP.equals(type)) {
    	taskService.deleteGroupIdentityLink(task.getId(), identityId,IdentityLinkType.CANDIDATE);
    } else if(TaskIdentityRequest.AUTHORIZE_USER.equals(type)) {
    	taskService.deleteUserIdentityLink(task.getId(), identityId,IdentityLinkType.CANDIDATE);
    }
}
 
开发者ID:wengwh,项目名称:plumdo-work,代码行数:17,代码来源:TaskIdentityResource.java

示例4: returnTask

import org.flowable.engine.task.Task; //导入依赖的package包/类
@RequestMapping(value="/task/{taskId}/return", method = RequestMethod.PUT, name="任务回退")
@ResponseStatus(value = HttpStatus.OK)
@Transactional(propagation = Propagation.REQUIRED)
public List<TaskResponse> returnTask(@PathVariable("taskId") String taskId,@RequestBody(required=false) TaskActionRequest actionRequest) {
	List<TaskResponse> responses = new ArrayList<TaskResponse>();
	
	Task task = getTaskFromRequest(taskId);
    
    if(task.getAssignee()==null){
		taskService.setAssignee(taskId, Authentication.getAuthenticatedUserId());
	}
    
   /* List<Task> tasks = taskExtService.returnTask(task.getId());
    for(Task nextTask : tasks){
    	TaskExt taskExt = taskExtService.getTaskExtById(nextTask.getId());
 		responses.add(restResponseFactory.createTaskResponse(taskExt));
    }*/
    return responses;
}
 
开发者ID:wengwh,项目名称:plumdo-work,代码行数:20,代码来源:TaskReturnResource.java

示例5: setDueDate

import org.flowable.engine.task.Task; //导入依赖的package包/类
private void setDueDate(Task task,TaskCompleteRequest taskCompleteRequest){
	for(TaskDueDate nextDueDate : taskCompleteRequest.getNextDueDates()){
		if(StringUtils.isEmpty(nextDueDate.getTaskDefinitionKey())
				||nextDueDate.getTaskDefinitionKey().equals(task.getTaskDefinitionKey())){
			if(StringUtils.isEmpty(nextDueDate.getMultiKey())){
				taskService.setDueDate(task.getId(), nextDueDate.getDate());
			}else{
				for (MultiKey multiKey : taskCompleteRequest.getMultiKeys()) {
					String multiVar = String.valueOf(taskService.getVariable(task.getId(), multiKey.getKey()));
					if(multiVar.equals(nextDueDate.getMultiKey())){
						taskService.setDueDate(task.getId(), nextDueDate.getDate());
						break;
					}
				}
			}
		}
	}
}
 
开发者ID:wengwh,项目名称:plumdo-work,代码行数:19,代码来源:TaskCompleteResource.java

示例6: addCandidate

import org.flowable.engine.task.Task; //导入依赖的package包/类
private void addCandidate(Task task,TaskCompleteRequest taskCompleteRequest){
	for(TaskActor nextActor : taskCompleteRequest.getNextActors()){
		if(StringUtils.isEmpty(nextActor.getTaskDefinitionKey())
				||nextActor.getTaskDefinitionKey().equals(task.getTaskDefinitionKey())){
			if(StringUtils.isEmpty(nextActor.getMultiKey())){
				if(nextActor.getType().equals(TaskActor.TYPE_GROUP)){
					taskService.addCandidateGroup(task.getId(), nextActor.getId());
				}else if(nextActor.getType().equals(TaskActor.TYPE_USER)){
					taskService.addCandidateUser(task.getId(), nextActor.getId());
				}	
			}else{
				for (MultiKey multiKey : taskCompleteRequest.getMultiKeys()) {
					String multiVar = String.valueOf(taskService.getVariable(task.getId(), multiKey.getKey()));
					if(multiVar.equals(nextActor.getMultiKey())){
						if(nextActor.getType().equals(TaskActor.TYPE_GROUP)){
							taskService.addCandidateGroup(task.getId(), nextActor.getId());
						}else if(nextActor.getType().equals(TaskActor.TYPE_USER)){
							taskService.addCandidateUser(task.getId(), nextActor.getId());
						}
						break;
					}
				}
			}
		}
	}
}
 
开发者ID:wengwh,项目名称:plumdo-work,代码行数:27,代码来源:TaskCompleteResource.java

示例7: testFindTodos

import org.flowable.engine.task.Task; //导入依赖的package包/类
@Test
public void testFindTodos(){
	List<Task> tasks = wfService.findTodos("managers");
	System.out.println("You have "+tasks.size()+" tasks:");
	int index = 1;
	for (Task task : tasks) {
		System.out.println(index+". 流程名称:["+task.getProcessDefinitionId().split(":")[0]+"]  任务名称:["+task.getName()+"]");
		index++;
	}
}
 
开发者ID:ranji1221,项目名称:clemon,代码行数:11,代码来源:WorkFlowServiceTest.java

示例8: createTaskResponseList

import org.flowable.engine.task.Task; //导入依赖的package包/类
public List<TaskResponse> createTaskResponseList(List<Task> tasks) {
	List<TaskResponse> responseList = new ArrayList<TaskResponse>();
	for (Task instance : tasks) {
		responseList.add(createTaskResponse(instance));
	}
	return responseList;
}
 
开发者ID:wengwh,项目名称:plumdo-work,代码行数:8,代码来源:RestResponseFactory.java

示例9: createTaskNextActorResponse

import org.flowable.engine.task.Task; //导入依赖的package包/类
public TaskNextActorResponse createTaskNextActorResponse(Task task,List<IdentityLink> identityLinks){
	TaskNextActorResponse taskNextActor = new TaskNextActorResponse();
	taskNextActor.setProcessDefinitionId(task.getProcessDefinitionId());
	taskNextActor.setTaskDefinitionKey(task.getTaskDefinitionKey());
	taskNextActor.setTaskDefinitionName(task.getName());
	for(IdentityLink identityLink :identityLinks){
		if(identityLink.getGroupId()!=null){
			taskNextActor.addActorInfo(identityLink.getGroupId(), TaskNextActorResponse.TYPE_GROUP, identityLink.getType());
		}else if(identityLink.getUserId()!=null){
			taskNextActor.addActorInfo(identityLink.getUserId(), TaskNextActorResponse.TYPE_USER, identityLink.getType());
		}
	}
	return taskNextActor;
}
 
开发者ID:wengwh,项目名称:plumdo-work,代码行数:15,代码来源:RestResponseFactory.java

示例10: addCandidate

import org.flowable.engine.task.Task; //导入依赖的package包/类
private void addCandidate(Task task, List<TaskActor> taskActors) {
	for (TaskActor nextActor : taskActors) {
		if (StringUtils.isEmpty(nextActor.getTaskDefinitionKey()) || nextActor.getTaskDefinitionKey().equals(task.getTaskDefinitionKey())) {
			if (nextActor.getType().equals(TaskActor.TYPE_GROUP)) {
				taskService.addCandidateGroup(task.getId(), nextActor.getId());
			} else if (nextActor.getType().equals(TaskActor.TYPE_USER)) {
				taskService.addCandidateUser(task.getId(), nextActor.getId());
			}
		}
	}
}
 
开发者ID:wengwh,项目名称:plumdo-work,代码行数:12,代码来源:ProcessInstanceResource.java

示例11: createIdentityLink

import org.flowable.engine.task.Task; //导入依赖的package包/类
@RequestMapping(value="/task/{taskId}/identity", method = RequestMethod.POST, name="任务候选人创建")
@ResponseStatus(value = HttpStatus.OK)
public void createIdentityLink(@PathVariable("taskId") String taskId, @RequestBody TaskIdentityRequest taskIdentityRequest) {
	Task task = getTaskFromRequest(taskId,false);
    
	validateIdentityLinkArguments(taskIdentityRequest.getIdentityId(), taskIdentityRequest.getType());
    
    if (TaskIdentityRequest.AUTHORIZE_GROUP.equals(taskIdentityRequest.getType())) {
    	taskService.addGroupIdentityLink(task.getId(), taskIdentityRequest.getIdentityId(),IdentityLinkType.CANDIDATE);
    } else if(TaskIdentityRequest.AUTHORIZE_USER.equals(taskIdentityRequest.getType())) {
    	taskService.addUserIdentityLink(task.getId(), taskIdentityRequest.getIdentityId(),IdentityLinkType.CANDIDATE);
    }
}
 
开发者ID:wengwh,项目名称:plumdo-work,代码行数:14,代码来源:TaskIdentityResource.java

示例12: helpTask

import org.flowable.engine.task.Task; //导入依赖的package包/类
@RequestMapping(value="/task/{taskId}/help/{helper}", method = RequestMethod.PUT, name="任务协办")
	@ResponseStatus(value = HttpStatus.OK)
	@Transactional(propagation = Propagation.REQUIRED)
	public void helpTask(@PathVariable("taskId") String taskId,@PathVariable("helper") String helper,@RequestBody(required=false) TaskActionRequest actionRequest) {
	    Task task = getTaskFromRequest(taskId);
	    if(task.getAssignee() == null){
			taskService.setAssignee(taskId, Authentication.getAuthenticatedUserId());
		}
    	taskService.delegateTask(task.getId(), helper);
//	    taskExtService.setStartTime(task.getId());
	}
 
开发者ID:wengwh,项目名称:plumdo-work,代码行数:12,代码来源:TaskHelpResource.java

示例13: claimTask

import org.flowable.engine.task.Task; //导入依赖的package包/类
@RequestMapping(value="/task/{taskId}/claim", method = RequestMethod.PUT, name="任务认领")
@ResponseStatus(value = HttpStatus.OK)
public void claimTask(@PathVariable String taskId,@RequestBody(required=false) TaskActionRequest actionRequest) {
    Task task = getTaskFromRequest(taskId,false);
    
	taskService.claim(task.getId(),Authentication.getAuthenticatedUserId());
}
 
开发者ID:wengwh,项目名称:plumdo-work,代码行数:8,代码来源:TaskClaimResource.java

示例14: assignTask

import org.flowable.engine.task.Task; //导入依赖的package包/类
@RequestMapping(value="/task/{taskId}/assign/{assignee}", method = RequestMethod.PUT, name="任务转办")
@ResponseStatus(value = HttpStatus.OK)
public void assignTask(@PathVariable("taskId") String taskId,@PathVariable("assignee") String assignee,@RequestBody(required=false) TaskActionRequest actionRequest) {
    Task task = getTaskFromRequest(taskId);
   	
    taskService.setAssignee(task.getId(),assignee);
}
 
开发者ID:wengwh,项目名称:plumdo-work,代码行数:8,代码来源:TaskAssignResource.java

示例15: getTaskFromRequest

import org.flowable.engine.task.Task; //导入依赖的package包/类
protected Task getTaskFromRequest(String taskId,boolean isAuthenticate) {
	Task task = taskService.createTaskQuery().taskId(taskId).singleResult();
	if (task == null) {
		throw new FlowableObjectNotFoundException("Could not find a run task with id '" + taskId + "'.",Task.class);
	}
	if(isAuthenticate){
		checkTaskAuthorize(task,false);
	}
	return task;
}
 
开发者ID:wengwh,项目名称:plumdo-work,代码行数:11,代码来源:BaseTaskResource.java


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