Class CmsLazyFolder

java.lang.Object
org.opencms.xml.containerpage.CmsLazyFolder

public class CmsLazyFolder extends Object
Helper class for creating a folder if it doesn'T already exist.

Since:
8.0.0
  • Constructor Details

    • CmsLazyFolder

      public CmsLazyFolder(CmsResource folder)
      Initializes this object with an existing folder.

      Parameters:
      folder - the existing folder
    • CmsLazyFolder

      public CmsLazyFolder(String path)
      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