|
|||||||||
| Home >> All >> com >> opencms >> [ file overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
com.opencms.file
Class CmsResource

java.lang.Objectcom.opencms.file.CmsResource
- All Implemented Interfaces:
- java.lang.Cloneable, com.opencms.core.I_CmsConstants, java.io.Serializable
- Direct Known Subclasses:
- CmsBackupResource, CmsFile, CmsFolder
- public class CmsResource
- extends java.lang.Object
- implements com.opencms.core.I_CmsConstants, java.lang.Cloneable, java.io.Serializable
- extends java.lang.Object
Describes a resource in the Cms. This resource can be a A_CmsFile or a A_CmsFolder.
- Version:
- $Revision: 1.44 $ $Date: 2003/04/01 15:20:18 $
| Field Summary | |
private int |
m_accessFlags
The access flags of this resource. |
private long |
m_dateCreated
The creation date of this resource. |
private long |
m_dateLastModified
The date of the last modification of this resource. |
private int |
m_fileId
The database Parent ID |
private int |
m_group
The group of this resource. |
private boolean |
m_isTouched
Boolean flag whether the timestamp of this resource was modified by a touch command. |
private java.lang.String |
m_launcherClassname
The Java class thas is invoked by the launcher to process this resource. |
private int |
m_launcherType
The type of the launcher which is used to process this resource. |
private int |
m_lockedBy
The user id of the usrer who locked this resource. |
private int |
m_lockedInProject
The projectId of the project where the resource was locked or modified in |
private int |
m_parentId
The database Parent ID |
private int |
m_projectId
The project id this recouce belongs to. |
private int |
m_resourceFlags
The flags of this resource ( not used yet; the Accessflags are stored in m_accessFlags). |
private int |
m_resourceId
The database ID |
private int |
m_resourceLastModifiedBy
The UserId of the user who modified this resource last. |
private java.lang.String |
m_resourceName
The name of this resource. |
private int |
m_resourceType
The type of this resource. |
protected int |
m_size
The size of the file content. |
private int |
m_state
The state of this resource. |
private int |
m_user
The owner of this resource. |
| Constructor Summary | |
CmsResource(int resourceId,
int parentId,
int fileId,
java.lang.String resourceName,
int resourceType,
int resourceFlags,
int user,
int group,
int projectId,
int accessFlags,
int state,
int lockedBy,
int launcherType,
java.lang.String launcherClassname,
long dateCreated,
long dateLastModified,
int resourceLastModifiedBy,
int size,
int lockedInProject)
Constructor, creates a new CmsRecource object. |
|
| Method Summary | |
java.lang.Object |
clone()
Clones the CmsResource by creating a new CmsObject. |
boolean |
equals(java.lang.Object obj)
Compares the overgiven object with this object. |
java.lang.String |
getAbsolutePath()
Returns the absolute path of this resource, e.g. |
static java.lang.String |
getAbsolutePath(java.lang.String resourceName)
Returns the absolute path of the provided resource, e.g. |
int |
getAccessFlags()
Returns the accessflags of this resource. |
long |
getDateCreated()
Returns the date of the creation for this resource. |
long |
getDateLastModified()
Returns the date of the last modification for this resource. |
int |
getFileId()
Gets the File id for this resource. |
int |
getFlags()
Returns the flags of this resource ( not used yet; the Accessflags are served in getAccessFlags). |
java.lang.String |
getFlagString()
Creates a Unix-Style string of access rights from the access right flag of a CmsResource |
int |
getGroupId()
Returns the groupid of this resource. |
java.lang.String |
getLauncherClassname()
Gets the launcher classname for this resource. |
int |
getLauncherType()
Gets the launcher type id for this resource. |
int |
getLength()
Gets the length of the content (filesize). |
int |
getLockedInProject()
Gets the project id of the project that has locked this resource. |
java.lang.String |
getName()
Returns the name of this resource. Example: retuns language.cms for the resource /system/def/language.cms |
int |
getOwnerId()
Returns the userid of the resource owner. |
java.lang.String |
getParent()
Returns the absolute parent folder name of this resource. |
static java.lang.String |
getParent(java.lang.String resource)
Returns the absolute parent folder name of a resource. |
int |
getParentId()
Gets the Parent database id for this resource. |
java.lang.String |
getPath()
Returns the folder path of this resource, if the resource is a folder, the complete path of the folder is returned (not the parent folder path). |
static java.lang.String |
getPath(java.lang.String resource)
Returns the folder path of the resource with the given name, if the resource is a folder (i.e. |
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. |
int |
getProjectId()
Returns the project id for this resource. |
int |
getResourceId()
Gets the database id for this resource. |
int |
getResourceLastModifiedBy()
Gets the userId from the user who made the last change. |
java.lang.String |
getResourceName()
Returns the resource name of this resource, e.g. |
java.lang.String |
getRootName()
Returns the root name of this resource, e.g. |
int |
getState()
Returns the state of this resource. This may be C_STATE_UNCHANGED, C_STATE_CHANGED, C_STATE_NEW or C_STATE_DELETED. |
int |
getType()
Gets the type id for this resource. |
boolean |
inProject(CmsProject project)
Checks if a resource belongs to a project. |
boolean |
isFile()
Determines, if this resource is a file. |
boolean |
isFolder()
Determines, if this resource is a folder. |
boolean |
isLocked()
Determines, if this resource is locked by a user. |
int |
isLockedBy()
Returns the user idthat locked this resource. |
boolean |
isTouched()
Returns the isTouched. |
void |
setAccessFlags(int flags)
Sets the accessflags of this resource. |
void |
setDateLastModified(long time)
Sets the date of the last modification for this resource. |
void |
setFileId(int fileId)
Sets the File id for this resource. |
(package private) void |
setFlags(int flags)
Sets the flags of this resource. |
void |
setGroupId(int group)
Sets the groupId of this resource. |
(package private) void |
setLauncherClassname(java.lang.String name)
Sets launcher classname for this resource. |
void |
setLauncherType(int type)
Sets launcher the type id for this resource. |
void |
setLocked(int id)
Sets the the user id that locked this resource. |
void |
setLockedInProject(int project)
Sets the projectId in which this resource is locked. |
void |
setParentId(int parentId)
Sets the parent database id for this resource. |
void |
setProjectId(int project)
Sets the projectId of this resource. |
(package private) void |
setResourceLastModifiedBy(int resourceLastModifiedBy)
Sets the user id from the user who changes the resource. |
void |
setState(int state)
Sets the state of this resource. |
void |
setType(int type)
Sets the type id for this resource. |
void |
setUserId(int user)
Sets the userId of this resource. |
java.lang.String |
toString()
Returns a string-representation for this object. |
| Methods inherited from class java.lang.Object |
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
m_resourceId
private int m_resourceId
- The database ID
m_parentId
private int m_parentId
- The database Parent ID
m_fileId
private int m_fileId
- The database Parent ID
m_resourceName
private java.lang.String m_resourceName
- The name of this resource.
m_resourceType
private int m_resourceType
- The type of this resource.
m_resourceFlags
private int m_resourceFlags
- The flags of this resource ( not used yet; the Accessflags are stored in m_accessFlags).
m_projectId
private int m_projectId
- The project id this recouce belongs to.
m_user
private int m_user
- The owner of this resource.
m_group
private int m_group
- The group of this resource.
m_accessFlags
private int m_accessFlags
- The access flags of this resource.
m_dateCreated
private long m_dateCreated
- The creation date of this resource.
m_dateLastModified
private long m_dateLastModified
- The date of the last modification of this resource.
m_isTouched
private boolean m_isTouched
- Boolean flag whether the timestamp of this resource was modified by a touch command.
m_size
protected int m_size
- The size of the file content.
m_state
private int m_state
- The state of this resource.
A resource can have the following states:- unchanged
- changed
- new
- deleted
m_lockedBy
private int m_lockedBy
- The user id of the usrer who locked this resource.
m_launcherType
private int m_launcherType
- The type of the launcher which is used to process this resource.
m_launcherClassname
private java.lang.String m_launcherClassname
- The Java class thas is invoked by the launcher to process this resource.
m_resourceLastModifiedBy
private int m_resourceLastModifiedBy
- The UserId of the user who modified this resource last.
m_lockedInProject
private int m_lockedInProject
- The projectId of the project where the resource was locked or modified in
| Constructor Detail |
CmsResource
public CmsResource(int resourceId,
int parentId,
int fileId,
java.lang.String resourceName,
int resourceType,
int resourceFlags,
int user,
int group,
int projectId,
int accessFlags,
int state,
int lockedBy,
int launcherType,
java.lang.String launcherClassname,
long dateCreated,
long dateLastModified,
int resourceLastModifiedBy,
int size,
int lockedInProject)
- Constructor, creates a new CmsRecource object.
| Method Detail |
clone
public java.lang.Object clone()
- Clones the CmsResource by creating a new CmsObject.
equals
public boolean equals(java.lang.Object obj)
- Compares the overgiven object with this object.
getAbsolutePath
public java.lang.String getAbsolutePath()
- Returns the absolute path of this resource,
e.g.
/system/workplace/action/index.html
getAbsolutePath
public static java.lang.String getAbsolutePath(java.lang.String resourceName)
- Returns the absolute path of the provided resource,
e.g.
/system/workplace/action/index.html
getRootName
public java.lang.String getRootName()
- Returns the root name of this resource,
e.g.
/default/vfs
getResourceName
public java.lang.String getResourceName()
- Returns the resource name of this resource,
e.g.
/default/vfs/system/workplace/action/index.html
getAccessFlags
public int getAccessFlags()
- Returns the accessflags of this resource.
getDateCreated
public long getDateCreated()
- Returns the date of the creation for this resource.
getDateLastModified
public long getDateLastModified()
- Returns the date of the last modification for this resource.
setDateLastModified
public void setDateLastModified(long time)
- Sets the date of the last modification for this resource.
getFileId
public int getFileId()
- Gets the File id for this resource.
getFlags
public int getFlags()
- Returns the flags of this resource ( not used yet; the Accessflags are served in getAccessFlags).
getFlagString
public java.lang.String getFlagString()
- Creates a Unix-Style string of access rights from the access right flag of a
CmsResource
getGroupId
public int getGroupId()
- Returns the groupid of this resource.
getLauncherClassname
public java.lang.String getLauncherClassname()
- Gets the launcher classname for this resource.
getLauncherType
public int getLauncherType()
- Gets the launcher type id for this resource.
getLength
public int getLength()
- Gets the length of the content (filesize).
getName
public java.lang.String getName()
- Returns the name of this resource.
Example: retuns language.cms for the resource /system/def/language.cms
getOwnerId
public int getOwnerId()
- Returns the userid of the resource owner.
getParent
public java.lang.String getParent()
- Returns the absolute parent folder name of this 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/.
getParent
public static java.lang.String getParent(java.lang.String resource)
- Returns the absolute parent folder name of a 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/.
getPath
public java.lang.String getPath()
- Returns the folder path of this resource,
if the resource is a folder, the complete path of the folder is returned
(not the parent folder path).
Example: Returns
/system/def/for the resource/system/def/file.htmland/system/def/for the (folder) resource/system/def/. Does not append the repository information to the result, i.e./system/def/will be returned, not/default/vfs/system/def/.
getPath
public static java.lang.String getPath(java.lang.String resource)
- Returns the folder path of the resource with the given name,
if the resource is a folder (i.e. ends with a "/"), the complete path of the folder
is returned (not the parent folder path).
This is achived by just cutting of everthing behind the last occurence 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.htmland/system/def/for the (folder) resource/system/def/..
getPathPart
public 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.
getPathLevel
public static int getPathLevel(java.lang.String resource)
- Returns the directory level of a resource.
The root folder "/" has level 0, a folder "/foo/" would have level 1, a folfer "/foo/bar/" level 2 etc.
getParentId
public int getParentId()
- Gets the Parent database id for this resource.
getProjectId
public int getProjectId()
- Returns the project id for this resource.
getResourceId
public int getResourceId()
- Gets the database id for this resource.
getResourceLastModifiedBy
public int getResourceLastModifiedBy()
- Gets the userId from the user who made the last change.
getState
public int getState()
- Returns the state of this resource.
This may be C_STATE_UNCHANGED, C_STATE_CHANGED, C_STATE_NEW or C_STATE_DELETED.
getType
public int getType()
- Gets the type id for this resource.
getLockedInProject
public int getLockedInProject()
- Gets the project id of the project that has locked this resource.
inProject
public boolean inProject(CmsProject project)
- Checks if a resource belongs to a project.
isFile
public boolean isFile()
- Determines, if this resource is a file.
isFolder
public boolean isFolder()
- Determines, if this resource is a folder.
isLocked
public boolean isLocked()
- Determines, if this resource is locked by a user.
isLockedBy
public int isLockedBy()
- Returns the user idthat locked this resource.
setAccessFlags
public void setAccessFlags(int flags)
- Sets the accessflags of this resource.
setFileId
public void setFileId(int fileId)
- Sets the File id for this resource.
setFlags
void setFlags(int flags)
- Sets the flags of this resource.
setGroupId
public void setGroupId(int group)
- Sets the groupId of this resource.
setLauncherClassname
void setLauncherClassname(java.lang.String name)
- Sets launcher classname for this resource.
setLauncherType
public void setLauncherType(int type)
- Sets launcher the type id for this resource.
setLocked
public void setLocked(int id)
- Sets the the user id that locked this resource.
setParentId
public void setParentId(int parentId)
- Sets the parent database id for this resource.
setResourceLastModifiedBy
void setResourceLastModifiedBy(int resourceLastModifiedBy)
- Sets the user id from the user who changes the resource.
setState
public void setState(int state)
- Sets the state of this resource.
setType
public void setType(int type)
- Sets the type id for this resource.
setUserId
public void setUserId(int user)
- Sets the userId of this resource.
setProjectId
public void setProjectId(int project)
- Sets the projectId of this resource.
setLockedInProject
public void setLockedInProject(int project)
- Sets the projectId in which this resource is locked.
toString
public java.lang.String toString()
- Returns a string-representation for this object.
This can be used for debugging.
isTouched
public boolean isTouched()
- Returns the isTouched.
|
|||||||||
| Home >> All >> com >> opencms >> [ file overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC
com.opencms.file.CmsResource