📄 cmsobject.java
字号:
* Creates a new folder.
*
* @param folder the complete path to the folder in which the new folder will
* be created.
* @param newFolderName the name of the new folder.
* @param properties A Hashtable of properties, that should be set for this folder.
* The keys for this Hashtable are the names for property-definitions, the values are
* the values for the properties.
*
* @return a <code>CmsFolder</code> object representing the newly created folder.
* @throws CmsException if the foldername is not valid, or if the user has not the appropriate rights to create
* a new folder.
*
*/
protected CmsFolder doCreateFolder(String newFolderName, Map properties) throws CmsException {
CmsFolder cmsFolder = m_rb.createFolder(m_context.currentUser(), m_context.currentGroup(), m_context.currentProject(),
getSiteRoot(newFolderName), properties);
return cmsFolder;
}
/**
* Creates a new resource.
*
* @param folder the complete path to the folder in which the new resource will
* be created.
* @param newResourceName the name of the new resource.
* @param resourceType The resourcetype of the new resource
* @param properties A Hashtable of propertyinfos, that should be set for this folder.
* The keys for this Hashtable are the names for propertydefinitions, the values are
* the values for the propertyinfos.
* @param launcherType The launcher type of the new resource
* @param launcherClassname The name of the launcherclass of the new resource
* @param ownername The name of the owner of the new resource
* @param groupname The name of the group of the new resource
* @param accessFlags The accessFlags of the new resource
* @param filecontent The content of the resource if it is of type file
*
* @return a <code>CmsFolder</code> object representing the newly created folder.
* @throws CmsException if the resourcename is not valid, or if the user has not the appropriate rights to create
* a new resource.
*
*/
protected CmsResource doImportResource(String newResourceName, int resourceType, Map properties, int launcherType,
String launcherClassname, String ownername, String groupname, int accessFlags, long lastmodified, byte[] filecontent) throws CmsException {
CmsResource cmsResource = m_rb.importResource(m_context.currentUser(), m_context.currentProject(),
getSiteRoot(newResourceName), resourceType, properties, launcherType,
launcherClassname, ownername, groupname, accessFlags, lastmodified, filecontent);
return cmsResource;
}
/**
* Writes a resource and its properties to the Cms.<br>
*
* @param resourcename The name of the resource to write.
* @param properties The properties of the resource.
* @param username The name of the new owner of the resource
* @param groupname The name of the new group of the resource
* @param accessFlags The new accessFlags of the resource
* @param resourceType The new type of the resource
* @param filecontent The new filecontent of the resource
*
* @throws CmsException Throws CmsException if operation was not succesful.
*/
protected void doWriteResource(String resourcename, Map properties,
String username, String groupname, int accessFlags,
int resourceType, byte[] filecontent)
throws CmsException{
m_rb.writeResource(m_context.currentUser(), m_context.currentProject(), getSiteRoot(resourcename),
properties, username, groupname, accessFlags, resourceType,
filecontent);
}
/**
* Creates a new project for task handling.
*
* @param projectname the name of the project
* @param projectType the type of the Project
* @param role a Usergroup for the project
* @param timeout the time when the Project must finished
* @param priority a Priority for the Project
*
* @return a <code>CmsTask</code> object representing the newly created task.
*
* @throws CmsException if operation was not successful.
*/
public CmsTask createProject(String projectname, int projectType, String roleName, long timeout, int priority) throws CmsException {
return m_rb.createProject(m_context.currentUser(), projectname, projectType, roleName, timeout, priority);
}
/**
* Creates a new project.
*
* @param name the name of the project to read.
* @param description the description for the new project.
* @param groupname the name of the group to be set.
* @param managergroupname the name of the managergroup to be set.
*
* @throws CmsException if operation was not successful.
*/
public CmsProject createProject(String name, String description, String groupname, String managergroupname) throws CmsException
{
CmsProject newProject = m_rb.createProject(m_context.currentUser(), m_context.currentProject(), name, description, groupname, managergroupname);
return (newProject);
}
/**
* Creates a new project.
*
* @param name the name of the project to read.
* @param description the description for the new project.
* @param groupname the name of the group to be set.
* @param managergroupname the name of the managergroup to be set.
* @param projecttype the type of the project (normal or temporary)
*
* @throws CmsException if operation was not successful.
*/
public CmsProject createProject(String name, String description, String groupname, String managergroupname, int projecttype) throws CmsException
{
CmsProject newProject = m_rb.createProject(m_context.currentUser(), m_context.currentProject(), name, description, groupname, managergroupname, projecttype);
return (newProject);
}
/**
* Creates a new project for the temporary files.
*
* @throws CmsException if operation was not successful.
*/
public CmsProject createTempfileProject() throws CmsException
{
CmsProject newProject = m_rb.createTempfileProject(this, m_context.currentUser(), m_context.currentProject());
return (newProject);
}
/**
* Creates the property-definition for a resource type.
*
* @param name the name of the property-definition to overwrite.
* @param resourcetype the name of the resource-type for the property-definition.
*
* @throws CmsException if operation was not successful.
*/
public CmsPropertydefinition createPropertydefinition(String name, String resourcetype) throws CmsException {
return (m_rb.createPropertydefinition(m_context.currentUser(), m_context.currentProject(), name, resourcetype));
}
/**
* Creates a new task.
* <p>
* <B>Security:</B>
* All users can create a new task.
*
* @param projectid the Id of the current project task of the user.
* @param agentname the User who will edit the task.
* @param rolename a Usergroup for the task.
* @param taskname a Name of the task.
* @param tasktype the type of the task.
* @param taskcomment a description of the task.
* @param timeout the time when the task must finished.
* @param priority the Id for the priority of the task.
*
* @return a <code>CmsTask</code> object representing the newly created task.
*
* @throws CmsException Throws CmsException if something goes wrong.
*/
public CmsTask createTask(int projectid, String agentName, String roleName, String taskname, String taskcomment, int tasktype, long timeout, int priority) throws CmsException {
return m_rb.createTask(m_context.currentUser(), projectid, agentName, roleName, taskname, taskcomment, tasktype, timeout, priority);
}
/**
* Creates a new task.
* <p>
* <B>Security:</B>
* All users can create a new task.
* @param agent the User who will edit the task.
* @param role a Usergroup for the task.
* @param taskname the name of the task.
* @param taskcomment a description of the task.
* @param timeout the time when the task must finished.
* @param priority the Id for the priority of the task.
*
* @return a <code>CmsTask</code> object representing the newly created task.
*
* @throws CmsException if operation was not successful.
*/
public CmsTask createTask(String agentName, String roleName, String taskname, String taskcomment, long timeout, int priority) throws CmsException {
return (m_rb.createTask(m_context.currentUser(), m_context.currentProject(), agentName, roleName, taskname, taskcomment, timeout, priority));
}
/**
* Deletes all properties for a file or folder.
*
* @param resourcename the name of the resource for which all properties should be deleted.
*
* @throws CmsException if operation was not successful.
*/
public void deleteAllProperties(String resourcename) throws CmsException {
m_rb.deleteAllProperties(m_context.currentUser(), m_context.currentProject(), getSiteRoot(resourcename));
}
/**
* Deletes a file.
*
* @param filename the complete path of the file.
*
* @throws CmsException if the file couldn't be deleted, or if the user
* has not the appropriate rights to delete the file.
*
* @deprecated Use deleteResource instead.
*/
public void deleteFile(String filename) throws CmsException {
deleteResource(filename);
}
/**
* Deletes a folder.
* <br>
* This is a very complex operation, because all sub-resources may be
* deleted too.
*
* @param foldername the complete path of the folder.
*
* @throws CmsException if the folder couldn't be deleted, or if the user
* has not the rights to delete this folder.
*
* @deprecated Use deleteResource instead.
*/
public void deleteFolder(String foldername) throws CmsException {
deleteResource(foldername);
}
/**
* Deletes a folder.
* <br>
* This is a very complex operation, because all sub-resources may be
* deleted too.
*
* @param foldername the complete path of the folder.
*
* @throws CmsException if the folder couldn't be deleted, or if the user
* has not the rights to delete this folder.
*
*/
public void deleteEmptyFolder(String foldername) throws CmsException {
m_rb.deleteFolder(m_context.currentUser(), m_context.currentProject(), getSiteRoot(foldername));
}
/**
* Deletes a resource.
*
* @param filename the complete path of the file.
*
* @throws CmsException if the file couldn't be deleted, or if the user
* has not the appropriate rights to delete the file.
*/
public void deleteResource(String filename) throws CmsException {
CmsResource res = readFileHeader(filename);
I_CmsResourceType rt = getResourceType(res.getType());
rt.deleteResource(this, filename);
}
/**
* Deletes a file.
*
* @param filename the complete path of the file.
*
* @throws CmsException if the file couldn't be deleted, or if the user
* has not the appropriate rights to delete the file.
*/
protected void doDeleteFile(String filename) throws CmsException {
m_rb.deleteFile(m_context.currentUser(), m_context.currentProject(), getSiteRoot(filename));
}
/**
* Deletes a folder.
* <br>
* This is a very complex operation, because all sub-resources may be
* deleted too.
*
* @param foldername the complete path of the folder.
*
* @throws CmsException if the folder couldn't be deleted, or if the user
* has not the rights to delete this folder.
*/
protected void doDeleteFolder(String foldername) throws CmsException {
m_rb.deleteFolder(m_context.currentUser(), m_context.currentProject(), getSiteRoot(foldername));
}
/**
* Undeletes a resource.
*
* @param filename the complete path of the file.
*
* @throws CmsException if the file couldn't be undeleted, or if the user
* has not the appropriate rights to undelete the file.
*/
public void undeleteResource(String filename) throws CmsException {
//read the file header including deleted
CmsResource res = m_rb.readFileHeader(m_context.currentUser(), m_context.currentProject(), getSiteRoot(filename), true);
I_CmsResourceType rt = getResourceType(res.getType());
rt.undeleteResource(this, filename);
}
/**
* Undeletes a file.
*
* @param filename the complete path of the file.
*
* @throws CmsException if the file couldn't be undeleted, or if the user
* has not the appropriate rights to undelete the file.
*/
protected void doUndeleteFile(String filename) throws CmsException {
m_rb.undeleteResource(m_context.currentUser(), m_context.currentProject(), getSiteRoot(filename));
}
/**
* Undeletes a folder.
* <br>
* This is a very complex operation, because all sub-resources may be
* undeleted too.
*
* @param foldername the complete path of the folder.
*
* @throws CmsException if the folder couldn't be undeleted, or if the user
* has not the rights to undelete this folder.
*/
protected void doUndeleteFolder(String foldername) throws CmsException {
m_rb.undeleteResource(m_context.currentUser(), m_context.currentProject(), getSiteRoot(foldername));
}
/**
* Deletes a group.
* <p>
* <b>Security:</b>
* Only the admin user is allowed to delete a group.
*
* @param delgroup the name of the group.
* @throws CmsException if operation was not successful.
*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -