Class EventRelationshipTraverser

java.lang.Object
ch.tocco.nice2.optional.event.api.eventrelationship.EventRelationshipTraverser

@Component public class EventRelationshipTraverser extends Object
can be used to work with Events related by Event_relationship
  • Field Details

  • Constructor Details

    • EventRelationshipTraverser

      public EventRelationshipTraverser()
  • Method Details

    • getAllChildren

      public List<Entity> getAllChildren(Entity event)
      get all children of an Event
      Parameters:
      event - the parent Event
      Returns:
      a list containing all child Event entities
    • visitAllChildren

      public void visitAllChildren(Entity event, Consumer<Entity> childConsumer)
      run some code for each child
      Parameters:
      event - the parent Event
      childConsumer - 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 Event
      childConsumer - gets called for each child
    • getRootEvent

      public Entity getRootEvent(Entity event)
      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