org.flowable.bpmn.model.Process Java Examples
The following examples show how to use
org.flowable.bpmn.model.Process.
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: EndEventValidator.java From flowable-engine with Apache License 2.0 | 8 votes |
@Override protected void executeValidation(BpmnModel bpmnModel, Process process, List<ValidationError> errors) { List<EndEvent> endEvents = process.findFlowElementsOfType(EndEvent.class); for (EndEvent endEvent : endEvents) { if (endEvent.getEventDefinitions() != null && !endEvent.getEventDefinitions().isEmpty()) { EventDefinition eventDefinition = endEvent.getEventDefinitions().get(0); // Error end event if (eventDefinition instanceof CancelEventDefinition) { FlowElementsContainer parent = process.findParent(endEvent); if (!(parent instanceof Transaction)) { addError(errors, Problems.END_EVENT_CANCEL_ONLY_INSIDE_TRANSACTION, process, endEvent, "end event with cancelEventDefinition only supported inside transaction subprocess"); } } } } }
Example #2
Source File: SubprocessValidator.java From flowable-engine with Apache License 2.0 | 6 votes |
@Override protected void executeValidation(BpmnModel bpmnModel, Process process, List<ValidationError> errors) { List<SubProcess> subProcesses = process.findFlowElementsOfType(SubProcess.class); for (SubProcess subProcess : subProcesses) { if (!(subProcess instanceof EventSubProcess)) { // Verify start events List<StartEvent> startEvents = process.findFlowElementsInSubProcessOfType(subProcess, StartEvent.class, false); if (startEvents.size() > 1) { addError(errors, Problems.SUBPROCESS_MULTIPLE_START_EVENTS, process, subProcess, "Multiple start events not supported for subprocess"); } for (StartEvent startEvent : startEvents) { if (!startEvent.getEventDefinitions().isEmpty()) { addError(errors, Problems.SUBPROCESS_START_EVENT_EVENT_DEFINITION_NOT_ALLOWED, process, startEvent, "event definitions only allowed on start event if subprocess is an event subprocess"); } } } } }
Example #3
Source File: SendTaskValidator.java From flowable-engine with Apache License 2.0 | 6 votes |
protected void verifyWebservice(BpmnModel bpmnModel, Process process, SendTask sendTask, List<ValidationError> errors) { if (ImplementationType.IMPLEMENTATION_TYPE_WEBSERVICE.equalsIgnoreCase(sendTask.getImplementationType()) && StringUtils.isNotEmpty(sendTask.getOperationRef())) { boolean operationFound = false; if (bpmnModel.getInterfaces() != null && !bpmnModel.getInterfaces().isEmpty()) { for (Interface bpmnInterface : bpmnModel.getInterfaces()) { if (bpmnInterface.getOperations() != null && !bpmnInterface.getOperations().isEmpty()) { for (Operation operation : bpmnInterface.getOperations()) { if (operation.getId() != null && operation.getId().equals(sendTask.getOperationRef())) { operationFound = true; break; } } } } } if (!operationFound) { addError(errors, Problems.SEND_TASK_WEBSERVICE_INVALID_OPERATION_REF, process, sendTask, "Invalid operation reference for send task"); } } }
Example #4
Source File: BaseAppDefinitionService.java From flowable-engine with Apache License 2.0 | 6 votes |
protected void processUserTasks(Collection<FlowElement> flowElements, Process process, Map<String, StartEvent> startEventMap) { for (FlowElement flowElement : flowElements) { if (flowElement instanceof UserTask) { UserTask userTask = (UserTask) flowElement; if ("$INITIATOR".equals(userTask.getAssignee())) { if (startEventMap.get(process.getId()) != null) { userTask.setAssignee("${" + startEventMap.get(process.getId()).getInitiator() + "}"); } } } else if (flowElement instanceof SubProcess) { processUserTasks(((SubProcess) flowElement).getFlowElements(), process, startEventMap); } } }
Example #5
Source File: ActivitiTestCaseProcessValidator.java From flowable-engine with Apache License 2.0 | 6 votes |
@Override public List<ValidationError> validate(BpmnModel bpmnModel) { List<ValidationError> errorList = new ArrayList<ValidationError>(); CustomParseValidator customParseValidator = new CustomParseValidator(); for (Process process : bpmnModel.getProcesses()) { customParseValidator.executeParse(bpmnModel, process); } for (String errorRef : bpmnModel.getErrors().keySet()) { ValidationError error = new ValidationError(); error.setValidatorSetName("Manual BPMN parse validator"); error.setProblem(errorRef); error.setActivityId(bpmnModel.getErrors().get(errorRef)); errorList.add(error); } return errorList; }
Example #6
Source File: ProcessDefinitionResource.java From flowable-engine with Apache License 2.0 | 6 votes |
protected FormInfo getStartForm(ProcessDefinition processDefinition) { FormInfo formInfo = null; BpmnModel bpmnModel = repositoryService.getBpmnModel(processDefinition.getId()); Process process = bpmnModel.getProcessById(processDefinition.getKey()); FlowElement startElement = process.getInitialFlowElement(); if (startElement instanceof StartEvent) { StartEvent startEvent = (StartEvent) startElement; if (StringUtils.isNotEmpty(startEvent.getFormKey())) { if (startEvent.isSameDeployment()) { Deployment deployment = repositoryService.createDeploymentQuery().deploymentId(processDefinition.getDeploymentId()).singleResult(); formInfo = formRepositoryService.getFormModelByKeyAndParentDeploymentId(startEvent.getFormKey(), deployment.getParentDeploymentId(), processDefinition.getTenantId(), processEngineConfiguration.isFallbackToDefaultTenant()); } else { formInfo = formRepositoryService.getFormModelByKey(startEvent.getFormKey(), processDefinition.getTenantId(), processEngineConfiguration.isFallbackToDefaultTenant()); } } } if (formInfo == null) { // Definition found, but no form attached throw new FlowableObjectNotFoundException("Process definition does not have a form defined: " + processDefinition.getId()); } return formInfo; }
Example #7
Source File: CachingAndArtifactsManager.java From flowable-engine with Apache License 2.0 | 6 votes |
/** * Ensures that the process definition is cached in the appropriate places, including the deployment's collection of deployed artifacts and the deployment manager's cache, as well as caching any * ProcessDefinitionInfos. */ public void updateCachingAndArtifacts(ParsedDeployment parsedDeployment) { CommandContext commandContext = Context.getCommandContext(); final ProcessEngineConfigurationImpl processEngineConfiguration = CommandContextUtil.getProcessEngineConfiguration(); DeploymentCache<ProcessDefinitionCacheEntry> processDefinitionCache = processEngineConfiguration.getDeploymentManager().getProcessDefinitionCache(); DeploymentEntity deployment = parsedDeployment.getDeployment(); for (ProcessDefinitionEntity processDefinition : parsedDeployment.getAllProcessDefinitions()) { BpmnModel bpmnModel = parsedDeployment.getBpmnModelForProcessDefinition(processDefinition); Process process = parsedDeployment.getProcessModelForProcessDefinition(processDefinition); ProcessDefinitionCacheEntry cacheEntry = new ProcessDefinitionCacheEntry(processDefinition, bpmnModel, process); processDefinitionCache.add(processDefinition.getId(), cacheEntry); addDefinitionInfoToCache(processDefinition, processEngineConfiguration, commandContext); // Add to deployment for further usage deployment.addDeployedArtifact(processDefinition); } }
Example #8
Source File: FlowableProcessDefinitionService.java From flowable-engine with Apache License 2.0 | 6 votes |
protected FormInfo getStartForm(ProcessDefinition processDefinition) { FormInfo formInfo = null; BpmnModel bpmnModel = repositoryService.getBpmnModel(processDefinition.getId()); Process process = bpmnModel.getProcessById(processDefinition.getKey()); FlowElement startElement = process.getInitialFlowElement(); if (startElement instanceof StartEvent) { StartEvent startEvent = (StartEvent) startElement; if (StringUtils.isNotEmpty(startEvent.getFormKey())) { Deployment deployment = repositoryService.createDeploymentQuery().deploymentId(processDefinition.getDeploymentId()).singleResult(); formInfo = formRepositoryService.getFormModelByKeyAndParentDeploymentId(startEvent.getFormKey(), deployment.getParentDeploymentId(), processDefinition.getTenantId(), processEngineConfiguration.isFallbackToDefaultTenant()); } } if (formInfo == null) { // Definition found, but no form attached throw new NotFoundException("Process definition does not have a form defined: " + processDefinition.getId()); } return formInfo; }
Example #9
Source File: FlowableListenerExport.java From flowable-engine with Apache License 2.0 | 6 votes |
public static boolean writeListeners(BaseElement element, boolean didWriteExtensionStartElement, XMLStreamWriter xtw) throws Exception { if (element instanceof HasExecutionListeners) { didWriteExtensionStartElement = writeListeners(ELEMENT_EXECUTION_LISTENER, ((HasExecutionListeners) element).getExecutionListeners(), didWriteExtensionStartElement, xtw); } // In case of a usertask, also add task-listeners if (element instanceof UserTask) { didWriteExtensionStartElement = writeListeners(ELEMENT_TASK_LISTENER, ((UserTask) element).getTaskListeners(), didWriteExtensionStartElement, xtw); } // In case of a process-element, write the event-listeners if (element instanceof Process) { didWriteExtensionStartElement = writeEventListeners(((Process) element).getEventListeners(), didWriteExtensionStartElement, xtw); } return didWriteExtensionStartElement; }
Example #10
Source File: BpmnModelValidator.java From flowable-engine with Apache License 2.0 | 6 votes |
/** * Returns 'true' if at least one process definition in the {@link BpmnModel} is executable. */ protected boolean validateAtLeastOneExecutable(BpmnModel bpmnModel, List<ValidationError> errors) { int nrOfExecutableDefinitions = 0; for (Process process : bpmnModel.getProcesses()) { if (process.isExecutable()) { nrOfExecutableDefinitions++; } } if (nrOfExecutableDefinitions == 0) { addError(errors, Problems.ALL_PROCESS_DEFINITIONS_NOT_EXECUTABLE, "All process definition are set to be non-executable (property 'isExecutable' on process). This is not allowed."); } return nrOfExecutableDefinitions > 0; }
Example #11
Source File: ServiceTaskValidator.java From flowable-engine with Apache License 2.0 | 6 votes |
protected void verifyWebservice(BpmnModel bpmnModel, Process process, ServiceTask serviceTask, List<ValidationError> errors) { if (ImplementationType.IMPLEMENTATION_TYPE_WEBSERVICE.equalsIgnoreCase(serviceTask.getImplementationType()) && StringUtils.isNotEmpty(serviceTask.getOperationRef())) { boolean operationFound = false; if (bpmnModel.getInterfaces() != null && !bpmnModel.getInterfaces().isEmpty()) { for (Interface bpmnInterface : bpmnModel.getInterfaces()) { if (bpmnInterface.getOperations() != null && !bpmnInterface.getOperations().isEmpty()) { for (Operation operation : bpmnInterface.getOperations()) { if (operation.getId() != null && operation.getId().equals(serviceTask.getOperationRef())) { operationFound = true; break; } } } } } if (!operationFound) { addError(errors, Problems.SERVICE_TASK_WEBSERVICE_INVALID_OPERATION_REF, process, serviceTask, "Invalid operation reference"); } } }
Example #12
Source File: EventListenerConverterTest.java From flowable-engine with Apache License 2.0 | 6 votes |
private void validateModel(BpmnModel model) { Process process = model.getMainProcess(); assertThat(process).isNotNull(); assertThat(process.getEventListeners()).isNotNull(); assertThat(process.getEventListeners()) .extracting(EventListener::getEvents, EventListener::getImplementation, EventListener::getImplementationType, EventListener::getEntityType) .containsExactly( // Listener with class tuple("ENTITY_CREATE", "org.activiti.test.MyListener", ImplementationType.IMPLEMENTATION_TYPE_CLASS, null), // Listener with class, but no specific event (== all events) tuple(null, "org.activiti.test.AllEventTypesListener", ImplementationType.IMPLEMENTATION_TYPE_CLASS, null), // Listener with delegate expression tuple("ENTITY_DELETE", "${myListener}", ImplementationType.IMPLEMENTATION_TYPE_DELEGATEEXPRESSION, null), // Listener that throws a signal-event tuple("ENTITY_DELETE", "theSignal", ImplementationType.IMPLEMENTATION_TYPE_THROW_SIGNAL_EVENT, null), // Listener that throws a global signal-event tuple("ENTITY_DELETE", "theSignal", ImplementationType.IMPLEMENTATION_TYPE_THROW_GLOBAL_SIGNAL_EVENT, null), // Listener that throws a message-event tuple("ENTITY_DELETE", "theMessage", ImplementationType.IMPLEMENTATION_TYPE_THROW_MESSAGE_EVENT, null), // Listener that throws an error-event tuple("ENTITY_DELETE", "123", ImplementationType.IMPLEMENTATION_TYPE_THROW_ERROR_EVENT, null), // Listener restricted to a specific entity tuple("ENTITY_DELETE", "123", ImplementationType.IMPLEMENTATION_TYPE_THROW_ERROR_EVENT, "job") ); }
Example #13
Source File: StartProcessInstanceBeforeContext.java From flowable-engine with Apache License 2.0 | 6 votes |
public StartProcessInstanceBeforeContext(String businessKey, String processInstanceName, String callbackId, String callbackType, String referenceId, String referenceType, Map<String, Object> variables, Map<String, Object> transientVariables, String tenantId, String initiatorVariableName, String initialActivityId, FlowElement initialFlowElement, Process process, ProcessDefinition processDefinition, String overrideDefinitionTenantId, String predefinedProcessInstanceId) { super(businessKey, processInstanceName, variables, initialActivityId, initialFlowElement, process, processDefinition); this.callbackId = callbackId; this.callbackType = callbackType; this.referenceId = referenceId; this.referenceType = referenceType; this.transientVariables = transientVariables; this.tenantId = tenantId; this.initiatorVariableName = initiatorVariableName; this.overrideDefinitionTenantId = overrideDefinitionTenantId; this.predefinedProcessInstanceId = predefinedProcessInstanceId; }
Example #14
Source File: StartProcessInstanceAsyncCmd.java From flowable-engine with Apache License 2.0 | 6 votes |
protected void executeAsynchronous(ExecutionEntity execution, Process process) { JobService jobService = CommandContextUtil.getJobService(); JobEntity job = jobService.createJob(); job.setExecutionId(execution.getId()); job.setProcessInstanceId(execution.getProcessInstanceId()); job.setProcessDefinitionId(execution.getProcessDefinitionId()); job.setElementId(process.getId()); job.setElementName(process.getName()); job.setJobHandlerType(AsyncContinuationJobHandler.TYPE); // Inherit tenant id (if applicable) if (execution.getTenantId() != null) { job.setTenantId(execution.getTenantId()); } execution.getJobs().add(job); jobService.createAsyncJob(job, false); jobService.scheduleAsyncJob(job); }
Example #15
Source File: StartProcessInstanceAsyncCmd.java From flowable-engine with Apache License 2.0 | 6 votes |
@Override public ProcessInstance execute(CommandContext commandContext) { ProcessEngineConfigurationImpl processEngineConfiguration = CommandContextUtil.getProcessEngineConfiguration(commandContext); ProcessDefinition processDefinition = getProcessDefinition(processEngineConfiguration); processInstanceHelper = CommandContextUtil.getProcessEngineConfiguration(commandContext).getProcessInstanceHelper(); ExecutionEntity processInstance = (ExecutionEntity) processInstanceHelper.createProcessInstance(processDefinition, businessKey, processInstanceName, overrideDefinitionTenantId, predefinedProcessInstanceId, variables, transientVariables, callbackId, callbackType, referenceId, referenceType, stageInstanceId, false); ExecutionEntity execution = processInstance.getExecutions().get(0); Process process = ProcessDefinitionUtil.getProcess(processInstance.getProcessDefinitionId()); processInstanceHelper.processAvailableEventSubProcesses(processInstance, process, commandContext); FlowableEventDispatcher eventDispatcher = CommandContextUtil.getProcessEngineConfiguration().getEventDispatcher(); if (eventDispatcher != null && eventDispatcher.isEnabled()) { eventDispatcher.dispatchEvent(FlowableEventBuilder.createProcessStartedEvent(execution, variables, false)); } executeAsynchronous(execution, process); return processInstance; }
Example #16
Source File: SyncopeFormHandlerHelper.java From syncope with Apache License 2.0 | 6 votes |
@Override public TaskFormHandler getTaskFormHandlder(final String procDefId, final String taskId) { Process process = ProcessDefinitionUtil.getProcess(procDefId); FlowElement flowElement = process.getFlowElement(taskId, true); if (flowElement instanceof UserTask) { UserTask userTask = (UserTask) flowElement; ProcessDefinition processDefinitionEntity = ProcessDefinitionUtil.getProcessDefinition(procDefId); DeploymentEntity deploymentEntity = CommandContextUtil.getProcessEngineConfiguration(). getDeploymentEntityManager().findById(processDefinitionEntity.getDeploymentId()); TaskFormHandler taskFormHandler = new SyncopeTaskFormHandler(); taskFormHandler.parseConfiguration( userTask.getFormProperties(), userTask.getFormKey(), deploymentEntity, processDefinitionEntity); return taskFormHandler; } return null; }
Example #17
Source File: TerminateEndEventActivityBehavior.java From flowable-engine with Apache License 2.0 | 5 votes |
protected Process getProcessForTerminateEndEvent(FlowElement terminateEndEvent) { FlowElementsContainer parent = terminateEndEvent.getParentContainer(); while (!(parent instanceof Process)) { // FlowElementsContainer can only be Process or SubProcess (and its subtypes) SubProcess subProcess = (SubProcess) parent; parent = subProcess.getParentContainer(); } return (Process) parent; }
Example #18
Source File: LaneParser.java From flowable-engine with Apache License 2.0 | 5 votes |
public void parse(XMLStreamReader xtr, Process activeProcess, BpmnModel model) throws Exception { Lane lane = new Lane(); BpmnXMLUtil.addXMLLocation(lane, xtr); lane.setId(xtr.getAttributeValue(null, ATTRIBUTE_ID)); lane.setName(xtr.getAttributeValue(null, ATTRIBUTE_NAME)); lane.setParentProcess(activeProcess); activeProcess.getLanes().add(lane); BpmnXMLUtil.parseChildElements(ELEMENT_LANE, lane, xtr, model); }
Example #19
Source File: NotExecutablePoolConverterTest.java From flowable-engine with Apache License 2.0 | 5 votes |
private void validateModel(BpmnModel model) { String idPool = "idPool"; String idProcess = "poolProcess"; assertThat(model.getPools()) .extracting(Pool::getId, Pool::getProcessRef, Pool::isExecutable) .containsExactly(tuple(idPool, idProcess, false)); Process process = model.getProcess(idPool); assertThat(process.getId()).isEqualTo(idProcess); assertThat(process.isExecutable()).isFalse(); assertThat(process.getLanes()).hasSize(3); }
Example #20
Source File: ServiceTaskValidator.java From flowable-engine with Apache License 2.0 | 5 votes |
protected void verifyResultVariableName(Process process, ServiceTask serviceTask, List<ValidationError> errors) { if (StringUtils.isNotEmpty(serviceTask.getResultVariableName()) && (ImplementationType.IMPLEMENTATION_TYPE_CLASS.equals(serviceTask.getImplementationType()) || ImplementationType.IMPLEMENTATION_TYPE_DELEGATEEXPRESSION.equals(serviceTask.getImplementationType()))) { addError(errors, Problems.SERVICE_TASK_RESULT_VAR_NAME_WITH_DELEGATE, process, serviceTask, "'resultVariableName' not supported for service tasks using 'class' or 'delegateExpression"); } if (serviceTask.isUseLocalScopeForResultVariable() && StringUtils.isEmpty(serviceTask.getResultVariableName())) { addWarning(errors, Problems.SERVICE_TASK_USE_LOCAL_SCOPE_FOR_RESULT_VAR_WITHOUT_RESULT_VARIABLE_NAME, process, serviceTask, "'useLocalScopeForResultVariable' is set, but no 'resultVariableName' is set. The property would not be used"); } }
Example #21
Source File: ProcessDefinitionPersistenceTest.java From flowable-engine with Apache License 2.0 | 5 votes |
@Test public void testProcessDefinitionIntrospection() { String deploymentId = repositoryService.createDeployment().addClasspathResource("org/flowable/engine/test/db/processOne.bpmn20.xml").deploy().getId(); String procDefId = repositoryService.createProcessDefinitionQuery().singleResult().getId(); ProcessDefinition processDefinition = ((RepositoryServiceImpl) repositoryService).getDeployedProcessDefinition(procDefId); assertThat(processDefinition.getId()).isEqualTo(procDefId); assertThat(processDefinition.getName()).isEqualTo("Process One"); Process process = repositoryService.getBpmnModel(processDefinition.getId()).getMainProcess(); StartEvent startElement = (StartEvent) process.getFlowElement("start"); assertThat(startElement).isNotNull(); assertThat(startElement.getId()).isEqualTo("start"); assertThat(startElement.getName()).isEqualTo("S t a r t"); assertThat(startElement.getDocumentation()).isEqualTo("the start event"); List<SequenceFlow> outgoingFlows = startElement.getOutgoingFlows(); assertThat(outgoingFlows) .extracting(SequenceFlow::getConditionExpression) .containsExactly("${a == b}"); EndEvent endElement = (EndEvent) process.getFlowElement("end"); assertThat(endElement).isNotNull(); assertThat(endElement.getId()).isEqualTo("end"); assertThat(outgoingFlows.get(0).getId()).isEqualTo("flow1"); assertThat(outgoingFlows.get(0).getName()).isEqualTo("Flow One"); assertThat(outgoingFlows.get(0).getDocumentation()).isEqualTo("The only transitions in the process"); assertThat(outgoingFlows.get(0).getSourceFlowElement()).isSameAs(startElement); assertThat(outgoingFlows.get(0).getTargetFlowElement()).isSameAs(endElement); repositoryService.deleteDeployment(deploymentId); }
Example #22
Source File: ServiceTaskValidator.java From flowable-engine with Apache License 2.0 | 5 votes |
protected void verifyType(Process process, ServiceTask serviceTask, List<ValidationError> errors) { if (StringUtils.isNotEmpty(serviceTask.getType())) { switch (serviceTask.getType()) { case ServiceTask.MAIL_TASK: validateFieldDeclarationsForEmail(process, serviceTask, serviceTask.getFieldExtensions(), errors); return; case ServiceTask.SHELL_TASK: validateFieldDeclarationsForShell(process, serviceTask, serviceTask.getFieldExtensions(), errors); return; case ServiceTask.DMN_TASK: validateFieldDeclarationsForDmn(process, serviceTask, serviceTask.getFieldExtensions(), errors); return; case ServiceTask.HTTP_TASK: validateFieldDeclarationsForHttp(process, serviceTask, serviceTask.getFieldExtensions(), errors); return; case ServiceTask.CASE_TASK: validateFieldDeclarationsForCase(process, (CaseServiceTask) serviceTask, errors); return; case ServiceTask.SEND_EVENT_TASK: validateFieldDeclarationsForSendEventTask(process, (SendEventServiceTask) serviceTask, errors); return; case ServiceTask.EXTERNAL_WORKER_TASK: validateExternalWorkerTask(process, (ExternalWorkerServiceTask) serviceTask, errors); return; case "mule": case "camel": // Mule or camel have no special validation return; default: addError(errors, Problems.SERVICE_TASK_INVALID_TYPE, process, serviceTask, "Invalid or unsupported service task type"); } } }
Example #23
Source File: BpmnParse.java From flowable-engine with Apache License 2.0 | 5 votes |
/** * Parses the 'definitions' root element */ protected void applyParseHandlers() { sequenceFlows = new HashMap<>(); for (Process process : bpmnModel.getProcesses()) { currentProcess = process; if (process.isExecutable()) { bpmnParserHandlers.parseElement(this, process); } } }
Example #24
Source File: ProcessParseHandler.java From flowable-engine with Apache License 2.0 | 5 votes |
protected ProcessDefinitionEntity transformProcess(BpmnParse bpmnParse, Process process) { ProcessDefinitionEntity currentProcessDefinition = CommandContextUtil.getProcessDefinitionEntityManager().create(); bpmnParse.setCurrentProcessDefinition(currentProcessDefinition); /* * Mapping object model - bpmn xml: * processDefinition.id -> generated by activiti engine * processDefinition.key -> bpmn id (required) * processDefinition.name -> bpmn name (optional) */ currentProcessDefinition.setKey(process.getId()); currentProcessDefinition.setName(process.getName()); currentProcessDefinition.setCategory(bpmnParse.getBpmnModel().getTargetNamespace()); currentProcessDefinition.setDescription(process.getDocumentation()); currentProcessDefinition.setDeploymentId(bpmnParse.getDeployment().getId()); if (bpmnParse.getDeployment().getEngineVersion() != null) { currentProcessDefinition.setEngineVersion(bpmnParse.getDeployment().getEngineVersion()); } createEventListeners(bpmnParse, process.getEventListeners()); if (LOGGER.isDebugEnabled()) { LOGGER.debug("Parsing process {}", currentProcessDefinition.getKey()); } bpmnParse.processFlowElements(process.getFlowElements()); processArtifacts(bpmnParse, process.getArtifacts()); return currentProcessDefinition; }
Example #25
Source File: ExclusiveGatewayValidator.java From flowable-engine with Apache License 2.0 | 5 votes |
@Override protected void executeValidation(BpmnModel bpmnModel, Process process, List<ValidationError> errors) { List<ExclusiveGateway> gateways = process.findFlowElementsOfType(ExclusiveGateway.class); for (ExclusiveGateway gateway : gateways) { validateExclusiveGateway(process, gateway, errors); } }
Example #26
Source File: ServiceTaskValidator.java From flowable-engine with Apache License 2.0 | 5 votes |
protected void verifyImplementation(Process process, ServiceTask serviceTask, List<ValidationError> errors) { if (!ImplementationType.IMPLEMENTATION_TYPE_CLASS.equalsIgnoreCase(serviceTask.getImplementationType()) && !ImplementationType.IMPLEMENTATION_TYPE_DELEGATEEXPRESSION.equalsIgnoreCase(serviceTask.getImplementationType()) && !ImplementationType.IMPLEMENTATION_TYPE_EXPRESSION.equalsIgnoreCase(serviceTask.getImplementationType()) && !ImplementationType.IMPLEMENTATION_TYPE_WEBSERVICE.equalsIgnoreCase(serviceTask.getImplementationType()) && StringUtils.isEmpty(serviceTask.getType())) { addError(errors, Problems.SERVICE_TASK_MISSING_IMPLEMENTATION, process, serviceTask, "One of the attributes 'class', 'delegateExpression', 'type', 'operation', or 'expression' is mandatory on serviceTask."); } }
Example #27
Source File: BpmnXMLConverter.java From flowable-engine with Apache License 2.0 | 5 votes |
protected FlowNode getFlowNodeFromScope(String elementId, BaseElement scope) { FlowNode flowNode = null; if (StringUtils.isNotEmpty(elementId)) { if (scope instanceof Process) { flowNode = (FlowNode) ((Process) scope).getFlowElement(elementId); } else if (scope instanceof SubProcess) { flowNode = (FlowNode) ((SubProcess) scope).getFlowElement(elementId); } } return flowNode; }
Example #28
Source File: AssociationValidator.java From flowable-engine with Apache License 2.0 | 5 votes |
protected void validate(Process process, Association association, List<ValidationError> errors) { if (StringUtils.isEmpty(association.getSourceRef())) { addError(errors, Problems.ASSOCIATION_INVALID_SOURCE_REFERENCE, process, association, "association element missing attribute 'sourceRef'"); } if (StringUtils.isEmpty(association.getTargetRef())) { addError(errors, Problems.ASSOCIATION_INVALID_TARGET_REFERENCE, process, association, "association element missing attribute 'targetRef'"); } }
Example #29
Source File: EventJavaTest.java From flowable-engine with Apache License 2.0 | 5 votes |
@Test public void testStartEventWithExecutionListener() throws Exception { BpmnModel bpmnModel = new BpmnModel(); Process process = new Process(); process.setId("simpleProcess"); process.setName("Very simple process"); bpmnModel.getProcesses().add(process); StartEvent startEvent = new StartEvent(); startEvent.setId("startEvent1"); TimerEventDefinition timerDef = new TimerEventDefinition(); timerDef.setTimeDuration("PT5M"); startEvent.getEventDefinitions().add(timerDef); FlowableListener listener = new FlowableListener(); listener.setImplementationType(ImplementationType.IMPLEMENTATION_TYPE_EXPRESSION); listener.setImplementation("${test}"); listener.setEvent("end"); startEvent.getExecutionListeners().add(listener); process.addFlowElement(startEvent); UserTask task = new UserTask(); task.setId("reviewTask"); task.setAssignee("kermit"); process.addFlowElement(task); SequenceFlow flow1 = new SequenceFlow(); flow1.setId("flow1"); flow1.setSourceRef("startEvent1"); flow1.setTargetRef("reviewTask"); process.addFlowElement(flow1); EndEvent endEvent = new EndEvent(); endEvent.setId("endEvent1"); process.addFlowElement(endEvent); byte[] xml = new BpmnXMLConverter().convertToXML(bpmnModel); new BpmnXMLConverter().validateModel(new InputStreamSource(new ByteArrayInputStream(xml))); Deployment deployment = repositoryService.createDeployment().name("test").addString("test.bpmn20.xml", new String(xml)).deploy(); repositoryService.deleteDeployment(deployment.getId()); }
Example #30
Source File: BpmnParse.java From flowable-engine with Apache License 2.0 | 5 votes |
/** * Parses the 'definitions' root element */ protected void transformProcessDefinitions() { sequenceFlows = new HashMap<>(); for (Process process : bpmnModel.getProcesses()) { if (process.isExecutable()) { bpmnParserHandlers.parseElement(this, process); } } if (!processDefinitions.isEmpty()) { processDI(); } }