|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.opencms.file.CmsObject
This pivotal class provides all authorized access to the OpenCms VFS resources.
It encapsulates user identification and permissions.
Think of it as an initialized "shell" to access the OpenCms VFS.
Every call to a method here will be checked for user permissions
according to the
this CmsObject instance was created with.CmsRequestContext
From a JSP page running in OpenCms, use
to gain
access to the current users CmsObject. Usually this is done with a CmsJspBean.getCmsObject()
.CmsJspActionElement
To generate a new instance of this class in your application, use
. The argument String should be
the name of the guest user, usually "Guest" and more formally obtained by OpenCms.initCmsObject(String)
.
This will give you an initialized context with guest user permissions.
Then use CmsDefaultUsers.getUserGuest()
to log in the user you want.
Obviously you need the password for the new user.
You should never try to create an instance of this class using the constructor,
this is reserved for internal operation only.loginUser(String, String)
Field Summary | |
protected CmsRequestContext |
m_context
The request context. |
protected CmsSecurityManager |
m_securityManager
The security manager to access the cms. |
Constructor Summary | |
CmsObject(CmsSecurityManager securityManager,
CmsRequestContext context)
Connects an OpenCms user context to a running database. |
Method Summary | |
void |
addUserToGroup(java.lang.String username,
java.lang.String groupname)
Adds a user to a group. |
CmsUser |
addWebUser(java.lang.String name,
java.lang.String password,
java.lang.String group,
java.lang.String description,
java.util.Map additionalInfos)
Creates a new web user. |
void |
backupProject(int versionId,
long publishDate)
Creates a backup of the current project. |
void |
chacc(java.lang.String resourceName,
java.lang.String principalType,
java.lang.String principalName,
int allowedPermissions,
int deniedPermissions,
int flags)
Changes the access control for a given resource and a given principal(user/group). |
void |
chacc(java.lang.String resourceName,
java.lang.String principalType,
java.lang.String principalName,
java.lang.String permissionString)
Changes the access control for a given resource and a given principal(user/group). |
void |
changeLastModifiedProjectId(java.lang.String resourcename)
Changes the project id of the resource to the current project, indicating that the resource was last modified in this project. |
void |
changeLock(java.lang.String resourcename)
Changes the lock of a resource to the current user, that is "steals" the lock from another user. |
java.util.List |
changeResourcesInFolderWithProperty(java.lang.String resourcename,
java.lang.String property,
java.lang.String oldValue,
java.lang.String newValue,
boolean recursive)
Returns a list with all sub resources of a given folder that have set the given property, matching the current property's value with the given old value and replacing it by a given new value. |
void |
changeUserType(CmsUUID userId,
int userType)
Changes the type of a user given its id. |
void |
changeUserType(java.lang.String username,
int userType)
Changes the type of a user given its name. |
void |
checkPublishPermissions(CmsPublishList publishList)
Checks if the given base publish list can be published by the current user. |
void |
checkRole(CmsRole roles)
Checks if the user of this OpenCms context is a member of at last one of the roles in the given role set. |
void |
chflags(java.lang.String resourcename,
int flags)
Changes the resource flags of a resource. |
void |
chtype(java.lang.String resourcename,
int type)
Changes the resource type of a resource. |
void |
copyResource(java.lang.String source,
java.lang.String destination)
Copies a resource. |
void |
copyResource(java.lang.String source,
java.lang.String destination,
int siblingMode)
Copies a resource. |
void |
copyResourceToProject(java.lang.String resourcename)
Copies a resource to the current project of the user. |
int |
countLockedResources(int id)
Counts the locked resources in a project. |
int |
countLockedResources(java.lang.String foldername)
Counts the locked resources within a folder. |
void |
cpacc(java.lang.String sourceName,
java.lang.String destName)
Copies access control entries of a given resource to another resource. |
CmsGroup |
createGroup(java.lang.String name,
java.lang.String description,
int flags,
java.lang.String parent)
Creates a new user group. |
CmsProject |
createProject(java.lang.String name,
java.lang.String description,
java.lang.String groupname,
java.lang.String managergroupname)
Creates a new project. |
CmsProject |
createProject(java.lang.String name,
java.lang.String description,
java.lang.String groupname,
java.lang.String managergroupname,
int projecttype)
Creates a new project. |
CmsPropertyDefinition |
createPropertyDefinition(java.lang.String name)
Creates a property definition. |
CmsResource |
createResource(java.lang.String resourcename,
int type)
Creates a new resource of the given resource type with empty content and no properties. |
CmsResource |
createResource(java.lang.String resourcename,
int type,
byte[] content,
java.util.List properties)
Creates a new resource of the given resource type with the provided content and properties. |
void |
createSibling(java.lang.String source,
java.lang.String destination,
java.util.List properties)
Creates a new sibling of the source resource. |
CmsProject |
createTempfileProject()
Creates the project for the temporary workplace files. |
CmsUser |
createUser(java.lang.String name,
java.lang.String password,
java.lang.String description,
java.util.Map additionalInfos)
Creates a new user. |
void |
deleteAllStaticExportPublishedResources(int linkType)
Deletes all published resource entries. |
void |
deleteBackups(long timestamp,
int versions,
I_CmsReport report)
Deletes the versions from the backup tables that are older then the given timestamp and/or number of remaining versions. |
void |
deleteGroup(CmsUUID groupId,
CmsUUID replacementId)
Deletes a group, where all permissions, users and childs of the group are transfered to a replacement group. |
void |
deleteGroup(java.lang.String delgroup)
Deletes a user group. |
void |
deleteProject(int id)
Deletes a project. |
void |
deleteProperty(java.lang.String resourcename,
java.lang.String key)
Deprecated. use instead. |
void |
deletePropertyDefinition(java.lang.String name)
Deletes a property definition. |
void |
deleteResource(java.lang.String resourcename,
int siblingMode)
Deletes a resource given its name. |
void |
deleteStaticExportPublishedResource(java.lang.String resourceName,
int linkType,
java.lang.String linkParameter)
Deletes a published resource entry. |
void |
deleteUser(CmsUUID userId)
Deletes a user. |
void |
deleteUser(CmsUUID userId,
CmsUUID replacementId)
Deletes a user, where all permissions and resources attributes of the user were transfered to a replacement user. |
void |
deleteUser(java.lang.String username)
Deletes a user. |
void |
deleteWebUser(CmsUUID userId)
Deletes a web user. |
boolean |
existsResource(java.lang.String resourcename)
Checks the availability of a resource in the VFS, using the filter. |
boolean |
existsResource(java.lang.String resourcename,
CmsResourceFilter filter)
Checks the availability of a resource in the VFS, using the filter. |
java.util.List |
getAccessControlEntries(java.lang.String resourceName)
Returns the list of access control entries of a resource given its name. |
java.util.List |
getAccessControlEntries(java.lang.String resourceName,
boolean getInherited)
Returns the list of access control entries of a resource given its name. |
CmsAccessControlList |
getAccessControlList(java.lang.String resourceName)
Returns the access control list (summarized access control entries) of a given resource. |
CmsAccessControlList |
getAccessControlList(java.lang.String resourceName,
boolean inheritedOnly)
Returns the access control list (summarized access control entries) of a given resource. |
java.util.List |
getAllAccessibleProjects()
Returns all projects which are owned by the current user or which are accessible for the group of the user. |
java.util.List |
getAllBackupProjects()
Returns a list with all projects from history. |
java.util.List |
getAllManageableProjects()
Returns all projects which are owned by the current user or which are manageable for the group of the user. |
int |
getBackupTagId()
Returns the next version id for the published backup resources. |
java.util.List |
getChild(java.lang.String groupname)
Returns all child groups of a group. |
java.util.List |
getChilds(java.lang.String groupname)
Returns all child groups of a group. |
java.util.Map |
getConfigurations()
Returns the configuration read fromr the opencms.properties file. |
java.util.List |
getDirectGroupsOfUser(java.lang.String username)
Returns all groups to which a given user directly belongs. |
java.util.List |
getFilesInFolder(java.lang.String resourcename)
Returns all file resources contained in a folder. |
java.util.List |
getFilesInFolder(java.lang.String resourcename,
CmsResourceFilter filter)
Returns all file resources contained in a folder. |
java.util.List |
getGroups()
Returns all groups. |
java.util.List |
getGroupsOfUser(java.lang.String username)
Returns all the groups the given user, directly or indirectly, belongs to. |
java.util.List |
getGroupsOfUser(java.lang.String username,
java.lang.String remoteAddress)
Returns the groups of a user filtered by the specified IP address. |
CmsLock |
getLock(CmsResource resource)
Returns the lock state for a specified resource. |
CmsLock |
getLock(java.lang.String resourcename)
Returns the lock state for a specified resource name. |
java.lang.String |
getLostAndFoundName(java.lang.String resourcename)
Returns the name a resource would have if it were moved to the "lost and found" folder. |
CmsGroup |
getParent(java.lang.String groupname)
Returns the parent group of a group. |
CmsPermissionSet |
getPermissions(java.lang.String resourceName)
Returns the set of permissions of the current user for a given resource. |
CmsPermissionSet |
getPermissions(java.lang.String resourceName,
java.lang.String userName)
Returns the set of permissions of a given user for a given resource. |
CmsPublishList |
getPublishList()
Returns a publish list with all new/changed/deleted resources of the current (offline) project that actually get published. |
CmsPublishList |
getPublishList(CmsResource directPublishResource,
boolean directPublishSiblings)
Returns a publish list with all new/changed/deleted resources of the current (offline) project that actually get published for a direct publish of a single resource. |
CmsPublishList |
getPublishList(java.util.List directPublishResources,
boolean directPublishSiblings)
Returns a publish list with all new/changed/deleted resources of the current (offline) project that actually get published for a direct publish of a List of resources. |
CmsPublishList |
getPublishList(java.util.List directPublishResources,
boolean directPublishSiblings,
boolean publishSubResources)
Returns a publish list with all new/changed/deleted resources of the current (offline) project that actually get published for a direct publish of a List of resources. |
CmsRequestContext |
getRequestContext()
Returns the current users request context. |
java.util.List |
getResourcesForPrincipal(CmsUUID principalId,
CmsPermissionSet permissions,
boolean includeAttr)
Returns all resources associated to a given principal via an ACE with the given permissions. |
java.util.List |
getResourcesInFolder(java.lang.String resourcename,
CmsResourceFilter filter)
Returns all child resources of a resource, that is the resources contained in a folder. |
java.util.List |
getResourcesInTimeRange(java.lang.String folder,
long starttime,
long endtime)
Deprecated. use readResources(String, CmsResourceFilter) and create a filter
based on CmsResourceFilter.IGNORE_EXPIRATION
using CmsResourceFilter.addRequireLastModifiedAfter(long) and
CmsResourceFilter.addRequireLastModifiedBefore(long) instead |
java.lang.String |
getSitePath(CmsResource resource)
Adjusts the absolute resource root path for the current site. |
java.util.List |
getSubFolders(java.lang.String resourcename)
Returns all folder resources contained in a folder. |
java.util.List |
getSubFolders(java.lang.String resourcename,
CmsResourceFilter filter)
Returns all folder resources contained in a folder. |
CmsTaskService |
getTaskService()
Returns the current session info manager object. |
java.util.List |
getUsers()
Returns all users. |
java.util.List |
getUsers(int type)
Returns all users of the given type. |
java.util.List |
getUsersOfGroup(java.lang.String groupname)
Returns all direct users of a given group. |
boolean |
hasPermissions(CmsResource resource,
CmsPermissionSet requiredPermissions)
Checks if the current user has required permissions to access a given resource. |
boolean |
hasPermissions(CmsResource resource,
CmsPermissionSet requiredPermissions,
boolean checkLock,
CmsResourceFilter filter)
Checks if the current user has required permissions to access a given resource. |
boolean |
hasPublishPermissions(java.lang.String resourcename)
Checks if the given resource or the current project can be published by the current user using his current OpenCms context. |
boolean |
hasRole(CmsRole roles)
Checks if the user of the current OpenCms context is a member of at last one of the roles in the given role set. |
void |
importAccessControlEntries(CmsResource resource,
java.util.List acEntries)
Writes a list of access control entries as new access control entries of a given resource. |
CmsResource |
importResource(java.lang.String resourcename,
CmsResource resource,
byte[] content,
java.util.List properties)
Imports a resource to the OpenCms VFS. |
CmsUser |
importUser(java.lang.String id,
java.lang.String name,
java.lang.String password,
java.lang.String description,
java.lang.String firstname,
java.lang.String lastname,
java.lang.String email,
java.lang.String address,
int flags,
int type,
java.util.Map additionalInfos)
Creates a new user by import. |
boolean |
isAdmin()
Deprecated. use or instead |
boolean |
isInsideCurrentProject(java.lang.String resourcename)
Checks if the specified resource is inside the current project. |
boolean |
isManagerOfProject()
Checks if the current user has management access to the current project. |
void |
lockResource(java.lang.String resourcename)
Locks a resource. |
void |
lockResource(java.lang.String resourcename,
int mode)
Locks a resource. |
java.lang.String |
loginUser(java.lang.String username,
java.lang.String password)
Logs a user into the Cms, if the password is correct. |
java.lang.String |
loginUser(java.lang.String username,
java.lang.String password,
java.lang.String remoteAddress)
Logs a user with a given ip address into the Cms, if the password is correct. |
java.lang.String |
loginUser(java.lang.String username,
java.lang.String password,
java.lang.String remoteAddress,
int type)
Logs a user with a given type and a given ip address into the Cms, if the password is correct. |
java.lang.String |
loginWebUser(java.lang.String username,
java.lang.String password)
Logs a web user into the Cms, if the password is correct. |
I_CmsPrincipal |
lookupPrincipal(CmsUUID principalId)
Lookups and reads the user or group with the given UUID. |
I_CmsPrincipal |
lookupPrincipal(java.lang.String principalName)
Lookups and reads the user or group with the given name. |
void |
moveResource(java.lang.String source,
java.lang.String destination)
Moves a resource to the given destination. |
java.lang.String |
moveToLostAndFound(java.lang.String resourcename)
Moves a resource to the "lost and found" folder. |
CmsUUID |
publishProject()
Publishes the current project, printing messages to a shell report. |
CmsUUID |
publishProject(I_CmsReport report)
Publishes the current project. |
CmsUUID |
publishProject(I_CmsReport report,
CmsPublishList publishList)
Publishes the resources of a specified publish list. |
CmsUUID |
publishProject(I_CmsReport report,
CmsResource directPublishResource,
boolean directPublishSiblings)
Direct publishes a specified resource. |
CmsUUID |
publishResource(java.lang.String resourcename)
Publishes a single resource, printing messages to a shell report. |
CmsUUID |
publishResource(java.lang.String resourcename,
boolean publishSiblings,
I_CmsReport report)
Publishes a single resource. |
java.util.List |
readAllBackupFileHeaders(java.lang.String filename)
Reads all file headers of a file. |
java.util.List |
readAllPropertyDefinitions()
Reads all property definitions. |
CmsFolder |
readAncestor(java.lang.String resourcename,
CmsResourceFilter filter)
Returns the first ancestor folder matching the filter criteria. |
CmsFolder |
readAncestor(java.lang.String resourcename,
int type)
Returns the first ancestor folder matching the resource type. |
CmsBackupResource |
readBackupFile(java.lang.String filename,
int tagId)
Returns a file from the history. |
CmsBackupProject |
readBackupProject(int tagId)
Returns a backup project. |
java.util.List |
readBackupPropertyObjects(CmsBackupResource resource)
Reads the list of objects that belong the the given backup resource. |
CmsFile |
readFile(java.lang.String resourcename)
Reads a file resource (including it's binary content) from the VFS, using the filter. |
CmsFile |
readFile(java.lang.String resourcename,
CmsResourceFilter filter)
Reads a file resource (including it's binary content) from the VFS, using the specified resource filter. |
CmsResource |
readFileHeader(java.lang.String resourcename)
Deprecated. use instead. |
CmsFolder |
readFolder(java.lang.String resourcename)
Reads a folder resource from the VFS, using the filter. |
CmsFolder |
readFolder(java.lang.String resourcename,
CmsResourceFilter filter)
Reads a folder resource from the VFS, using the specified resource filter. |
CmsGroup |
readGroup(CmsProject project)
Reads the group of a project. |
CmsGroup |
readGroup(CmsUUID groupId)
Reads a group based on its id. |
CmsGroup |
readGroup(java.lang.String groupName)
Reads a group based on its name. |
CmsGroup |
readManagerGroup(CmsProject project)
Returns the project manager group of a project. |
CmsUser |
readOwner(CmsProject project)
Reads the owner of a project. |
java.util.List |
readPath(java.lang.String path,
CmsResourceFilter filter)
Builds a list of resources for a given path. |
CmsProject |
readProject(int id)
Reads the project with the given id. |
CmsProject |
readProject(java.lang.String name)
Reads the project with the given name. |
java.util.List |
readProjectResources(CmsProject project)
Returns the list of all resource names that define the "view" of the given project. |
java.util.List |
readProjectView(int projectId,
int state)
Reads all resources of a project that match a given state from the VFS. |
java.util.Map |
readProperties(java.lang.String resourcePath)
Deprecated. use instead. |
java.util.Map |
readProperties(java.lang.String resourcePath,
boolean search)
Deprecated. use instead. |
java.lang.String |
readProperty(java.lang.String resourcePath,
java.lang.String property)
Deprecated. use instead. |
java.lang.String |
readProperty(java.lang.String resourcePath,
java.lang.String property,
boolean search)
Deprecated. use instead. |
java.lang.String |
readProperty(java.lang.String resourcePath,
java.lang.String property,
boolean search,
java.lang.String propertyDefault)
Deprecated. use instead. |
CmsPropertyDefinition |
readPropertyDefinition(java.lang.String name)
Reads a property definition. |
CmsProperty |
readPropertyObject(CmsResource resource,
java.lang.String property,
boolean search)
Reads a property object from a resource specified by a property name. |
CmsProperty |
readPropertyObject(java.lang.String resourcePath,
java.lang.String property,
boolean search)
Reads a property object from a resource specified by a property name. |
java.util.List |
readPropertyObjects(CmsResource resource,
boolean search)
Reads all property objects from a resource. |
java.util.List |
readPropertyObjects(java.lang.String resourcePath,
boolean search)
Reads all property objects from a resource. |
java.util.List |
readPublishedResources(CmsUUID publishHistoryId)
Reads the resources that were published in a publish task for a given publish history ID. |
CmsResource |
readResource(java.lang.String resourcename)
Reads a resource from the VFS, using the filter. |
CmsResource |
readResource(java.lang.String resourcename,
CmsResourceFilter filter)
Reads a resource from the VFS, using the specified resource filter. |
java.util.List |
readResources(java.lang.String resourcename,
CmsResourceFilter filter)
Reads all resources below the given path matching the filter criteria, including the full tree below the path. |
java.util.List |
readResources(java.lang.String resourcename,
CmsResourceFilter filter,
boolean readTree)
Reads all resources below the given path matching the filter criteria, including the full tree below the path only in case the readTree
parameter is true . |
java.util.List |
readResourcesWithProperty(java.lang.String propertyDefinition)
Reads all resources that have a value set for the specified property. |
java.util.List |
readResourcesWithProperty(java.lang.String path,
java.lang.String propertyDefinition)
Reads all resources that have a value set for the specified property in the given path. |
java.util.List |
readResourcesWithProperty(java.lang.String path,
java.lang.String propertyDefinition,
java.lang.String value)
Reads all resources that have a value (containing the specified value) set for the specified property in the given path. |
java.util.Set |
readResponsiblePrincipals(CmsResource resource)
Returns a set of principals that are responsible for a specific resource. |
java.util.Set |
readResponsibleUsers(CmsResource resource)
Returns a set of users that are responsible for a specific resource. |
java.util.List |
readSiblings(java.lang.String resourcename,
CmsResourceFilter filter)
Returns a list of all siblings of the specified resource, the specified resource being always part of the result set. |
java.lang.String |
readStaticExportPublishedResourceParameters(java.lang.String rfsName)
Returns the parameters of a resource in the list of all published template resources. |
java.util.List |
readStaticExportResources(int parameterResources,
long timestamp)
Returns a list of all template resources which must be processed during a static export. |
CmsUser |
readUser(CmsUUID userId)
Reads a user based on its id. |
CmsUser |
readUser(java.lang.String username)
Reads a user based on its name. |
CmsUser |
readUser(java.lang.String username,
int type)
Returns a user given its name and type. |
CmsUser |
readUser(java.lang.String username,
java.lang.String password)
Returns a user, if the password is correct. |
CmsUser |
readWebUser(java.lang.String username)
Returns a webuser. |
CmsUser |
readWebUser(java.lang.String username,
java.lang.String password)
Returns a web user if the password for the user is correct. |
void |
removeResourceFromProject(java.lang.String resourcename)
Removes a resource from the current project of the user. |
void |
removeUserFromGroup(java.lang.String username,
java.lang.String groupname)
Removes a user from a group. |
void |
renameResource(java.lang.String source,
java.lang.String destination)
Renames a resource to the given destination name, this is identical to a move operation. |
void |
replaceResource(java.lang.String resourcename,
int type,
byte[] content,
java.util.List properties)
Replaces the content, type and properties of a resource. |
void |
restoreResourceBackup(java.lang.String resourcename,
int tagId)
Restores a file in the current project with a version from the backup archive. |
void |
rmacc(java.lang.String resourceName,
java.lang.String principalType,
java.lang.String principalName)
Removes an access control entry of a griven principal from a given resource. |
void |
setDateExpired(java.lang.String resourcename,
long dateExpired,
boolean recursive)
Changes the "expire" date of a resource. |
void |
setDateLastModified(java.lang.String resourcename,
long dateLastModified,
boolean recursive)
Changes the "last modified" timestamp of a resource. |
void |
setDateReleased(java.lang.String resourcename,
long dateReleased,
boolean recursive)
Changes the "release" date of a resource. |
void |
setParentGroup(java.lang.String groupName,
java.lang.String parentGroupName)
Sets a new parent-group for an already existing group. |
void |
setPassword(java.lang.String username,
java.lang.String newPassword)
Sets the password for a user. |
void |
setPassword(java.lang.String username,
java.lang.String oldPassword,
java.lang.String newPassword)
Sets the password for a specified user. |
void |
touch(java.lang.String resourcename,
long dateLastModified,
long dateReleased,
long dateExpired,
boolean recursive)
Deprecated. use ,
or
instead |
void |
undeleteResource(java.lang.String resourcename)
Undeletes a resource (this is the same operation as "undo changes"). |
void |
undoChanges(java.lang.String resourcename,
boolean recursive)
Undos all changes to a resource by restoring the version from the online project to the current offline project. |
void |
unlockProject(int id)
Unlocks all resources of a project. |
void |
unlockResource(java.lang.String resourcename)
Unlocks a resource. |
boolean |
userInGroup(java.lang.String username,
java.lang.String groupname)
Tests if a user is member of the given group. |
java.util.Map |
validateHtmlLinks(CmsPublishList publishList,
I_CmsReport report)
Validates the HTML links in the unpublished files of the specified publish list, if a file resource type implements the interface . |
void |
validatePassword(java.lang.String password)
This method checks if a new password follows the rules for new passwords, which are defined by a Class implementing the
interface and configured in the opencms.properties file. |
CmsFile |
writeFile(CmsFile resource)
Writes a resource to the OpenCms VFS, including it's content. |
void |
writeFileHeader(CmsFile file)
Writes a file-header. |
void |
writeGroup(CmsGroup group)
Writes an already existing group. |
void |
writeProject(CmsProject project)
Writes an already existing project. |
void |
writeProperties(java.lang.String resourceName,
java.util.Map properties)
Deprecated. use instead. |
void |
writeProperties(java.lang.String name,
java.util.Map properties,
boolean addDefinition)
Deprecated. use instead. |
void |
writeProperty(java.lang.String resourceName,
java.lang.String key,
java.lang.String value)
Deprecated. use instead. |
void |
writeProperty(java.lang.String resourcename,
java.lang.String key,
java.lang.String value,
boolean addDefinition)
Deprecated. use instead. |
void |
writePropertyObject(java.lang.String resourcename,
CmsProperty property)
Writes a property for a specified resource. |
void |
writePropertyObjects(java.lang.String resourcename,
java.util.List properties)
Writes a list of properties for a specified resource. |
void |
writeStaticExportPublishedResource(java.lang.String resourceName,
int linkType,
java.lang.String linkParameter,
long timestamp)
Writes a published resource entry. |
void |
writeUser(CmsUser user)
Updates the user information. |
void |
writeWebUser(CmsUser user)
Updates the user information of a web user. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected CmsRequestContext m_context
protected CmsSecurityManager m_securityManager
Constructor Detail |
public CmsObject(CmsSecurityManager securityManager, CmsRequestContext context)
Please note: This constructor is internal to OpenCms and not for public use.
If you want to create a new instance of a
in your application,
use CmsObject
.OpenCms.initCmsObject(String)
securityManager
- the security managercontext
- the request context that contains the user authentificationMethod Detail |
public void addUserToGroup(java.lang.String username, java.lang.String groupname) throws CmsException
username
- the name of the user that is to be added to the groupgroupname
- the name of the group
CmsException
- if something goes wrongpublic CmsUser addWebUser(java.lang.String name, java.lang.String password, java.lang.String group, java.lang.String description, java.util.Map additionalInfos) throws CmsException
A web user has no access to the workplace but is able to access personalized
functions controlled by the OpenCms.
Moreover, a web user can be created by any user, the intention being that
a "Guest" user can create a personalized account for himself.
name
- the name for the new web userpassword
- the password for the usergroup
- the default groupname for the userdescription
- the description for the useradditionalInfos
- a Map
with additional infos for the user
CmsException
- if something goes wrongpublic void backupProject(int versionId, long publishDate) throws CmsException
versionId
- the version of the backuppublishDate
- the date of publishing
CmsException
- if operation was not succesfulpublic void chacc(java.lang.String resourceName, java.lang.String principalType, java.lang.String principalName, int allowedPermissions, int deniedPermissions, int flags) throws CmsException
resourceName
- name of the resourceprincipalType
- the type of the principal (currently group or user):
principalName
- name of the principalallowedPermissions
- bitset of allowed permissionsdeniedPermissions
- bitset of denied permissionsflags
- additional flags of the access control entry
CmsException
- if something goes wrongpublic void chacc(java.lang.String resourceName, java.lang.String principalType, java.lang.String principalName, java.lang.String permissionString) throws CmsException
resourceName
- name of the resourceprincipalType
- the type of the principal (group or user):
principalName
- name of the principalpermissionString
- the permissions in the format ((+|-)(r|w|v|c|i|o))*
CmsException
- if something goes wrongpublic void changeLastModifiedProjectId(java.lang.String resourcename) throws CmsException
This information is used while publishing. Only resources inside the project folders that are new/modified/changed and that "belong" to the project (i.e. have the id of the project set) are published with the project.
resourcename
- the name of the resource to change the project id for (full path)
CmsException
- if something goes wrongpublic void changeLock(java.lang.String resourcename) throws CmsException
This is the "steal lock" operation.
resourcename
- the name of the resource to change the lock with complete path
CmsException
- if something goes wrongpublic java.util.List changeResourcesInFolderWithProperty(java.lang.String resourcename, java.lang.String property, java.lang.String oldValue, java.lang.String newValue, boolean recursive) throws CmsException
resourcename
- the name of the resource to change the property valueproperty
- the name of the property to change the valueoldValue
- the old value of the property, can be a regular expressionnewValue
- the new value of the propertyrecursive
- if true, change recursively all property values on sub-resources (only for folders)
CmsResource
's where the property value has been changed
CmsException
- if operation was not successfulpublic void changeUserType(CmsUUID userId, int userType) throws CmsException
userId
- The id of the user to changeuserType
- The new type of the user
CmsException
- if something goes wrongpublic void changeUserType(java.lang.String username, int userType) throws CmsException
username
- The name of the user to changeuserType
- The new type of the user
CmsException
- if something goes wrongpublic void checkPublishPermissions(CmsPublishList publishList) throws CmsException
publishList
- the base publish list to check
CmsException
- in case the publish permissions are not grantedpublic void checkRole(CmsRole roles) throws CmsRoleViolationException
roles
- the roles to check
CmsRoleViolationException
- if the user does not have the required role permissionspublic void chflags(java.lang.String resourcename, int flags) throws CmsException
The resource flags are used to indicate various "special" conditions for a resource. Most notably, the "internal only" setting which signals that a resource can not be directly requested with it's URL.
resourcename
- the name of the resource to change the flags for (full path)flags
- the new flags for this resource
CmsException
- if something goes wrongpublic void chtype(java.lang.String resourcename, int type) throws CmsException
OpenCms handles resources according to the resource type, not the file suffix. This is e.g. why a JSP in OpenCms can have the suffix ".html" instead of ".jsp" only. Changing the resource type makes sense e.g. if you want to make a plain text file a JSP resource, or a binary file an image, etc.
resourcename
- the name of the resource to change the type for (full path)type
- the new resource type for this resource
CmsException
- if something goes wrongpublic void copyResource(java.lang.String source, java.lang.String destination) throws CmsException, CmsIllegalArgumentException
The copied resource will always be locked to the current user after the copy operation.
Siblings will be treated according to the
mode.CmsResource.COPY_PRESERVE_SIBLING
source
- the name of the resource to copy (full path)destination
- the name of the copy destination (full path)
CmsException
- if something goes wrong
CmsIllegalArgumentException
- if the destination
argument is null or of length 0copyResource(String, String, int)
public void copyResource(java.lang.String source, java.lang.String destination, int siblingMode) throws CmsException, CmsIllegalArgumentException
The copied resource will always be locked to the current user after the copy operation.
The siblingMode
parameter controls how to handle siblings
during the copy operation.
Possible values for this parameter are:
source
- the name of the resource to copy (full path)destination
- the name of the copy destination (full path)siblingMode
- indicates how to handle siblings during copy
CmsException
- if something goes wrong
CmsIllegalArgumentException
- if the destination
argument is null or of length 0public void copyResourceToProject(java.lang.String resourcename) throws CmsException
This is used to extend the current users project with the specified resource, in case that the resource is not yet part of the project. The resource is not really copied like in a regular copy operation, it is in fact only "enabled" in the current users project.
resourcename
- the name of the resource to copy to the current project (full path)
CmsException
- if something goes wrongpublic int countLockedResources(int id) throws CmsException
id
- the id of the project
CmsException
- if operation was not successfulpublic int countLockedResources(java.lang.String foldername) throws CmsException
foldername
- the name of the folder
CmsException
- if operation was not successfulpublic void cpacc(java.lang.String sourceName, java.lang.String destName) throws CmsException
Already existing access control entries of the destination resource are removed.
sourceName
- the name of the resource of which the access control entries are copieddestName
- the name of the resource to which the access control entries are applied
CmsException
- if something goes wrongpublic CmsGroup createGroup(java.lang.String name, java.lang.String description, int flags, java.lang.String parent) throws CmsException
name
- the name of the new groupdescription
- the description of the new groupflags
- the flags for the new groupparent
- the parent group (or null
)
CmsGroup
object representing the newly created group
CmsException
- if operation was not successfulpublic CmsProject createProject(java.lang.String name, java.lang.String description, java.lang.String groupname, java.lang.String managergroupname) throws CmsException
name
- the name of the project to createdescription
- the description for the new projectgroupname
- the name of the project user groupmanagergroupname
- the name of the project manager group
CmsException
- if something goes wrongpublic CmsProject createProject(java.lang.String name, java.lang.String description, java.lang.String groupname, java.lang.String managergroupname, int projecttype) throws CmsException
name
- the name of the project to createdescription
- the description for the new projectgroupname
- the name of the project user groupmanagergroupname
- the name of the project manager groupprojecttype
- the type of the project (normal or temporary)
CmsException
- if operation was not successfulpublic CmsPropertyDefinition createPropertyDefinition(java.lang.String name) throws CmsException
Property definitions are valid for all resource types.
name
- the name of the property definition to create
CmsException
- if something goes wrongpublic CmsResource createResource(java.lang.String resourcename, int type) throws CmsException, CmsIllegalArgumentException
resourcename
- the name of the resource to create (full path)type
- the type of the resource to create
CmsException
- if something goes wrong
CmsIllegalArgumentException
- if the given resourcename
is null or of length 0createResource(String, int, byte[], List)
public CmsResource createResource(java.lang.String resourcename, int type, byte[] content, java.util.List properties) throws CmsException, CmsIllegalArgumentException
resourcename
- the name of the resource to create (full path)type
- the type of the resource to createcontent
- the contents for the new resourceproperties
- the properties for the new resource
CmsException
- if something goes wrong
CmsIllegalArgumentException
- if the resourcename
argument is null or of length 0public void createSibling(java.lang.String source, java.lang.String destination, java.util.List properties) throws CmsException
source
- the name of the resource to create a sibling for with complete pathdestination
- the name of the sibling to create with complete pathproperties
- the individual properties for the new sibling
CmsException
- if something goes wrongpublic CmsProject createTempfileProject() throws CmsException
CmsException
- if something goes wrongpublic CmsUser createUser(java.lang.String name, java.lang.String password, java.lang.String description, java.util.Map additionalInfos) throws CmsException
name
- the name for the new userpassword
- the password for the new userdescription
- the description for the new useradditionalInfos
- the additional infos for the user
CmsException
- if something goes wrongpublic void deleteAllStaticExportPublishedResources(int linkType) throws CmsException
linkType
- the type of resource deleted (0= non-paramter, 1=parameter)
CmsException
- if something goes wrongpublic void deleteBackups(long timestamp, int versions, I_CmsReport report) throws CmsException
The number of verions always wins, i.e. if the given timestamp would delete more versions than given in the versions parameter, the timestamp will be ignored.
Deletion will delete file header, content and properties.
timestamp
- timestamp which defines the date after which backup resources must be deletedversions
- the number of versions per file which should kept in the systemreport
- the report for output logging
CmsException
- if something goes wrongpublic void deleteGroup(CmsUUID groupId, CmsUUID replacementId) throws CmsException
groupId
- the id of the group to be deletedreplacementId
- the id of the group to be transfered, can be null
CmsException
- if operation was not successfulpublic void deleteGroup(java.lang.String delgroup) throws CmsException
Only groups that contain no subgroups can be deleted.
delgroup
- the name of the group
CmsException
- if operation was not successfulpublic void deleteProject(int id) throws CmsException
All resources inside the project have to be be reset to their online state.
id
- the id of the project to delete
CmsException
- if operation was not successfulpublic void deleteProperty(java.lang.String resourcename, java.lang.String key) throws CmsException
writePropertyObject(String, CmsProperty)
instead.
resourcename
- the name of a resource for which the property should be deletedkey
- the name of the property
CmsException
- if something goes wrongpublic void deletePropertyDefinition(java.lang.String name) throws CmsException
name
- the name of the property definition to delete
CmsException
- if something goes wrongpublic void deleteResource(java.lang.String resourcename, int siblingMode) throws CmsException
The siblingMode
parameter controls how to handle siblings
during the delete operation.
Possible values for this parameter are:
resourcename
- the name of the resource to delete (full path)siblingMode
- indicates how to handle siblings of the deleted resource
CmsException
- if something goes wrongpublic void deleteStaticExportPublishedResource(java.lang.String resourceName, int linkType, java.lang.String linkParameter) throws CmsException
resourceName
- The name of the resource to be deleted in the static exportlinkType
- the type of resource deleted (0= non-paramter, 1=parameter)linkParameter
- the parameters of the resource
CmsException
- if something goes wrongpublic void deleteUser(CmsUUID userId) throws CmsException
userId
- the id of the user to be deleted
CmsException
- if operation was not successfulpublic void deleteUser(CmsUUID userId, CmsUUID replacementId) throws CmsException
userId
- the id of the user to be deletedreplacementId
- the id of the user to be transfered, can be null
CmsException
- if operation was not successfulpublic void deleteUser(java.lang.String username) throws CmsException
username
- the name of the user to be deleted
CmsException
- if operation was not successfulpublic void deleteWebUser(CmsUUID userId) throws CmsException
userId
- the id of the user to be deleted
CmsException
- if operation was not successfulpublic boolean existsResource(java.lang.String resourcename)
CmsResourceFilter.DEFAULT
filter.
A resource may be of type
or
CmsFile
.CmsFolder
This method also takes into account the user permissions, so if
the given resource exists, but the current user has not the required
permissions, then this method will return false
.
resourcename
- the name of the resource to check (full path)
true
if the resource is availablereadResource(String)
,
existsResource(String, CmsResourceFilter)
public boolean existsResource(java.lang.String resourcename, CmsResourceFilter filter)
CmsResourceFilter.DEFAULT
filter.
A resource may be of type
or
CmsFile
.CmsFolder
The specified filter controls what kind of resources should be "found"
during the read operation. This will depend on the application. For example,
using
will only return currently
"valid" resources, while using CmsResourceFilter.DEFAULT
will ignore the date release / date expired information of the resource.CmsResourceFilter.IGNORE_EXPIRATION
This method also takes into account the user permissions, so if
the given resource exists, but the current user has not the required
permissions, then this method will return false
.
resourcename
- the name of the resource to check (full path)filter
- the resource filter to use while checking
true
if the resource is availablereadResource(String)
,
readResource(String, CmsResourceFilter)
public java.util.List getAccessControlEntries(java.lang.String resourceName) throws CmsException
resourceName
- the name of the resource
CmsAccessControlEntry
objects
CmsException
- if something goes wrongpublic java.util.List getAccessControlEntries(java.lang.String resourceName, boolean getInherited) throws CmsException
resourceName
- the name of the resourcegetInherited
- true
, if inherited access control entries should be returned, too
CmsAccessControlEntry
objects defining all permissions for the given resource
CmsException
- if something goes wrongpublic CmsAccessControlList getAccessControlList(java.lang.String resourceName) throws CmsException
resourceName
- the name of the resource
CmsException
- if something goes wrongpublic CmsAccessControlList getAccessControlList(java.lang.String resourceName, boolean inheritedOnly) throws CmsException
If inheritedOnly
is set, only inherited access control entries are returned.
resourceName
- the name of the resourceinheritedOnly
- if set, the non-inherited entries are skipped
CmsException
- if something goes wrongpublic java.util.List getAllAccessibleProjects() throws CmsException
CmsProject
CmsException
- if operation was not successfulpublic java.util.List getAllBackupProjects() throws CmsException
CmsBackupProject
objects
with all projects from history.
CmsException
- if operation was not succesfulpublic java.util.List getAllManageableProjects() throws CmsException
CmsProject
CmsException
- if operation was not successfulpublic int getBackupTagId()
public java.util.List getChild(java.lang.String groupname) throws CmsException
groupname
- the name of the group
CmsGroup
objects or null
CmsException
- if operation was not successfulpublic java.util.List getChilds(java.lang.String groupname) throws CmsException
This method also returns all sub-child groups of the current group.
groupname
- the name of the group
CmsGroup
objects or null
CmsException
- if operation was not successfulpublic java.util.Map getConfigurations()
opencms.properties
file.
opencms.properties
filepublic java.util.List getDirectGroupsOfUser(java.lang.String username) throws CmsException
username
- the name of the user to get all groups for
CmsGroup
objects
CmsException
- if operation was not successfulpublic java.util.List getFilesInFolder(java.lang.String resourcename) throws CmsException
The result is filtered according to the rules of
the
filter.CmsResourceFilter.DEFAULT
resourcename
- the full path of the resource to return the child resources for.
CmsResource
s
CmsException
- if something goes wronggetFilesInFolder(String, CmsResourceFilter)
public java.util.List getFilesInFolder(java.lang.String resourcename, CmsResourceFilter filter) throws CmsException
With the
provided as parameter
you can control if you want to include deleted, invisible or
time-invalid resources in the result.CmsResourceFilter
resourcename
- the full path of the resource to return the child resources for.filter
- the resource filter to use
CmsResource
s
CmsException
- if something goes wrongpublic java.util.List getGroups() throws CmsException
CmsGroup
objects
CmsException
- if operation was not successfulpublic java.util.List getGroupsOfUser(java.lang.String username) throws CmsException
username
- the name of the user
CmsGroup
objects
CmsException
- if operation was not succesfulpublic java.util.List getGroupsOfUser(java.lang.String username, java.lang.String remoteAddress) throws CmsException
username
- the name of the userremoteAddress
- the IP address to filter the groups in the result list
CmsGroup
objects filtered by the specified IP address
CmsException
- if operation was not succesfulpublic CmsLock getLock(CmsResource resource) throws CmsException
resource
- the resource to return the lock state for
CmsException
- if something goes wrongpublic CmsLock getLock(java.lang.String resourcename) throws CmsException
resourcename
- the name if the resource to get the lock state for (full path)
CmsException
- if something goes wrongpublic java.lang.String getLostAndFoundName(java.lang.String resourcename) throws CmsException
In general, it is the same name as the given resource has, the only exception is if a resource in the "lost and found" folder with the same name already exists. In such case, a counter is added to the resource name.
resourcename
- the name of the resource to get the "lost and found" name for (full path)
CmsException
- if something goes wrongmoveToLostAndFound(String)
public CmsGroup getParent(java.lang.String groupname) throws CmsException
groupname
- the name of the group
null
CmsException
- if operation was not successfulpublic CmsPermissionSet getPermissions(java.lang.String resourceName) throws CmsException
resourceName
- the name of the resource
CmsException
- if something goes wrongpublic CmsPermissionSet getPermissions(java.lang.String resourceName, java.lang.String userName) throws CmsException
resourceName
- the name of the resourceuserName
- the name of the user
CmsException
- if something goes wrongpublic CmsPublishList getPublishList() throws CmsException
CmsException
- if something goes wrongpublic CmsPublishList getPublishList(CmsResource directPublishResource, boolean directPublishSiblings) throws CmsException
directPublishResource
- the resource which will be directly publisheddirectPublishSiblings
- true
, if all eventual siblings of the direct
published resource should also get published.
CmsException
- if something goes wrongpublic CmsPublishList getPublishList(java.util.List directPublishResources, boolean directPublishSiblings) throws CmsException
directPublishResources
- the resources which will be directly publisheddirectPublishSiblings
- true
, if all eventual siblings of the direct
published resources should also get published.
CmsException
- if something goes wrongpublic CmsPublishList getPublishList(java.util.List directPublishResources, boolean directPublishSiblings, boolean publishSubResources) throws CmsException
directPublishResources
- the resources which will be directly publisheddirectPublishSiblings
- true
, if all eventual siblings of the direct
published resources should also get published.publishSubResources
- indicates if sub-resources in folders should be published (for direct publish only)
CmsException
- if something goes wrongpublic CmsRequestContext getRequestContext()
This request context is used to authenticate the user for all OpenCms operations. It also contains the request runtime settings, e.g. about the current site this request was made on.
public java.util.List getResourcesForPrincipal(CmsUUID principalId, CmsPermissionSet permissions, boolean includeAttr) throws CmsException
If the includeAttr
flag is set it returns also all resources associated to
a given principal through some of following attributes.
principalId
- the id of the principalpermissions
- a set of permissions to match, can be null
for all ACEsincludeAttr
- a flag to include resources associated by attributes
CmsResource
objects
CmsException
- if something goes wrongpublic java.util.List getResourcesInFolder(java.lang.String resourcename, CmsResourceFilter filter) throws CmsException
With the
provided as parameter
you can control if you want to include deleted, invisible or
time-invalid resources in the result.CmsResourceFilter
This method is mainly used by the workplace explorer.
resourcename
- the full path of the resource to return the child resources forfilter
- the resource filter to use
CmsResource
s
CmsException
- if something goes wrongpublic java.util.List getResourcesInTimeRange(java.lang.String folder, long starttime, long endtime) throws CmsException
readResources(String, CmsResourceFilter)
and create a filter
based on CmsResourceFilter.IGNORE_EXPIRATION
using CmsResourceFilter.addRequireLastModifiedAfter(long)
and
CmsResourceFilter.addRequireLastModifiedBefore(long)
instead
The result list is descending sorted (newest resource first).
folder
- the folder to get the subresources fromstarttime
- the begin of the time rangeendtime
- the end of the time range
CmsResource
objects
that have been modified in the given time range.
CmsException
- if operation was not successfulpublic java.lang.String getSitePath(CmsResource resource)
The full root path of a resource is always available using
. From this name this method cuts
of the current site root using
CmsResource.getRootPath()
.CmsRequestContext.removeSiteRoot(String)
If the resource root path does not start with the current site root, it is left untouched.
resource
- the resource to get the adjusted site root path for
CmsRequestContext.removeSiteRoot(String)
,
CmsRequestContext.getSitePath(CmsResource)
,
CmsResource.getRootPath()
public java.util.List getSubFolders(java.lang.String resourcename) throws CmsException
The result is filtered according to the rules of
the
filter.CmsResourceFilter.DEFAULT
resourcename
- the full path of the resource to return the child resources for.
CmsResource
s
CmsException
- if something goes wronggetSubFolders(String, CmsResourceFilter)
public java.util.List getSubFolders(java.lang.String resourcename, CmsResourceFilter filter) throws CmsException
With the
provided as parameter
you can control if you want to include deleted, invisible or
time-invalid resources in the result.CmsResourceFilter
resourcename
- the full path of the resource to return the child resources for.filter
- the resource filter to use
CmsResource
s
CmsException
- if something goes wrongpublic CmsTaskService getTaskService()
public java.util.List getUsers() throws CmsException
CmsUser
objects
CmsException
- if operation was not successfulpublic java.util.List getUsers(int type) throws CmsException
type
- the type of the users
CmsUser
objects of the given type
CmsException
- if operation was not successfulpublic java.util.List getUsersOfGroup(java.lang.String groupname) throws CmsException
Users that are "indirectly" in the group are not returned in the result.
groupname
- the name of the group to get all users for
CmsUser
objects in the group
CmsException
- if operation was not successfulpublic boolean hasPermissions(CmsResource resource, CmsPermissionSet requiredPermissions) throws CmsException
resource
- the resource to check the permissions forrequiredPermissions
- the set of permissions to check for
true
if the required permissions are satisfied
CmsException
- if something goes wrongpublic boolean hasPermissions(CmsResource resource, CmsPermissionSet requiredPermissions, boolean checkLock, CmsResourceFilter filter) throws CmsException
resource
- the resource to check the permissions forrequiredPermissions
- the set of permissions to check forcheckLock
- if true
, a lock for the current user is required for
all write operations, if false
it's ok to write as long as the resource
is not locked by another user.filter
- the resource filter to use
true
if the required permissions are satisfied
CmsException
- if something goes wrongpublic boolean hasPublishPermissions(java.lang.String resourcename)
If the resource parameter is null
, then the current project is checked,
otherwise the resource is checked for direct publish permissions.
resourcename
- the direct publish resource name (optional, if null only the current project is checked)
true
, if the current user can direct publish the given resource in his current contextpublic boolean hasRole(CmsRole roles)
roles
- the role to check
true
if the user of the current OpenCms context is at a member of at last
one of the roles in the given role setpublic void importAccessControlEntries(CmsResource resource, java.util.List acEntries) throws CmsException
Already existing access control entries of this resource are removed before.
resource
- the resource to attach the control entries toacEntries
- a list of CmsAccessControlEntry
objects
CmsException
- if something goes wrongpublic CmsResource importResource(java.lang.String resourcename, CmsResource resource, byte[] content, java.util.List properties) throws CmsException
If a resource already exists in the VFS (i.e. has the same name and same id) it is replaced by the imported resource.
If a resource with the same name but a different id exists, the imported resource is (usually) moved to the "lost and found" folder.
resourcename
- the name for the resource after import (full path)resource
- the resource object to be importedcontent
- the content of the resourceproperties
- the properties of the resource
CmsException
- if something goes wrongmoveToLostAndFound(String)
public CmsUser importUser(java.lang.String id, java.lang.String name, java.lang.String password, java.lang.String description, java.lang.String firstname, java.lang.String lastname, java.lang.String email, java.lang.String address, int flags, int type, java.util.Map additionalInfos) throws CmsException
id
- the id of the username
- the new name for the userpassword
- the new password for the userdescription
- the description for the userfirstname
- the firstname of the userlastname
- the lastname of the useremail
- the email of the useraddress
- the address of the userflags
- the flags for a user (for example I_CmsPrincipal.FLAG_ENABLED
)type
- the type of the useradditionalInfos
- the additional user infos
CmsException
- if something goes wrongpublic boolean isAdmin()
hasRole(CmsRole)
or checkRole(CmsRole)
instead
CmsRole.ADMINISTRATOR
.
true
, if the current user has role access to CmsRole.ADMINISTRATOR
public boolean isInsideCurrentProject(java.lang.String resourcename)
The project "view" is determined by a set of path prefixes. If the resource starts with any one of this prefixes, it is considered to be "inside" the project.
resourcename
- the specified resource name (full path)
true
, if the specified resource is inside the current projectpublic boolean isManagerOfProject()
true
, if the user has management access to the current projectpublic void lockResource(java.lang.String resourcename) throws CmsException
The mode for the lock is
.CmsLock.COMMON
resourcename
- the name of the resource to lock (full path)
CmsException
- if something goes wronglockResource(String, int)
public void lockResource(java.lang.String resourcename, int mode) throws CmsException
The mode
parameter controls what kind of lock is used.
Possible values for this parameter are:
resourcename
- the name of the resource to lock (full path)mode
- flag indicating the mode for the lock
CmsException
- if something goes wrongpublic java.lang.String loginUser(java.lang.String username, java.lang.String password) throws CmsException
username
- the name of the userpassword
- the password of the user
CmsException
- if the login was not successfulpublic java.lang.String loginUser(java.lang.String username, java.lang.String password, java.lang.String remoteAddress) throws CmsException
username
- the name of the userpassword
- the password of the userremoteAddress
- the ip address
CmsException
- if the login was not successfulpublic java.lang.String loginUser(java.lang.String username, java.lang.String password, java.lang.String remoteAddress, int type) throws CmsException
username
- the name of the userpassword
- the password of the userremoteAddress
- the ip addresstype
- the user type (System or Web user)
CmsException
- if the login was not successfulpublic java.lang.String loginWebUser(java.lang.String username, java.lang.String password) throws CmsException
username
- the name of the userpassword
- the password of the user
CmsException
- if the login was not successfulpublic I_CmsPrincipal lookupPrincipal(CmsUUID principalId)
principalId
- the uuid of a user or group
public I_CmsPrincipal lookupPrincipal(java.lang.String principalName)
principalName
- the name of the user or group
public void moveResource(java.lang.String source, java.lang.String destination) throws CmsException
A move operation in OpenCms is always a copy (as sibling) followed by a delete, this is a result of the online/offline structure of the OpenCms VFS. This way you can see the deleted files/folders in the offline project, and you will be unable to undelete them.
source
- the name of the resource to move (full path)destination
- the destination resource name (full path)
CmsException
- if something goes wrongrenameResource(String, String)
public java.lang.String moveToLostAndFound(java.lang.String resourcename) throws CmsException
The "lost and found" folder is a special system folder. This operation is used e.g. during import of resources when a resource with the same name but a different resource ID already exists in the VFS. In this case, the imported resource is moved to the "lost and found" folder.
resourcename
- the name of the resource to move to "lost and found" (full path)
CmsException
- if something goes wronggetLostAndFoundName(String)
public CmsUUID publishProject() throws java.lang.Exception
java.lang.Exception
- if something goes wrongCmsShellReport
public CmsUUID publishProject(I_CmsReport report) throws CmsException
report
- an instance of I_CmsReport
to print messages
CmsException
- if something goes wrongpublic CmsUUID publishProject(I_CmsReport report, CmsPublishList publishList) throws CmsException
report
- an instance of I_CmsReport
to print messagespublishList
- a publish list
CmsException
- if something goes wronggetPublishList()
,
getPublishList(CmsResource, boolean)
,
getPublishList(List, boolean)
public CmsUUID publishProject(I_CmsReport report, CmsResource directPublishResource, boolean directPublishSiblings) throws CmsException
report
- an instance of I_CmsReport
to print messagesdirectPublishResource
- a CmsResource
that gets directly published;
or null
if an entire project gets published.directPublishSiblings
- if a CmsResource
that should get published directly is
provided as an argument, all eventual siblings of this resource
get publish too, if this flag is true
.
CmsException
- if something goes wrongpublishResource(String)
,
publishResource(String, boolean, I_CmsReport)
public CmsUUID publishResource(java.lang.String resourcename) throws java.lang.Exception
The siblings of the resource will not be published.
resourcename
- the name of the resource to be published
java.lang.Exception
- if something goes wrongCmsShellReport
public CmsUUID publishResource(java.lang.String resourcename, boolean publishSiblings, I_CmsReport report) throws java.lang.Exception
resourcename
- the name of the resource to be publishedpublishSiblings
- if true
, all siblings of the resource are also publishedreport
- the report to write the progress information to
java.lang.Exception
- if something goes wrongpublic java.util.List readAllBackupFileHeaders(java.lang.String filename) throws CmsException
filename
- the name of the file to be read
CmsBackupResource
objects, read from the Cms
CmsException
- if operation was not successfulpublic java.util.List readAllPropertyDefinitions() throws CmsException
CmsPropertyDefinition
objects (may be empty)
CmsException
- if something goes wrongpublic CmsFolder readAncestor(java.lang.String resourcename, CmsResourceFilter filter) throws CmsException
If no folder matching the filter criteria is found, null is returned.
resourcename
- the name of the resource to start (full path)filter
- the resource filter to match while reading the ancestors
CmsException
- if something goes wrongpublic CmsFolder readAncestor(java.lang.String resourcename, int type) throws CmsException
If no folder with the requested resource type is found, null is returned.
resourcename
- the name of the resource to start (full path)type
- the resource type of the folder to match
CmsException
- if something goes wrongpublic CmsBackupResource readBackupFile(java.lang.String filename, int tagId) throws CmsException
filename
- the complete path of the file to be readtagId
- the tag id of the resource
CmsException
- if the user has not the rights to read the file, or
if the file couldn't be read.public CmsBackupProject readBackupProject(int tagId) throws CmsException
tagId
- the tag of the backup project to be read
CmsException
- if operation was not successfulpublic java.util.List readBackupPropertyObjects(CmsBackupResource resource) throws CmsException
CmsProperty
objects that belong the the given backup resource.
resource
- the backup resource to read the properties from
CmsProperty
objects that belong the the given backup resource
CmsException
- if something goes wrongpublic CmsFile readFile(java.lang.String resourcename) throws CmsException
CmsResourceFilter.DEFAULT
filter.
In case you do not need the file content,
use
instead.readResource(String)
resourcename
- the name of the resource to read (full path)
CmsException
- if the file resource could not be read for any reasonreadFile(String, CmsResourceFilter)
,
readResource(String)
public CmsFile readFile(java.lang.String resourcename, CmsResourceFilter filter) throws CmsException
In case you do not need the file content,
use
instead.readResource(String, CmsResourceFilter)
The specified filter controls what kind of resources should be "found"
during the read operation. This will depend on the application. For example,
using
will only return currently
"valid" resources, while using CmsResourceFilter.DEFAULT
will ignore the date release / date expired information of the resource.CmsResourceFilter.IGNORE_EXPIRATION
resourcename
- the name of the resource to read (full path)filter
- the resource filter to use while reading
CmsException
- if the file resource could not be read for any reasonreadResource(String, CmsResourceFilter)
public CmsResource readFileHeader(java.lang.String resourcename) throws CmsException
readResource(String, CmsResourceFilter)
instead.
CmsResourceFilter.DEFAULT
filter.
resourcename
- the name of the resource to read (full path)
CmsException
- if something goes wrongpublic CmsFolder readFolder(java.lang.String resourcename) throws CmsException
CmsResourceFilter.DEFAULT
filter.
resourcename
- the name of the folder resource to read (full path)
CmsException
- if the resource could not be read for any reasonreadResource(String, CmsResourceFilter)
,
readFolder(String, CmsResourceFilter)
public CmsFolder readFolder(java.lang.String resourcename, CmsResourceFilter filter) throws CmsException
The specified filter controls what kind of resources should be "found"
during the read operation. This will depend on the application. For example,
using
will only return currently
"valid" resources, while using CmsResourceFilter.DEFAULT
will ignore the date release / date expired information of the resource.CmsResourceFilter.IGNORE_EXPIRATION
resourcename
- the name of the folder resource to read (full path)filter
- the resource filter to use while reading
CmsException
- if the resource could not be read for any reasonreadResource(String, CmsResourceFilter)
public CmsGroup readGroup(CmsProject project)
project
- the project to read the group from
public CmsGroup readGroup(CmsUUID groupId) throws CmsException
groupId
- the id of the group to be read
CmsException
- if something goes wrongpublic CmsGroup readGroup(java.lang.String groupName) throws CmsException
groupName
- the name of the group to be read
CmsException
- if something goes wrongpublic CmsGroup readManagerGroup(CmsProject project)
project
- the project
public CmsUser readOwner(CmsProject project) throws CmsException
project
- the project to read the owner from
CmsException
- if something goes wrongpublic java.util.List readPath(java.lang.String path, CmsResourceFilter filter) throws CmsException
path
- the requested pathfilter
- a filter object (only "includeDeleted" information is used!)
CmsResource
s
CmsException
- if something goes wrongpublic CmsProject readProject(int id) throws CmsException
id
- the id of the project
CmsException
- if operation was not successfulpublic CmsProject readProject(java.lang.String name) throws CmsException
name
- the name of the project
CmsException
- if operation was not successfulpublic java.util.List readProjectResources(CmsProject project) throws CmsException
project
- the project to get the project resources for
String
objects
that define the "view" of the given project.
CmsException
- if something goes wrongpublic java.util.List readProjectView(int projectId, int state) throws CmsException
Possible values for the state
parameter are:
CmsResource.STATE_CHANGED
: Read all "changed" resources in the projectCmsResource.STATE_NEW
: Read all "new" resources in the projectCmsResource.STATE_DELETED
: Read all "deleted" resources in the projectCmsResource.STATE_KEEP
: Read all resources either "changed", "new" or "deleted" in the project
projectId
- the id of the project to read the file resources forstate
- the resource state to match
CmsResource
s of a project that match a given criteria from the VFS
CmsException
- if something goes wrongpublic java.util.Map readProperties(java.lang.String resourcePath) throws CmsException
readPropertyObjects(String, boolean)
instead.
resourcePath
- the resource to look up the property for
String
objects representing all properties of the resource
CmsException
- in case there where problems reading the propertiespublic java.util.Map readProperties(java.lang.String resourcePath, boolean search) throws CmsException
readPropertyObjects(String, boolean)
instead.
resourcePath
- the resource to look up the property forsearch
- if true
, the properties will also be looked up on all parent folders and the results will be merged, if false
not (ie. normal property lookup)
String
objects representing all properties of the resource
CmsException
- in case there where problems reading the propertiespublic java.lang.String readProperty(java.lang.String resourcePath, java.lang.String property) throws CmsException
readPropertyObject(String, String, boolean)
instead.
resourcePath
- the resource to look up the property forproperty
- the name of the property to look up
null
if nothing was found
CmsException
- in case there where problems reading the propertyCmsProperty.getValue()
public java.lang.String readProperty(java.lang.String resourcePath, java.lang.String property, boolean search) throws CmsException
readPropertyObject(String, String, boolean)
instead.
resourcePath
- the resource to look up the property forproperty
- the name of the property to look upsearch
- if true
, the property will be looked up on all parent folders if it is not attached to the the resource, if false not (ie. normal property lookup)
null
if nothing was found
CmsException
- in case there where problems reading the propertyCmsProperty.getValue()
public java.lang.String readProperty(java.lang.String resourcePath, java.lang.String property, boolean search, java.lang.String propertyDefault) throws CmsException
readPropertyObject(String, String, boolean)
instead.
true
).
resourcePath
- the resource to look up the property forproperty
- the name of the property to look upsearch
- if true
, the property will be looked up on all parent folders if it is not attached to the the resource, if false
not (ie. normal property lookup)propertyDefault
- a default value that will be returned if the property was not found on the selected resource
propertyDefault
parameter is returned
CmsException
- in case there where problems reading the propertyCmsProperty.getValue()
public CmsPropertyDefinition readPropertyDefinition(java.lang.String name) throws CmsException
If no property definition with the given name is found,
null
is returned.
name
- the name of the property definition to read
null
if there is no property definition with the given name.
CmsException
- if something goes wrongpublic CmsProperty readPropertyObject(CmsResource resource, java.lang.String property, boolean search) throws CmsException
Returns
if the property is not found.CmsProperty.getNullProperty()
This method is more efficient then using
if you already have an instance of the resource to look up the property from.readPropertyObject(String, String, boolean)
resource
- the resource where the property is attached toproperty
- the property namesearch
- if true, the property is searched on all parent folders of the resource,
if it's not found attached directly to the resource
CmsProperty.getNullProperty()
if the property was not found
CmsException
- if something goes wrongpublic CmsProperty readPropertyObject(java.lang.String resourcePath, java.lang.String property, boolean search) throws CmsException
Returns
if the property is not found.CmsProperty.getNullProperty()
resourcePath
- the name of resource where the property is attached toproperty
- the property namesearch
- if true, the property is searched on all parent folders of the resource,
if it's not found attached directly to the resource
CmsProperty.getNullProperty()
if the property was not found
CmsException
- if something goes wrongpublic java.util.List readPropertyObjects(CmsResource resource, boolean search) throws CmsException
Returns an empty list if no properties are found.
This method is more efficient then using
if you already have an instance of the resource to look up the property from.readPropertyObjects(String, boolean)
If the search
parameter is true
, the properties of all
parent folders of the resource are also read. The results are merged with the
properties directly attached to the resource. While merging, a property
on a parent folder that has already been found will be ignored.
So e.g. if a resource has a property "Title" attached, and it's parent folder
has the same property attached but with a differrent value, the result list will
contain only the property with the value from the resource, not form the parent folder(s).
resource
- the resource where the property is mapped tosearch
- if true
, the properties of all parent folders of the resource
are merged with the resource properties.
CmsProperty
objects
CmsException
- if something goes wrongpublic java.util.List readPropertyObjects(java.lang.String resourcePath, boolean search) throws CmsException
Returns an empty list if no properties are found.
All properties in the result List will be in frozen (read only) state, so you can't change the values.
If the search
parameter is true
, the properties of all
parent folders of the resource are also read. The results are merged with the
properties directly attached to the resource. While merging, a property
on a parent folder that has already been found will be ignored.
So e.g. if a resource has a property "Title" attached, and it's parent folder
has the same property attached but with a differrent value, the result list will
contain only the property with the value from the resource, not form the parent folder(s).
resourcePath
- the name of resource where the property is mapped tosearch
- if true
, the properties of all parent folders of the resource
are merged with the resource properties.
CmsProperty
objects
CmsException
- if something goes wrongpublic java.util.List readPublishedResources(CmsUUID publishHistoryId) throws CmsException
publishHistoryId
- unique int ID to identify each publish task in the publish history
CmsPublishedResource
objects
CmsException
- if something goes wrongpublic CmsResource readResource(java.lang.String resourcename) throws CmsException
CmsResourceFilter.DEFAULT
filter.
A resource may be of type
or
CmsFile
. In case of
a file, the resource will not contain the binary file content. Since reading
the binary content is a cost-expensive database operation, it's recommended
to work with resources if possible, and only read the file content when absolutely
required. To "upgrade" a resource to a file,
use CmsFolder
.CmsFile.upgrade(CmsResource, CmsObject)
resourcename
- the name of the resource to read (full path)
CmsException
- if the resource could not be read for any reasonreadFile(String)
,
readResource(String, CmsResourceFilter)
,
CmsFile.upgrade(CmsResource, CmsObject)
public CmsResource readResource(java.lang.String resourcename, CmsResourceFilter filter) throws CmsException
A resource may be of type
or
CmsFile
. In case of
a file, the resource will not contain the binary file content. Since reading
the binary content is a cost-expensive database operation, it's recommended
to work with resources if possible, and only read the file content when absolutly
required. To "upgrade" a resource to a file,
use CmsFolder
.CmsFile.upgrade(CmsResource, CmsObject)
The specified filter controls what kind of resources should be "found"
during the read operation. This will depend on the application. For example,
using
will only return currently
"valid" resources, while using CmsResourceFilter.DEFAULT
will ignore the date release / date expired information of the resource.CmsResourceFilter.IGNORE_EXPIRATION
resourcename
- the name of the resource to read (full path)filter
- the resource filter to use while reading
CmsException
- if the resource could not be read for any reasonreadFile(String, CmsResourceFilter)
,
readFolder(String, CmsResourceFilter)
,
CmsFile.upgrade(CmsResource, CmsObject)
public java.util.List readResources(java.lang.String resourcename, CmsResourceFilter filter) throws CmsException
resourcename
- the parent path to read the resources fromfilter
- the filter
CmsResource
objects matching the filter criteria
CmsException
- if something goes wrongreadResources(String, CmsResourceFilter, boolean)
public java.util.List readResources(java.lang.String resourcename, CmsResourceFilter filter, boolean readTree) throws CmsException
readTree
parameter is true
.
resourcename
- the parent path to read the resources fromfilter
- the filterreadTree
- true
to read all subresources
CmsResource
objects matching the filter criteria
CmsException
- if something goes wrongpublic java.util.List readResourcesWithProperty(java.lang.String propertyDefinition) throws CmsException
Both individual and shared properties of a resource are checked.
propertyDefinition
- the name of the property to check for
CmsResource
objects
that have a value set for the specified property.
CmsException
- if something goes wrongpublic java.util.List readResourcesWithProperty(java.lang.String path, java.lang.String propertyDefinition) throws CmsException
Both individual and shared properties of a resource are checked.
path
- the folder to get the resources with the property frompropertyDefinition
- the name of the property to check for
CmsResource
objects
that have a value set for the specified property in the given path.
CmsException
- if something goes wrongpublic java.util.List readResourcesWithProperty(java.lang.String path, java.lang.String propertyDefinition, java.lang.String value) throws CmsException
Both individual and shared properties of a resource are checked.
path
- the folder to get the resources with the property frompropertyDefinition
- the name of the property to check forvalue
- the string to search in the value of the property
CmsResource
objects
that have a value set for the specified property in the given path.
CmsException
- if something goes wrongpublic java.util.Set readResponsiblePrincipals(CmsResource resource) throws CmsException
resource
- the resource to get the responsible principals from
CmsException
- if something goes wrongpublic java.util.Set readResponsibleUsers(CmsResource resource) throws CmsException
resource
- the resource to get the responsible users from
CmsException
- if something goes wrongpublic java.util.List readSiblings(java.lang.String resourcename, CmsResourceFilter filter) throws CmsException
resourcename
- the name of the specified resourcefilter
- a resource filter
CmsResource
s that
are siblings to the specified resource,
including the specified resource itself.
CmsException
- if something goes wrongpublic java.lang.String readStaticExportPublishedResourceParameters(java.lang.String rfsName) throws CmsException
rfsName
- the rfs name of the resource
CmsException
- if something goes wrongpublic java.util.List readStaticExportResources(int parameterResources, long timestamp) throws CmsException
parameterResources
- flag for reading resources with parameters (1) or without (0)timestamp
- a timestamp for reading the data from the db
String
objects
CmsException
- if something goes wrongpublic CmsUser readUser(CmsUUID userId) throws CmsException
userId
- the id of the user to be read
CmsException
- if something goes wrongpublic CmsUser readUser(java.lang.String username) throws CmsException
username
- the name of the user to be read
CmsException
- if somthing goes wrongpublic CmsUser readUser(java.lang.String username, int type) throws CmsException
username
- the name of the user to be returnedtype
- the type of the user
CmsException
- if operation was not successfulpublic CmsUser readUser(java.lang.String username, java.lang.String password) throws CmsException
If the user/pwd pair is not valid a
is thrown.CmsException
username
- the name of the user to be returnedpassword
- the password of the user to be returned
CmsException
- if operation was not successfulpublic CmsUser readWebUser(java.lang.String username) throws CmsException
username
- the username of the webuser that is to be read
CmsException
- if operation was not succesfulpublic CmsUser readWebUser(java.lang.String username, java.lang.String password) throws CmsException
If the user/pwd pair is not valid a
is thrown.CmsException
username
- the username of the user that is to be readpassword
- the password of the user that is to be read
CmsException
- if something goes wrongpublic void removeResourceFromProject(java.lang.String resourcename) throws CmsException
This is used to reduce the current users project with the specified resource, in case that the resource is already part of the project. The resource is not really removed like in a regular copy operation, it is in fact only "disabled" in the current users project.
resourcename
- the name of the resource to remove to the current project (full path)
CmsException
- if something goes wrongpublic void removeUserFromGroup(java.lang.String username, java.lang.String groupname) throws CmsException
username
- the name of the user that is to be removed from the groupgroupname
- the name of the group
CmsException
- if operation was not successfulpublic void renameResource(java.lang.String source, java.lang.String destination) throws CmsException
move
operation.
source
- the name of the resource to rename (full path)destination
- the new resource name (full path)
CmsException
- if something goes wrongmoveResource(String, String)
public void replaceResource(java.lang.String resourcename, int type, byte[] content, java.util.List properties) throws CmsException
resourcename
- the name of the resource to replace (full path)type
- the new type of the resourcecontent
- the new content of the resourceproperties
- the new properties of the resource
CmsException
- if something goes wrongpublic void restoreResourceBackup(java.lang.String resourcename, int tagId) throws CmsException
resourcename
- the name of the resource to restore from the archive (full path)tagId
- the desired tag ID of the resource
CmsException
- if something goes wrongpublic void rmacc(java.lang.String resourceName, java.lang.String principalType, java.lang.String principalName) throws CmsException
resourceName
- name of the resourceprincipalType
- the type of the principal (currently group or user)principalName
- the name of the principal
CmsException
- if something goes wrongpublic void setDateExpired(java.lang.String resourcename, long dateExpired, boolean recursive) throws CmsException
resourcename
- the name of the resource to change (full path)dateExpired
- the new expire date of the changed resourcerecursive
- if this operation is to be applied recursivly to all resources in a folder
CmsException
- if something goes wrongpublic void setDateLastModified(java.lang.String resourcename, long dateLastModified, boolean recursive) throws CmsException
resourcename
- the name of the resource to change (full path)dateLastModified
- timestamp the new timestamp of the changed resourcerecursive
- if this operation is to be applied recursivly to all resources in a folder
CmsException
- if something goes wrongpublic void setDateReleased(java.lang.String resourcename, long dateReleased, boolean recursive) throws CmsException
resourcename
- the name of the resource to change (full path)dateReleased
- the new release date of the changed resourcerecursive
- if this operation is to be applied recursivly to all resources in a folder
CmsException
- if something goes wrongpublic void setParentGroup(java.lang.String groupName, java.lang.String parentGroupName) throws CmsException
groupName
- the name of the group that should be updatedparentGroupName
- the name of the parent group to set,
or null
if the parent
group should be deleted.
CmsException
- if operation was not successfullpublic void setPassword(java.lang.String username, java.lang.String newPassword) throws CmsException
username
- the name of the usernewPassword
- the new password
CmsException
- if operation was not successfulpublic void setPassword(java.lang.String username, java.lang.String oldPassword, java.lang.String newPassword) throws CmsException
username
- the name of the useroldPassword
- the old passwordnewPassword
- the new password
CmsException
- if the user data could not be read from the databasepublic void touch(java.lang.String resourcename, long dateLastModified, long dateReleased, long dateExpired, boolean recursive) throws CmsException
setDateLastModified(String, long, boolean)
,
setDateReleased(String, long, boolean)
or
setDateExpired(String, long, boolean)
instead
This method is used to set the "last modified" date of a resource, the "release" date of a resource, and also the "expire" date of a resource.
resourcename
- the name of the resource to change (full path)dateLastModified
- timestamp the new timestamp of the changed resourcedateReleased
- the new release date of the changed resource,
set it to CmsResource.TOUCH_DATE_UNCHANGED
to keep it unchanged.dateExpired
- the new expire date of the changed resource.
set it to CmsResource.TOUCH_DATE_UNCHANGED
to keep it unchanged.recursive
- if this operation is to be applied recursivly to all resources in a folder
CmsException
- if something goes wrongpublic void undeleteResource(java.lang.String resourcename) throws CmsException
Only resources that have already been published once can be undeleted, if a "new" resource is deleted it can not be undeleted.
Internally, this method undos all changes to a resource by restoring the version from the online project, that is to the state of last publishing.
resourcename
- the name of the resource to undelete (full path)
CmsException
- if something goes wrongundoChanges(String, boolean)
public void undoChanges(java.lang.String resourcename, boolean recursive) throws CmsException
resourcename
- the name of the resource to undo the changes for (full path)recursive
- if this operation is to be applied recursivly to all resources in a folder
CmsException
- if something goes wrongpublic void unlockProject(int id) throws CmsException
id
- the id of the project to be unlocked
CmsException
- if operation was not successfulpublic void unlockResource(java.lang.String resourcename) throws CmsException
resourcename
- the name of the resource to unlock (full path)
CmsException
- if something goes wrongpublic boolean userInGroup(java.lang.String username, java.lang.String groupname) throws CmsException
username
- the name of the user to testgroupname
- the name of the group to test
true
, if the user is in the group; or false
otherwise
CmsException
- if operation was not successfulpublic java.util.Map validateHtmlLinks(CmsPublishList publishList, I_CmsReport report) throws java.lang.Exception
I_CmsXmlDocumentLinkValidatable
.
publishList
- an OpenCms publish listreport
- a report to write the messages to
String
objects) keyed by resource names
java.lang.Exception
- if something goes wrongI_CmsXmlDocumentLinkValidatable
public void validatePassword(java.lang.String password) throws CmsSecurityException
I_CmsPasswordHandler
interface and configured in the opencms.properties file.If this method throws no exception the password is valid.
password
- the new password that has to be checked
CmsSecurityException
- if the password is not validpublic CmsFile writeFile(CmsFile resource) throws CmsException
Applies only to resources of type
i.e. resources that have a binary content attached.CmsFile
Certain resource types might apply content validation or transformation rules before the resource is actually written to the VFS. The returned result might therefore be a modified version from the provided original.
resource
- the resource to write
CmsException
- if something goes wrongpublic void writeFileHeader(CmsFile file) throws CmsException
file
- the file to write
CmsException
- if resourcetype is set to folder, or
if the user has not the rights to write the file header.public void writeGroup(CmsGroup group) throws CmsException
The group id has to be a valid OpenCms group id.
The group with the given id will be completely overriden
by the given data.
group
- the group that should be written
CmsException
- if operation was not successfulpublic void writeProject(CmsProject project) throws CmsException
The project id has to be a valid OpenCms project id.
The project with the given id will be completely overriden
by the given data.
project
- the project that should be written
CmsException
- if operation was not successfulpublic void writeProperties(java.lang.String resourceName, java.util.Map properties) throws CmsException
writePropertyObjects(String, List)
instead.
resourceName
- the resource-name of which the Property has to be setproperties
- a Hashtable with property-definitions and property values as Strings
CmsException
- if operation was not successfulpublic void writeProperties(java.lang.String name, java.util.Map properties, boolean addDefinition) throws CmsException
writePropertyObjects(String, List)
instead.
name
- the resource-name of which the Property has to be setproperties
- a Hashtable with property-definitions and property values as StringsaddDefinition
- flag to indicate if unknown definitions should be added
CmsException
- if operation was not successfulpublic void writeProperty(java.lang.String resourceName, java.lang.String key, java.lang.String value) throws CmsException
writePropertyObject(String, CmsProperty)
instead.
resourceName
- the resource-name for which the property will be setkey
- the property definition namevalue
- the value for the property to be set
CmsException
- if operation was not successfulpublic void writeProperty(java.lang.String resourcename, java.lang.String key, java.lang.String value, boolean addDefinition) throws CmsException
writePropertyObject(String, CmsProperty)
instead.
resourcename
- the resource-name for which the property will be setkey
- the property-definition namevalue
- the value for the property to be setaddDefinition
- flag to indicate if unknown definitions should be added
CmsException
- if operation was not successfulpublic void writePropertyObject(java.lang.String resourcename, CmsProperty property) throws CmsException
resourcename
- the name of resource with complete pathproperty
- the property to write
CmsException
- if something goes wrongpublic void writePropertyObjects(java.lang.String resourcename, java.util.List properties) throws CmsException
Code calling this method has to ensure that the no properties
a, b
are contained in the specified list so that a.equals(b)
,
otherwise an exception is thrown.
resourcename
- the name of resource with complete pathproperties
- the list of properties to write
CmsException
- if something goes wrongpublic void writeStaticExportPublishedResource(java.lang.String resourceName, int linkType, java.lang.String linkParameter, long timestamp) throws CmsException
This is done during static export.
resourceName
- The name of the resource to be added to the static exportlinkType
- the type of resource exported (0= non-paramter, 1=parameter)linkParameter
- the parameters added to the resourcetimestamp
- a timestamp for writing the data into the db
CmsException
- if something goes wrongpublic void writeUser(CmsUser user) throws CmsException
The user id has to be a valid OpenCms user id.
The user with the given id will be completely overriden
by the given data.
user
- the user to be written
CmsException
- if operation was not successfulpublic void writeWebUser(CmsUser user) throws CmsException
The user id has to be a valid OpenCms user id.
The user with the given id will be completely overriden
by the given data.
user
- the user to be written
CmsException
- if operation was not successful
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |