Package org.opencms.file
Interface I_CmsResource
-
- All Known Subinterfaces:
I_CmsHistoryResource
- All Known Implementing Classes:
CmsFile,CmsFolder,CmsHistoryFile,CmsHistoryFolder,CmsJspResourceWrapper,CmsResource,CmsSearchResource
public interface I_CmsResource
Common ancestor interface forCmsFileandCmsFolderas well as forCmsHistoryFileandCmsHistoryFolder.- Since:
- 8.0.0
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classI_CmsResource.CmsResourceAttributeEnumeration for all attributes of a resource.
-
Field Summary
Fields Modifier and Type Field Description static java.util.Comparator<I_CmsResource>COMPARE_DATE_LAST_MODIFIEDA comparator for the date last modified of two resources.static java.util.Comparator<I_CmsResource>COMPARE_DATE_RELEASEDA comparator for the release date of two resources.static java.util.Comparator<I_CmsResource>COMPARE_ROOT_PATHA comparator for the root path of two resources.static java.util.Comparator<I_CmsResource>COMPARE_ROOT_PATH_IGNORE_CASEA comparator for the root path of two resources ignoring case differences.static java.util.Comparator<I_CmsResource>COMPARE_ROOT_PATH_IGNORE_CASE_FOLDERS_FIRSTA comparator for the root path of two resources ignoring case differences, putting folders before files.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description longgetDateContent()Returns the date of the last modification of the content of this resource.longgetDateCreated()Returns the date of the creation of this resource.longgetDateExpired()Returns the expiration date this resource.longgetDateLastModified()Returns the date of the last modification of this resource.longgetDateReleased()Returns the release date this resource.intgetFlags()Returns the flags of this resource.intgetLength()Returns the content length of this resource.java.lang.StringgetName()Returns the file name of this resource without parent folders, for exampleindex.html.CmsUUIDgetProjectLastModified()Returns the id of theCmsProjectwhere this resource has been last modified.CmsUUIDgetResourceId()Returns the id of the database content record of this resource.java.lang.StringgetRootPath()Returns the name of this resource with it's full path from the top level root folder, for example/sites/default/myfolder/index.html.intgetSiblingCount()Returns the number of siblings of this resource, also counting this resource.CmsResourceStategetState()Returns the state of this resource.CmsUUIDgetStructureId()Returns the id of the database structure record of this resource.intgetTypeId()Returns the resource type id for this resource.CmsUUIDgetUserCreated()Returns the id of theCmsUserwho created this resource.CmsUUIDgetUserLastModified()Returns the id of theCmsUserwho made the last modification on this resource.intgetVersion()Returns the current version number of this resource.booleanisExpired(long time)Returnstrueif this resource is expired at the given time according to the information stored ingetDateExpired().booleanisFile()Returnstrueif the resource is a file, i.e.booleanisFolder()Returnstrueif the resource is a folder, i.e.booleanisInternal()Checks if the resource is internal.booleanisLabeled()Checks if the link has to be labeled with a special icon in the explorer view.booleanisReleased(long time)Returnstrueif this resource is released at the given time according to the information stored ingetDateReleased().booleanisReleasedAndNotExpired(long time)Returnstrueif this resource is valid at the given time according to the information stored ingetDateReleased()andgetDateExpired().booleanisTouched()Returns true if this resource was touched.
-
-
-
Field Detail
-
COMPARE_DATE_LAST_MODIFIED
static final java.util.Comparator<I_CmsResource> COMPARE_DATE_LAST_MODIFIED
A comparator for the date last modified of two resources.
-
COMPARE_DATE_RELEASED
static final java.util.Comparator<I_CmsResource> COMPARE_DATE_RELEASED
A comparator for the release date of two resources.If the release date of a resource is not set, the creation date is used instead.
-
COMPARE_ROOT_PATH
static final java.util.Comparator<I_CmsResource> COMPARE_ROOT_PATH
A comparator for the root path of two resources.
-
COMPARE_ROOT_PATH_IGNORE_CASE
static final java.util.Comparator<I_CmsResource> COMPARE_ROOT_PATH_IGNORE_CASE
A comparator for the root path of two resources ignoring case differences.
-
COMPARE_ROOT_PATH_IGNORE_CASE_FOLDERS_FIRST
static final java.util.Comparator<I_CmsResource> COMPARE_ROOT_PATH_IGNORE_CASE_FOLDERS_FIRST
A comparator for the root path of two resources ignoring case differences, putting folders before files.
-
-
Method Detail
-
getDateContent
long getDateContent()
Returns the date of the last modification of the content of this resource.- Returns:
- the date of the last modification of the content of this resource
-
getDateCreated
long getDateCreated()
Returns the date of the creation of this resource.- Returns:
- the date of the creation of this resource
-
getDateExpired
long getDateExpired()
Returns the expiration date this resource.- Returns:
- the expiration date of this resource
-
getDateLastModified
long getDateLastModified()
Returns the date of the last modification of this resource.- Returns:
- the date of the last modification of this resource
-
getDateReleased
long getDateReleased()
Returns the release date this resource.- Returns:
- the release date of this resource
-
getFlags
int getFlags()
Returns the flags of this resource.- Returns:
- the flags of this resource
-
getLength
int getLength()
Returns the content length of this 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.
- Returns:
- the content length of this resource
-
getName
java.lang.String getName()
Returns the file name of this resource without parent folders, for exampleindex.html.- Returns:
- the file name of this resource without parent folders
-
getProjectLastModified
CmsUUID getProjectLastModified()
Returns the id of theCmsProjectwhere this resource has been last modified.- Returns:
- the id of the
CmsProjectwhere this resource has been last modified, ornull
-
getResourceId
CmsUUID getResourceId()
Returns the id of the database content record of this resource.- Returns:
- the id of the database content record of this resource
-
getRootPath
java.lang.String getRootPath()
Returns the name of this resource with it's full path from the top level root folder, for example/sites/default/myfolder/index.html.- Returns:
- name of this resource with it's full path from the top level root folder
-
getSiblingCount
int getSiblingCount()
Returns the number of siblings of this resource, also counting this resource.If a resource has no sibling, the total sibling count for this resource is
1, if a resource hasnsiblings, the sibling count isn + 1.- Returns:
- the number of siblings of this resource, also counting this resource
-
getState
CmsResourceState getState()
Returns the state of this resource.- Returns:
- the state of this resource
-
getStructureId
CmsUUID getStructureId()
Returns the id of the database structure record of this resource.- Returns:
- the id of the database structure record of this resource
-
getTypeId
int getTypeId()
Returns the resource type id for this resource.- Returns:
- the resource type id of this resource
-
getUserCreated
CmsUUID getUserCreated()
Returns the id of theCmsUserwho created this resource.- Returns:
- the id of the
CmsUserwho created this resource
-
getUserLastModified
CmsUUID getUserLastModified()
Returns the id of theCmsUserwho made the last modification on this resource.- Returns:
- the id of the
CmsUserwho made the last modification on this resource
-
getVersion
int getVersion()
Returns the current version number of this resource.- Returns:
- the current version number of this resource
-
isExpired
boolean isExpired(long time)
Returnstrueif this resource is expired at the given time according to the information stored ingetDateExpired().- Parameters:
time- the time to check the expiration date against- Returns:
trueif this resource is expired at the given time- See Also:
isReleased(long),isReleasedAndNotExpired(long)
-
isFile
boolean isFile()
Returnstrueif the resource is a file, i.e. can have no sub-resources.- Returns:
- true if this resource is a file, false otherwise
-
isFolder
boolean isFolder()
Returnstrueif the resource is a folder, i.e. can have sub-resources.- Returns:
- true if this resource is a folder, false otherwise
-
isInternal
boolean isInternal()
Checks if the resource is internal.This state is stored as bit 1 in the resource flags.
- Returns:
- true if the resource is internal, otherwise false
-
isLabeled
boolean isLabeled()
Checks if the link has to be labeled with a special icon in the explorer view.This state is stored as bit 2 in the resource flags.
- Returns:
- true if a link to the resource has to be labeled, otherwise false
-
isReleased
boolean isReleased(long time)
Returnstrueif this resource is released at the given time according to the information stored ingetDateReleased().- Parameters:
time- the time to check the release date against- Returns:
trueif this resource is released at the given time- See Also:
isExpired(long),isReleasedAndNotExpired(long)
-
isReleasedAndNotExpired
boolean isReleasedAndNotExpired(long time)
Returnstrueif this resource is valid at the given time according to the information stored ingetDateReleased()andgetDateExpired().A resource is valid if it is released and not yet expired.
- Parameters:
time- the time to check the release and expiration date against- Returns:
trueif this resource is valid at the given time- See Also:
isExpired(long),isReleased(long)
-
isTouched
boolean isTouched()
Returns true if this resource was touched.- Returns:
- boolean true if this resource was touched
-
-