diff --git a/open-bpmn.metamodel/src/main/java/org/openbpmn/bpmn/navigation/BPMNFlowNavigator.java b/open-bpmn.metamodel/src/main/java/org/openbpmn/bpmn/navigation/BPMNFlowIterator.java similarity index 89% rename from open-bpmn.metamodel/src/main/java/org/openbpmn/bpmn/navigation/BPMNFlowNavigator.java rename to open-bpmn.metamodel/src/main/java/org/openbpmn/bpmn/navigation/BPMNFlowIterator.java index bd3b0384..e2bee423 100644 --- a/open-bpmn.metamodel/src/main/java/org/openbpmn/bpmn/navigation/BPMNFlowNavigator.java +++ b/open-bpmn.metamodel/src/main/java/org/openbpmn/bpmn/navigation/BPMNFlowIterator.java @@ -15,19 +15,19 @@ import org.openbpmn.bpmn.exceptions.BPMNValidationException; /** - * The BPMNFlowNavigator can be used to navigate through a BPMN model. Based on - * a Source BPMNElement the navigator routes to the next Flow Element fulfilling + * The BPMNFlowIterator can be used to iterate through a BPMN model. Based on + * a Source BPMNElement the class routes to the next Flow Element fulfilling * a * given criteria. For example you can find all Event Nodes followed by an * Activity Node. Or you can navigate to the next Activity from an Event. *

- * The BPMNFlowNavigator expects a filter argument (Functional Interface + * The BPMNFlowIterator expects a filter argument (Functional Interface * Predicate) with one BPMNElementNode argument that return a boolean value. *

* In case the filter does not specify a Gateway, Gateway Nodes are ignored. * */ -public class BPMNFlowNavigator implements Iterator { +public class BPMNFlowIterator implements Iterator { protected static Logger logger = Logger.getLogger(BPMNElementNode.class.getName()); @@ -39,7 +39,7 @@ public class BPMNFlowNavigator implements Iterator { private List targetNodes; /** - * Creates a new BPMNFlowNavigator with a given filter criteria. + * Creates a new BPMNFlowIterator with a given filter criteria. * The method collects all BPMNElements following the given start element and * matching the given filter * @@ -47,7 +47,7 @@ public class BPMNFlowNavigator implements Iterator { * @param filter * @throws BPMNValidationException */ - public BPMNFlowNavigator(BPMNElementNode bpmnElementNode, Predicate filter) + public BPMNFlowIterator(BPMNElementNode bpmnElementNode, Predicate filter) throws BPMNValidationException { this.filter = filter; this.targetNodes = new ArrayList<>(); @@ -57,7 +57,7 @@ public BPMNFlowNavigator(BPMNElementNode bpmnElementNode, Predicate filter, + public BPMNFlowIterator(BPMNElementNode bpmnElementNode, Predicate filter, Predicate conditionEvaluator) throws BPMNValidationException { this.filter = filter; diff --git a/open-bpmn.metamodel/src/test/java/org/openbpmn/metamodel/navigation/TestFilter.java b/open-bpmn.metamodel/src/test/java/org/openbpmn/metamodel/navigation/TestFilter.java index c4a78cab..5d29b641 100644 --- a/open-bpmn.metamodel/src/test/java/org/openbpmn/metamodel/navigation/TestFilter.java +++ b/open-bpmn.metamodel/src/test/java/org/openbpmn/metamodel/navigation/TestFilter.java @@ -68,7 +68,8 @@ public void testComplexFilterMethod() throws BPMNModelException { Set filterResult = process .findElementNodes( n -> (BPMNTypes.CATCH_EVENT.equals(n.getType()) // - && ((Event) n).getEventDefinitionsByType(BPMNTypes.EVENT_DEFINITION_LINK) + && ((Event) n).getEventDefinitionsByType( + BPMNTypes.EVENT_DEFINITION_LINK) .size() == 1 // && "LINK".equals(n.getName()))); @@ -80,7 +81,8 @@ public void testComplexFilterMethod() throws BPMNModelException { filterResult = process .findElementNodes( n -> (BPMNTypes.CATCH_EVENT.equals(n.getType()) // - && ((Event) n).getEventDefinitionsByType(BPMNTypes.EVENT_DEFINITION_CANCEL) + && ((Event) n).getEventDefinitionsByType( + BPMNTypes.EVENT_DEFINITION_CANCEL) .size() == 1 // && "LINK".equals(n.getName()))); diff --git a/open-bpmn.metamodel/src/test/java/org/openbpmn/metamodel/navigation/TestNavigation.java b/open-bpmn.metamodel/src/test/java/org/openbpmn/metamodel/navigation/TestNavigation.java index 40a9509f..d6d9441d 100644 --- a/open-bpmn.metamodel/src/test/java/org/openbpmn/metamodel/navigation/TestNavigation.java +++ b/open-bpmn.metamodel/src/test/java/org/openbpmn/metamodel/navigation/TestNavigation.java @@ -16,7 +16,7 @@ import org.openbpmn.bpmn.elements.Gateway; import org.openbpmn.bpmn.elements.core.BPMNElementNode; import org.openbpmn.bpmn.exceptions.BPMNModelException; -import org.openbpmn.bpmn.navigation.BPMNFlowNavigator; +import org.openbpmn.bpmn.navigation.BPMNFlowIterator; import org.openbpmn.bpmn.util.BPMNModelFactory; import org.openbpmn.metamodel.examples.TestCreateEdges; @@ -47,7 +47,7 @@ public void testFindAllEventsFromTask1() throws BPMNModelException { BPMNElementNode task1 = process.findElementNodeById("task_SBK01w"); assertNotNull(task1); - BPMNFlowNavigator eventNavigator = new BPMNFlowNavigator(task1, + BPMNFlowIterator eventNavigator = new BPMNFlowIterator(task1, n -> n instanceof Event); assertNotNull(eventNavigator); @@ -85,7 +85,7 @@ public void testFindTargetFromEvent2() throws BPMNModelException { BPMNElementNode event2 = process.findElementNodeById("event_IyD2LA"); assertNotNull(event2); - BPMNFlowNavigator taskNavigator = new BPMNFlowNavigator(event2, + BPMNFlowIterator taskNavigator = new BPMNFlowIterator(event2, n -> n instanceof Activity); assertNotNull(taskNavigator); @@ -122,7 +122,7 @@ public void testFindTargetFromEvent1() throws BPMNModelException { BPMNElementNode event1 = process.findElementNodeById("event_TGi3FA"); assertNotNull(event1); - BPMNFlowNavigator taskNavigator = new BPMNFlowNavigator(event1, + BPMNFlowIterator taskNavigator = new BPMNFlowIterator(event1, n -> n instanceof Activity); assertNotNull(taskNavigator); @@ -159,7 +159,7 @@ public void testFindAllEventsFromTask1ByGateway() throws BPMNModelException { BPMNElementNode task1 = process.findElementNodeById("task_SBK01w"); assertNotNull(task1); - BPMNFlowNavigator eventNavigator = new BPMNFlowNavigator(task1, + BPMNFlowIterator eventNavigator = new BPMNFlowIterator(task1, n -> n instanceof Event); assertNotNull(eventNavigator); @@ -198,7 +198,7 @@ public void testFindGatewayFromTask1() throws BPMNModelException { BPMNElementNode task1 = process.findElementNodeById("task_SBK01w"); assertNotNull(task1); - BPMNFlowNavigator eventNavigator = new BPMNFlowNavigator(task1, + BPMNFlowIterator eventNavigator = new BPMNFlowIterator(task1, n -> n instanceof Gateway); assertNotNull(eventNavigator); diff --git a/open-bpmn.metamodel/src/test/java/org/openbpmn/metamodel/navigation/TestNavigationCallbacks.java b/open-bpmn.metamodel/src/test/java/org/openbpmn/metamodel/navigation/TestNavigationCallbacks.java index 221b9931..2a1b1035 100644 --- a/open-bpmn.metamodel/src/test/java/org/openbpmn/metamodel/navigation/TestNavigationCallbacks.java +++ b/open-bpmn.metamodel/src/test/java/org/openbpmn/metamodel/navigation/TestNavigationCallbacks.java @@ -14,7 +14,7 @@ import org.openbpmn.bpmn.elements.Event; import org.openbpmn.bpmn.elements.core.BPMNElementNode; import org.openbpmn.bpmn.exceptions.BPMNModelException; -import org.openbpmn.bpmn.navigation.BPMNFlowNavigator; +import org.openbpmn.bpmn.navigation.BPMNFlowIterator; import org.openbpmn.bpmn.util.BPMNModelFactory; import org.openbpmn.metamodel.examples.TestCreateEdges; @@ -46,7 +46,7 @@ public void testFindAllEventsFromTask1WithComplexRule() throws BPMNModelExceptio BPMNElementNode task1 = process.findElementNodeById("task_SBK01w"); assertNotNull(task1); - BPMNFlowNavigator eventNavigator = new BPMNFlowNavigator(task1, + BPMNFlowIterator eventNavigator = new BPMNFlowIterator(task1, n -> isSubmitEvent(n)); assertNotNull(eventNavigator); @@ -102,7 +102,7 @@ public void testFindAllEventsFromTask1WithCondition() throws BPMNModelException assertNotNull(task1); // Build a navigator with a callback method to eval the condition - BPMNFlowNavigator eventNavigator = new BPMNFlowNavigator<>( + BPMNFlowIterator eventNavigator = new BPMNFlowIterator<>( task1, node -> node instanceof Event || node instanceof Event, condition -> evalCondition(condition));