Class AbstractNode<N extends AbstractNode<N>>

java.lang.Object
net.datenwerke.treedb.service.treedb.AbstractNode<N>
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
AbstractTsDiskNode, SecuredAbstractNode
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@GenerateDto(dtoPackage="net.datenwerke.treedb.client.treedb.dto",abstractDto=true,poso2DtoPostProcessors=AbstractNode2DtoPostProcessor.class,createDecorator=true,additionalFields={,,,,}) public abstract class AbstractNode<N extends AbstractNode<N>> extends Object implements Serializable
This class provides a generic tree-like structure to entities
See Also:
  • Field Details

    • FLAG_WRITE_PROTECTION

      public static final long FLAG_WRITE_PROTECTION
      See Also:
    • FLAG_CONFIGURATION_PROTECTION

      public static final long FLAG_CONFIGURATION_PROTECTION
      See Also:
  • Constructor Details

    • AbstractNode

      public AbstractNode()
  • Method Details

    • getId

      public Long getId()
    • setId

      public void setId(Long id)
    • getVersion

      public Long getVersion()
    • setVersion

      public void setVersion(Long version)
    • getPosition

      public int getPosition()
    • setPosition

      public void setPosition(int position)
    • getChildrenSorted

      public List<N> getChildrenSorted()
      Get all of this nodes childnodes sorted by position.
    • setChildren

      public void setChildren(List<N> children)
      Do never call unless with a very good cause
      Parameters:
      children -
    • getChildren

      public List<N> getChildren()
      Returns the children unsorted.
      See Also:
    • getChildrenOfType

      public <T extends N> List<T> getChildrenOfType(Class<T> type)
    • getDescendants

      public List<N> getDescendants()
      Retrieves all children nodes of this node, also transitively. I.e. if there are any child folders, also all their children nodes are retrieved.
      Returns:
      all (transitive) children nodes
    • getDescendants

      public <T extends AbstractNode<N>> List<T> getDescendants(Class<T> type)
      Retrieves all children nodes of this node having this type, also transitively. I.e. if there are any child folders, also all their children nodes are retrieved.
      Parameters:
      type - the type of the (transitive) children nodes we are filtering for
      Returns:
      all (transitive) children nodes
    • hasChildren

      public boolean hasChildren()
    • hasChildrenOfType

      public boolean hasChildrenOfType(Class<? extends AbstractNode<?>> type)
    • hasDescendantsOfType

      public boolean hasDescendantsOfType(Class<? extends AbstractNode<?>> type)
    • getParent

      public N getParent()
      Get this nodes parent node. Returns null for the root element
    • setParent

      public void setParent(AbstractNode<N> abstractNode)
      Should not be called. Always go for (root.addChild())
    • isRoot

      public final boolean isRoot()
      Tells whether this entity is a root
    • isAncestorOf

      public boolean isAncestorOf(N node)
    • getRootLine

      public List<N> getRootLine()
    • addChild

      public final void addChild(N child)
      Add a new childnode to this node. Childnode will become detached from old parent node if necessary
      Parameters:
      child -
    • addChild

      public final void addChild(N childObj, int position)
    • getBaseType

      public final Class<?> getBaseType()
      Returns the tree's base class;
    • getManagerClass

      public final Class<? extends TreeDBManager> getManagerClass()
    • getSupportedChildren

      public final Class<?>[] getSupportedChildren()
      Returns a list with supported children
    • getDeniedChildren

      public final Class<?>[] getDeniedChildren()
      Returns a list with denied child types
    • removeChild

      public N removeChild(N child)
      Method does not remove the child from the database
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • setCreatedOn

      public void setCreatedOn(Date createdOn)
    • getCreatedOn

      public Date getCreatedOn()
    • setLastUpdated

      public void setLastUpdated(Date lastUpdated)
    • getLastUpdated

      public Date getLastUpdated()
    • setOldTransientId

      public void setOldTransientId(Long oldTransientId)
    • getOldTransientId

      public Long getOldTransientId()
    • setOldTransientKey

      public void setOldTransientKey(String oldTransientKey)
    • getOldTransientKey

      public String getOldTransientKey()
    • getIdOrOldTransient

      public Long getIdOrOldTransient()
    • setFlags

      public void setFlags(long flags)
    • getFlags

      public long getFlags()
    • addFlag

      public void addFlag(long bitfield)
    • removeFlag

      public void removeFlag(long bitfield)
    • hasFlag

      public boolean hasFlag(long flag)
    • wouldContainFlag

      public boolean wouldContainFlag(long flag, long newFlag)
    • clearFlags

      public void clearFlags()
    • isWriteProtected

      public boolean isWriteProtected()
    • setWriteProtection

      public void setWriteProtection(boolean w)
    • isConfigurationProtected

      public boolean isConfigurationProtected()
    • setConfigurationProtection

      public void setConfigurationProtection(boolean w)
    • isFolder

      public boolean isFolder()
    • setUpdateLastUpdated

      public void setUpdateLastUpdated(boolean updateLastUpdated)
    • isUpdateLastUpdated

      public boolean isUpdateLastUpdated()
    • getNodeName

      public abstract String getNodeName()
    • getRootNodeName

      public abstract String getRootNodeName()
    • idsMatch

      public boolean idsMatch(AbstractNode<?> node)
    • toString

      public String toString()
      Overrides:
      toString in class Object