Interface ContentTreeNode

All Known Subinterfaces:
BinaryContent, CmsDomainNode, DomainNode, FolderNode, PageNode, ResourceNode
All Known Implementing Classes:
AbstractContentTreeNode, BinaryContentImpl, CmsDomainNodeImpl, DomainNodeImpl, FolderNodeImpl, PageNodeImpl, ResourceNodeImpl

public interface ContentTreeNode
Java Bean representation for entities in the DMS / CMS tree.

Note: implementations of this class won't handle any transactions. If you want to modify the underlying entity make sure you call the corresponding methods within a transaction.
  • Method Details

    • getModel

      Returns the model of this node.
      Returns:
      the model of the node.
    • getName

      String getName()
      Returns this node's name. The name is a normalized string used in URLs to identify this node.
    • setName

      void setName(String name)
      Sets the name for this node. The method takes care of properly normalizing the `name` argument.
    • getLabel

      String getLabel()
      Returns the human readable label for this node.
    • setLabel

      void setLabel(String label)
      Sets the human readable label for this node. If this node does not have a `name` set, a name value is generated from the given label and set for this node.
    • getSorting

      Integer getSorting()
    • setSorting

      void setSorting(Integer sorting)
    • hasAliases

      boolean hasAliases()
    • areAliasesChanged

      boolean areAliasesChanged()
      Determine if aliases have changed (in current transaction).
      Returns:
      true, if the aliases have changed, else false.
    • aliasesApplyRecursive

      boolean aliasesApplyRecursive()
      Is true, if an alias applies to the child nodes, else false. This means: If aliases of this node apply recursive and this node has an alias "http://www.example.com" and there is a child node named "child", then "http://www.example.com/child" would resolve the child node.
    • getAliases

      String getAliases() throws ContentException
      Returns:
      all aliases of this ContentTreeNode as a string.
      Throws:
      UnsupportedOperationException - if this node doesn't support aliases.
      ContentException
      See Also:
    • getAliasesSet

      Set<String> getAliasesSet()
      Same as getAliases(), but aliases are split (not a multiline string).
    • setAliases

      void setAliases(String aliases)
      Throws:
      UnsupportedOperationException - if this node doesn't support aliases.
      See Also:
    • addAlias

      void addAlias(String alias)
      Add an alias to the existing aliases.
      Parameters:
      alias - The new alias to add.
    • getChildren

      The iterable returned is a "lazy-loading" view that only creates ContentTreeNode objects upon iterating over the iterable. It is recommended to call hasChildren() in order to find out if this node has any children.
      Returns:
      child nodes of the current ContentTreeNode
      Throws:
      ContentException
      See Also:
    • getChildren

      Iterable<ContentTreeNode> getChildren(Pagination pagination, String sort)
      Same as getChildren(), but fetches only the requested subset.
      Parameters:
      pagination - the bounds of the requested subset with offset and limit
      sort - comma separated string of fields to sort by
      Returns:
      child nodes subset of the current ContentTreeNode
    • getChildrenCount

      long getChildrenCount()
      Returns:
      the total number of children (that are readable by the current user).
    • hasChildren

      boolean hasChildren() throws ContentException
      Throws:
      ContentException
    • getChildren

      Parameters:
      filter - a filter to be applied to each child for filtering the result
      Returns:
      filtered child nodes of the current ContentTreeNode
      Throws:
      ContentException
    • isChildOf

      boolean isChildOf(ContentTreeNode parentNode) throws ContentException
      Returns:
      true if current node is a child of @param parentNode, otherwise false.
      Throws:
      ContentException
    • hasChild

      boolean hasChild(String name) throws ContentException
      Determine if the node has a child with the given name.
      Parameters:
      name - The name of the child.
      Returns:
      true, if the node has a child with the given name, else false.
      Throws:
      ContentException
    • getChild

      Returns child if the node has a child with the given name.
      Parameters:
      name - The name of the child.
      Throws:
      ContentException
    • getParent

      @Nullable @Nullable ContentTreeNode getParent() throws ContentException
      Returns:
      the parent node of the current ContentTreeNode
      Throws:
      ContentException
      See Also:
    • requireParent

      ContentTreeNode requireParent() throws ContentException
      The same as getParent(), but the return value is not nullable and a IllegalStateException is thrown if the parent is null.
      Returns:
      the parent node of the current ContentTreeNode
      Throws:
      IllegalStateException - if the parent is null
      ContentException
    • getRoot

      Returns:
      The root node of the tree this node pertains to. Absent value can be returned when required permissions are not available.
      Throws:
      ContentException
    • isRoot

      boolean isRoot()
      Determine if the node is a root node.
      Returns:
      true, if the node is a root node, else false.
    • getRoot

      <T extends ContentTreeNode> T getRoot(Class<T> expectedClass) throws ContentException
      Throws:
      ContentException
      See Also:
    • getPaths

      List<String> getPaths()
      Get all full paths of this node (without aliases).
      Returns:
      all full paths of the node (without aliases).
    • getOldPaths

      List<String> getOldPaths()
      Get the *old* full paths of this node (without aliases). This is different from getPaths(), if the path part of this node or of a parent node has changed in the current transaction.
      Returns:
      all old full paths of the node (without aliases).
    • getPath

      String getPath() throws ContentException
      Returns:
      the full path of the current ContentTreeNode
      Throws:
      ContentException
    • getOldPath

      String getOldPath()
      The *old* full path of the current ContentTreeNode. This is different from getPath(), if the path part of this node or of a parent node has changed in the current transaction.
      Returns:
      the old full path of the node.
      See Also:
    • getOptimalPath

      String getOptimalPath() throws ContentException
      Returns:
      the optimal full path of the current ContentTreeNode
      Throws:
      ContentException
    • getOptimalPathForRequest

      String getOptimalPathForRequest(String requestUrl) throws ContentException
      Returns:
      the optimal path of the current ContentTreeNode which does not contain authority if possible and uses same alias as request if possible
      Throws:
      ContentException
    • getPathPart

      String getPathPart()
      Get the path part of this node. The full path of a node is put together from the path parts of the node and of all parent nodes.
      Returns:
      the path part of this node.
    • getOldPathPart

      Optional<String> getOldPathPart()
      Get the old path part of this node. This is different from getPathPart() if the path part of this node or of a parent node has changed in the current transaction.
      Returns:
      the old path part.
      See Also:
    • getAdminUrl

      String getAdminUrl()
      Get the admin URL of this node.
      Returns:
      the admin URL.
    • delete

      void delete() throws ContentException
      recursively delete the current ContentTreeNode
      Throws:
      ContentException
    • copy

      Copy the current ContentTreeNode
      Returns:
      the copied ContentTreeNode
      Throws:
      ContentException
    • moveInto

      void moveInto(ContentTreeNode parentNode) throws ContentException
      move the current ContentTreeNode into parentNode
      Parameters:
      parentNode - becomes the new parent of this ContentTreeNode
      Throws:
      ContentException
    • moveBelow

      void moveBelow(ContentTreeNode referenceNode) throws ContentException
      move the current ContentTreeNode to the position after referenceNode
      Parameters:
      referenceNode - becomes the new left neighbour of this ContentTreeNode
      Throws:
      ContentException
    • moveAbove

      void moveAbove(ContentTreeNode referenceNode) throws ContentException
      move the current ContentTreeNode to the position before referenceNode
      Parameters:
      referenceNode - becomes the new right neighbour of this ContentTreeNode
      Throws:
      ContentException
    • getTreeNode

      EntityTreeNode getTreeNode() throws ContentException
      Returns:
      TreeNode representation for the current ContentTreeNode for use in a DwrTreePanel
      Throws:
      ContentException
    • setParent

      void setParent(ContentTreeNode parentNode) throws ContentException
      Throws:
      ContentException
    • getDelegate

      Entity getDelegate()
    • setContentTreeContext

      void setContentTreeContext(ContentTreeContext context)
    • getContentTreeContext

      ContentTreeContext getContentTreeContext()
    • getDefaultPublicContentTreeContext

      ContentTreeContext getDefaultPublicContentTreeContext()
    • isSystemNode

      boolean isSystemNode()
      System nodes are nodes in the content tree that are generated by the system.
      Returns:
      true if this ContentTreeNode is a system node, false otherwise
    • getNodeRights

      EntityList getNodeRights()
      Returns:
      an EntityList of Node_rights of this node
    • getNodeRight

      @Nullable @Nullable Entity getNodeRight(String role, ContentNodePermission permission)
      get Node_right entity (if it esxists)
      Parameters:
      role - unique_id of the role entity
      permission - unique_id of the permission entity
      Returns:
      the Node_right entity or null
    • getOrCreateNodeRight

      @Nullable @Nullable Entity getOrCreateNodeRight(String role, ContentNodePermission permission)
      add a new Node_right entity
      Parameters:
      role - unique_id of the role entity
      permission - unique_id of the permission entity
      Returns:
      the loaded or created Node_right entity, null if it cannot be created because the requested permission is not available for this node type
    • removeNodeRight

      void removeNodeRight(String role, ContentNodePermission permission)
      remove a Node_right entity from this node
      Parameters:
      role - unique_id of the role entity
      permission - unique_id of the permission entity
    • getAvailablePermissions

      Set<ContentNodePermission> getAvailablePermissions()
      Returns:
      a set of available permissions for this node
    • getPermissionsForChildren

      Set<ContentNodePermission> getPermissionsForChildren()
      Returns:
      a set of permissions for this node's children
    • verifyChecksum

      boolean verifyChecksum(String checksum)
      Checks if the given checksum matches the checksum of this node.
      Parameters:
      checksum - The checksum to check.
      Returns:
      true, if the checksum matches, else false.
    • verifyName

      boolean verifyName(String name)
      Checks if the given name matches the name of this node.
    • getChecksum

      String getChecksum()
      Get the checksum of this node.
      Returns:
      the checksum of this node.
    • getContentEntity

      @Nullable @Nullable Entity getContentEntity() throws ContentException
      Does not check permission of content entity (privileged for performance reasons). It assumes that you have read permission when you can read the node itself (same acl).
      Throws:
      ContentException
      See Also:
    • hasContentReadPermission

      default boolean hasContentReadPermission()
      Returns whether you can read this node's content.
    • hasContentReadPermission

      boolean hasContentReadPermission(boolean checkPathOnly)
      Returns whether you can read this node's content, but assumes that the content entity is readable and that only additional paths need to be checked. This can be used when it is *known* that the content node is readable to optimize performance.
    • hasPermissionEditPermission

      boolean hasPermissionEditPermission()
      Returns whether you are allowed to edit the permissions for this node.
    • getContent

      Entity getContent()
      Returns the over "relContent" related entity.
    • getContentPublished

      Optional<Entity> getContentPublished()
      Returns the over "relContent_published" related entity.
    • isVisibleInNavigation

      boolean isVisibleInNavigation()
      Returns:
      true if this node is to be displayed in a navigation
    • isCurrentlyPublished

      boolean isCurrentlyPublished()
      Returns:
      true if this node has publish dates (published_from and published_until) which are valid for the current date
    • isPathPartChanged

      boolean isPathPartChanged()
      Determine if path part has changed (in current transaction).
      Returns:
      true, if the path part has changed, else false.
      See Also:
    • isParentRelationChanged

      boolean isParentRelationChanged()
      Determine if parent relation has changed (in current transaction).
      Returns:
      true, if the parent relation has changed, else false.
    • isChildRelationChanged

      boolean isChildRelationChanged()
      Determine if at least one of the child relations has changed (in current transaction).
      Returns:
      true, if the child relation has changed, else false.
    • resetChildren

      void resetChildren()
      Should only be used internally. Resets children cache.
    • getPublishStatus

      PublishStatus getPublishStatus()
      Get the PublishStatus or PUBLISHED if no publish status is available on node.
    • getCopySource

      Optional<ContentTreeNode> getCopySource()
      Get the source node if this node is a copy.
      Returns:
      the source node if this node is a copy.
    • getBusinessUnit

      Optional<BusinessUnit> getBusinessUnit()
      Returns:
      the business unit of the current node element
    • getBusinessUnitInvoker

      Invoker getBusinessUnitInvoker()
      Returns:
      an Invoker for the business unit of this node or an empty invoker if there is no associated business unit