org.activiti.engine.ActivitiObjectNotFoundException Java Examples
The following examples show how to use
org.activiti.engine.ActivitiObjectNotFoundException.
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: ModelSourceResource.java From activiti6-boot2 with Apache License 2.0 | 6 votes |
@ApiOperation(value = "Get the editor source for a model", tags = {"Models"}, notes = "Response body contains the model’s raw editor source. " + "The response’s content-type is set to application/octet-stream, regardless of the content of the source.") @ApiResponses(value = { @ApiResponse(code = 200, message = "Indicates the model was found and source is returned."), @ApiResponse(code = 404, message = "Indicates the requested model was not found.") }) @RequestMapping(value = "/repository/models/{modelId}/source", method = RequestMethod.GET) @ResponseBody protected byte[] getModelBytes(@ApiParam(name = "modelId", value="The id of the model.") @PathVariable String modelId, HttpServletResponse response) { byte[] editorSource = repositoryService.getModelEditorSource(modelId); if (editorSource == null) { throw new ActivitiObjectNotFoundException("Model with id '" + modelId + "' does not have source available.", String.class); } response.setContentType("application/octet-stream"); return editorSource; }
Example #2
Source File: JobExceptionStacktraceResource.java From activiti6-boot2 with Apache License 2.0 | 6 votes |
@ApiOperation(value = "Get the exception stacktrace for a job", tags = {"Jobs"}) @ApiResponses(value = { @ApiResponse(code = 200, message = "Indicates the requested job was not found and the stacktrace has been returned. The response contains the raw stacktrace and always has a Content-type of text/plain."), @ApiResponse(code = 404, message = "Indicates the requested job was not found or the job doesn’t have an exception stacktrace. Status-description contains additional information about the error.") }) @RequestMapping(value = "/management/jobs/{jobId}/exception-stacktrace", method = RequestMethod.GET) public String getJobStacktrace(@ApiParam(name = "jobId", value="Id of the job to get the stacktrace for.") @PathVariable String jobId, HttpServletResponse response) { Job job = managementService.createJobQuery().jobId(jobId).singleResult(); if (job == null) { throw new ActivitiObjectNotFoundException("Could not find a job with id '" + jobId + "'.", Job.class); } String stackTrace = managementService.getJobExceptionStacktrace(job.getId()); if (stackTrace == null) { throw new ActivitiObjectNotFoundException("Job with id '" + job.getId() + "' doesn't have an exception stacktrace.", String.class); } response.setContentType("text/plain"); return stackTrace; }
Example #3
Source File: GetExecutionVariableInstanceCmd.java From activiti6-boot2 with Apache License 2.0 | 6 votes |
public VariableInstance execute(CommandContext commandContext) { if (executionId == null) { throw new ActivitiIllegalArgumentException("executionId is null"); } if (variableName == null) { throw new ActivitiIllegalArgumentException("variableName is null"); } ExecutionEntity execution = commandContext.getExecutionEntityManager().findExecutionById(executionId); if (execution == null) { throw new ActivitiObjectNotFoundException("execution " + executionId + " doesn't exist", Execution.class); } VariableInstance variableEntity = null; if (isLocal) { variableEntity = execution.getVariableInstanceLocal(variableName, false); } else { variableEntity = execution.getVariableInstance(variableName, false); } return variableEntity; }
Example #4
Source File: TaskEventResource.java From activiti6-boot2 with Apache License 2.0 | 6 votes |
@ApiOperation(value = "Get an event on a task", tags = {"Tasks"}) @ApiResponses(value = { @ApiResponse(code = 200, message = "Indicates the task and event were found and the event is returned."), @ApiResponse(code = 404, message = "Indicates the requested task was not found or the tasks doesn’t have an event with the given ID.") }) @RequestMapping(value = "/runtime/tasks/{taskId}/events/{eventId}", method = RequestMethod.GET, produces = "application/json") public EventResponse getEvent(@ApiParam(name="taskId", value="The id of the task to get the event for.") @PathVariable("taskId") String taskId,@ApiParam(name="eventId", value="The id of the event.") @PathVariable("eventId") String eventId, HttpServletRequest request) { HistoricTaskInstance task = getHistoricTaskFromRequest(taskId); Event event = taskService.getEvent(eventId); if (event == null || !task.getId().equals(event.getTaskId())) { throw new ActivitiObjectNotFoundException("Task '" + task.getId() + "' doesn't have an event with id '" + eventId + "'.", Event.class); } return restResponseFactory.createEventResponse(event); }
Example #5
Source File: GroupMembershipResource.java From activiti6-boot2 with Apache License 2.0 | 6 votes |
@ApiOperation(value = "Delete a member from a group", tags = {"Groups"}) @ApiResponses(value = { @ApiResponse(code = 204, message = "Indicates the group was found and the member has been deleted. The response body is left empty intentionally."), @ApiResponse(code = 404, message = "Indicates the requested group was not found or that the user is not a member of the group. The status description contains additional information about the error.") }) @RequestMapping(value = "/identity/groups/{groupId}/members/{userId}", method = RequestMethod.DELETE) public void deleteMembership(@ApiParam(name = "groupId", value="The id of the group to remove a member from.") @PathVariable("groupId") String groupId,@ApiParam(name = "userId", value="The id of the user to remove.") @PathVariable("userId") String userId, HttpServletRequest request, HttpServletResponse response) { Group group = getGroupFromRequest(groupId); // Check if user is not a member of group since API doesn't return typed // exception if (identityService.createUserQuery().memberOfGroup(group.getId()).userId(userId).count() != 1) { throw new ActivitiObjectNotFoundException("User '" + userId + "' is not part of group '" + group.getId() + "'.", null); } identityService.deleteMembership(userId, group.getId()); response.setStatus(HttpStatus.NO_CONTENT.value()); }
Example #6
Source File: DeploymentManager.java From activiti6-boot2 with Apache License 2.0 | 6 votes |
public ProcessDefinition findDeployedProcessDefinitionById(String processDefinitionId) { if (processDefinitionId == null) { throw new ActivitiIllegalArgumentException("Invalid process definition id : null"); } // first try the cache ProcessDefinitionCacheEntry cacheEntry = processDefinitionCache.get(processDefinitionId); ProcessDefinition processDefinition = cacheEntry != null ? cacheEntry.getProcessDefinition() : null; if (processDefinition == null) { processDefinition = processDefinitionEntityManager.findById(processDefinitionId); if (processDefinition == null) { throw new ActivitiObjectNotFoundException("no deployed process definition found with id '" + processDefinitionId + "'", ProcessDefinition.class); } processDefinition = resolveProcessDefinition(processDefinition).getProcessDefinition(); } return processDefinition; }
Example #7
Source File: BusinessProcess.java From activiti6-boot2 with Apache License 2.0 | 6 votes |
@Deprecated public ProcessInstance startProcessByName(String string) { if (Context.getCommandContext() != null) { throw new ActivitiCdiException("Cannot use startProcessByName in an activiti command."); } ProcessDefinition definition = processEngine.getRepositoryService().createProcessDefinitionQuery().processDefinitionName(string).singleResult(); if (definition == null) { throw new ActivitiObjectNotFoundException("No process definition found for name: " + string, ProcessDefinition.class); } ProcessInstance instance = processEngine.getRuntimeService().startProcessInstanceById(definition.getId(), getAndClearCachedVariables()); if (!instance.isEnded()) { setExecution(instance); } return instance; }
Example #8
Source File: HasExecutionVariableCmd.java From activiti6-boot2 with Apache License 2.0 | 6 votes |
public Boolean execute(CommandContext commandContext) { if (executionId == null) { throw new ActivitiIllegalArgumentException("executionId is null"); } if (variableName == null) { throw new ActivitiIllegalArgumentException("variableName is null"); } ExecutionEntity execution = commandContext.getExecutionEntityManager().findById(executionId); if (execution == null) { throw new ActivitiObjectNotFoundException("execution " + executionId + " doesn't exist", Execution.class); } boolean hasVariable = false; if (isLocal) { hasVariable = execution.hasVariableLocal(variableName); } else { hasVariable = execution.hasVariable(variableName); } return hasVariable; }
Example #9
Source File: TableResource.java From activiti6-boot2 with Apache License 2.0 | 6 votes |
@ApiOperation(value = "Get a single table", tags = {"Database tables"}) @ApiResponses(value = { @ApiResponse(code = 200, message = "Indicates the table exists and the table count is returned."), @ApiResponse(code = 404, message = "Indicates the requested table does not exist.") }) @RequestMapping(value = "/management/tables/{tableName}", method = RequestMethod.GET, produces = "application/json") public TableResponse getTable(@ApiParam(name = "tableName", value="The name of the table to get.") @PathVariable String tableName, HttpServletRequest request) { Map<String, Long> tableCounts = managementService.getTableCount(); TableResponse response = null; for (Entry<String, Long> entry : tableCounts.entrySet()) { if (entry.getKey().equals(tableName)) { response = restResponseFactory.createTableResponse(entry.getKey(), entry.getValue()); break; } } if (response == null) { throw new ActivitiObjectNotFoundException("Could not find a table with name '" + tableName + "'.", String.class); } return response; }
Example #10
Source File: Activiti5Util.java From activiti6-boot2 with Apache License 2.0 | 6 votes |
public static boolean isActiviti5ProcessDefinitionId(CommandContext commandContext, final String processDefinitionId) { if (processDefinitionId == null) { return false; } try { ProcessDefinition processDefinition = ProcessDefinitionUtil.getProcessDefinition(processDefinitionId); if (processDefinition == null) { return false; } return isActiviti5ProcessDefinition(commandContext, processDefinition); } catch (ActivitiObjectNotFoundException e) { return false; } }
Example #11
Source File: DeleteJobCmd.java From activiti6-boot2 with Apache License 2.0 | 6 votes |
protected JobEntity getJobToDelete(CommandContext commandContext) { if (jobId == null) { throw new ActivitiIllegalArgumentException("jobId is null"); } if (log.isDebugEnabled()) { log.debug("Deleting job {}", jobId); } JobEntity job = commandContext.getJobEntityManager().findById(jobId); if (job == null) { throw new ActivitiObjectNotFoundException("No job found with id '" + jobId + "'", Job.class); } // We need to check if the job was locked, ie acquired by the job acquisition thread // This happens if the the job was already acquired, but not yet executed. // In that case, we can't allow to delete the job. if (job.getLockOwner() != null) { throw new ActivitiException("Cannot delete job when the job is being executed. Try again later."); } return job; }
Example #12
Source File: DeleteIdentityLinkForProcessDefinitionCmd.java From activiti6-boot2 with Apache License 2.0 | 6 votes |
public Void execute(CommandContext commandContext) { ProcessDefinitionEntity processDefinition = commandContext.getProcessDefinitionEntityManager().findById(processDefinitionId); if (processDefinition == null) { throw new ActivitiObjectNotFoundException("Cannot find process definition with id " + processDefinitionId, ProcessDefinition.class); } if (Activiti5Util.isActiviti5ProcessDefinition(commandContext, processDefinition)) { Activiti5CompatibilityHandler activiti5CompatibilityHandler = Activiti5Util.getActiviti5CompatibilityHandler(); activiti5CompatibilityHandler.deleteCandidateStarter(processDefinitionId, userId, groupId); return null; } commandContext.getIdentityLinkEntityManager().deleteIdentityLink(processDefinition, userId, groupId); return null; }
Example #13
Source File: DeploymentResourceCollectionResource.java From activiti6-boot2 with Apache License 2.0 | 6 votes |
@ApiOperation(value = "List resources in a deployment", tags = {"Deployment"}, notes="The dataUrl property in the resulting JSON for a single resource contains the actual URL to use for retrieving the binary resource.") @ApiResponses(value = { @ApiResponse(code = 200, message = "Indicates the deployment was found and the resource list has been returned."), @ApiResponse(code = 404, message = "Indicates the requested deployment was not found.") }) @RequestMapping(value = "/repository/deployments/{deploymentId}/resources", method = RequestMethod.GET, produces = "application/json") public List<DeploymentResourceResponse> getDeploymentResources(@ApiParam(name = "deploymentId", value = "The id of the deployment to get the resources for.") @PathVariable String deploymentId, HttpServletRequest request) { // Check if deployment exists Deployment deployment = repositoryService.createDeploymentQuery().deploymentId(deploymentId).singleResult(); if (deployment == null) { throw new ActivitiObjectNotFoundException("Could not find a deployment with id '" + deploymentId + "'.", Deployment.class); } List<String> resourceList = repositoryService.getDeploymentResourceNames(deploymentId); return restResponseFactory.createDeploymentResourceResponseList(deploymentId, resourceList, contentTypeResolver); }
Example #14
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 #15
Source File: AddIdentityLinkForProcessInstanceCmd.java From activiti6-boot2 with Apache License 2.0 | 6 votes |
public Void execute(CommandContext commandContext) { ExecutionEntityManager executionEntityManager = commandContext.getExecutionEntityManager(); ExecutionEntity processInstance = executionEntityManager.findById(processInstanceId); if (processInstance == null) { throw new ActivitiObjectNotFoundException("Cannot find process instance with id " + processInstanceId, ExecutionEntity.class); } if (Activiti5Util.isActiviti5ProcessDefinitionId(commandContext, processInstance.getProcessDefinitionId())) { Activiti5CompatibilityHandler activiti5CompatibilityHandler = Activiti5Util.getActiviti5CompatibilityHandler(); activiti5CompatibilityHandler.addIdentityLinkForProcessInstance(processInstanceId, userId, groupId, type); return null; } IdentityLinkEntityManager identityLinkEntityManager = commandContext.getIdentityLinkEntityManager(); identityLinkEntityManager.addIdentityLink(processInstance, userId, groupId, type); commandContext.getHistoryManager().createProcessInstanceIdentityLinkComment(processInstanceId, userId, groupId, type, true); return null; }
Example #16
Source File: HistoricProcessInstanceCommentResource.java From activiti6-boot2 with Apache License 2.0 | 6 votes |
@ApiOperation(value = "Delete a comment on a historic process instance", tags = { "History" }, notes = "") @ApiResponses(value = { @ApiResponse(code = 204, message = "Indicates the historic process instance and comment were found and the comment is deleted. Response body is left empty intentionally."), @ApiResponse(code = 404, message = "Indicates the requested historic process instance was not found or the historic process instance doesn’t have a comment with the given ID.") }) @RequestMapping(value = "/history/historic-process-instances/{processInstanceId}/comments/{commentId}", method = RequestMethod.DELETE) public void deleteComment(@ApiParam(name="processInstanceId", value="The id of the historic process instance to delete the comment for.") @PathVariable("processInstanceId") String processInstanceId, @ApiParam(name="commentId", value="The id of the comment.") @PathVariable("commentId") String commentId, HttpServletRequest request, HttpServletResponse response) { HistoricProcessInstance instance = getHistoricProcessInstanceFromRequest(processInstanceId); Comment comment = taskService.getComment(commentId); if (comment == null || comment.getProcessInstanceId() == null || !comment.getProcessInstanceId().equals(instance.getId())) { throw new ActivitiObjectNotFoundException("Process instance '" + instance.getId() + "' doesn't have a comment with id '" + commentId + "'.", Comment.class); } taskService.deleteComment(commentId); response.setStatus(HttpStatus.NO_CONTENT.value()); }
Example #17
Source File: GetTaskVariableCmd.java From activiti6-boot2 with Apache License 2.0 | 6 votes |
public Object execute(CommandContext commandContext) { if (taskId == null) { throw new ActivitiIllegalArgumentException("taskId is null"); } if (variableName == null) { throw new ActivitiIllegalArgumentException("variableName is null"); } TaskEntity task = commandContext.getTaskEntityManager().findById(taskId); if (task == null) { throw new ActivitiObjectNotFoundException("task " + taskId + " doesn't exist", Task.class); } Object value; if (isLocal) { value = task.getVariableLocal(variableName, false); } else { value = task.getVariable(variableName, false); } return value; }
Example #18
Source File: AddIdentityLinkForProcessDefinitionCmd.java From activiti6-boot2 with Apache License 2.0 | 6 votes |
public Void execute(CommandContext commandContext) { ProcessDefinitionEntity processDefinition = commandContext.getProcessDefinitionEntityManager().findById(processDefinitionId); if (processDefinition == null) { throw new ActivitiObjectNotFoundException("Cannot find process definition with id " + processDefinitionId, ProcessDefinition.class); } if (Activiti5Util.isActiviti5ProcessDefinition(commandContext, processDefinition)) { Activiti5CompatibilityHandler activiti5CompatibilityHandler = Activiti5Util.getActiviti5CompatibilityHandler(); activiti5CompatibilityHandler.addCandidateStarter(processDefinitionId, userId, groupId); return null; } commandContext.getIdentityLinkEntityManager().addIdentityLink(processDefinition, userId, groupId); return null; }
Example #19
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 #20
Source File: UserInfoResource.java From activiti6-boot2 with Apache License 2.0 | 6 votes |
@ApiOperation(value = "Get a user’s info", tags = {"Users"}) @ApiResponses(value = { @ApiResponse(code = 200, message = "Indicates the user was found and the user has info for the given key."), @ApiResponse(code = 404, message = "Indicates the requested user was not found or the user doesn’t have info for the given key. Status description contains additional information about the error.") }) @RequestMapping(value = "/identity/users/{userId}/info/{key}", method = RequestMethod.GET, produces = "application/json") public UserInfoResponse getUserInfo(@ApiParam(name = "userId", value="The id of the user to get the info for.") @PathVariable("userId") String userId,@ApiParam(name = "key", value="The key of the user info to get.") @PathVariable("key") String key, HttpServletRequest request) { User user = getUserFromRequest(userId); String existingValue = identityService.getUserInfo(user.getId(), key); if (existingValue == null) { throw new ActivitiObjectNotFoundException("User info with key '" + key + "' does not exists for user '" + user.getId() + "'.", null); } return restResponseFactory.createUserInfoResponse(key, existingValue, user.getId()); }
Example #21
Source File: RepositoryServiceTest.java From activiti6-boot2 with Apache License 2.0 | 5 votes |
@Deployment(resources = { "org/activiti/engine/test/api/oneTaskProcess.bpmn20.xml" }) public void testGetResourceAsStreamUnexistingDeployment() { try { repositoryService.getResourceAsStream("unexistingdeployment", "org/activiti/engine/test/api/unexistingProcess.bpmn.xml"); fail("ActivitiException expected"); } catch (ActivitiObjectNotFoundException ae) { assertTextPresent("deployment does not exist", ae.getMessage()); assertEquals(org.activiti.engine.repository.Deployment.class, ae.getObjectClass()); } }
Example #22
Source File: HistoricVariableInstanceDataResource.java From activiti6-boot2 with Apache License 2.0 | 5 votes |
@ApiResponses(value = { @ApiResponse(code = 200, message = "Indicates the variable instance was found and the requested variable data is returned."), @ApiResponse(code = 404, message = "Indicates the requested variable instance was not found or the variable instance doesn’t have a variable with the given name or the variable doesn’t have a binary stream available. Status message provides additional information.")}) @ApiOperation(value = "Get the binary data for a historic task instance variable", tags = {"History"}, nickname = "getHistoricInstanceVariableData", notes = "The response body contains the binary value of the variable. When the variable is of type binary, the content-type of the response is set to application/octet-stream, regardless of the content of the variable or the request accept-type header. In case of serializable, application/x-java-serialized-object is used as content-type.") @RequestMapping(value = "/history/historic-variable-instances/{varInstanceId}/data", method = RequestMethod.GET) public @ResponseBody byte[] getVariableData(@ApiParam(name="varInstanceId") @PathVariable("varInstanceId") String varInstanceId, HttpServletRequest request, HttpServletResponse response) { try { byte[] result = null; RestVariable variable = getVariableFromRequest(true, varInstanceId, request); if (RestResponseFactory.BYTE_ARRAY_VARIABLE_TYPE.equals(variable.getType())) { result = (byte[]) variable.getValue(); response.setContentType("application/octet-stream"); } else if (RestResponseFactory.SERIALIZABLE_VARIABLE_TYPE.equals(variable.getType())) { ByteArrayOutputStream buffer = new ByteArrayOutputStream(); ObjectOutputStream outputStream = new ObjectOutputStream(buffer); outputStream.writeObject(variable.getValue()); outputStream.close(); result = buffer.toByteArray(); response.setContentType("application/x-java-serialized-object"); } else { throw new ActivitiObjectNotFoundException("The variable does not have a binary data stream.", null); } return result; } catch (IOException ioe) { // Re-throw IOException throw new ActivitiException("Unexpected exception getting variable data", ioe); } }
Example #23
Source File: RuntimeServiceTest.java From activiti6-boot2 with Apache License 2.0 | 5 votes |
public void testStartProcessInstanceByKeyUnexistingKey() { try { runtimeService.startProcessInstanceByKey("unexistingkey"); fail("ActivitiException expected"); } catch (ActivitiObjectNotFoundException ae) { assertTextPresent("no processes deployed with key", ae.getMessage()); assertEquals(ProcessDefinition.class, ae.getObjectClass()); } }
Example #24
Source File: FindActiveActivityIdsCmd.java From activiti6-boot2 with Apache License 2.0 | 5 votes |
public List<String> execute(CommandContext commandContext) { if (executionId == null) { throw new ActivitiIllegalArgumentException("executionId is null"); } ExecutionEntityManager executionEntityManager = commandContext.getExecutionEntityManager(); ExecutionEntity execution = executionEntityManager.findById(executionId); if (execution == null) { throw new ActivitiObjectNotFoundException("execution " + executionId + " doesn't exist", Execution.class); } return findActiveActivityIds(execution); }
Example #25
Source File: RepositoryServiceTest.java From activiti6-boot2 with Apache License 2.0 | 5 votes |
@Deployment(resources = { "org/activiti/engine/test/api/oneTaskProcess.bpmn20.xml" }) public void testGetResourceAsStreamUnexistingResourceInExistingDeployment() { // Get hold of the deployment id org.activiti.engine.repository.Deployment deployment = repositoryService.createDeploymentQuery().singleResult(); try { repositoryService.getResourceAsStream(deployment.getId(), "org/activiti/engine/test/api/unexistingProcess.bpmn.xml"); fail("ActivitiException expected"); } catch (ActivitiObjectNotFoundException ae) { assertTextPresent("no resource found with name", ae.getMessage()); assertEquals(InputStream.class, ae.getObjectClass()); } }
Example #26
Source File: DeploymentResource.java From activiti6-boot2 with Apache License 2.0 | 5 votes |
@ApiOperation(value = "Get a deployment", tags = {"Deployment"}) @ApiResponses(value = { @ApiResponse(code = 200, message = "Indicates the deployment was found and returned."), @ApiResponse(code = 404, message = "Indicates the requested deployment was not found.") }) @RequestMapping(value = "/repository/deployments/{deploymentId}", method = RequestMethod.GET, produces = "application/json") public DeploymentResponse getDeployment(@ApiParam(name = "deploymentId", value = "The id of the deployment to get.") @PathVariable String deploymentId, HttpServletRequest request) { Deployment deployment = repositoryService.createDeploymentQuery().deploymentId(deploymentId).singleResult(); if (deployment == null) { throw new ActivitiObjectNotFoundException("Could not find a deployment with id '" + deploymentId + "'.", Deployment.class); } return restResponseFactory.createDeploymentResponse(deployment); }
Example #27
Source File: TestHelper.java From activiti6-boot2 with Apache License 2.0 | 5 votes |
public static void annotationDeploymentTearDown(ProcessEngine processEngine, String deploymentId, Class<?> testClass, String methodName) { log.debug("annotation @Deployment deletes deployment for {}.{}", testClass.getSimpleName(), methodName); if (deploymentId != null) { try { ProcessEngineConfigurationImpl processEngineConfig = (ProcessEngineConfigurationImpl) processEngine.getProcessEngineConfiguration(); processEngineConfig.getActiviti5CompatibilityHandler().deleteDeployment(deploymentId, true); } catch (ActivitiObjectNotFoundException e) { // Deployment was already deleted by the test case. Ignore. } } }
Example #28
Source File: ExecuteActivityForAdhocSubProcessCmd.java From activiti6-boot2 with Apache License 2.0 | 5 votes |
public Execution execute(CommandContext commandContext) { ExecutionEntity execution = commandContext.getExecutionEntityManager().findById(executionId); if (execution == null) { throw new ActivitiObjectNotFoundException("No execution found for id '" + executionId + "'", ExecutionEntity.class); } if (execution.getCurrentFlowElement() instanceof AdhocSubProcess == false) { throw new ActivitiException("The current flow element of the requested execution is not an ad-hoc sub process"); } FlowNode foundNode = null; AdhocSubProcess adhocSubProcess = (AdhocSubProcess) execution.getCurrentFlowElement(); // if sequential ordering, only one child execution can be active if (adhocSubProcess.hasSequentialOrdering()) { if (execution.getExecutions().size() > 0) { throw new ActivitiException("Sequential ad-hoc sub process already has an active execution"); } } for (FlowElement flowElement : adhocSubProcess.getFlowElements()) { if (activityId.equals(flowElement.getId()) && flowElement instanceof FlowNode) { FlowNode flowNode = (FlowNode) flowElement; if (flowNode.getIncomingFlows().size() == 0) { foundNode = flowNode; } } } if (foundNode == null) { throw new ActivitiException("The requested activity with id " + activityId + " can not be enabled"); } ExecutionEntity activityExecution = Context.getCommandContext().getExecutionEntityManager().createChildExecution(execution); activityExecution.setCurrentFlowElement(foundNode); Context.getAgenda().planContinueProcessOperation(activityExecution); return activityExecution; }
Example #29
Source File: TaskVariableResource.java From activiti6-boot2 with Apache License 2.0 | 5 votes |
@ApiOperation(value = "Delete a variable on a task", tags = {"Tasks"}, nickname = "deleteTaskInstanceVariable") @ApiResponses(value = { @ApiResponse(code = 204, message = "Indicates the task variable was found and has been deleted. Response-body is intentionally empty."), @ApiResponse(code = 404, message = "Indicates the requested task was not found or the task doesn’t have a variable with the given name. Status message contains additional information about the error.") }) @RequestMapping(value = "/runtime/tasks/{taskId}/variables/{variableName}", method = RequestMethod.DELETE) public void deleteVariable(@ApiParam(name="taskId", value = "The id of the task the variable to delete belongs to.") @PathVariable("taskId") String taskId,@ApiParam(name="variableName", value = "The name of the variable to delete.") @PathVariable("variableName") String variableName,@ApiParam(hidden=true) @RequestParam(value = "scope", required = false) String scopeString, HttpServletResponse response) { Task task = getTaskFromRequest(taskId); // Determine scope RestVariableScope scope = RestVariableScope.LOCAL; if (scopeString != null) { scope = RestVariable.getScopeFromString(scopeString); } if (!hasVariableOnScope(task, variableName, scope)) { throw new ActivitiObjectNotFoundException("Task '" + task.getId() + "' doesn't have a variable '" + variableName + "' in scope " + scope.name().toLowerCase(), VariableInstanceEntity.class); } if (scope == RestVariableScope.LOCAL) { taskService.removeVariableLocal(task.getId(), variableName); } else { // Safe to use executionId, as the hasVariableOnScope whould have // stopped a global-var update on standalone task runtimeService.removeVariable(task.getExecutionId(), variableName); } response.setStatus(HttpStatus.NO_CONTENT.value()); }
Example #30
Source File: GetTaskFormCmd.java From activiti6-boot2 with Apache License 2.0 | 5 votes |
public TaskFormData execute(CommandContext commandContext) { TaskEntity task = commandContext.getTaskEntityManager().findById(taskId); if (task == null) { throw new ActivitiObjectNotFoundException("No task found for taskId '" + taskId + "'", Task.class); } TaskFormHandler taskFormHandler = FormHandlerUtil.getTaskFormHandlder(task); if (taskFormHandler == null) { throw new ActivitiException("No taskFormHandler specified for task '" + taskId + "'"); } return taskFormHandler.createTaskForm(task); }