Java Code Examples for org.activiti.engine.impl.persistence.entity.TaskEntity#getProcessInstanceId()
The following examples show how to use
org.activiti.engine.impl.persistence.entity.TaskEntity#getProcessInstanceId() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DeleteTaskWithCommentCmd.java From lemon with Apache License 2.0 | 6 votes |
public Object execute(CommandContext commandContext) { TaskEntity taskEntity = commandContext.getTaskEntityManager() .findTaskById(taskId); // taskEntity.fireEvent(TaskListener.EVENTNAME_COMPLETE); if ((Authentication.getAuthenticatedUserId() != null) && (taskEntity.getProcessInstanceId() != null)) { taskEntity.getProcessInstance().involveUser( Authentication.getAuthenticatedUserId(), IdentityLinkType.PARTICIPANT); } Context.getCommandContext().getTaskEntityManager() .deleteTask(taskEntity, comment, false); if (taskEntity.getExecutionId() != null) { ExecutionEntity execution = taskEntity.getExecution(); execution.removeTask(taskEntity); // execution.signal(null, null); } return null; }
Example 2
Source File: CounterSignCmd.java From lemon with Apache License 2.0 | 6 votes |
public Object execute(CommandContext commandContext) { this.commandContext = commandContext; if (this.taskId != null) { TaskEntity taskEntity = commandContext.getTaskEntityManager() .findTaskById(taskId); activityId = taskEntity.getExecution().getActivityId(); processInstanceId = taskEntity.getProcessInstanceId(); this.collectionVariableName = "countersignUsers"; this.collectionElementVariableName = "countersignUser"; } if (operateType.equalsIgnoreCase("add")) { addInstance(); } else if (operateType.equalsIgnoreCase("remove")) { removeInstance(); } return null; }
Example 3
Source File: AbstractCompleteTaskCmd.java From activiti6-boot2 with Apache License 2.0 | 5 votes |
protected void executeTaskComplete(CommandContext commandContext, TaskEntity taskEntity, Map<String, Object> variables, boolean localScope) { // Task complete logic if (taskEntity.getDelegationState() != null && taskEntity.getDelegationState().equals(DelegationState.PENDING)) { throw new ActivitiException("A delegated task cannot be completed, but should be resolved instead."); } commandContext.getProcessEngineConfiguration().getListenerNotificationHelper().executeTaskListeners(taskEntity, TaskListener.EVENTNAME_COMPLETE); if (Authentication.getAuthenticatedUserId() != null && taskEntity.getProcessInstanceId() != null) { ExecutionEntity processInstanceEntity = commandContext.getExecutionEntityManager().findById(taskEntity.getProcessInstanceId()); commandContext.getIdentityLinkEntityManager().involveUser(processInstanceEntity, Authentication.getAuthenticatedUserId(),IdentityLinkType.PARTICIPANT); } ActivitiEventDispatcher eventDispatcher = Context.getProcessEngineConfiguration().getEventDispatcher(); if (eventDispatcher.isEnabled()) { if (variables != null) { eventDispatcher.dispatchEvent(ActivitiEventBuilder.createEntityWithVariablesEvent(ActivitiEventType.TASK_COMPLETED, taskEntity, variables, localScope)); } else { eventDispatcher.dispatchEvent(ActivitiEventBuilder.createEntityEvent(ActivitiEventType.TASK_COMPLETED, taskEntity)); } } commandContext.getTaskEntityManager().deleteTask(taskEntity, null, false, false); // Continue process (if not a standalone task) if (taskEntity.getExecutionId() != null) { ExecutionEntity executionEntity = commandContext.getExecutionEntityManager().findById(taskEntity.getExecutionId()); Context.getAgenda().planTriggerExecutionOperation(executionEntity); } }
Example 4
Source File: CompleteTaskWithCommentCmd.java From lemon with Apache License 2.0 | 4 votes |
public Object execute(CommandContext commandContext) { TaskEntity taskEntity = commandContext.getTaskEntityManager() .findTaskById(taskId); if (variables != null) { taskEntity.setExecutionVariables(variables); } boolean localScope = false; if ((taskEntity.getDelegationState() != null) && taskEntity.getDelegationState().equals( DelegationState.PENDING)) { throw new ActivitiException( "A delegated task cannot be completed, but should be resolved instead."); } taskEntity.fireEvent(TaskListener.EVENTNAME_COMPLETE); if ((Authentication.getAuthenticatedUserId() != null) && (taskEntity.getProcessInstanceId() != null)) { taskEntity.getProcessInstance().involveUser( Authentication.getAuthenticatedUserId(), IdentityLinkType.PARTICIPANT); } if (Context.getProcessEngineConfiguration().getEventDispatcher() .isEnabled()) { Context.getProcessEngineConfiguration() .getEventDispatcher() .dispatchEvent( ActivitiEventBuilder .createEntityWithVariablesEvent( ActivitiEventType.TASK_COMPLETED, taskEntity, variables, localScope)); } Context.getCommandContext().getTaskEntityManager() .deleteTask(taskEntity, comment, false); if (taskEntity.getExecutionId() != null) { ExecutionEntity execution = taskEntity.getExecution(); execution.removeTask(taskEntity); try { Context.setExecutionContext(execution); execution.signal(null, null); } finally { Context.removeExecutionContext(); } } return null; }