Copyright© 2008-2023 Sitevision AB, all rights reserved.
@Requireable(value="TrashcanUtil") public interface TrashcanUtil
An instance of the Sitevision class implementing this interface can be obtained via Utils.getTrashcanUtil()
.
See Utils
for how to obtain an instance of the Utils
interface.
ResourceLocatorUtil.getTrashcan()
Modifier and Type | Method and Description |
---|---|
void |
deleteNodeFromTrashcan(Node aNode)
Deletes a node from the site trashcan.
|
boolean |
isInTrashcan(Node aNode)
Checks if a node is in the site trashcan
If no node is specified a
NullPointerException is thrown. |
void |
moveNodeToTrashcan(Node aNode)
Puts a node in the site trashcan.
|
void |
restoreNode(Node aNode)
Restores a node from the site trashcan.
|
void moveNodeToTrashcan(Node aNode) throws ConstraintViolationException, RepositoryException
Puts a node in the site trashcan.
A node that has been deleted (i.e. put in the site trashcan) can later be restored using the method
restoreNode(javax.jcr.Node)
or be permanently removed with the method
deleteNodeFromTrashcan(javax.jcr.Node)
.
Valid node types are:
sv:archive
sv:article
sv:collaborationGroupPage
(since Sitevision 2023.02.1)sv:file
sv:folder
sv:image
sv:link
sv:page
sv:template
If any other node is specified a ConstraintViolationException
is thrown.
The current user must be authorized to delete objects, to alter the node and its current parent or
a ConstraintViolationException
is thrown
(see PermissionUtil.hasEffectiveDeletePermission(Node, Node)
).
If no node is specified a NullPointerException
is thrown.
aNode
- the node that will be moved to the site trashcan. May not be null
ConstraintViolationException
- if an invalid node is specified or if the current user is not
authorized to perform the delete operationRepositoryException
- if something else goes wrongPermissionUtil.hasEffectiveDeletePermission(Node, Node)
void restoreNode(Node aNode) throws ConstraintViolationException, RepositoryException
Restores a node from the site trashcan.
If the node is not in the site trashcan or if an invalid node type is specified
(i.e. a node that never could be in the site trashcan like the sv:site node)
a IllegalArgumentException
is thrown.
The current user must be authorized to alter the node and the parent node after the
restore operation or a ConstraintViolationException
is thrown.
If no node is specified a NullPointerException
is thrown.
aNode
- the node that should be restored. This node must be located in the site trashcan. May not be nullConstraintViolationException
- is thrown if the current user is not authorized to perform the
restore operationRepositoryException
- is thrown if something else goes wrongvoid deleteNodeFromTrashcan(Node aNode) throws ConstraintViolationException, RepositoryException
Deletes a node from the site trashcan.
If the node is not in the site trashcan or if an invalid node type is specified
(i.e. a node that never could be in the site trashcan like the sv:site node)
a IllegalArgumentException
is thrown.
The current user must be authorized to delete objects or a ConstraintViolationException
is thrown.
If no node is specified a NullPointerException
is thrown.
aNode
- the node that should be removed from the site trashcan. This node must be located in the site trashcan.
May not be null
ConstraintViolationException
- if the current user is not authorized to perform the delete operationRepositoryException
- if something else goes wrongboolean isInTrashcan(Node aNode)
Checks if a node is in the site trashcan
If no node is specified a NullPointerException
is thrown.
Note that some nodes can't be put in the trashcan (e.g. sv:user, sv:color, sv:portlet, sv:layout etc).
For such nodes false
will be returned.
aNode
- the node to be checked if it is located in the site trashcan.
May not be null
true
if the Node
is in site trashcan, false
otherwiseSitevision - Portal and Content Management Made Easy
Sitevision is an advanced Java enterprise portal product and a portlet container (JSR 286) that implements Java Content Repository (JSR 283).
Copyright© 2008-2023 Sitevision AB, all rights reserved.