org.flowable.bpmn.model.BpmnModel Java Examples
The following examples show how to use
org.flowable.bpmn.model.BpmnModel.
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: DataStoreExport.java From flowable-engine with Apache License 2.0 | 6 votes |
public static void writeDataStores(BpmnModel model, XMLStreamWriter xtw) throws Exception { for (DataStore dataStore : model.getDataStores().values()) { xtw.writeStartElement(ELEMENT_DATA_STORE); xtw.writeAttribute(ATTRIBUTE_ID, dataStore.getId()); xtw.writeAttribute(ATTRIBUTE_NAME, dataStore.getName()); if (StringUtils.isNotEmpty(dataStore.getItemSubjectRef())) { xtw.writeAttribute(ATTRIBUTE_ITEM_SUBJECT_REF, dataStore.getItemSubjectRef()); } if (StringUtils.isNotEmpty(dataStore.getDataState())) { xtw.writeStartElement(ELEMENT_DATA_STATE); xtw.writeAttribute(ATTRIBUTE_NAME, dataStore.getDataState()); xtw.writeEndElement(); } xtw.writeEndElement(); } }
Example #2
Source File: InjectParallelUserTaskCmd.java From flowable-engine with Apache License 2.0 | 6 votes |
@Override protected void updateExecutions(CommandContext commandContext, ProcessDefinitionEntity processDefinitionEntity, ExecutionEntity processInstance, List<ExecutionEntity> childExecutions) { TaskEntity taskEntity = CommandContextUtil.getTaskService().getTask(taskId); ExecutionEntityManager executionEntityManager = CommandContextUtil.getExecutionEntityManager(commandContext); ExecutionEntity executionAtTask = executionEntityManager.findById(taskEntity.getExecutionId()); BpmnModel bpmnModel = ProcessDefinitionUtil.getBpmnModel(processDefinitionEntity.getId()); FlowElement taskElement = bpmnModel.getFlowElement(executionAtTask.getCurrentActivityId()); FlowElement subProcessElement = bpmnModel.getFlowElement(((SubProcess) taskElement.getParentContainer()).getId()); ExecutionEntity subProcessExecution = executionEntityManager.createChildExecution(executionAtTask.getParent()); subProcessExecution.setScope(true); subProcessExecution.setCurrentFlowElement(subProcessElement); CommandContextUtil.getActivityInstanceEntityManager(commandContext).recordActivityStart(subProcessExecution); executionAtTask.setParent(subProcessExecution); ExecutionEntity taskExecution = executionEntityManager.createChildExecution(subProcessExecution); FlowElement userTaskElement = bpmnModel.getFlowElement(dynamicUserTaskBuilder.getDynamicTaskId()); taskExecution.setCurrentFlowElement(userTaskElement); Context.getAgenda().planContinueProcessOperation(taskExecution); }
Example #3
Source File: BoundaryEventGraphicInfoTest.java From flowable-engine with Apache License 2.0 | 6 votes |
protected void validate(BpmnModel model) { BoundaryEvent event = (BoundaryEvent) model.getFlowElement(TIMER_BOUNDERY_ID); assertThat(event.getAttachedToRefId()).isEqualTo(USER_TASK_ID); //check graphicinfo boundary GraphicInfo giBoundary = model.getGraphicInfo(TIMER_BOUNDERY_ID); assertThat(giBoundary.getX()).isEqualTo(334.2201675394047); assertThat(giBoundary.getY()).isEqualTo(199.79587432571776); assertThat(giBoundary.getHeight()).isEqualTo(31.0); assertThat(giBoundary.getWidth()).isEqualTo(31.0); //check graphicinfo task GraphicInfo giTaskOne = model.getGraphicInfo(USER_TASK_ID); assertThat(giTaskOne.getX()).isEqualTo(300.0); assertThat(giTaskOne.getY()).isEqualTo(135.0); assertThat(giTaskOne.getWidth()).isEqualTo(100.0); assertThat(giTaskOne.getHeight()).isEqualTo(80.0); }
Example #4
Source File: BpmnEventRegistryEventConsumer.java From flowable-engine with Apache License 2.0 | 6 votes |
protected String getStartCorrelationConfiguration(EventSubscription eventSubscription) { BpmnModel bpmnModel = processEngineConfiguration.getRepositoryService().getBpmnModel(eventSubscription.getProcessDefinitionId()); if (bpmnModel != null) { // There are potentially multiple start events, with different configurations. // The one that has the matching eventType needs to be used List<StartEvent> startEvents = bpmnModel.getMainProcess().findFlowElementsOfType(StartEvent.class); for (StartEvent startEvent : startEvents) { List<ExtensionElement> eventTypes = startEvent.getExtensionElements().get(BpmnXMLConstants.ELEMENT_EVENT_TYPE); if (eventTypes != null && !eventTypes.isEmpty() && Objects.equals(eventSubscription.getEventType(), eventTypes.get(0).getElementText())) { List<ExtensionElement> correlationCfgExtensions = startEvent.getExtensionElements() .getOrDefault(BpmnXMLConstants.START_EVENT_CORRELATION_CONFIGURATION, Collections.emptyList()); if (!correlationCfgExtensions.isEmpty()) { return correlationCfgExtensions.get(0).getElementText(); } } } } return null; }
Example #5
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 #6
Source File: SubProcessConverterAutoLayoutTest.java From flowable-engine with Apache License 2.0 | 6 votes |
private void validateModel(BpmnModel model) { FlowElement flowElement = model.getMainProcess().getFlowElement("start1"); assertThat(flowElement) .isInstanceOfSatisfying(StartEvent.class, startEvent -> { assertThat(startEvent.getId()).isEqualTo("start1"); }); flowElement = model.getMainProcess().getFlowElement("userTask1"); assertThat(flowElement) .isInstanceOfSatisfying(UserTask.class, userTask -> { assertThat(userTask.getId()).isEqualTo("userTask1"); assertThat(userTask.getCandidateUsers()).hasSize(1); assertThat(userTask.getCandidateGroups()).hasSize(1); }); flowElement = model.getMainProcess().getFlowElement("subprocess1"); assertThat(flowElement) .isInstanceOfSatisfying(SubProcess.class, subProcess -> { assertThat(subProcess.getId()).isEqualTo("subprocess1"); assertThat(subProcess.getFlowElements()).hasSize(6); assertThat(subProcess.getDataObjects()) .extracting(ValuedDataObject::getName, ValuedDataObject::getValue) .containsExactly(tuple("SubTest", "Testing")); assertThat(subProcess.getDataObjects().get(0).getItemSubjectRef().getStructureRef()).isEqualTo("xsd:string"); }); }
Example #7
Source File: IntermediateThrowEventValidator.java From flowable-engine with Apache License 2.0 | 6 votes |
@Override protected void executeValidation(BpmnModel bpmnModel, Process process, List<ValidationError> errors) { List<ThrowEvent> throwEvents = process.findFlowElementsOfType(ThrowEvent.class); for (ThrowEvent throwEvent : throwEvents) { EventDefinition eventDefinition = null; if (!throwEvent.getEventDefinitions().isEmpty()) { eventDefinition = throwEvent.getEventDefinitions().get(0); } if (eventDefinition != null && !(eventDefinition instanceof SignalEventDefinition) && !(eventDefinition instanceof EscalationEventDefinition) && !(eventDefinition instanceof CompensateEventDefinition)) { addError(errors, Problems.THROW_EVENT_INVALID_EVENTDEFINITION, process, throwEvent, "Unsupported intermediate throw event type"); } } }
Example #8
Source File: FlowableHttpRequestHandlerParser.java From flowable-engine with Apache License 2.0 | 6 votes |
@Override public void parseChildElement(XMLStreamReader xtr, BaseElement parentElement, BpmnModel model) throws Exception { FlowableHttpRequestHandler requestHandler = new FlowableHttpRequestHandler(); BpmnXMLUtil.addXMLLocation(requestHandler, xtr); if (StringUtils.isNotEmpty(xtr.getAttributeValue(null, ATTRIBUTE_LISTENER_CLASS))) { requestHandler.setImplementation(xtr.getAttributeValue(null, ATTRIBUTE_LISTENER_CLASS)); requestHandler.setImplementationType(ImplementationType.IMPLEMENTATION_TYPE_CLASS); } else if (StringUtils.isNotEmpty(xtr.getAttributeValue(null, ATTRIBUTE_LISTENER_DELEGATEEXPRESSION))) { requestHandler.setImplementation(xtr.getAttributeValue(null, ATTRIBUTE_LISTENER_DELEGATEEXPRESSION)); requestHandler.setImplementationType(ImplementationType.IMPLEMENTATION_TYPE_DELEGATEEXPRESSION); } if (parentElement instanceof HttpServiceTask) { ((HttpServiceTask) parentElement).setHttpRequestHandler(requestHandler); parseChildElements(xtr, requestHandler, model, new FieldExtensionParser()); } }
Example #9
Source File: ModelImageService.java From flowable-engine with Apache License 2.0 | 6 votes |
protected void scaleFlowElements(Collection<FlowElement> elementList, BpmnModel bpmnModel, double scaleFactor) { for (FlowElement flowElement : elementList) { List<GraphicInfo> graphicInfoList = new ArrayList<>(); if (flowElement instanceof SequenceFlow) { List<GraphicInfo> flowList = bpmnModel.getFlowLocationGraphicInfo(flowElement.getId()); if (flowList != null) { graphicInfoList.addAll(flowList); } // no graphic info for Data Objects } else if (!DataObject.class.isInstance(flowElement)) { graphicInfoList.add(bpmnModel.getGraphicInfo(flowElement.getId())); } scaleGraphicInfoList(graphicInfoList, scaleFactor); if (flowElement instanceof SubProcess) { SubProcess subProcess = (SubProcess) flowElement; scaleFlowElements(subProcess.getFlowElements(), bpmnModel, scaleFactor); } } }
Example #10
Source File: BPMNDIExport.java From flowable-engine with Apache License 2.0 | 6 votes |
protected static void createBpmnShape(BpmnModel model, String elementId, XMLStreamWriter xtw) throws Exception { xtw.writeStartElement(BPMNDI_PREFIX, ELEMENT_DI_SHAPE, BPMNDI_NAMESPACE); xtw.writeAttribute(ATTRIBUTE_DI_BPMNELEMENT, elementId); xtw.writeAttribute(ATTRIBUTE_ID, "BPMNShape_" + elementId); GraphicInfo graphicInfo = model.getGraphicInfo(elementId); FlowElement flowElement = model.getFlowElement(elementId); if (flowElement instanceof SubProcess && graphicInfo.getExpanded() != null) { xtw.writeAttribute(ATTRIBUTE_DI_IS_EXPANDED, String.valueOf(graphicInfo.getExpanded())); } xtw.writeStartElement(OMGDC_PREFIX, ELEMENT_DI_BOUNDS, OMGDC_NAMESPACE); xtw.writeAttribute(ATTRIBUTE_DI_HEIGHT, String.valueOf(graphicInfo.getHeight())); xtw.writeAttribute(ATTRIBUTE_DI_WIDTH, String.valueOf(graphicInfo.getWidth())); xtw.writeAttribute(ATTRIBUTE_DI_X, String.valueOf(graphicInfo.getX())); xtw.writeAttribute(ATTRIBUTE_DI_Y, String.valueOf(graphicInfo.getY())); xtw.writeEndElement(); xtw.writeEndElement(); }
Example #11
Source File: AssociationXMLConverter.java From flowable-engine with Apache License 2.0 | 6 votes |
@Override protected BaseElement convertXMLToElement(XMLStreamReader xtr, BpmnModel model) throws Exception { Association association = new Association(); BpmnXMLUtil.addXMLLocation(association, xtr); association.setSourceRef(xtr.getAttributeValue(null, ATTRIBUTE_FLOW_SOURCE_REF)); association.setTargetRef(xtr.getAttributeValue(null, ATTRIBUTE_FLOW_TARGET_REF)); association.setId(xtr.getAttributeValue(null, ATTRIBUTE_ID)); String associationDirectionString = xtr.getAttributeValue(null, ATTRIBUTE_ASSOCIATION_DIRECTION); if (StringUtils.isNotEmpty(associationDirectionString)) { AssociationDirection associationDirection = AssociationDirection.valueOf(associationDirectionString.toUpperCase()); association.setAssociationDirection(associationDirection); } parseChildElements(getXMLElementName(), association, model, xtr); return association; }
Example #12
Source File: WebServiceActivityBehavior.java From flowable-engine with Apache License 2.0 | 6 votes |
protected void createOperations(BpmnModel bpmnModel) { for (Interface interfaceObject : bpmnModel.getInterfaces()) { BpmnInterface bpmnInterface = new BpmnInterface(interfaceObject.getId(), interfaceObject.getName()); bpmnInterface.setImplementation(wsServiceMap.get(interfaceObject.getImplementationRef())); for (org.flowable.bpmn.model.Operation operationObject : interfaceObject.getOperations()) { if (!operationMap.containsKey(operationObject.getId())) { MessageDefinition inMessage = messageDefinitionMap.get(operationObject.getInMessageRef()); Operation operation = new Operation(operationObject.getId(), operationObject.getName(), bpmnInterface, inMessage); operation.setImplementation(wsOperationMap.get(operationObject.getImplementationRef())); if (StringUtils.isNotEmpty(operationObject.getOutMessageRef())) { if (messageDefinitionMap.containsKey(operationObject.getOutMessageRef())) { MessageDefinition outMessage = messageDefinitionMap.get(operationObject.getOutMessageRef()); operation.setOutMessage(outMessage); } } operationMap.put(operation.getId(), operation); } } } }
Example #13
Source File: CallActivityTest.java From flowable-engine with Apache License 2.0 | 6 votes |
public void testInstantiateSuspendedProcessByMessage() throws Exception { BpmnModel messageTriggeredBpmnModel = loadBPMNModel(MESSAGE_TRIGGERED_PROCESS_RESOURCE); Deployment messageTriggeredBpmnDeployment = processEngine.getRepositoryService() .createDeployment() .name("messageTriggeredProcessDeployment") .addBpmnModel("messageTriggered.bpmn20.xml", messageTriggeredBpmnModel) .deploymentProperty(DeploymentProperties.DEPLOY_AS_FLOWABLE5_PROCESS_DEFINITION, Boolean.TRUE) .deploy(); suspendProcessDefinitions(messageTriggeredBpmnDeployment); try { runtimeService.startProcessInstanceByMessage("TRIGGER_PROCESS_MESSAGE"); fail("Exception expected"); } catch (FlowableException ae) { assertTextPresent("Cannot start process instance. Process definition Message Triggered Process", ae.getMessage()); } }
Example #14
Source File: TerminateEndEventTest.java From flowable-engine with Apache License 2.0 | 6 votes |
public void testParseTerminateEndEventDefinitionWithExtensions() { org.flowable.engine.repository.Deployment deployment = repositoryService.createDeployment().addClasspathResource("org/activiti/engine/test/bpmn/event/end/TerminateEndEventTest.parseExtensionElements.bpmn20.xml").deploy(); ProcessDefinition processDefinitionQuery = repositoryService.createProcessDefinitionQuery().deploymentId(deployment.getId()).singleResult(); BpmnModel bpmnModel = this.processEngineConfiguration.getProcessDefinitionCache() .get(processDefinitionQuery.getId()).getBpmnModel(); Map<String, List<ExtensionElement>> extensionElements = bpmnModel.getProcesses().get(0) .findFlowElementsOfType(EndEvent.class).get(0).getExtensionElements(); assertThat(extensionElements.size(), is(1)); List<ExtensionElement> strangeProperties = extensionElements.get("strangeProperty"); assertThat(strangeProperties.size(), is(1)); ExtensionElement strangeProperty = strangeProperties.get(0); assertThat(strangeProperty.getNamespace(), is("http://activiti.org/bpmn")); assertThat(strangeProperty.getElementText(), is("value")); assertThat(strangeProperty.getAttributes().size(), is(1)); ExtensionAttribute id = strangeProperty.getAttributes().get("id").get(0); assertThat(id.getName(), is("id")); assertThat(id.getValue(), is("strangeId")); repositoryService.deleteDeployment(deployment.getId()); }
Example #15
Source File: DataObjectValidator.java From flowable-engine with Apache License 2.0 | 6 votes |
@Override protected void executeValidation(BpmnModel bpmnModel, Process process, List<ValidationError> errors) { // Gather data objects List<ValuedDataObject> allDataObjects = new ArrayList<>(process.getDataObjects()); List<SubProcess> subProcesses = process.findFlowElementsOfType(SubProcess.class, true); for (SubProcess subProcess : subProcesses) { allDataObjects.addAll(subProcess.getDataObjects()); } // Validate for (ValuedDataObject dataObject : allDataObjects) { if (StringUtils.isEmpty(dataObject.getName())) { addError(errors, Problems.DATA_OBJECT_MISSING_NAME, process, dataObject, "Name is mandatory for a data object"); } } }
Example #16
Source File: BpmnModelEventDispatchAction.java From flowable-engine with Apache License 2.0 | 6 votes |
@Override public void dispatchEvent(CommandContext commandContext, FlowableEventSupport eventSupport, FlowableEvent event) { if (event.getType() == FlowableEngineEventType.ENTITY_DELETED && event instanceof FlowableEntityEvent) { FlowableEntityEvent entityEvent = (FlowableEntityEvent) event; if (entityEvent.getEntity() instanceof ProcessDefinition) { // process definition deleted event doesn't need to be dispatched to event listeners return; } } // Try getting hold of the Process definition, based on the process definition key, if a context is active if (commandContext != null) { BpmnModel bpmnModel = extractBpmnModelFromEvent(event); if (bpmnModel != null) { ((FlowableEventSupport) bpmnModel.getEventSupport()).dispatchEvent(event); } } }
Example #17
Source File: ScopedConverterTest.java From flowable-engine with Apache License 2.0 | 6 votes |
private void validateModel(BpmnModel model) { FlowElement flowElement = model.getMainProcess().getFlowElement("outerSubProcess"); assertThat(flowElement) .isInstanceOfSatisfying(SubProcess.class, outerProcess -> { assertThat(outerProcess.getId()).isEqualTo("outerSubProcess"); assertThat(outerProcess.getBoundaryEvents()) .extracting(BoundaryEvent::getId) .containsExactly("outerBoundaryEvent"); assertThat(outerProcess.getFlowElement("innerSubProcess")) .isInstanceOfSatisfying(SubProcess.class, innerProcess -> { assertThat(innerProcess.getId()).isEqualTo("innerSubProcess"); assertThat(innerProcess.getBoundaryEvents()) .extracting(BoundaryEvent::getId) .containsExactly("innerBoundaryEvent"); assertThat(innerProcess.getFlowElement("usertask")) .isInstanceOfSatisfying(UserTask.class, userTask -> { assertThat(userTask.getBoundaryEvents()) .extracting(BoundaryEvent::getId) .containsExactly("taskBoundaryEvent"); }); }); }); }
Example #18
Source File: AbstractFlowableTestCase.java From flowable-engine with Apache License 2.0 | 5 votes |
public String deployOneTaskTestProcessWithCandidateStarterGroup() { BpmnModel bpmnModel = createOneTaskTestProcessWithCandidateStarterGroup(); Deployment deployment = repositoryService.createDeployment().addBpmnModel("oneTasktest.bpmn20.xml", bpmnModel).deploy(); deploymentIdsForAutoCleanup.add(deployment.getId()); // For auto-cleanup ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().deploymentId(deployment.getId()).singleResult(); return processDefinition.getId(); }
Example #19
Source File: ScriptTaskXMLConverter.java From flowable-engine with Apache License 2.0 | 5 votes |
@Override protected void writeAdditionalAttributes(BaseElement element, BpmnModel model, XMLStreamWriter xtw) throws Exception { ScriptTask scriptTask = (ScriptTask) element; writeDefaultAttribute(ATTRIBUTE_TASK_SCRIPT_FORMAT, scriptTask.getScriptFormat(), xtw); writeQualifiedAttribute(ATTRIBUTE_TASK_SCRIPT_RESULTVARIABLE, scriptTask.getResultVariable(), xtw); writeQualifiedAttribute(ATTRIBUTE_TASK_SCRIPT_AUTO_STORE_VARIABLE, String.valueOf(scriptTask.isAutoStoreVariables()), xtw); }
Example #20
Source File: BaseAppDefinitionService.java From flowable-engine with Apache License 2.0 | 5 votes |
protected void postProcessFlowElements(Collection<FlowElement> traverseElementList, List<FlowElement> eventRegistryElements, Map<String, StartEvent> noneStartEventMap, String processId, BpmnModel bpmnModel) { for (FlowElement flowElement : traverseElementList) { if (flowElement instanceof Event) { List<ExtensionElement> eventTypeElements = flowElement.getExtensionElements().get("eventType"); if (eventTypeElements != null && eventTypeElements.size() > 0) { eventRegistryElements.add(flowElement); } if (flowElement instanceof StartEvent) { StartEvent startEvent = (StartEvent) flowElement; if (CollectionUtils.isEmpty(startEvent.getEventDefinitions())) { if (StringUtils.isEmpty(startEvent.getInitiator())) { startEvent.setInitiator("initiator"); } noneStartEventMap.put(processId, startEvent); } } } else if (flowElement instanceof SendEventServiceTask) { SendEventServiceTask task = (SendEventServiceTask) flowElement; if (StringUtils.isNotEmpty(task.getEventType())) { eventRegistryElements.add(flowElement); } } else if (flowElement instanceof SubProcess) { SubProcess subProcess = (SubProcess) flowElement; postProcessFlowElements(subProcess.getFlowElements(), eventRegistryElements, noneStartEventMap, processId, bpmnModel); } } }
Example #21
Source File: AddMultiInstanceExecutionCmd.java From flowable-engine with Apache License 2.0 | 5 votes |
@Override public Execution execute(CommandContext commandContext) { ExecutionEntityManager executionEntityManager = CommandContextUtil.getExecutionEntityManager(); ExecutionEntity miExecution = searchForMultiInstanceActivity(activityId, parentExecutionId, executionEntityManager); if (miExecution == null) { throw new FlowableException("No multi instance execution found for activity id " + activityId); } if (Flowable5Util.isFlowable5ProcessDefinitionId(commandContext, miExecution.getProcessDefinitionId())) { throw new FlowableException("Flowable 5 process definitions are not supported"); } ExecutionEntity childExecution = executionEntityManager.createChildExecution(miExecution); childExecution.setCurrentFlowElement(miExecution.getCurrentFlowElement()); BpmnModel bpmnModel = ProcessDefinitionUtil.getBpmnModel(miExecution.getProcessDefinitionId()); Activity miActivityElement = (Activity) bpmnModel.getFlowElement(miExecution.getActivityId()); MultiInstanceLoopCharacteristics multiInstanceLoopCharacteristics = miActivityElement.getLoopCharacteristics(); Integer currentNumberOfInstances = (Integer) miExecution.getVariable(NUMBER_OF_INSTANCES); miExecution.setVariableLocal(NUMBER_OF_INSTANCES, currentNumberOfInstances + 1); if (executionVariables != null) { childExecution.setVariablesLocal(executionVariables); } if (!multiInstanceLoopCharacteristics.isSequential()) { miExecution.setActive(true); miExecution.setScope(false); childExecution.setCurrentFlowElement(miActivityElement); CommandContextUtil.getAgenda().planContinueMultiInstanceOperation(childExecution, miExecution, currentNumberOfInstances); } return childExecution; }
Example #22
Source File: CaseServiceTaskSameDeploymentConverterTest.java From flowable-engine with Apache License 2.0 | 5 votes |
private void validateModel(BpmnModel model) { FlowElement flowElement = model.getMainProcess().getFlowElement("caseServiceTask"); assertThat(flowElement) .isInstanceOfSatisfying(CaseServiceTask.class, task -> { assertThat(task.getId()).isEqualTo("caseServiceTask"); assertThat(task.isSameDeployment()).isTrue(); }); }
Example #23
Source File: HttpServiceTask2ConverterTest.java From flowable-engine with Apache License 2.0 | 5 votes |
private void validateModel(BpmnModel model) { FlowElement flowElement = model.getMainProcess().getFlowElement("servicetask"); assertThat(flowElement) .isInstanceOfSatisfying(HttpServiceTask.class, httpServiceTask -> { assertThat(httpServiceTask.getId()).isEqualTo("servicetask"); assertThat(httpServiceTask.getName()).isEqualTo("Service task"); assertThat(httpServiceTask.getFieldExtensions()).isEmpty(); assertThat(httpServiceTask.getHttpRequestHandler()) .extracting(FlowableHttpRequestHandler::getImplementationType, FlowableHttpRequestHandler::getImplementation) .containsExactly(ImplementationType.IMPLEMENTATION_TYPE_DELEGATEEXPRESSION, "${delegateExpression}"); }); }
Example #24
Source File: RuntimeDisplayJsonClientResource.java From flowable-engine with Apache License 2.0 | 5 votes |
protected void fillWaypoints(String id, BpmnModel model, ObjectNode elementNode, GraphicInfo diagramInfo) { List<GraphicInfo> flowInfo = model.getFlowLocationGraphicInfo(id); ArrayNode waypointArray = objectMapper.createArrayNode(); for (GraphicInfo graphicInfo : flowInfo) { ObjectNode pointNode = objectMapper.createObjectNode(); fillGraphicInfo(pointNode, graphicInfo, false); waypointArray.add(pointNode); fillDiagramInfo(graphicInfo, diagramInfo); } elementNode.set("waypoints", waypointArray); }
Example #25
Source File: FlowableListenerParser.java From flowable-engine with Apache License 2.0 | 5 votes |
@Override public void parseChildElement(XMLStreamReader xtr, BaseElement parentElement, BpmnModel model) throws Exception { FlowableListener listener = new FlowableListener(); BpmnXMLUtil.addXMLLocation(listener, xtr); if (StringUtils.isNotEmpty(xtr.getAttributeValue(null, ATTRIBUTE_LISTENER_CLASS))) { listener.setImplementation(xtr.getAttributeValue(null, ATTRIBUTE_LISTENER_CLASS)); listener.setImplementationType(ImplementationType.IMPLEMENTATION_TYPE_CLASS); } else if (StringUtils.isNotEmpty(xtr.getAttributeValue(null, ATTRIBUTE_LISTENER_EXPRESSION))) { listener.setImplementation(xtr.getAttributeValue(null, ATTRIBUTE_LISTENER_EXPRESSION)); listener.setImplementationType(ImplementationType.IMPLEMENTATION_TYPE_EXPRESSION); } else if (StringUtils.isNotEmpty(xtr.getAttributeValue(null, ATTRIBUTE_LISTENER_DELEGATEEXPRESSION))) { listener.setImplementation(xtr.getAttributeValue(null, ATTRIBUTE_LISTENER_DELEGATEEXPRESSION)); listener.setImplementationType(ImplementationType.IMPLEMENTATION_TYPE_DELEGATEEXPRESSION); } listener.setEvent(xtr.getAttributeValue(null, ATTRIBUTE_LISTENER_EVENT)); listener.setOnTransaction(xtr.getAttributeValue(null, ATTRIBUTE_LISTENER_ON_TRANSACTION)); if (StringUtils.isNotEmpty(xtr.getAttributeValue(null, ATTRIBUTE_LISTENER_CUSTOM_PROPERTIES_RESOLVER_CLASS))) { listener.setCustomPropertiesResolverImplementation(xtr.getAttributeValue(null, ATTRIBUTE_LISTENER_CUSTOM_PROPERTIES_RESOLVER_CLASS)); listener.setCustomPropertiesResolverImplementationType(ImplementationType.IMPLEMENTATION_TYPE_CLASS); } else if (StringUtils.isNotEmpty(xtr.getAttributeValue(null, ATTRIBUTE_LISTENER_CUSTOM_PROPERTIES_RESOLVER_EXPRESSION))) { listener.setCustomPropertiesResolverImplementation(xtr.getAttributeValue(null, ATTRIBUTE_LISTENER_CUSTOM_PROPERTIES_RESOLVER_EXPRESSION)); listener.setCustomPropertiesResolverImplementationType(ImplementationType.IMPLEMENTATION_TYPE_EXPRESSION); } else if (StringUtils.isNotEmpty(xtr.getAttributeValue(null, ATTRIBUTE_LISTENER_CUSTOM_PROPERTIES_RESOLVER_DELEGATEEXPRESSION))) { listener.setCustomPropertiesResolverImplementation(xtr.getAttributeValue(null, ATTRIBUTE_LISTENER_CUSTOM_PROPERTIES_RESOLVER_DELEGATEEXPRESSION)); listener.setCustomPropertiesResolverImplementationType(ImplementationType.IMPLEMENTATION_TYPE_DELEGATEEXPRESSION); } addListenerToParent(listener, parentElement); parseChildElements(xtr, listener, model, new FieldExtensionParser()); }
Example #26
Source File: EventSubprocessSequenceFlowTest.java From flowable-engine with Apache License 2.0 | 5 votes |
private void validate(BpmnModel model) { EventSubProcess eventSubProcess = (EventSubProcess) model.getFlowElement(EVENT_SUBPROCESS_ID); //assert that there where 5 sequenceflows registered. assertThat(model.getFlowLocationMap()).hasSize(5); List<GraphicInfo> graphicInfo = model.getFlowLocationGraphicInfo(FROM_SE_TO_TASK); GraphicInfo start = graphicInfo.get(0); assertThat(start.getX()).isCloseTo(180.5, offset(PRECISION)); //75.0+105.5 (parent + interception point) assertThat(start.getY()).isCloseTo(314.0, offset(PRECISION)); //230.0 + 99.0 - 15.0 (parent + lower right y - bounds y) GraphicInfo end = graphicInfo.get(1); assertThat(end.getX()).isCloseTo(225.5, offset(PRECISION)); //75.0 +150.5 assertThat(end.getY()).isCloseTo(314.0, offset(PRECISION)); //230.0 + 44.0 + 40 }
Example #27
Source File: AbstractFlowableTestCase.java From flowable-engine with Apache License 2.0 | 5 votes |
public BpmnModel createTwoTasksTestProcess() { BpmnModel model = new BpmnModel(); org.flowable.bpmn.model.Process process = new org.flowable.bpmn.model.Process(); model.addProcess(process); process.setId("twoTasksProcess"); process.setName("The two tasks process"); StartEvent startEvent = new StartEvent(); startEvent.setId("start"); process.addFlowElement(startEvent); UserTask userTask = new UserTask(); userTask.setName("The First Task"); userTask.setId("task1"); userTask.setAssignee("kermit"); process.addFlowElement(userTask); UserTask userTask2 = new UserTask(); userTask2.setName("The Second Task"); userTask2.setId("task2"); userTask2.setAssignee("kermit"); process.addFlowElement(userTask2); EndEvent endEvent = new EndEvent(); endEvent.setId("theEnd"); process.addFlowElement(endEvent); process.addFlowElement(new SequenceFlow("start", "task1")); process.addFlowElement(new SequenceFlow("start", "task2")); process.addFlowElement(new SequenceFlow("task1", "theEnd")); process.addFlowElement(new SequenceFlow("task2", "theEnd")); return model; }
Example #28
Source File: DefaultProcessValidatorTest.java From flowable-engine with Apache License 2.0 | 5 votes |
@Test public void testAllNonExecutableProcesses() { BpmnModel bpmnModel = new BpmnModel(); for (int i = 0; i < 5; i++) { org.flowable.bpmn.model.Process process = TestProcessUtil.createOneTaskProcess(); process.setExecutable(false); bpmnModel.addProcess(process); } List<ValidationError> errors = processValidator.validate(bpmnModel); assertThat(errors).hasSize(1); }
Example #29
Source File: ServiceTaskValidator.java From flowable-engine with Apache License 2.0 | 5 votes |
@Override protected void executeValidation(BpmnModel bpmnModel, Process process, List<ValidationError> errors) { List<ServiceTask> serviceTasks = process.findFlowElementsOfType(ServiceTask.class); for (ServiceTask serviceTask : serviceTasks) { verifyImplementation(process, serviceTask, errors); verifyType(process, serviceTask, errors); verifyResultVariableName(process, serviceTask, errors); verifyWebservice(bpmnModel, process, serviceTask, errors); } }
Example #30
Source File: CustomNamespaceAttributeConverterTest.java From flowable-engine with Apache License 2.0 | 5 votes |
private void validateModel(BpmnModel model) { Process process = model.getMainProcess(); assertThat(process.getAttributes()).isNotNull(); List<ExtensionAttribute> attributes = process.getAttributes().get("version"); // custom:version = "9" assertThat(attributes) .extracting(ExtensionAttribute::getNamespace, ExtensionAttribute::getNamespacePrefix, ExtensionAttribute::getName, ExtensionAttribute::getValue) .containsExactly(tuple("http://custom.org/bpmn", "custom", "version", "9")); FlowElement flowElement = model.getMainProcess().getFlowElement("usertask"); assertThat(flowElement).isInstanceOf(UserTask.class); assertThat(flowElement.getId()).isEqualTo("usertask"); assertThat(flowElement.getName()).isEqualTo("User Task"); UserTask userTask = (UserTask) flowElement; Map<String, List<ExtensionAttribute>> attributesMap = userTask.getAttributes(); assertThat(attributesMap).isNotNull(); assertThat(attributesMap).hasSize(2); attributes = attributesMap.get("id"); assertThat(attributes) .extracting(ExtensionAttribute::getName, ExtensionAttribute::getValue, ExtensionAttribute::getNamespacePrefix, ExtensionAttribute::getNamespace) .containsExactly(tuple("id", "test", "custom2", "http://custom2.org/bpmn")); attributes = attributesMap.get("attr"); assertThat(attributes) .extracting(ExtensionAttribute::getName, ExtensionAttribute::getValue, ExtensionAttribute::getNamespacePrefix, ExtensionAttribute::getNamespace) .containsExactly(tuple("attr", "attrValue", "custom2", "http://custom2.org/bpmn")); }