📄 cmsshellcommands.java
字号:
/**
* Changes the owner for this resource<BR/>
*
* The user may change this, if he is admin of the resource.
*
* @param filename The complete path to the resource.
* @param newOwner The name of the new owner for this resource.
*/
public void chown(String filename, String newOwner) {
try {
m_cms.chown(filename, newOwner);
}
catch(Exception exc) {
CmsShell.printException(exc);
}
}
/**
* Changes the resourcetype for this resource<BR/>
*
* The user may change this, if he is admin of the resource.
*
* @param filename The complete path to the resource.
* @param newType The name of the new resourcetype for this resource.
*/
public void chtype(String filename, String newType) {
try {
m_cms.chtype(filename, newType);
}
catch(Exception exc) {
CmsShell.printException(exc);
}
}
/**
* Clears all internal DB-Caches.
*/
public void clearcache() {
try {
m_cms.clearcache();
}
catch(Exception exc) {
CmsShell.printException(exc);
}
}
/**
* Copies the file.
*
* @param source The complete path of the sourcefile.
* @param destination The complete path of the destination.
*
* @throws CmsException will be thrown, if the file couldn't be copied.
* The CmsException will also be thrown, if the user has not the rights
* for this resource.
*/
public void copyFile(String source, String destination) {
try {
m_cms.copyResource(source, destination);
}
catch(Exception exc) {
CmsShell.printException(exc);
}
}
/**
* Copies a folder.
*
* @param source the complete path of the sourcefolder.
* @param destination the complete path of the destinationfolder.
*/
public void copyFolder(String source, String destination) {
try {
// copy the folder with keeping the flags
m_cms.copyResource(source, destination, true);
}
catch(Exception exc) {
CmsShell.printException(exc);
}
}
/**
* Copies a resource.
*
* @param source the complete path of the sourcefolder.
* @param destination the complete path of the destinationfolder.
*/
public void copyResource(String source, String destination) {
try {
m_cms.copyResource(source, destination);
}
catch(Exception exc) {
CmsShell.printException(exc);
}
}
/**
* Copies a resource from the online project to a new, specified project.<br>
* Copying a resource will copy the file header or folder into the specified
* offline project and set its state to UNCHANGED.
*
* @param resource The name of the resource.
*/
public void copyResourceToProject(String resource) {
try {
m_cms.copyResourceToProject(resource);
}
catch(Exception exc) {
CmsShell.printException(exc);
}
}
/**
* Returns a copyright-string for this OpenCms.
*/
public void copyright() {
String[] copy = C_COPYRIGHT;
for(int i = 0;i < copy.length;i++) {
System.out.println(copy[i]);
}
}
/**
* Counts the locked resources in a project.
*
* @param id the id of the project
*/
public void countLockedResources(String id) {
try {
int intId = Integer.parseInt(id);
System.out.println(m_cms.countLockedResources(intId));
}
catch(Exception exc) {
CmsShell.printException(exc);
}
}
/**
* 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 (No pathinformation allowed).
*/
public void createFolder(String folder, String newFolderName) {
try {
System.out.println((CmsFolder)m_cms.createResource(folder, newFolderName, C_TYPE_FOLDER_NAME));
}
catch(Exception exc) {
CmsShell.printException(exc);
}
}
/**
* This method creates a new module in the repository.
*
* @param String modulename the name of the module.
* @param String niceModulename another name of the module.
* @param String description the description of the module.
* @param String author the name of the author.
* @param String createDate the creation date of the module
* @param String version the version number of the module.
*/
public void createModule(String modulename, String niceModulename, String description, String author, String type, String createDate, String version) {
// create the module
try {
I_CmsRegistry reg = m_cms.getRegistry();
int ver = Integer.parseInt(version);
long date = Long.parseLong(createDate);
reg.createModule(modulename, niceModulename, description, author, type, new HashMap(), date, ver);
}
catch(Exception exc) {
CmsShell.printException(exc);
}
}
/**
* Creates a project.
*
* @param name The name of the project to create
* @param description The description for the new project
* @param groupname the name of the group to be set
*/
public void createProject(String name, String description, String groupname, String managergroupname) {
try {
System.out.println(m_cms.createProject(name, description, groupname, managergroupname));
}
catch(Exception exc) {
CmsShell.printException(exc);
}
}
/**
* Creates a project.
*
* @param name The name of the project to create
* @param description The description for the new project
* @param groupname the name of the group to be set
*/
public void createProject(String name, String description, String groupname, String managergroupname, String projecttype) {
try {
System.out.println(m_cms.createProject(name, description, groupname, managergroupname, Integer.parseInt(projecttype)));
}
catch(Exception exc) {
CmsShell.printException(exc);
}
}
/**
* Creates a default cms project.
* This default project has the following properties:<ul>
* <li>The users groups is "Users"
* <li>The project managers group is "Projectmanager"
* <li>All resources are contained in the project
* <li>The project will remain after publishing</ul>
*
* @param name The name of the project to create
* @param description The description for the new project
*
*/
public void createDefaultProject(String name, String description) {
try {
CmsProject project = m_cms.createProject(name, description, C_GROUP_USERS, C_GROUP_PROJECTLEADER, C_PROJECT_TYPE_NORMAL);
int id = project.getId();
m_cms.getRequestContext().setCurrentProject(id);
// copy the VFS folders to the project
m_cms.copyResourceToProject(C_ROOT);
// copy the COS channels to the project
m_cms.setContextToCos();
m_cms.copyResourceToProject(C_ROOT);
m_cms.setContextToVfs();
}
catch(Exception exc) {
CmsShell.printException(exc);
}
}
/**
* Creates a new project for the temporary files.
*
* @throws CmsException if operation was not successful.
*/
public void createTempfileProject() throws CmsException
{
try {
System.out.println(m_cms.createTempfileProject());
}
catch(Exception exc) {
CmsShell.printException(exc);
}
}
/**
* Creates the propertydefinition for the resource type.<BR/>
*
* @param name The name of the propertydefinition to overwrite.
* @param resourcetype The name of the resource-type for the propertydefinition.
*
* @throws CmsException Throws CmsException if something goes wrong.
*/
public void createPropertydefinition(String name, String resourcetype) throws CmsException {
try {
System.out.println(m_cms.createPropertydefinition(name, resourcetype));
}
catch(Exception exc) {
CmsShell.printException(exc);
}
}
/**
* 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.
*/
public void createTask(String agentName, String roleName, String taskname, String taskcomment, String timeout, String priority) {
try {
int intPriority = Integer.parseInt(priority);
long longTimeout = Long.parseLong(timeout);
System.out.println(m_cms.createTask(agentName, roleName, taskname, taskcomment, longTimeout, intPriority));
}
catch(Exception exc) {
CmsShell.printException(exc);
}
}
/**
* 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.
*/
public void createTask(String projectid, String agentName, String roleName,
String taskname, String taskcomment, String tasktype, String timeout, String priority) {
try {
System.out.println(m_cms.createTask(Integer.parseInt(projectid), agentName, roleName, taskname, taskcomment,
Integer.parseInt(tasktype), Long.parseLong(timeout), Integer.parseInt(priority)));
}
catch(Exception exc) {
CmsShell.printException(exc);
}
}
/**
* Deletes all propertyinformation for a file or folder.
*
* @param resource The name of the resource of which the propertyinformations
* have to be deleted.
*/
public void deleteAllProperties(String resource) {
try {
m_cms.deleteAllProperties(resource);
}
catch(Exception exc) {
CmsShell.printException(exc);
}
}
/**
* Deletes the file.
*
* @param filename The complete path of the file.
*/
public void deleteFile(String filename) {
try {
m_cms.deleteResource(filename);
}
catch(Exception exc) {
CmsShell.printException(exc);
}
}
/**
* Deletes the folder.
*
* @param foldername The complete path of the folder.
*/
public void deleteFolder(String foldername) {
try {
m_cms.deleteResource(foldername);
}
catch(Exception exc) {
CmsShell.printException(exc);
}
}
/**
* Deletes a Resource.
*
* @param filename the complete path of the sourcefolder.
*/
public void deleteResource(String filename) {
try {
m_cms.deleteResource(filename);
} catch (Exception exc) {
CmsShell.printException(exc);
}
}
/**
* Undeletes the resource.
*
* @param resourcename The complete path of the resource.
*/
public void undeleteResource(String resourcename) {
try {
m_cms.undeleteResource(resourcename);
}
catch(Exception exc) {
CmsShell.printException(exc);
}
}
/**
* Delete a group from the Cms.<BR/>
*
* @param delgroup The name of the group that is to be deleted.
*/
public void deleteGroup(String delgroup) {
try {
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -