Copyright© 2008-2022 Sitevision AB, all rights reserved.
@Requireable(value="FolderUtil") public interface FolderUtil
sv:folder
.
Note! This interface is used to create folders. You would typically use
StructureUtil
to move a folder
and TrashcanUtil
to delete a folder.
An instance of the Sitevision class implementing this interface can be obtained via Utils.getFolderUtil()
.
See Utils
for how to obtain an instance of the Utils
interface.
Modifier and Type | Method and Description |
---|---|
Node |
createFolder(Node aParent,
String aName)
Creates a folder as sub node of the specified parent.
|
void |
renameFolder(Node aFolder,
String aName)
Alters the name of a folder.
|
void |
setDownloadProtected(Node aFolder,
boolean aDownloadProtected)
Modifies download protection for a file folder (download protection only applies to new files created in the file folder).
|
void |
setVersioned(Node aFolder,
boolean aVersioned)
Modifies versioning for a file folder (versioning only applies to new files created in the file folder).
|
Node createFolder(Node aParent, String aName) throws ConstraintViolationException, RepositoryException
Creates a folder as sub node of the specified parent.
The parent may be either a sv:sitePage
, sv:page
, sv:folder
, sv:article
, sv:collaborationGroupPage
,
sv:imageRepository
, sv:localImageRepository
, sv:personalImageRepository
,
sv:fileRepository
, sv:localFileRepository
, sv:personalFileRepository
or sv:templateRepository
.
If an other parent is specified an ConstraintViolationException
is thrown.
Any name can be given the folder. If null is provided a NullPointerException
is thrown.
The current user must be authorized to create folders and to do write operations on the parent node or
a ConstraintViolationException
will be thrown.
Note that a new folder inherits metadata and permissions from its parent.
aParent
- the parent node of the sv:folder. May not be null
aName
- the name of the folder. May not be null
ConstraintViolationException
- if an invalid parent is specified or if the current user
is not authorized to create a folderRepositoryException
- if something else goes wrongvoid renameFolder(Node aFolder, String aName) throws ConstraintViolationException, RepositoryException
Alters the name of a folder. If no folder is specified a NullPointerException
is thrown. If the node is not a sv:folder an IllegalArgumentException
is thrown.
Any name can be given a folder. If null is provided a NullPointerException
is thrown.
The current user must be authorized to do write operations on the folder or
a ConstraintViolationException
will be thrown.
aFolder
- the sv:folder that should be renamed. May not be null
aName
- the new name of the folder. May not be null
ConstraintViolationException
- if the current user is not authorized to alter the name of the folderRepositoryException
- if something else goes wrongvoid setVersioned(Node aFolder, boolean aVersioned) throws ConstraintViolationException, RepositoryException
If no folder is specified a NullPointerException
is thrown.
If the node is not a sv:folder in a file tree an IllegalArgumentException
is thrown.
Current user must be authorized to do write operations on the folder or
a ConstraintViolationException
will be thrown.
aFolder
- the sv:folder. May not be nullaVersioned
- the new state of versioning for aFolderConstraintViolationException
- if the current user is not authorized to mutate aFolderRepositoryException
- if something else goes wrongvoid setDownloadProtected(Node aFolder, boolean aDownloadProtected) throws ConstraintViolationException, RepositoryException
Current user (the invoker of this method) must have WRITE permission and MANAGE_DOWNLOAD_PROTECTION permission on the folder node that
should be updated (see PermissionUtil.Permission.WRITE
and PermissionUtil.Permission.MANAGE_DOWNLOAD_PROTECTION
).
If no folder is specified a NullPointerException
is thrown.
If the node is not a sv:folder in a file tree an IllegalArgumentException
is thrown.
Tip! Use PropertyUtil
or Properties
to check current state, i.e. the "downloadProtected" boolean property.
aFolder
- the sv:folder. May not be nullaDownloadProtected
- the new state of download protection for aFolderConstraintViolationException
- if the current user is not authorized to mutate aFolderRepositoryException
- if something else goes wrongSitevision - 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-2022 Sitevision AB, all rights reserved.