⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cmsshellcommands.java

📁 java 编写的程序
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
            CmsShell.printException(exc);
        }
    }

    /**
     * Delete 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.
     */
    public void deletepropertydefinition(String name, String resourcetype) {
        try {
            m_cms.deletePropertydefinition(name, resourcetype);
        }
        catch(Exception exc) {
            CmsShell.printException(exc);
        }
    }

    /**
     * Deletes a user from the Cms.
     *
     * @param name The name of the user to be deleted.
     */
    public void deleteUser(String name) {
        try {
            m_cms.deleteUser(name);
        }
        catch(Exception exc) {
            CmsShell.printException(exc);
        }
    }

    /**
     * Deletes a web user from the Cms.
     *
     * @param name the id of the user to be deleted.
     */
    public void deleteWebUser(String userId) {
        try {
            m_cms.deleteWebUser(Integer.parseInt(userId));
        }
        catch(Exception exc) {
            CmsShell.printException(exc);
        }
    }

    /**
     * Echos the input to output.
     *
     * @param echo The echo to be written to output.
     */
    public void echo(String echo) {
        if(echo.toLowerCase().equals("on")) {
            CmsShell.m_echo = true;
        }
        else {
            if(echo.toLowerCase().equals("off")) {
                CmsShell.m_echo = false;
            }
            else {
                System.out.println(echo);
            }
        }
    }

    /**
     * Ends a task of the Cms.
     *
     * @param taskid the ID of the task to end.
     */
    public void endTask(String taskid) {
        try {
            m_cms.endTask(Integer.parseInt(taskid));
        }
        catch(Exception exc) {
            CmsShell.printException(exc);
        }
    }

    /**
     * Exits the commandline-interface
     */
    public void exit() {
        try {
            m_openCms.destroy();
        }
        catch(CmsException e) {
            e.printStackTrace();
        }
        CmsShell.m_exitCalled = true;
    }

    /**
     * Exports cms-resources to zip. In the zip-file the system - path will be included.
     *
     * @param exportFile the name (absolute Path) of the export resource (zip)
     *
     * @exception Throws CmsException if something goes wrong.
     */
    public void exportAllResources(String exportFile) throws CmsException {

        // export the resources
        String[] exportPaths =  {
            C_ROOT
        };
        try {
            m_cms.exportResources(exportFile, exportPaths, false, false);
        }
        catch(Exception exc) {
            CmsShell.printException(exc);
        }
    }

    /**
     * Exports cms-resources to zip. In the zip-file the system - path will be included.
     * Unchanged resources will be ignored.
     *
     * @param exportFile the name (absolute Path) of the export resource (zip)
     *
     * @exception Throws CmsException if something goes wrong.
     */
    public void exportAllResourcesOnlyChanged(String exportFile) throws CmsException {

        // export the resources
        String[] exportPaths =  {
            C_ROOT
        };
        try {
            m_cms.exportResources(exportFile, exportPaths, false, true);
        }
        catch(Exception exc) {
            CmsShell.printException(exc);
        }
    }

    /**
     * Exports a module.
     *
     * @param modulename the name of the module to export
     * @param resource the folder to export.
     * @param filename the name of the file to export to.
     */
    public void exportModule(String modulename, String resource, String filename) {
        try {
            String[] resources =  {
                resource
            };
            I_CmsRegistry reg = m_cms.getRegistry();
            reg.exportModule(modulename, resources, filename);
        }
        catch(Exception exc) {
            CmsShell.printException(exc);
        }
    }

    /**
     * Exports cms-resources to zip.
     *
     * @param exportFile the name (absolute Path) of the export resource (zip)
     * @param pathList the names (absolute Path) of folders from which should be exported
     *          separated by semicolons
     *
     * @exception Throws CmsException if something goes wrong.
     */
    public void exportResources(String exportFile, String pathList) throws CmsException {

        // export the resources
        StringTokenizer tok = new StringTokenizer(pathList, ";");
        Vector paths = new Vector();
        while(tok.hasMoreTokens()) {
            paths.addElement(tok.nextToken());
        }
        String exportPaths[] = new String[paths.size()];
        for(int i = 0;i < paths.size();i++) {
            exportPaths[i] = (String)paths.elementAt(i);
        }
        boolean excludeSystem = true;
        if(pathList.startsWith("/system/") || (pathList.indexOf(";/system/") > -1)) {
            excludeSystem = false;
        }
        try {
            m_cms.exportResources(exportFile, exportPaths, excludeSystem, false);
        }
        catch(Exception exc) {
            CmsShell.printException(exc);
        }
    }

    /**
     * Exports cms-resources to zip.
     *
     * @param exportFile the name (absolute Path) of the export resource (zip)
     * @param pathList the names (absolute Path) of folders from which should be exported
     *          separated by semicolons
     *
     * @exception Throws CmsException if something goes wrong.
     */
    public void exportResourcesAndUserdata(String exportFile, String pathList) throws CmsException {

        // export the resources
        StringTokenizer tok = new StringTokenizer(pathList, ";");
        Vector paths = new Vector();
        while(tok.hasMoreTokens()) {
            paths.addElement(tok.nextToken());
        }
        String exportPaths[] = new String[paths.size()];
        for(int i = 0;i < paths.size();i++) {
            exportPaths[i] = (String)paths.elementAt(i);
        }
        boolean excludeSystem = true;
        if(pathList.startsWith("/system/") || (pathList.indexOf(";/system/") > -1)) {
            excludeSystem = false;
        }
        try {
            m_cms.exportResources(exportFile, exportPaths, excludeSystem, false, true);
        }
        catch(Exception exc) {
            CmsShell.printException(exc);
        }
    }

    /**
     * Exports cms-resources to zip.
     * Unchanged resources will be ignored.
     *
     * @param exportFile the name (absolute Path) of the export resource (zip)
     * @param pathList the names (absolute Path) of folders from which should be exported
     *          separated by semicolons
     *
     * @exception Throws CmsException if something goes wrong.
     */
    public void exportResourcesOnlyChanged(String exportFile, String pathList) throws CmsException {

        // export the resources
        StringTokenizer tok = new StringTokenizer(pathList, ";");
        Vector paths = new Vector();
        while(tok.hasMoreTokens()) {
            paths.addElement(tok.nextToken());
        }
        String exportPaths[] = new String[paths.size()];
        for(int i = 0;i < paths.size();i++) {
            exportPaths[i] = (String)paths.elementAt(i);
        }
        boolean excludeSystem = true;
        if(pathList.startsWith("/system/") || (pathList.indexOf(";/system/") > -1)) {
            excludeSystem = false;
        }
        try {
            m_cms.exportResources(exportFile, exportPaths, excludeSystem, true);
        }
        catch(Exception exc) {
            CmsShell.printException(exc);
        }
    }

    /**
     * Forwards a task to a new user.
     *
     * @param taskid the id of the task which will be forwarded.
     * @param newRole the new group for the task.
     * @param newUser the new user who gets the task.
     */
    public void forwardTask(String taskid, String newRoleName, String newUserName) {
        try {
            m_cms.forwardTask(Integer.parseInt(taskid), newRoleName, newUserName);
        }
        catch(Exception exc) {
            CmsShell.printException(exc);
        }
    }

    /**
     * Returns all projects, which the user may access.
     *
     * @return a Vector of projects.
     */
    public void getAllAccessibleProjects() {
        try {
            Vector projects = m_cms.getAllAccessibleProjects();
            for(int i = 0;i < projects.size();i++) {
                System.out.println((CmsProject)projects.elementAt(i));
            }
        }
        catch(Exception exc) {
            CmsShell.printException(exc);
        }
    }

    /**
     * Returns all projects which are owned by the current user or which are manageable
     * for the group of the user.
     */
    public void getAllManageableProjects() {
        try {
            Vector projects = m_cms.getAllManageableProjects();
            for(int i = 0;i < projects.size();i++) {
                CmsProject project = (CmsProject)projects.elementAt(i);
                System.out.println(project);
            }
        }
        catch(Exception exc) {
            CmsShell.printException(exc);
        }
    }

    /**
     * Returns  all I_CmsResourceTypes.
     */
    public void getAllResourceTypes() {
        try {
            Hashtable resourceTypes = m_cms.getAllResourceTypes();
            Enumeration keys = resourceTypes.keys();
            while(keys.hasMoreElements()) {
                System.out.println(resourceTypes.get(keys.nextElement()));
            }
        }
        catch(Exception exc) {
            CmsShell.printException(exc);
        }
    }

    /**
     * Gets information about the cache size.
     * <br>
     * The size of the following caching areas is returned:
     * <ul>
     *  <li>GroupCache</li>
     *  <li>UserGroupCache</li>
     *  <li>ResourceCache</li>
     *  <li>SubResourceCache</li>
     *  <li>ProjectCache</li>
     *  <li>PropertyCache</li>
     *  <li>PropertyDefinitionCache</li>
     *  <li>PropertyDefinitionVectorCache</li>
     * </ul>
     */
    public void getCacheInfo() {
        try {
            Hashtable cacheInfo = m_cms.getCacheInfo();
            Enumeration keys = cacheInfo.keys();
            while(keys.hasMoreElements()) {
                String key = (String)keys.nextElement();
                String info = (String)cacheInfo.get(key);
                System.out.println("\t" + key + ": " + info);
            }
        }
        catch(Exception exc) {
            CmsShell.printException(exc);
        }
    }

    /**
     * Returns all child groups of a group<P/>
     *
     * @param groupname The name of the group.
     */
    public void getChild(String groupname) {
        try {
            Vector groups = m_cms.getChild(groupname);
            for(int i = 0;i < groups.size();i++) {
                System.out.println((CmsGroup)groups.elementAt(i));
            }
        }
        catch(Exception exc) {
            CmsShell.printException(exc);
        }
    }

    /**
     * Returns all child groups of a group<P/>
     * This method also returns all sub-child groups of the current group.
     *
     * @param groupname The name of the group.
     */
    public void getChilds(String groupname) {
        try {
            Vector groups = m_cms.getChilds(groupname);
            for(int i = 0;i < groups.size();i++) {
                System.out.println((CmsGroup)groups.elementAt(i));
            }
        }
        catch(Exception exc) {
            CmsShell.printException(exc);
        }
    }

    /**
     * Returns the current project for the user.
     */
    public void getCurrentProject() {
        System.out.println(m_cms.getRequestContext().currentProject().toString());
    }

    /**
     * Gets all groups to which a given user directly belongs.
     *
     * @param username the name of the user to get all groups for.
     * @return a Vector of all groups of a user.
     */
    public void getDirectGroupsOfUser(String username) {
        try {
            Vector groups = m_cms.getDirectGroupsOfUser(username);
            for(int i = 0;i < groups.size();i++) {
                System.out.println((CmsGroup)groups.elementAt(i));
            }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -