Package ch.tocco.nice2.dms.api.tree
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.
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 Summary
Modifier and TypeMethodDescriptionvoid
Add an alias to the existing aliases.boolean
Is true, if an alias applies to the child nodes, else false.boolean
Determine if aliases have changed (in current transaction).copy
(CopyContentTreeNodeParams params) Copy the current ContentTreeNodevoid
delete()
recursively delete the current ContentTreeNodeGet the admin URL of this node.Same asgetAliases()
, but aliases are split (not a multiline string).Get the checksum of this node.Returns child if the node has a child with the given name.The iterable returned is a "lazy-loading" view that only creates ContentTreeNode objects upon iterating over the iterable.getChildren
(Pagination pagination, String sort) Same asgetChildren()
, but fetches only the requested subset.getChildren
(Predicate<ContentTreeNode> filter) long
Returns the over "relContent" related entity.@Nullable Entity
Does not check permission of content entity (privileged for performance reasons).Returns the over "relContent_published" related entity.Get the source node if this node is a copy.getLabel()
Returns the human readable label for this node.getModel()
Returns the model of this node.getName()
Returns this node's name.@Nullable Entity
getNodeRight
(String role, ContentNodePermission permission) get Node_right entity (if it esxists)The *old* full path of the current ContentTreeNode.Get the old path part of this node.Get the *old* full paths of this node (without aliases).getOptimalPathForRequest
(String requestUrl) @Nullable Entity
getOrCreateNodeRight
(String role, ContentNodePermission permission) add a new Node_right entity@Nullable ContentTreeNode
getPath()
Get the path part of this node.getPaths()
Get all full paths of this node (without aliases).Get thePublishStatus
or PUBLISHED if no publish status is available on node.getRoot()
<T extends ContentTreeNode>
Tboolean
boolean
Determine if the node has a child with the given name.boolean
default boolean
Returns whether you can read this node's content.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.boolean
Returns whether you are allowed to edit the permissions for this node.boolean
isChildOf
(ContentTreeNode parentNode) boolean
Determine if at least one of the child relations has changed (in current transaction).boolean
boolean
Determine if parent relation has changed (in current transaction).boolean
Determine if path part has changed (in current transaction).boolean
isRoot()
Determine if the node is a root node.boolean
System nodes are nodes in the content tree that are generated by the system.boolean
void
moveAbove
(ContentTreeNode referenceNode) move the currentContentTreeNode
to the position beforereferenceNode
void
moveBelow
(ContentTreeNode referenceNode) move the currentContentTreeNode
to the position afterreferenceNode
void
moveInto
(ContentTreeNode parentNode) move the currentContentTreeNode
intoparentNode
void
removeNodeRight
(String role, ContentNodePermission permission) remove a Node_right entity from this nodeThe same asgetParent()
, but the return value is not nullable and aIllegalStateException
is thrown if the parent is null.void
Should only be used internally.void
setAliases
(String aliases) void
setContentTreeContext
(ContentTreeContext context) void
Sets the human readable label for this node.void
Sets the name for this node.void
setParent
(ContentTreeNode parentNode) void
setSorting
(Integer sorting) boolean
verifyChecksum
(String checksum) Checks if the given checksum matches the checksum of this node.boolean
verifyName
(String name) Checks if the given name matches the name of this node.
-
Method Details
-
getModel
ContentTreeNodeModel 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
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
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
-
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
- Returns:
- all aliases of this ContentTreeNode as a string.
- Throws:
UnsupportedOperationException
- if this node doesn't support aliases.ContentException
- See Also:
-
getAliasesSet
Same asgetAliases()
, but aliases are split (not a multiline string). -
setAliases
- Throws:
UnsupportedOperationException
- if this node doesn't support aliases.- See Also:
-
addAlias
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 callhasChildren()
in order to find out if this node has any children.- Returns:
- child nodes of the current ContentTreeNode
- Throws:
ContentException
- See Also:
-
getChildren
Same asgetChildren()
, but fetches only the requested subset.- Parameters:
pagination
- the bounds of the requested subset with offset and limitsort
- 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
- 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
- Returns:
- true if current node is a child of @param parentNode, otherwise false.
- Throws:
ContentException
-
hasChild
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
- Returns:
- the parent node of the current ContentTreeNode
- Throws:
ContentException
- See Also:
-
requireParent
The same asgetParent()
, but the return value is not nullable and aIllegalStateException
is thrown if the parent is null.- Returns:
- the parent node of the current ContentTreeNode
- Throws:
IllegalStateException
- if the parent is nullContentException
-
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
- Throws:
ContentException
- See Also:
-
getPaths
Get all full paths of this node (without aliases).- Returns:
- all full paths of the node (without aliases).
-
getOldPaths
Get the *old* full paths of this node (without aliases). This is different fromgetPaths()
, 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
- Returns:
- the full path of the current ContentTreeNode
- Throws:
ContentException
-
getOldPath
String getOldPath()The *old* full path of the current ContentTreeNode. This is different fromgetPath()
, 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
- Returns:
- the optimal full path of the current ContentTreeNode
- Throws:
ContentException
-
getOptimalPathForRequest
- 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
Get the old path part of this node. This is different fromgetPathPart()
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
recursively delete the current ContentTreeNode- Throws:
ContentException
-
copy
Copy the current ContentTreeNode- Returns:
- the copied ContentTreeNode
- Throws:
ContentException
-
moveInto
move the currentContentTreeNode
intoparentNode
- Parameters:
parentNode
- becomes the new parent of thisContentTreeNode
- Throws:
ContentException
-
moveBelow
move the currentContentTreeNode
to the position afterreferenceNode
- Parameters:
referenceNode
- becomes the new left neighbour of thisContentTreeNode
- Throws:
ContentException
-
moveAbove
move the currentContentTreeNode
to the position beforereferenceNode
- Parameters:
referenceNode
- becomes the new right neighbour of thisContentTreeNode
- Throws:
ContentException
-
getTreeNode
- Returns:
- TreeNode representation for the current ContentTreeNode for use in a DwrTreePanel
- Throws:
ContentException
-
setParent
- Throws:
ContentException
-
getDelegate
Entity getDelegate() -
setContentTreeContext
-
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
get Node_right entity (if it esxists)- Parameters:
role
- unique_id of the role entitypermission
- unique_id of the permission entity- Returns:
- the Node_right entity or null
-
getOrCreateNodeRight
add a new Node_right entity- Parameters:
role
- unique_id of the role entitypermission
- 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
remove a Node_right entity from this node- Parameters:
role
- unique_id of the role entitypermission
- 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
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
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
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
Returns the over "relContent_published" related entity. -
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 thePublishStatus
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
-