Java Code Examples for org.activiti.engine.impl.bpmn.parser.BpmnParse#getBpmnModel()
The following examples show how to use
org.activiti.engine.impl.bpmn.parser.BpmnParse#getBpmnModel() .
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: MessageEventDefinitionParseHandler.java From activiti6-boot2 with Apache License 2.0 | 6 votes |
protected void executeParse(BpmnParse bpmnParse, MessageEventDefinition messageDefinition) { BpmnModel bpmnModel = bpmnParse.getBpmnModel(); String messageRef = messageDefinition.getMessageRef(); if (bpmnModel.containsMessageId(messageRef)) { Message message = bpmnModel.getMessage(messageRef); messageDefinition.setMessageRef(message.getName()); messageDefinition.setExtensionElements(message.getExtensionElements()); } if (bpmnParse.getCurrentFlowElement() instanceof IntermediateCatchEvent) { IntermediateCatchEvent intermediateCatchEvent = (IntermediateCatchEvent) bpmnParse.getCurrentFlowElement(); intermediateCatchEvent.setBehavior(bpmnParse.getActivityBehaviorFactory().createIntermediateCatchMessageEventActivityBehavior(intermediateCatchEvent, messageDefinition)); } else if (bpmnParse.getCurrentFlowElement() instanceof BoundaryEvent) { BoundaryEvent boundaryEvent = (BoundaryEvent) bpmnParse.getCurrentFlowElement(); boundaryEvent.setBehavior(bpmnParse.getActivityBehaviorFactory().createBoundaryMessageEventActivityBehavior(boundaryEvent, messageDefinition, boundaryEvent.isCancelActivity())); } else { // What to do here? } }
Example 2
Source File: AbstractBpmnParseHandler.java From activiti6-boot2 with Apache License 2.0 | 5 votes |
protected void createAssociation(BpmnParse bpmnParse, Association association) { BpmnModel bpmnModel = bpmnParse.getBpmnModel(); if (bpmnModel.getArtifact(association.getSourceRef()) != null || bpmnModel.getArtifact(association.getTargetRef()) != null) { // connected to a text annotation so skipping it return; } // ActivityImpl sourceActivity = // parentScope.findActivity(association.getSourceRef()); // ActivityImpl targetActivity = // parentScope.findActivity(association.getTargetRef()); // an association may reference elements that are not parsed as // activities (like for instance // text annotations so do not throw an exception if sourceActivity or // targetActivity are null) // However, we make sure they reference 'something': // if (sourceActivity == null) { // bpmnModel.addProblem("Invalid reference sourceRef '" + // association.getSourceRef() + "' of association element ", // association.getId()); // } else if (targetActivity == null) { // bpmnModel.addProblem("Invalid reference targetRef '" + // association.getTargetRef() + "' of association element ", // association.getId()); /* * } else { if (sourceActivity.getProperty("type").equals("compensationBoundaryCatch" )) { Object isForCompensation = targetActivity.getProperty(PROPERTYNAME_IS_FOR_COMPENSATION); if * (isForCompensation == null || !(Boolean) isForCompensation) { logger.warn( "compensation boundary catch must be connected to element with isForCompensation=true" ); } else { ActivityImpl * compensatedActivity = sourceActivity.getParentActivity(); compensatedActivity.setProperty(BpmnParse .PROPERTYNAME_COMPENSATION_HANDLER_ID, targetActivity.getId()); } } } */ }
Example 3
Source File: StartEventParseHandler.java From activiti6-boot2 with Apache License 2.0 | 5 votes |
@Override protected void executeParse(BpmnParse bpmnParse, StartEvent element) { if (element.getSubProcess() != null && element.getSubProcess() instanceof EventSubProcess) { if (CollectionUtil.isNotEmpty(element.getEventDefinitions())) { EventDefinition eventDefinition = element.getEventDefinitions().get(0); if (eventDefinition instanceof MessageEventDefinition) { MessageEventDefinition messageDefinition = (MessageEventDefinition) eventDefinition; BpmnModel bpmnModel = bpmnParse.getBpmnModel(); String messageRef = messageDefinition.getMessageRef(); if (bpmnModel.containsMessageId(messageRef)) { Message message = bpmnModel.getMessage(messageRef); messageDefinition.setMessageRef(message.getName()); messageDefinition.setExtensionElements(message.getExtensionElements()); } element.setBehavior(bpmnParse.getActivityBehaviorFactory().createEventSubProcessMessageStartEventActivityBehavior(element, messageDefinition)); } else if (eventDefinition instanceof ErrorEventDefinition) { element.setBehavior(bpmnParse.getActivityBehaviorFactory().createEventSubProcessErrorStartEventActivityBehavior(element)); } } } else if (CollectionUtil.isEmpty(element.getEventDefinitions())) { element.setBehavior(bpmnParse.getActivityBehaviorFactory().createNoneStartEventActivityBehavior(element)); } if (element.getSubProcess() == null && (CollectionUtil.isEmpty(element.getEventDefinitions()) || bpmnParse.getCurrentProcess().getInitialFlowElement() == null)) { bpmnParse.getCurrentProcess().setInitialFlowElement(element); } }
Example 4
Source File: AbstractBpmnParseHandler.java From flowable-engine with Apache License 2.0 | 5 votes |
protected void createAssociation(BpmnParse bpmnParse, Association association, ScopeImpl parentScope) { BpmnModel bpmnModel = bpmnParse.getBpmnModel(); if (bpmnModel.getArtifact(association.getSourceRef()) != null || bpmnModel.getArtifact(association.getTargetRef()) != null) { // connected to a text annotation so skipping it return; } ActivityImpl sourceActivity = parentScope.findActivity(association.getSourceRef()); ActivityImpl targetActivity = parentScope.findActivity(association.getTargetRef()); // an association may reference elements that are not parsed as activities (like for instance // text annotations so do not throw an exception if sourceActivity or targetActivity are null) // However, we make sure they reference 'something': if (sourceActivity == null) { // bpmnModel.addProblem("Invalid reference sourceRef '" + association.getSourceRef() + "' of association element ", association.getId()); } else if (targetActivity == null) { // bpmnModel.addProblem("Invalid reference targetRef '" + association.getTargetRef() + "' of association element ", association.getId()); } else { if (sourceActivity.getProperty("type").equals("compensationBoundaryCatch")) { Object isForCompensation = targetActivity.getProperty(PROPERTYNAME_IS_FOR_COMPENSATION); if (isForCompensation == null || !(Boolean) isForCompensation) { LOGGER.warn("compensation boundary catch must be connected to element with isForCompensation=true"); } else { ActivityImpl compensatedActivity = sourceActivity.getParentActivity(); compensatedActivity.setProperty(BpmnParse.PROPERTYNAME_COMPENSATION_HANDLER_ID, targetActivity.getId()); } } } }
Example 5
Source File: ParsedDeployment.java From activiti6-boot2 with Apache License 2.0 | 4 votes |
public BpmnModel getBpmnModelForProcessDefinition(ProcessDefinitionEntity processDefinition) { BpmnParse parse = getBpmnParseForProcessDefinition(processDefinition); return (parse == null ? null : parse.getBpmnModel()); }