Class EventRelationshipTraverser
java.lang.Object
ch.tocco.nice2.optional.event.api.eventrelationship.EventRelationshipTraverser
can be used to work with Events related by Event_relationship
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic final record
static final record
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptiongetAllChildren
(Entity event) get all children of an EventgetRootEvent
(Entity event) get the top most Event in the hierarchy.void
visitAllChildren
(Entity event, BiConsumer<Entity, EventRelationshipTraverser.TreeContext> childConsumer) run some code for each childvoid
visitAllChildren
(Entity event, Consumer<Entity> childConsumer) run some code for each child
-
Field Details
-
EVENT_TO_CHILD_RELATION
- See Also:
-
EVENT_TO_PARENT_RELATION
- See Also:
-
RELATIONSHIP_TO_CHILD_RELATION
- See Also:
-
RELATIONSHIP_TO_PARENT_RELATION
- See Also:
-
-
Constructor Details
-
EventRelationshipTraverser
public EventRelationshipTraverser()
-
-
Method Details
-
getAllChildren
get all children of an Event- Parameters:
event
- the parent Event- Returns:
- a list containing all child Event entities
-
visitAllChildren
run some code for each child- Parameters:
event
- the parent EventchildConsumer
- gets called for each child
-
visitAllChildren
public void visitAllChildren(Entity event, BiConsumer<Entity, EventRelationshipTraverser.TreeContext> childConsumer) run some code for each child- Parameters:
event
- the parent EventchildConsumer
- gets called for each child
-
getRootEvent
get the top most Event in the hierarchy. for Events not used in Seminars, multiple parents may exist, which this method treats as unresolvable and will return the last Event that was a clear single parent.- Parameters:
event
- the Event to search from- Returns:
- the Event with no single direct parent
-