org.activiti.engine.ActivitiException Java Examples
The following examples show how to use
org.activiti.engine.ActivitiException.
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: UelExpressionCondition.java From flowable-engine with Apache License 2.0 | 6 votes |
@Override public boolean evaluate(String sequenceFlowId, DelegateExecution execution) { String conditionExpression = null; if (Context.getProcessEngineConfiguration().isEnableProcessDefinitionInfoCache()) { ObjectNode elementProperties = Context.getBpmnOverrideElementProperties(sequenceFlowId, execution.getProcessDefinitionId()); conditionExpression = getActiveValue(initialConditionExpression, DynamicBpmnConstants.SEQUENCE_FLOW_CONDITION, elementProperties); } else { conditionExpression = initialConditionExpression; } Expression expression = Context.getProcessEngineConfiguration().getExpressionManager().createExpression(conditionExpression); Object result = expression.getValue(execution); if (result == null) { throw new ActivitiException("condition expression returns null (sequenceFlowId: " + sequenceFlowId + ")" ); } if (!(result instanceof Boolean)) { throw new ActivitiException("condition expression returns non-Boolean (sequenceFlowId: " + sequenceFlowId + "): " + result + " (" + result.getClass().getName() + ")"); } return (Boolean) result; }
Example #2
Source File: SingleResourceAutoDeploymentStrategy.java From flowable-engine with Apache License 2.0 | 6 votes |
@Override public void deployResources(final String deploymentNameHint, final Resource[] resources, final RepositoryService repositoryService) { // Create a separate deployment for each resource using the resource // name for (final Resource resource : resources) { final String resourceName = determineResourceName(resource); final DeploymentBuilder deploymentBuilder = repositoryService.createDeployment().enableDuplicateFiltering().name(resourceName); try { if (resourceName.endsWith(".bar") || resourceName.endsWith(".zip") || resourceName.endsWith(".jar")) { deploymentBuilder.addZipInputStream(new ZipInputStream(resource.getInputStream())); } else { deploymentBuilder.addInputStream(resourceName, resource.getInputStream()); } } catch (IOException e) { throw new ActivitiException("couldn't auto deploy resource '" + resource + "': " + e.getMessage(), e); } deploymentBuilder.deploy(); } }
Example #3
Source File: ProcessDiagramCanvas.java From activiti-in-action-codes with Apache License 2.0 | 6 votes |
/** * Generates an image of what currently is drawn on the canvas. * <p/> * Throws an {@link ActivitiException} when {@link #close()} is already * called. */ public InputStream generateImage(String imageType) { if (closed) { throw new ActivitiException("ProcessDiagramGenerator already closed"); } ByteArrayOutputStream out = new ByteArrayOutputStream(); try { // Try to remove white space minX = (minX <= 5) ? 5 : minX; minY = (minY <= 5) ? 5 : minY; BufferedImage imageToSerialize = processDiagram; if (minX >= 0 && minY >= 0) { imageToSerialize = processDiagram.getSubimage(minX - 5, minY - 5, canvasWidth - minX + 5, canvasHeight - minY + 5); } ImageIO.write(imageToSerialize, imageType, out); } catch (IOException e) { throw new ActivitiException("Error while generating process image", e); } finally { IoUtil.closeSilently(out); } return new ByteArrayInputStream(out.toByteArray()); }
Example #4
Source File: ProcessValidationExecutedAfterDeployTest.java From activiti6-boot2 with Apache License 2.0 | 6 votes |
public void testGetLatestProcessDefinitionTextByKey() { disableValidation(); repositoryService.createDeployment().addClasspathResource("org/activiti/engine/test/regression/ProcessValidationExecutedAfterDeployTest.bpmn20.xml").deploy(); enableValidation(); clearDeploymentCache(); ProcessDefinition definition = getLatestProcessDefinitionVersionByKey("testProcess1"); if (definition == null) { fail("Error occurred in fetching process model."); } try { repositoryService.getProcessModel(definition.getId()); assertTrue(true); } catch (ActivitiException e) { fail("Error occurred in fetching process model."); } for (org.activiti.engine.repository.Deployment deployment : repositoryService.createDeploymentQuery().list()) { repositoryService.deleteDeployment(deployment.getId()); } }
Example #5
Source File: Activiti5Util.java From activiti6-boot2 with Apache License 2.0 | 6 votes |
public static boolean isActiviti5ProcessDefinition(CommandContext commandContext, ProcessDefinition processDefinition) { if (!commandContext.getProcessEngineConfiguration().isActiviti5CompatibilityEnabled()) { return false; } if (processDefinition.getEngineVersion() != null) { if (Activiti5CompatibilityHandler.ACTIVITI_5_ENGINE_TAG.equals(processDefinition.getEngineVersion())) { if (commandContext.getProcessEngineConfiguration().isActiviti5CompatibilityEnabled()) { return true; } } else { throw new ActivitiException("Invalid 'engine' for process definition " + processDefinition.getId() + " : " + processDefinition.getEngineVersion()); } } return false; }
Example #6
Source File: ProcessInstanceSuspensionTest.java From activiti6-boot2 with Apache License 2.0 | 6 votes |
@Deployment(resources = { "org/activiti/engine/test/api/runtime/oneTaskProcess.bpmn20.xml" }) public void testCannotSuspendSuspendedProcessInstance() { ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().singleResult(); runtimeService.startProcessInstanceByKey(processDefinition.getKey()); ProcessInstance processInstance = runtimeService.createProcessInstanceQuery().singleResult(); assertFalse(processInstance.isSuspended()); runtimeService.suspendProcessInstanceById(processInstance.getId()); try { runtimeService.suspendProcessInstanceById(processInstance.getId()); fail("Expected activiti exception"); } catch (ActivitiException e) { // expected } }
Example #7
Source File: DeploymentBuilderImpl.java From flowable-engine with Apache License 2.0 | 6 votes |
@Override public DeploymentBuilder addZipInputStream(ZipInputStream zipInputStream) { try { ZipEntry entry = zipInputStream.getNextEntry(); while (entry != null) { if (!entry.isDirectory()) { String entryName = entry.getName(); byte[] bytes = IoUtil.readInputStream(zipInputStream, entryName); ResourceEntity resource = new ResourceEntity(); resource.setName(entryName); resource.setBytes(bytes); deployment.addResource(resource); } entry = zipInputStream.getNextEntry(); } } catch (Exception e) { throw new ActivitiException("problem reading zip input stream", e); } return this; }
Example #8
Source File: ProcessInstanceQueryTest.java From activiti6-boot2 with Apache License 2.0 | 6 votes |
public void testQueryByProcessDefinitionId() { final ProcessDefinition processDefinition1 = repositoryService.createProcessDefinitionQuery().processDefinitionKey(PROCESS_DEFINITION_KEY).singleResult(); ProcessInstanceQuery query1 = runtimeService.createProcessInstanceQuery().processDefinitionId(processDefinition1.getId()); assertEquals(PROCESS_DEFINITION_KEY_DEPLOY_COUNT, query1.count()); assertEquals(PROCESS_DEFINITION_KEY_DEPLOY_COUNT, query1.list().size()); try { query1.singleResult(); fail(); } catch (ActivitiException e) { // Exception is expected } final ProcessDefinition processDefinition2 = repositoryService.createProcessDefinitionQuery().processDefinitionKey(PROCESS_DEFINITION_KEY_2).singleResult(); ProcessInstanceQuery query2 = runtimeService.createProcessInstanceQuery().processDefinitionId(processDefinition2.getId()); assertEquals(PROCESS_DEFINITION_KEY_2_DEPLOY_COUNT, query2.count()); assertEquals(PROCESS_DEFINITION_KEY_2_DEPLOY_COUNT, query2.list().size()); assertNotNull(query2.singleResult()); }
Example #9
Source File: ProcessDiagramCanvas.java From maven-framework-project with MIT License | 6 votes |
/** * Generates an image of what currently is drawn on the canvas. * * Throws an {@link ActivitiException} when {@link #close()} is already * called. */ public InputStream generateImage(String imageType) { if (closed) { throw new ActivitiException("ProcessDiagramGenerator already closed"); } ByteArrayOutputStream out = new ByteArrayOutputStream(); try { // Try to remove white space minX = (minX <= 5) ? 5 : minX; minY = (minY <= 5) ? 5 : minY; BufferedImage imageToSerialize = processDiagram; if (minX >= 0 && minY >= 0) { imageToSerialize = processDiagram.getSubimage(minX - 5, minY - 5, canvasWidth - minX + 5, canvasHeight - minY + 5); } ImageIO.write(imageToSerialize, imageType, out); } catch (IOException e) { throw new ActivitiException("Error while generating process image", e); } finally { IoUtil.closeSilently(out); } return new ByteArrayInputStream(out.toByteArray()); }
Example #10
Source File: TaskQueryTest.java From activiti6-boot2 with Apache License 2.0 | 6 votes |
public void testQueryByCandidateGroupOr() { TaskQuery query = taskService.createTaskQuery() .or() .taskId("invalid") .taskCandidateGroup("management"); assertEquals(3, query.count()); assertEquals(3, query.list().size()); try { query.singleResult(); fail("expected exception"); } catch (ActivitiException e) { // OK } query = taskService.createTaskQuery() .or() .taskId("invalid") .taskCandidateGroup("sales"); assertEquals(0, query.count()); assertEquals(0, query.list().size()); }
Example #11
Source File: BaseExecutionVariableResource.java From activiti6-boot2 with Apache License 2.0 | 6 votes |
protected void setVariable(Execution execution, 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(execution, name, scope); if (isNew && hasVariable) { throw new ActivitiException("Variable '" + name + "' is already present on execution '" + execution.getId() + "'."); } if (!isNew && !hasVariable) { throw new ActivitiObjectNotFoundException("Execution '" + execution.getId() + "' doesn't have a variable with name: '" + name + "'.", null); } if (scope == RestVariableScope.LOCAL) { runtimeService.setVariableLocal(execution.getId(), name, value); } else { if (execution.getParentId() != null) { runtimeService.setVariable(execution.getParentId(), name, value); } else { runtimeService.setVariable(execution.getId(), name, value); } } }
Example #12
Source File: ExpressionBeanAccessTest.java From activiti6-boot2 with Apache License 2.0 | 6 votes |
@Deployment public void testConfigurationBeanAccess() { // Exposed bean returns 'I'm exposed' when to-string is called in first // service-task ProcessInstance pi = runtimeService.startProcessInstanceByKey("expressionBeanAccess"); assertEquals("I'm exposed", runtimeService.getVariable(pi.getId(), "exposedBeanResult")); // After signaling, an expression tries to use a bean that is present in // the configuration but is not added to the beans-list try { runtimeService.trigger(runtimeService.createExecutionQuery().processInstanceId(pi.getId()).onlyChildExecutions().singleResult().getId()); fail("Exception expected"); } catch (ActivitiException ae) { assertNotNull(ae.getCause()); assertTrue(ae.getCause() instanceof RuntimeException); RuntimeException runtimeException = (RuntimeException) ae.getCause(); assertTrue(runtimeException.getCause() instanceof PropertyNotFoundException); } }
Example #13
Source File: TaskQueryTest.java From activiti6-boot2 with Apache License 2.0 | 5 votes |
public void testQueryByCandidateGroup() { TaskQuery query = taskService.createTaskQuery().taskCandidateGroup("management"); assertEquals(3, query.count()); assertEquals(3, query.list().size()); try { query.singleResult(); fail("expected exception"); } catch (ActivitiException e) { // OK } query = taskService.createTaskQuery().taskCandidateGroup("sales"); assertEquals(0, query.count()); assertEquals(0, query.list().size()); }
Example #14
Source File: SignalEventHandler.java From flowable-engine with Apache License 2.0 | 5 votes |
@Override public void handleEvent(EventSubscriptionEntity eventSubscription, Object payload, CommandContext commandContext) { if (eventSubscription.getExecutionId() != null) { super.handleEvent(eventSubscription, payload, commandContext); } else if (eventSubscription.getProcessDefinitionId() != null) { // Start event String processDefinitionId = eventSubscription.getProcessDefinitionId(); DeploymentManager deploymentCache = Context .getProcessEngineConfiguration() .getDeploymentManager(); ProcessDefinitionEntity processDefinition = (ProcessDefinitionEntity) deploymentCache.findDeployedProcessDefinitionById(processDefinitionId); if (processDefinition == null) { throw new ActivitiObjectNotFoundException("No process definition found for id '" + processDefinitionId + "'", ProcessDefinition.class); } ActivityImpl startActivity = processDefinition.findActivity(eventSubscription.getActivityId()); if (startActivity == null) { throw new ActivitiException("Could no handle signal: no start activity found with id " + eventSubscription.getActivityId()); } ExecutionEntity processInstance = processDefinition.createProcessInstance(null, startActivity); if (processInstance == null) { throw new ActivitiException("Could not handle signal: no process instance started"); } if (payload != null) { if (payload instanceof Map) { Map<String, Object> variables = (Map<String, Object>) payload; processInstance.setVariables(variables); } } processInstance.start(); } else { throw new ActivitiException("Invalid signal handling: no execution nor process definition set"); } }
Example #15
Source File: DefaultActiviti5CompatibilityHandler.java From activiti6-boot2 with Apache License 2.0 | 5 votes |
public void saveAttachment(Attachment attachment) { try { org.activiti5.engine.impl.identity.Authentication.setAuthenticatedUserId(Authentication.getAuthenticatedUserId()); org.activiti5.engine.task.Attachment activiti5Attachment = getProcessEngine().getTaskService().getAttachment(attachment.getId()); activiti5Attachment.setName(attachment.getName()); activiti5Attachment.setDescription(attachment.getDescription()); activiti5Attachment.setTime(attachment.getTime()); getProcessEngine().getTaskService().saveAttachment(activiti5Attachment); } catch (org.activiti5.engine.ActivitiException e) { handleActivitiException(e); } }
Example #16
Source File: TaskQueryTest.java From activiti6-boot2 with Apache License 2.0 | 5 votes |
public void testQueryByDescription() { TaskQuery query = taskService.createTaskQuery().taskDescription("testTask description"); assertEquals(6, query.list().size()); assertEquals(6, query.count()); try { query.singleResult(); fail(); } catch (ActivitiException e) {} }
Example #17
Source File: JavaServiceTaskTest.java From activiti6-boot2 with Apache License 2.0 | 5 votes |
@Deployment public void testUnexistingClassDelegation() { try { runtimeService.startProcessInstanceByKey("unexistingClassDelegation"); fail(); } catch (ActivitiException e) { assertTrue(e.getMessage().contains("couldn't instantiate class org.activiti.BogusClass")); assertNotNull(e.getCause()); assertTrue(e.getCause() instanceof ActivitiClassLoadingException); } }
Example #18
Source File: LongJsonType.java From activiti6-boot2 with Apache License 2.0 | 5 votes |
public byte[] serialize(Object value, ValueFields valueFields) { if (value == null) { return null; } JsonNode valueNode = (JsonNode) value; try { return valueNode.toString().getBytes("utf-8"); } catch (Exception e) { throw new ActivitiException("Error getting bytes from json variable", e); } }
Example #19
Source File: JPAEntityMappings.java From flowable-engine with Apache License 2.0 | 5 votes |
private Object findEntity(Class<?> entityClass, Object primaryKey) { EntityManager em = Context .getCommandContext() .getSession(EntityManagerSession.class) .getEntityManager(); Object entity = em.find(entityClass, primaryKey); if (entity == null) { throw new ActivitiException("Entity does not exist: " + entityClass.getName() + " - " + primaryKey); } return entity; }
Example #20
Source File: SequentialMultiInstanceBehavior.java From flowable-engine with Apache License 2.0 | 5 votes |
/** * Called when the wrapped {@link ActivityBehavior} calls the {@link AbstractBpmnActivityBehavior#leave(ActivityExecution)} method. Handles the completion of one instance, and executes the logic * for the sequential behavior. */ @Override public void leave(ActivityExecution execution) { int loopCounter = getLoopVariable(execution, getCollectionElementIndexVariable()) + 1; int nrOfInstances = getLoopVariable(execution, NUMBER_OF_INSTANCES); int nrOfCompletedInstances = getLoopVariable(execution, NUMBER_OF_COMPLETED_INSTANCES) + 1; int nrOfActiveInstances = getLoopVariable(execution, NUMBER_OF_ACTIVE_INSTANCES); if (loopCounter != nrOfInstances && !completionConditionSatisfied(execution)) { callActivityEndListeners(execution); } setLoopVariable(execution, getCollectionElementIndexVariable(), loopCounter); setLoopVariable(execution, NUMBER_OF_COMPLETED_INSTANCES, nrOfCompletedInstances); logLoopDetails(execution, "instance completed", loopCounter, nrOfCompletedInstances, nrOfActiveInstances, nrOfInstances); if (loopCounter >= nrOfInstances || completionConditionSatisfied(execution)) { super.leave(execution); } else { try { executeOriginalBehavior(execution, loopCounter); } catch (BpmnError error) { // re-throw business fault so that it can be caught by an Error Intermediate Event or Error Event Sub-Process in the process throw error; } catch (Exception e) { throw new ActivitiException("Could not execute inner activity behavior of multi instance behavior", e); } } }
Example #21
Source File: JPAEntityListVariableType.java From flowable-engine with Apache License 2.0 | 5 votes |
/** * @return a bytearray containing all ID's in the given string serialized as an array. */ protected byte[] serializeIds(List<String> ids) { try { String[] toStore = ids.toArray(new String[]{}); ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectOutputStream out = new ObjectOutputStream(baos); out.writeObject(toStore); return baos.toByteArray(); } catch (IOException ioe) { throw new ActivitiException("Unexpected exception when serializing JPA id's", ioe); } }
Example #22
Source File: JavaServiceTaskTest.java From activiti6-boot2 with Apache License 2.0 | 5 votes |
@Deployment public void testUnexistingClassDelegation() { try { runtimeService.startProcessInstanceByKey("unexistingClassDelegation"); fail(); } catch (ActivitiException e) { assertTrue(e.getMessage().contains("couldn't instantiate class org.activiti.BogusClass")); assertNotNull(e.getCause()); assertTrue(e.getCause() instanceof ActivitiClassLoadingException); } }
Example #23
Source File: HistoricTaskInstanceVariableDataResource.java From activiti6-boot2 with Apache License 2.0 | 5 votes |
@ApiResponses(value = { @ApiResponse(code = 200, message = "Indicates the task instance was found and the requested variable data is returned."), @ApiResponse(code = 404, message = "Indicates the requested task instance was not found or the process 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 = "getHistoricTaskInstanceVariableData", 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-task-instances/{taskId}/variables/{variableName}/data", method = RequestMethod.GET) public @ResponseBody byte[] getVariableData(@ApiParam(name="taskId") @PathVariable("taskId") String taskId,@ApiParam(name="variableName") @PathVariable("variableName") String variableName, @RequestParam(value = "scope", required = false) String scope, HttpServletRequest request, HttpServletResponse response) { try { byte[] result = null; RestVariable variable = getVariableFromRequest(true, taskId, variableName, scope, 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 #24
Source File: CallActivityTest.java From activiti6-boot2 with Apache License 2.0 | 5 votes |
public void testInstantiateSubprocess() throws Exception { BpmnModel mainBpmnModel = loadBPMNModel(MAIN_PROCESS_RESOURCE); BpmnModel childBpmnModel = loadBPMNModel(CHILD_PROCESS_RESOURCE); Deployment childDeployment = processEngine.getRepositoryService() .createDeployment() .name("childProcessDeployment") .addBpmnModel("childProcess.bpmn20.xml", childBpmnModel) .deploymentProperty(DeploymentProperties.DEPLOY_AS_ACTIVITI5_PROCESS_DEFINITION, Boolean.TRUE) .deploy(); processEngine.getRepositoryService() .createDeployment() .name("masterProcessDeployment") .addBpmnModel("masterProcess.bpmn20.xml", mainBpmnModel) .deploymentProperty(DeploymentProperties.DEPLOY_AS_ACTIVITI5_PROCESS_DEFINITION, Boolean.TRUE) .deploy(); suspendProcessDefinitions(childDeployment); try { runtimeService.startProcessInstanceByKey("masterProcess"); fail("Exception expected"); } catch (ActivitiException ae) { assertTextPresent("Cannot start process instance. Process definition Child Process", ae.getMessage()); } }
Example #25
Source File: StartTimerEventRepeatWithoutN.java From activiti6-boot2 with Apache License 2.0 | 5 votes |
@Deployment public void testStartTimerEventRepeatWithoutN() { counter = 0; try { waitForJobExecutorToProcessAllJobs(5500, 500); fail("job is finished sooner than expected"); } catch (ActivitiException e) { assertTrue(e.getMessage().startsWith("time limit")); assertTrue(counter >= 2); } }
Example #26
Source File: MailActivityBehavior.java From activiti6-boot2 with Apache License 2.0 | 5 votes |
protected void addCc(Email email, String cc) { String[] ccs = splitAndTrim(cc); if (ccs != null) { for (String c : ccs) { try { email.addCc(c); } catch (EmailException e) { throw new ActivitiException("Could not add " + c + " as cc recipient", e); } } } }
Example #27
Source File: BoundaryErrorEventTest.java From activiti6-boot2 with Apache License 2.0 | 5 votes |
public void testThrowErrorWithEmptyErrorCode() { try { repositoryService.createDeployment() .addClasspathResource("org/activiti5/engine/test/bpmn/event/error/BoundaryErrorEventTest.testThrowErrorWithEmptyErrorCode.bpmn20.xml") .deploymentProperty(DeploymentProperties.DEPLOY_AS_ACTIVITI5_PROCESS_DEFINITION, Boolean.TRUE) .deploy(); fail("ActivitiException expected"); } catch (ActivitiException re) { } }
Example #28
Source File: ExecutionVariableDataResource.java From activiti6-boot2 with Apache License 2.0 | 5 votes |
@RequestMapping(value = "/runtime/executions/{executionId}/variables/{variableName}/data", method = RequestMethod.GET) @ApiResponses(value = { @ApiResponse(code = 200, message = "Indicates the execution was found and the requested variables are returned."), @ApiResponse(code = 404, message = "Indicates the requested execution was not found or the task doesn’t have a variable with the given name (in the given scope). Status message provides additional information.") }) @ApiOperation(value = "Get the binary data for an execution", tags = {"Executions"}, nickname = "getExecutionVariableData") public @ResponseBody byte[] getVariableData(@ApiParam(name = "executionId") @PathVariable("executionId") String executionId, @ApiParam(name = "variableName") @PathVariable("variableName") String variableName, @RequestParam(value = "scope", required = false) String scope, HttpServletRequest request, HttpServletResponse response) { try { byte[] result = null; Execution execution = getExecutionFromRequest(executionId); RestVariable variable = getVariableFromRequest(execution, variableName, scope, true); 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) { throw new ActivitiException("Error getting variable " + variableName, ioe); } }
Example #29
Source File: ExclusiveGatewayTest.java From activiti6-boot2 with Apache License 2.0 | 5 votes |
@Deployment(resources = {"org/activiti5/engine/test/bpmn/gateway/ExclusiveGatewayTest.testDivergingExclusiveGateway.bpmn20.xml"}) public void testUnknownVariableInExpression() { // Instead of 'input' we're starting a process instance with the name 'iinput' (ie. a typo) try { runtimeService.startProcessInstanceByKey( "exclusiveGwDiverging", CollectionUtil.singletonMap("iinput", 1)); fail(); } catch (ActivitiException e) { assertTextPresent("Unknown property used in expression", e.getMessage()); } }
Example #30
Source File: TaskEntity.java From flowable-engine with Apache License 2.0 | 5 votes |
@Override protected VariableInstanceEntity getSpecificVariable(String variableName) { CommandContext commandContext = Context.getCommandContext(); if (commandContext == null) { throw new ActivitiException("lazy loading outside command context"); } VariableInstanceEntity variableInstance = commandContext .getVariableInstanceEntityManager() .findVariableInstanceByTaskAndName(id, variableName); return variableInstance; }