Interface TreeSession


public interface TreeSession
Interface responsible for storing element trees. An element tree corresponds to a hierarchical data structure in a tree format in which the elements are arranged as nodes of that tree. This tree can be created freely or from a data structure whose objects, in that structure, behave like a tree but are arranged linearly. By invoking TreeTransaction.initializeSession(String, Collection), this linear structure is transformed into an actual tree structure.

The sessions are initialized by the TreeTransaction interface, which can manage one or more sessions, where each session represents a tree instance in the HappyTree API context. Although the TreeTransaction interface is able to manage instances of TreeSession, it can only do so one at a time. Thus, to handle a given session, it must be captured first by invoking TreeTransaction.sessionCheckout(String). On each session change via this method, the chosen session becomes the current session so the TreeTransaction interface can manipulate it.

It is important to note that when invoking TreeTransaction.initializeSession(String, Class) or TreeTransaction.initializeSession(String, Collection), the session is automatically made available to the TreeTransaction. Thus, the session is ready for manipulation immediately after initialization.

A session contains three fundamental states:

Session States
StateExists?Can it be handled?
Activated
DeactivatedX
DestroyedXX

An active session, as noted above, exists and can be freely handled. A deactivated session, on the other hand, although it cannot be handled, still remains in memory, waiting only to be activated so it can be handled. In this case, the tree and its elements are 'alive' in memory but disabled.

A destroyed session is one that previously existed but has been permanently removed along with the entire tree and its elements. A destroyed session never returns to its natural state. It represents the end of its lifecycle.

Author:
Diego Madson de Andrade Nóbrega
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the session identifier name.
    boolean
    Verifies whether the session is active.
    <T> Element<T>
    Returns the entire tree session structure, represented by the root element.