Skip to content

Commit

Permalink
renaming
Browse files Browse the repository at this point in the history
Issue #237
  • Loading branch information
rsoika committed Aug 9, 2024
1 parent 1904749 commit 109471a
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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.
* <p>
* 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.
* <p>
* In case the filter does not specify a Gateway, Gateway Nodes are ignored.
*
*/
public class BPMNFlowNavigator<T> implements Iterator<BPMNElementNode> {
public class BPMNFlowIterator<T> implements Iterator<BPMNElementNode> {

protected static Logger logger = Logger.getLogger(BPMNElementNode.class.getName());

Expand All @@ -39,15 +39,15 @@ public class BPMNFlowNavigator<T> implements Iterator<BPMNElementNode> {
private List<BPMNElementNode> 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
*
* @param bpmnElementNode
* @param filter
* @throws BPMNValidationException
*/
public BPMNFlowNavigator(BPMNElementNode bpmnElementNode, Predicate<BPMNElementNode> filter)
public BPMNFlowIterator(BPMNElementNode bpmnElementNode, Predicate<BPMNElementNode> filter)
throws BPMNValidationException {
this.filter = filter;
this.targetNodes = new ArrayList<>();
Expand All @@ -57,7 +57,7 @@ public BPMNFlowNavigator(BPMNElementNode bpmnElementNode, Predicate<BPMNElementN
}

/**
* 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
*
Expand All @@ -66,7 +66,7 @@ public BPMNFlowNavigator(BPMNElementNode bpmnElementNode, Predicate<BPMNElementN
* @param conditionEvaluator optional conditional evaluator
* @throws BPMNValidationException
*/
public BPMNFlowNavigator(BPMNElementNode bpmnElementNode, Predicate<BPMNElementNode> filter,
public BPMNFlowIterator(BPMNElementNode bpmnElementNode, Predicate<BPMNElementNode> filter,
Predicate<String> conditionEvaluator)
throws BPMNValidationException {
this.filter = filter;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ public void testComplexFilterMethod() throws BPMNModelException {
Set<? extends BPMNElementNode> 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())));

Expand All @@ -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())));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -47,7 +47,7 @@ public void testFindAllEventsFromTask1() throws BPMNModelException {
BPMNElementNode task1 = process.findElementNodeById("task_SBK01w");
assertNotNull(task1);

BPMNFlowNavigator<Event> eventNavigator = new BPMNFlowNavigator<Event>(task1,
BPMNFlowIterator<Event> eventNavigator = new BPMNFlowIterator<Event>(task1,
n -> n instanceof Event);
assertNotNull(eventNavigator);

Expand Down Expand Up @@ -85,7 +85,7 @@ public void testFindTargetFromEvent2() throws BPMNModelException {
BPMNElementNode event2 = process.findElementNodeById("event_IyD2LA");
assertNotNull(event2);

BPMNFlowNavigator<Event> taskNavigator = new BPMNFlowNavigator<Event>(event2,
BPMNFlowIterator<Event> taskNavigator = new BPMNFlowIterator<Event>(event2,
n -> n instanceof Activity);
assertNotNull(taskNavigator);

Expand Down Expand Up @@ -122,7 +122,7 @@ public void testFindTargetFromEvent1() throws BPMNModelException {
BPMNElementNode event1 = process.findElementNodeById("event_TGi3FA");
assertNotNull(event1);

BPMNFlowNavigator<Event> taskNavigator = new BPMNFlowNavigator<Event>(event1,
BPMNFlowIterator<Event> taskNavigator = new BPMNFlowIterator<Event>(event1,
n -> n instanceof Activity);
assertNotNull(taskNavigator);

Expand Down Expand Up @@ -159,7 +159,7 @@ public void testFindAllEventsFromTask1ByGateway() throws BPMNModelException {
BPMNElementNode task1 = process.findElementNodeById("task_SBK01w");
assertNotNull(task1);

BPMNFlowNavigator<Event> eventNavigator = new BPMNFlowNavigator<Event>(task1,
BPMNFlowIterator<Event> eventNavigator = new BPMNFlowIterator<Event>(task1,
n -> n instanceof Event);
assertNotNull(eventNavigator);

Expand Down Expand Up @@ -198,7 +198,7 @@ public void testFindGatewayFromTask1() throws BPMNModelException {
BPMNElementNode task1 = process.findElementNodeById("task_SBK01w");
assertNotNull(task1);

BPMNFlowNavigator<Event> eventNavigator = new BPMNFlowNavigator<Event>(task1,
BPMNFlowIterator<Event> eventNavigator = new BPMNFlowIterator<Event>(task1,
n -> n instanceof Gateway);
assertNotNull(eventNavigator);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -46,7 +46,7 @@ public void testFindAllEventsFromTask1WithComplexRule() throws BPMNModelExceptio
BPMNElementNode task1 = process.findElementNodeById("task_SBK01w");
assertNotNull(task1);

BPMNFlowNavigator<Event> eventNavigator = new BPMNFlowNavigator<Event>(task1,
BPMNFlowIterator<Event> eventNavigator = new BPMNFlowIterator<Event>(task1,
n -> isSubmitEvent(n));
assertNotNull(eventNavigator);

Expand Down Expand Up @@ -102,7 +102,7 @@ public void testFindAllEventsFromTask1WithCondition() throws BPMNModelException
assertNotNull(task1);

// Build a navigator with a callback method to eval the condition
BPMNFlowNavigator<BPMNElementNode> eventNavigator = new BPMNFlowNavigator<>(
BPMNFlowIterator<BPMNElementNode> eventNavigator = new BPMNFlowIterator<>(
task1,
node -> node instanceof Event || node instanceof Event,
condition -> evalCondition(condition));
Expand Down

0 comments on commit 109471a

Please sign in to comment.