public class CmsResource
extends java.lang.Object
CmsResource.| 限定符和类型 | 字段和说明 |
|---|---|
static CmsResourceState |
STATE_CHANGED
Indicates if a resource has been changed in the offline version when compared to the online version.
|
static CmsResourceState |
STATE_DELETED
Indicates if a resource has been deleted in the offline version when compared to the online version.
|
static CmsResourceState |
STATE_KEEP
Special state value that indicates the current state must be kept on a resource,
this value must never be written to the database.
|
static CmsResourceState |
STATE_NEW
Indicates if a resource is new in the offline version when compared to the online version.
|
static CmsResourceState |
STATE_UNCHANGED
Indicates if a resource is unchanged in the offline version when compared to the online version.
|
static java.lang.String |
TEMP_FILE_PREFIX
Prefix for temporary files in the VFS.
|
| 构造器和说明 |
|---|
CmsResource() |
| 限定符和类型 | 方法和说明 |
|---|---|
static java.lang.String |
getFolderPath(java.lang.String resource)
Returns the folder path of the resource with the given name.
|
static java.lang.String |
getName(java.lang.String resource)
Returns the name of a resource without the path information.
|
static java.lang.String |
getParentFolder(java.lang.String resource)
Returns the absolute parent folder name of a resource.
|
static int |
getPathLevel(java.lang.String resource)
Returns the directory level of a resource.
|
static java.lang.String |
getPathPart(java.lang.String resource,
int level)
Returns the name of a parent folder of the given resource,
that is either minus levels up
from the current folder, or that is plus levels down from the
root folder.
|
static boolean |
isFolder(java.lang.String resource)
Returns true if the resource name certainly denotes a folder, that is ends with a "/".
|
static boolean |
isTemporaryFileName(java.lang.String path)
Returns
true if the given resource path points to a temporary file name. |
public static final CmsResourceState STATE_CHANGED
public static final CmsResourceState STATE_DELETED
public static final CmsResourceState STATE_KEEP
public static final CmsResourceState STATE_NEW
public static final CmsResourceState STATE_UNCHANGED
public static final java.lang.String TEMP_FILE_PREFIX
public static java.lang.String getFolderPath(java.lang.String resource)
If the resource name denotes a folder (that is ends with a "/"), the complete path of the folder is returned (not the parent folder path).
This is achieved by just cutting of everything behind the last occurrence of a "/" character
in the String, no check if performed if the resource exists or not in the VFS,
only resources that end with a "/" are considered to be folders.
Example: Returns /system/def/ for the
resource /system/def/file.html and
/system/def/ for the (folder) resource /system/def/.
resource - the name of a resourcepublic static java.lang.String getName(java.lang.String resource)
The resource name of a file is the name of the file.
The resource name of a folder is the folder name with trailing "/".
The resource name of the root folder is /.
Example: /system/workplace/ has the resource name workplace/.
resource - the resource to get the name forpublic static java.lang.String getParentFolder(java.lang.String resource)
The parent resource of a file is the folder of the file.
The parent resource of a folder is the parent folder.
The parent resource of the root folder is null.
Example: /system/workplace/ has the parent /system/.
resource - the resource to find the parent folder fornull for the root folderpublic static int getPathLevel(java.lang.String resource)
The root folder "/" has level 0, a folder "/foo/" would have level 1, a folfer "/foo/bar/" level 2 etc.
resource - the resource to determine the directory level forpublic static java.lang.String getPathPart(java.lang.String resource,
int level)
resource - the name of a resourcelevel - of levels to walk up or downpublic static boolean isFolder(java.lang.String resource)
resource - the resource to checkpublic static boolean isTemporaryFileName(java.lang.String path)
true if the given resource path points to a temporary file name.
A resource name is considered a temporary file name if the name of the file
(without parent folders) starts with the prefix char '~' (tilde).
Existing parent folder elements are removed from the path before the file name is checked.
path - the resource path to checktrue if the given resource name is a temporary file name