org.opencms.file
Class CmsFolder

java.lang.Object
  extended by org.opencms.file.CmsResource
      extended by org.opencms.file.CmsFolder
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.lang.Comparable
Direct Known Subclasses:
CmsHistoryFolder

public class CmsFolder
extends CmsResource
implements java.lang.Cloneable, java.io.Serializable, java.lang.Comparable

A folder resource in the OpenCms VFS.

A folder resource is a CmsResource object that can contain sub-resources.

Since:
6.0.0
Version:
$Revision: 1.26 $
Author:
Alexander Kandzior, Michael Emmerich
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class org.opencms.file.CmsResource
CmsResource.CmsResourceCopyMode, CmsResource.CmsResourceDeleteMode, CmsResource.CmsResourceUndoMode
 
Field Summary
 
Fields inherited from class org.opencms.file.CmsResource
COMPARE_DATE_RELEASED, COMPARE_ROOT_PATH, COMPARE_ROOT_PATH_IGNORE_CASE, COMPARE_ROOT_PATH_IGNORE_CASE_FOLDERS_FIRST, COPY_AS_NEW, COPY_AS_SIBLING, COPY_PRESERVE_SIBLING, DATE_EXPIRED_DEFAULT, DATE_RELEASED_DEFAULT, DATE_RELEASED_EXPIRED_IGNORE, DELETE_PRESERVE_SIBLINGS, DELETE_REMOVE_SIBLINGS, FLAG_INTERNAL, FLAG_LABELED, FLAG_TEMPFILE, m_dateContent, m_length, NAME_CONSTRAINTS, STATE_CHANGED, STATE_DELETED, STATE_KEEP, STATE_NEW, STATE_UNCHANGED, TOUCH_DATE_UNCHANGED, UNDO_CONTENT, UNDO_CONTENT_RECURSIVE, UNDO_MOVE_CONTENT, UNDO_MOVE_CONTENT_RECURSIVE, VFS_FOLDER_SITES, VFS_FOLDER_SYSTEM
 
Constructor Summary
CmsFolder(CmsResource resource)
          Constructor, creates a new CmsFolder Object from the given CmsResource.
CmsFolder(CmsUUID structureId, CmsUUID resourceId, java.lang.String path, int type, int flags, CmsUUID projectId, CmsResourceState state, long dateCreated, CmsUUID userCreated, long dateLastModified, CmsUUID userLastModified, long dateReleased, long dateExpired, int version)
          Constructor, creates a new CmsFolder object.
 
Method Summary
 java.lang.Object clone()
          Returns a clone of this Objects instance.
 int getLength()
          Returns the length of the resource.
 boolean isFile()
          Returns true if the resource is a file, i.e. can have no sub-resources.
 boolean isFolder()
          Returns true if the resource is a folder, i.e. can have sub-resources.
static boolean isFolderSize(long size)
          Returns true if the given resource size describes a folder type.
static boolean isFolderType(int typeId)
          Returns true if the given resource type id describes a folder type.
static boolean isFolderType(java.lang.String typeName)
          Returns true if the given resource type name describes a folder type.
 
Methods inherited from class org.opencms.file.CmsResource
checkResourceName, compareTo, equals, getDateContent, getDateCreated, getDateExpired, getDateLastModified, getDateReleased, getFlags, getFolderPath, getName, getName, getParentFolder, getPathLevel, getPathPart, getProjectLastModified, getResourceId, getRootPath, getSiblingCount, getState, getStructureId, getTypeId, getUserCreated, getUserLastModified, getVersion, hashCode, isExpired, isFolder, isInternal, isLabeled, isReleased, isReleasedAndNotExpired, isTouched, setDateExpired, setDateLastModified, setDateReleased, setFlags, setState, setType, setUserLastModified, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.lang.Comparable
compareTo
 

Constructor Detail

CmsFolder

public CmsFolder(CmsResource resource)
Constructor, creates a new CmsFolder Object from the given CmsResource.

Parameters:
resource - the base resource object to create a folder from

CmsFolder

public CmsFolder(CmsUUID structureId,
                 CmsUUID resourceId,
                 java.lang.String path,
                 int type,
                 int flags,
                 CmsUUID projectId,
                 CmsResourceState state,
                 long dateCreated,
                 CmsUUID userCreated,
                 long dateLastModified,
                 CmsUUID userLastModified,
                 long dateReleased,
                 long dateExpired,
                 int version)
Constructor, creates a new CmsFolder object.

Parameters:
structureId - the id of this resources structure record
resourceId - the id of this resources resource record
path - the filename of this resouce
type - the type of this resource
flags - the flags of this resource
projectId - the project id this resource was last modified in
state - the state of this resource
dateCreated - the creation date of this resource
userCreated - the id of the user who created this resource
dateLastModified - the date of the last modification of this resource
userLastModified - the id of the user who did the last modification of this resource * @param size the size of the file content of this resource
dateReleased - the release date of this resource
dateExpired - the expiration date of this resource
version - the version number of this resource
Method Detail

isFolderSize

public static final boolean isFolderSize(long size)
Returns true if the given resource size describes a folder type.

Parameters:
size - the resource size to check
Returns:
true if the given resource size describes a folder type or false if it is no folder

isFolderType

public static final boolean isFolderType(int typeId)
Returns true if the given resource type id describes a folder type.

Parameters:
typeId - the resource type id to check
Returns:
true if the given resource type id describes a folder type or false if it is no folder or an unknown type.

isFolderType

public static final boolean isFolderType(java.lang.String typeName)
Returns true if the given resource type name describes a folder type.

Parameters:
typeName - the resource type name to check
Returns:
true if the given resource type name describes a folder type

clone

public java.lang.Object clone()
Returns a clone of this Objects instance.

Overrides:
clone in class CmsResource
Returns:
a clone of this instance

getLength

public int getLength()
Description copied from class: CmsResource
Returns the length of the resource.

If the resource is a file, then this is the byte size of the file content. If the resource is a folder, then the size is always -1.

Overrides:
getLength in class CmsResource
Returns:
the length of the content
See Also:
CmsResource.getLength()

isFile

public boolean isFile()
Description copied from class: CmsResource
Returns true if the resource is a file, i.e. can have no sub-resources.

Overrides:
isFile in class CmsResource
Returns:
true if this resource is a file, false otherwise
See Also:
CmsResource.isFile()

isFolder

public boolean isFolder()
Description copied from class: CmsResource
Returns true if the resource is a folder, i.e. can have sub-resources.

Overrides:
isFolder in class CmsResource
Returns:
true if this resource is a folder, false otherwise
See Also:
CmsResource.isFolder()