Class CmsImportFolder


  • public class CmsImportFolder
    extends java.lang.Object
    Allows to import resources from the filesystem or a ZIP file into the OpenCms VFS.

    Since:
    6.0.0
    • Constructor Summary

      Constructors 
      Constructor Description
      CmsImportFolder()
      Default Constructor.
      CmsImportFolder​(byte[] content, java.lang.String importPath, CmsObject cms, boolean noSubFolder)
      Constructor for a new CmsImportFolder that will read from a ZIP file.
      CmsImportFolder​(java.lang.String importFolderName, java.lang.String importPath, CmsObject cms)
      Constructor for a new CmsImportFolder that will read from the real file system.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.util.List<CmsResource> getImportedResources()
      Returns the list of imported resources.
      void importFolder​(java.lang.String importFolderName, java.lang.String importPath, CmsObject cms)
      Import that will read from the real file system.
      void importZip​(byte[] content, java.lang.String importPath, CmsObject cms, boolean noSubFolder)
      Import that will read from a ZIP file.
      boolean isValidZipFile()
      Returns true if a valid ZIP file was imported.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • CmsImportFolder

        public CmsImportFolder​(byte[] content,
                               java.lang.String importPath,
                               CmsObject cms,
                               boolean noSubFolder)
                        throws CmsException
        Constructor for a new CmsImportFolder that will read from a ZIP file.

        Parameters:
        content - the zip file to import
        importPath - the path to the OpenCms VFS to import to
        cms - a OpenCms context to provide the permissions
        noSubFolder - if true no sub folders will be created, if false the content of the zip file is created 1:1 inclusive sub folders
        Throws:
        CmsException - if something goes wrong
      • CmsImportFolder

        public CmsImportFolder​(java.lang.String importFolderName,
                               java.lang.String importPath,
                               CmsObject cms)
                        throws CmsException
        Constructor for a new CmsImportFolder that will read from the real file system.

        Parameters:
        importFolderName - the folder to import
        importPath - the path to the OpenCms VFS to import to
        cms - a OpenCms context to provide the permissions
        Throws:
        CmsException - if something goes wrong
    • Method Detail

      • getImportedResources

        public java.util.List<CmsResourcegetImportedResources()
        Returns the list of imported resources.

        Returns:
        the list of imported resources
      • importFolder

        public void importFolder​(java.lang.String importFolderName,
                                 java.lang.String importPath,
                                 CmsObject cms)
                          throws CmsException
        Import that will read from the real file system.

        Parameters:
        importFolderName - the folder to import
        importPath - the path to the OpenCms VFS to import to
        cms - a OpenCms context to provide the permissions
        Throws:
        CmsException - if something goes wrong
      • importZip

        public void importZip​(byte[] content,
                              java.lang.String importPath,
                              CmsObject cms,
                              boolean noSubFolder)
                       throws CmsException
        Import that will read from a ZIP file.

        Parameters:
        content - the zip file to import
        importPath - the path to the OpenCms VFS to import to
        cms - a OpenCms context to provide the permissions
        noSubFolder - if true no sub folders will be created, if false the content of the zip file is created 1:1 inclusive sub folders
        Throws:
        CmsException - if something goes wrong
      • isValidZipFile

        public boolean isValidZipFile()
        Returns true if a valid ZIP file was imported.

        Returns:
        true if a valid ZIP file was imported