taskServiceImpl.getCommandExecutor().execute(new JumpTaskCmd(task.getExecutionId(), activityId));
processDefinitionId = task.getProcessDefinitionId(); processInstanceId = task.getProcessInstanceId(); executionId = task.getExecutionId();
event.setExecutionId(((Task) persistedObject).getExecutionId()); event.setProcessDefinitionId(((Task) persistedObject).getProcessDefinitionId()); } else if (persistedObject instanceof ProcessDefinition) {
@Override public String getExecutionId() { return activiti5Task.getExecutionId(); }
protected boolean hasVariableOnScope(Task task, String variableName, RestVariableScope scope) { boolean variableFound = false; if (scope == RestVariableScope.GLOBAL) { if (task.getExecutionId() != null && runtimeService.hasVariable(task.getExecutionId(), variableName)) { variableFound = true; } } else if (scope == RestVariableScope.LOCAL) { if (taskService.hasVariableLocal(task.getId(), variableName)) { variableFound = true; } } return variableFound; }
protected void addGlobalVariables(Task task, Map<String, RestVariable> variableMap) { if (task.getExecutionId() != null) { Map<String, Object> rawVariables = runtimeService.getVariables(task.getExecutionId()); List<RestVariable> globalVariables = restResponseFactory.createRestVariables(rawVariables, task.getId(), RestResponseFactory.VARIABLE_TASK, RestVariableScope.GLOBAL); // Overlay global variables over local ones. In case they are // present the values are not overridden, // since local variables get precedence over global ones at all // times. for (RestVariable var : globalVariables) { if (!variableMap.containsKey(var.getName())) { variableMap.put(var.getName(), var); } } } }
@ApiOperation(value = "Delete a task", tags = {"Tasks"}) @ApiResponses(value = { @ApiResponse(code = 204, message = "Indicates the task was found and has been deleted. Response-body is intentionally empty."), @ApiResponse(code = 403, message = "Indicates the requested task cannot be deleted because it’s part of a workflow."), @ApiResponse(code = 404, message = "Indicates the requested task was not found.") }) @RequestMapping(value = "/runtime/tasks/{taskId}", method = RequestMethod.DELETE) public void deleteTask(@ApiParam(name="taskId", value="The id of the task to delete.") @PathVariable String taskId,@ApiParam(hidden=true) @RequestParam(value = "cascadeHistory", required = false) Boolean cascadeHistory, @ApiParam(hidden=true) @RequestParam(value = "deleteReason", required = false) String deleteReason, HttpServletResponse response) { Task taskToDelete = getTaskFromRequest(taskId); if (taskToDelete.getExecutionId() != null) { // Can't delete a task that is part of a process instance throw new ActivitiForbiddenException("Cannot delete a task that is part of a process-instance."); } if (cascadeHistory != null) { // Ignore delete-reason since the task-history (where the reason is // recorded) will be deleted anyway taskService.deleteTask(taskToDelete.getId(), cascadeHistory); } else { // Delete with delete-reason taskService.deleteTask(taskToDelete.getId(), deleteReason); } response.setStatus(HttpStatus.NO_CONTENT.value()); }
runtimeService.removeVariable(task.getExecutionId(), variableName);
@Override @SuppressWarnings("deprecation") public WorkflowPath getPath() { if(path == null) { if(task != null) { this.path = activitiTypeConverter.getWorkflowPath(task.getExecutionId(), true); } else { this.path = activitiTypeConverter.getWorkflowPath(historicTask); } } return super.getPath(); }
@Override @SuppressWarnings("deprecation") public WorkflowPath getPath() { if(path == null) { if(task != null) { this.path = activitiTypeConverter.getWorkflowPath(task.getExecutionId(), true); } else { this.path = activitiTypeConverter.getWorkflowPath(historicTask); } } return super.getPath(); }
@Override public String transform(Task task) { Execution exec = getProcessEngine().getRuntimeService().createExecutionQuery().executionId(task.getExecutionId()).singleResult(); return exec.getProcessInstanceId(); } });
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; }
protected void setVariable(Task task, String name, Object value, RestVariableScope scope, boolean isNew) { // Create can only be done on new variables. Existing variables should // be updated using PUT boolean hasVariable = hasVariableOnScope(task, name, scope); if (isNew && hasVariable) { throw new ActivitiException("Variable '" + name + "' is already present on task '" + task.getId() + "'."); } if (!isNew && !hasVariable) { throw new ActivitiObjectNotFoundException("Task '" + task.getId() + "' doesn't have a variable with name: '" + name + "'.", null); } if (scope == RestVariableScope.LOCAL) { taskService.setVariableLocal(task.getId(), name, value); } else { if (task.getExecutionId() != null) { // Explicitly set on execution, setting non-local variable on // task will override local-variable if exists runtimeService.setVariable(task.getExecutionId(), name, value); } else { // Standalone task, no global variables possible throw new ActivitiIllegalArgumentException("Cannot set global variable '" + name + "' on task '" + task.getId() + "', task is not part of process."); } } } }
/** * Associates the task with the provided taskId with the current conversation. * <p/> * * @param taskId * the id of the task * * @return the resumed task * * @throws ActivitiCdiException * if no such task is found */ public Task startTask(String taskId) { Task currentTask = associationManager.getTask(); if(currentTask != null && currentTask.getId().equals(taskId)) { return currentTask; } Task task = processEngine.getTaskService().createTaskQuery().taskId(taskId).singleResult(); if(task == null) { throw new ActivitiCdiException("Cannot resume task with id '"+taskId+"', no such task."); } associationManager.setTask(task); associateExecutionById(task.getExecutionId()); return task; }
/** * Associates the task with the provided taskId with the current conversation. * <p/> * * @param taskId * the id of the task * * @return the resumed task * * @throws ActivitiCdiException * if no such task is found */ public Task startTask(String taskId) { Task currentTask = associationManager.getTask(); if(currentTask != null && currentTask.getId().equals(taskId)) { return currentTask; } Task task = processEngine.getTaskService().createTaskQuery().taskId(taskId).singleResult(); if(task == null) { throw new ActivitiCdiException("Cannot resume task with id '"+taskId+"', no such task."); } associationManager.setTask(task); associateExecutionById(task.getExecutionId()); return task; }
processDefinitionId = task.getProcessDefinitionId(); processInstanceId = task.getProcessInstanceId(); executionId = task.getExecutionId();
@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)); } } }
private MutableBpmTask collectTask(Task task, ProcessInstance pi, ProcessToolContext ctx) { MutableBpmTask t = new MutableBpmTask(); t.setProcessInstance(pi); t.setAssignee(task.getAssignee()); UserData ud = ctx.getUserDataDAO().loadUserByLogin(task.getAssignee()); if (ud == null) { ud = new UserData(); ud.setLogin(task.getAssignee()); } t.setOwner(ud); t.setTaskName(task.getName()); t.setInternalTaskId(task.getId()); t.setExecutionId(task.getExecutionId()); t.setCreateDate(task.getCreateTime()); t.setFinished(false); return t; }
public TaskResponse(Task task) { setId(task.getId()); setOwner(task.getOwner()); setAssignee(task.getAssignee()); setDelegationState(getDelegationStateString(task.getDelegationState())); setName(task.getName()); setDescription(task.getDescription()); setCreateTime(task.getCreateTime()); setDueDate(task.getDueDate()); setPriority(task.getPriority()); setSuspended(task.isSuspended()); setTaskDefinitionKey(task.getTaskDefinitionKey()); setParentTaskId(task.getParentTaskId()); setExecutionId(task.getExecutionId()); setCategory(task.getCategory()); setProcessInstanceId(task.getProcessInstanceId()); setProcessDefinitionId(task.getProcessDefinitionId()); setTenantId(task.getTenantId()); setFormKey(task.getFormKey()); }
event.setExecutionId(((Task) persistedObject).getExecutionId()); event.setProcessDefinitionId(((Task) persistedObject).getProcessDefinitionId()); } else if (persistedObject instanceof ProcessDefinition) {