Java Code Examples for org.activiti.engine.impl.persistence.entity.TaskEntity#isSuspended()
The following examples show how to use
org.activiti.engine.impl.persistence.entity.TaskEntity#isSuspended() .
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: NeedsActiveTaskCmd.java From activiti6-boot2 with Apache License 2.0 | 6 votes |
public T execute(CommandContext commandContext) { if (taskId == null) { throw new ActivitiIllegalArgumentException("taskId is null"); } TaskEntity task = commandContext.getTaskEntityManager().findById(taskId); if (task == null) { throw new ActivitiObjectNotFoundException("Cannot find task with id " + taskId, Task.class); } if (task.isSuspended()) { throw new ActivitiException(getSuspendedTaskException()); } return execute(commandContext, task); }
Example 2
Source File: NeedsActiveTaskCmd.java From flowable-engine with Apache License 2.0 | 6 votes |
@Override public T execute(CommandContext commandContext) { if (taskId == null) { throw new ActivitiIllegalArgumentException("taskId is null"); } TaskEntity task = commandContext .getTaskEntityManager() .findTaskById(taskId); if (task == null) { throw new ActivitiObjectNotFoundException("Cannot find task with id " + taskId, Task.class); } if (task.isSuspended()) { throw new ActivitiException(getSuspendedTaskException()); } return execute(commandContext, task); }
Example 3
Source File: CreateAttachmentCmd.java From flowable-engine with Apache License 2.0 | 6 votes |
private void verifyParameters(CommandContext commandContext) { if (taskId != null) { TaskEntity task = commandContext.getTaskEntityManager().findTaskById(taskId); if (task == null) { throw new ActivitiObjectNotFoundException("Cannot find task with id " + taskId, Task.class); } if (task.isSuspended()) { throw new ActivitiException("It is not allowed to add an attachment to a suspended task"); } } if (processInstanceId != null) { ExecutionEntity execution = commandContext.getExecutionEntityManager().findExecutionById(processInstanceId); if (execution == null) { throw new ActivitiObjectNotFoundException("Process instance " + processInstanceId + " doesn't exist", ProcessInstance.class); } if (execution.isSuspended()) { throw new ActivitiException("It is not allowed to add an attachment to a suspended process instance"); } } }
Example 4
Source File: CreateAttachmentCmd.java From activiti6-boot2 with Apache License 2.0 | 5 votes |
protected TaskEntity verifyTaskParameters(CommandContext commandContext) { TaskEntity task = commandContext.getTaskEntityManager().findById(taskId); if (task == null) { throw new ActivitiObjectNotFoundException("Cannot find task with id " + taskId, Task.class); } if (task.isSuspended()) { throw new ActivitiException("It is not allowed to add an attachment to a suspended task"); } return task; }
Example 5
Source File: AddCommentCmd.java From activiti6-boot2 with Apache License 2.0 | 4 votes |
public Comment execute(CommandContext commandContext) { TaskEntity task = null; // Validate task if (taskId != null) { task = commandContext.getTaskEntityManager().findById(taskId); if (task == null) { throw new ActivitiObjectNotFoundException("Cannot find task with id " + taskId, Task.class); } if (task.isSuspended()) { throw new ActivitiException(getSuspendedTaskException()); } } ExecutionEntity execution = null; if (processInstanceId != null) { execution = commandContext.getExecutionEntityManager().findById(processInstanceId); if (execution == null) { throw new ActivitiObjectNotFoundException("execution " + processInstanceId + " doesn't exist", Execution.class); } if (execution.isSuspended()) { throw new ActivitiException(getSuspendedExceptionMessage()); } } String processDefinitionId = null; if (execution != null) { processDefinitionId = execution.getProcessDefinitionId(); } else if (task != null) { processDefinitionId = task.getProcessDefinitionId(); } if (processDefinitionId != null && Activiti5Util.isActiviti5ProcessDefinitionId(commandContext, processDefinitionId)) { Activiti5CompatibilityHandler activiti5CompatibilityHandler = Activiti5Util.getActiviti5CompatibilityHandler(); return activiti5CompatibilityHandler.addComment(taskId, processInstanceId, type, message); } String userId = Authentication.getAuthenticatedUserId(); CommentEntity comment = commandContext.getCommentEntityManager().create(); comment.setUserId(userId); comment.setType((type == null) ? CommentEntity.TYPE_COMMENT : type); comment.setTime(commandContext.getProcessEngineConfiguration().getClock().getCurrentTime()); comment.setTaskId(taskId); comment.setProcessInstanceId(processInstanceId); comment.setAction(Event.ACTION_ADD_COMMENT); String eventMessage = message.replaceAll("\\s+", " "); if (eventMessage.length() > 163) { eventMessage = eventMessage.substring(0, 160) + "..."; } comment.setMessage(eventMessage); comment.setFullMessage(message); commandContext.getCommentEntityManager().insert(comment); return comment; }
Example 6
Source File: AddCommentCmd.java From flowable-engine with Apache License 2.0 | 4 votes |
@Override public Comment execute(CommandContext commandContext) { // Validate task if (taskId != null) { TaskEntity task = commandContext.getTaskEntityManager().findTaskById(taskId); if (task == null) { throw new ActivitiObjectNotFoundException("Cannot find task with id " + taskId, Task.class); } if (task.isSuspended()) { throw new ActivitiException(getSuspendedTaskException()); } } if (processInstanceId != null) { ExecutionEntity execution = commandContext.getExecutionEntityManager().findExecutionById(processInstanceId); if (execution == null) { throw new ActivitiObjectNotFoundException("execution " + processInstanceId + " doesn't exist", Execution.class); } if (execution.isSuspended()) { throw new ActivitiException(getSuspendedExceptionMessage()); } } String userId = Authentication.getAuthenticatedUserId(); CommentEntity comment = new CommentEntity(); comment.setUserId(userId); comment.setType((type == null) ? CommentEntity.TYPE_COMMENT : type); comment.setTime(commandContext.getProcessEngineConfiguration().getClock().getCurrentTime()); comment.setTaskId(taskId); comment.setProcessInstanceId(processInstanceId); comment.setAction(Event.ACTION_ADD_COMMENT); String eventMessage = message.replaceAll("\\s+", " "); if (eventMessage.length() > 163) { eventMessage = eventMessage.substring(0, 160) + "..."; } comment.setMessage(eventMessage); comment.setFullMessage(message); commandContext .getCommentEntityManager() .insert(comment); return comment; }