Package org.opencms.xml.containerpage
Class CmsLazyFolder
java.lang.Object
org.opencms.xml.containerpage.CmsLazyFolder
Helper class for creating a folder if it doesn'T already exist.
- Since:
- 8.0.0
-
Constructor Summary
ConstructorDescriptionCmsLazyFolder
(String path) Initializes this object with a path at which the folder should be created.CmsLazyFolder
(CmsResource folder) Initializes this object with an existing folder. -
Method Summary
Modifier and TypeMethodDescriptioncreateFolder
(CmsObject cms) Creates the folder with the given name if it doesn't already exist, and returns it.Returns the folder if it already exists, or null if it doesn't.Returns the folder if it already exists, or creates and returns it if it doesn't.Returns the folder to check for permissions, which is either the folder itself if it already exists, or the parent folder if it doesn't.getSitePath
(CmsObject cms) Computes the site path of the folder, which is either the original path constructor argument, or the site path of the original resource constructor argument.
-
Constructor Details
-
CmsLazyFolder
Initializes this object with an existing folder.- Parameters:
folder
- the existing folder
-
CmsLazyFolder
Initializes this object with a path at which the folder should be created.- Parameters:
path
- the path at which the folder should be created
-
-
Method Details
-
createFolder
Creates the folder with the given name if it doesn't already exist, and returns it.- Parameters:
cms
- the current CMS context- Returns:
- the created folder or the already existing folder
- Throws:
CmsException
- if something goes wrong
-
getFolder
Returns the folder if it already exists, or null if it doesn't.- Parameters:
cms
- the current CMS context- Returns:
- the folder if it exists, else null
- Throws:
CmsException
- if something goes wrong
-
getOrCreateFolder
Returns the folder if it already exists, or creates and returns it if it doesn't.- Parameters:
cms
- the current CMS context- Returns:
- the folder
- Throws:
CmsException
- if something goes wrong
-
getPermissionCheckFolder
Returns the folder to check for permissions, which is either the folder itself if it already exists, or the parent folder if it doesn't.- Parameters:
cms
- the current CMS context- Returns:
- the folder to check for permissions
- Throws:
CmsException
- if something goes wrong
-
getSitePath
Computes the site path of the folder, which is either the original path constructor argument, or the site path of the original resource constructor argument.- Parameters:
cms
- the current CMS context- Returns:
- the site path of the lazy folder
-