Java Code Examples for org.activiti.engine.impl.persistence.entity.ExecutionEntity#isSuspended()
The following examples show how to use
org.activiti.engine.impl.persistence.entity.ExecutionEntity#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: NeedsActiveExecutionCmd.java From activiti6-boot2 with Apache License 2.0 | 6 votes |
public T execute(CommandContext commandContext) { if (executionId == null) { throw new ActivitiIllegalArgumentException("executionId is null"); } ExecutionEntity execution = commandContext.getExecutionEntityManager().findById(executionId); if (execution == null) { throw new ActivitiObjectNotFoundException("execution " + executionId + " doesn't exist", Execution.class); } if (execution.isSuspended()) { throw new ActivitiException(getSuspendedExceptionMessage()); } return execute(commandContext, execution); }
Example 2
Source File: NeedsActiveExecutionCmd.java From flowable-engine with Apache License 2.0 | 6 votes |
@Override public T execute(CommandContext commandContext) { if (executionId == null) { throw new ActivitiIllegalArgumentException("executionId is null"); } ExecutionEntity execution = commandContext .getExecutionEntityManager() .findExecutionById(executionId); if (execution == null) { throw new ActivitiObjectNotFoundException("execution " + executionId + " doesn't exist", Execution.class); } if (execution.isSuspended()) { throw new ActivitiException(getSuspendedExceptionMessage()); } return execute(commandContext, execution); }
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 ExecutionEntity verifyExecutionParameters(CommandContext commandContext) { ExecutionEntity execution = commandContext.getExecutionEntityManager().findById(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"); } return execution; }
Example 5
Source File: SetProcessInstanceNameCmd.java From activiti6-boot2 with Apache License 2.0 | 5 votes |
@Override public Void execute(CommandContext commandContext) { if (processInstanceId == null) { throw new ActivitiIllegalArgumentException("processInstanceId is null"); } ExecutionEntity execution = commandContext.getExecutionEntityManager().findById(processInstanceId); if (execution == null) { throw new ActivitiObjectNotFoundException("process instance " + processInstanceId + " doesn't exist", ProcessInstance.class); } if (!execution.isProcessInstanceType()) { throw new ActivitiObjectNotFoundException("process instance " + processInstanceId + " doesn't exist, the given ID references an execution, though", ProcessInstance.class); } if (execution.isSuspended()) { throw new ActivitiException("process instance " + processInstanceId + " is suspended, cannot set name"); } // Actually set the name execution.setName(name); // Record the change in history commandContext.getHistoryManager().recordProcessInstanceNameChange(processInstanceId, name); return null; }
Example 6
Source File: SignalEventReceivedCmd.java From flowable-engine with Apache License 2.0 | 5 votes |
@Override public Void execute(CommandContext commandContext) { List<SignalEventSubscriptionEntity> signalEvents = null; if (executionId == null) { signalEvents = commandContext.getEventSubscriptionEntityManager().findSignalEventSubscriptionsByEventName(eventName, tenantId); } else { ExecutionEntity execution = commandContext.getExecutionEntityManager().findExecutionById(executionId); if (execution == null) { throw new ActivitiObjectNotFoundException("Cannot find execution with id '" + executionId + "'", Execution.class); } if (execution.isSuspended()) { throw new ActivitiException("Cannot throw signal event '" + eventName + "' because execution '" + executionId + "' is suspended"); } signalEvents = commandContext.getEventSubscriptionEntityManager().findSignalEventSubscriptionsByNameAndExecution(eventName, executionId); if (signalEvents.isEmpty()) { throw new ActivitiException("Execution '" + executionId + "' has not subscribed to a signal event with name '" + eventName + "'."); } } for (SignalEventSubscriptionEntity signalEventSubscriptionEntity : signalEvents) { // We only throw the event to globally scoped signals. // Process instance scoped signals must be thrown within the process itself if (signalEventSubscriptionEntity.isGlobalScoped()) { signalEventSubscriptionEntity.eventReceived(payload, async); } } return null; }
Example 7
Source File: SetProcessInstanceNameCmd.java From flowable-engine with Apache License 2.0 | 5 votes |
@Override public Void execute(CommandContext commandContext) { if (processInstanceId == null) { throw new ActivitiIllegalArgumentException("processInstanceId is null"); } ExecutionEntity execution = commandContext .getExecutionEntityManager() .findExecutionById(processInstanceId); if (execution == null) { throw new ActivitiObjectNotFoundException("process instance " + processInstanceId + " doesn't exist", ProcessInstance.class); } if (!execution.isProcessInstanceType()) { throw new ActivitiObjectNotFoundException("process instance " + processInstanceId + " doesn't exist, the given ID references an execution, though", ProcessInstance.class); } if (execution.isSuspended()) { throw new ActivitiException("process instance " + processInstanceId + " is suspended, cannot set name"); } // Actually set the name execution.setName(name); // Record the change in history commandContext.getHistoryManager().recordProcessInstanceNameChange(processInstanceId, name); return null; }
Example 8
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 9
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; }