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

📄 cmsshellcommands.java

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

    /**
     * Returns a Vector with all subfiles.<BR/>
     *
     * @param foldername the complete path to the folder.
     *
     * @return subfiles A Vector with all subfiles for the overgiven folder.
     *
     * @exception CmsException will be thrown, if the user has not the rights
     * for this resource.
     */
    public void getFilesInFolder(String foldername) {
        try {
            Vector files = m_cms.getFilesInFolder(foldername);
            for(int i = 0;i < files.size();i++) {
                System.out.println((CmsFile)files.elementAt(i));
            }
        }
        catch(Exception exc) {
            CmsShell.printException(exc);
        }
    }

    /**
     * Returns a Vector with all resource-names of the resources that have set the given property to the given value.
     *
     * @param propertydef the name of the property-definition to check.
     * @param property the value of the property for the resource.
     */
    public void getFilesWithProperty(String propertyDefinition, String propertyValue) {
        try {
            Vector files = m_cms.getFilesWithProperty(propertyDefinition, propertyValue);
            for(int i = 0;i < files.size();i++) {
                System.out.println((CmsFile)files.elementAt(i));
            }
        }
        catch(Exception exc) {
            CmsShell.printException(exc);
        }
    }

    /**
     * This method can be called, to determine if the file-system was changed
     * in the past. A module can compare its previosly stored number with this
     * returned number. If they differ, a change was made.
     *
     * @return the number of file-system-changes.
     */
    public void getFileSystemChanges() {
        System.out.println(m_cms.getFileSystemChanges());
    }

    /**
     * Returns a Vector with the complete folder-tree for this project.<br>
     *
     * Subfolders can be read from an offline project and the online project. <br>
     */
    public void getFolderTree() {
        try {
            Vector folders = m_cms.getFolderTree();
            for(int i = 0;i < folders.size();i++) {
                System.out.println((CmsFolder)folders.elementAt(i));
            }
        }
        catch(Exception exc) {
            CmsShell.printException(exc);
        }
    }

    /**
     * Returns all users of the cms.
     */
    public void getGroups() {
        try {
            Vector groups = m_cms.getGroups();
            for(int i = 0;i < groups.size();i++) {
                System.out.println((CmsGroup)groups.elementAt(i));
            }
        }
        catch(Exception exc) {
            CmsShell.printException(exc);
        }
    }

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

    /**
     * Prints out all files for a module.
     *
     * @param moduleZip The file-name of module to import.
     */
    public void getModuleFiles(String name) {
        try {
            I_CmsRegistry reg = m_cms.getRegistry();
            Vector names = new Vector();
            Vector codes = new Vector();
            reg.getModuleFiles(name, names, codes);
            for(int i = 0;i < names.size();i++) {
                System.out.print(names.elementAt(i));
                System.out.print(" -> ");
                System.out.println(codes.elementAt(i));
            }
        }
        catch(Exception exc) {
            CmsShell.printException(exc);
        }
    }

    /**
     * Imports a module into the cms.
     *
     * @param moduleZip The file-name of module to import.
     */
    public void getModuleInfo() {
        try {
            I_CmsRegistry reg = m_cms.getRegistry();
            java.util.Enumeration names = reg.getModuleNames();

            // print out the available modules
            while(names.hasMoreElements()) {
                String name = (String)names.nextElement();
                getModuleInfo(name);
            }
            System.out.println("\ngeneral stuff");
            System.out.println("\tall repositories: ");
            String[] repositories = reg.getRepositories();
            for(int i = 0;i < repositories.length;i++) {
                System.out.println("\t\t" + repositories[i]);
            }
            System.out.println("\tall views: ");
            java.util.Vector views = new java.util.Vector();
            java.util.Vector urls = new java.util.Vector();
            int max = reg.getViews(views, urls);
            for(int i = 0;i < max;i++) {
                System.out.println("\t\t" + views.elementAt(i) + " -> " + urls.elementAt(i));
            }
        }
        catch(Exception exc) {
            CmsShell.printException(exc);
        }
    }

    /**
     * Prints out informations about a module.
     *
     * @param String module the name of the module to get infos about.
     */
    public void getModuleInfo(String name) {
        try {
            I_CmsRegistry reg = m_cms.getRegistry();
            if(reg.moduleExists(name)) {
                System.out.println("\nModule: " + name + " v" + reg.getModuleVersion(name));
                System.out.println("\tNice Name: " + reg.getModuleNiceName(name));
                System.out.println("\tDescription: " + reg.getModuleDescription(name));
                System.out.println("\tAuthor: " + reg.getModuleAuthor(name));
                System.out.println("\tUploaded by: " + reg.getModuleUploadedBy(name));
                System.out.println("\tEmail: " + reg.getModuleAuthorEmail(name));
                System.out.println("\tCreationdate: " + new java.util.Date(reg.getModuleCreateDate(name)));
                System.out.println("\tUploaddate: " + new java.util.Date(reg.getModuleUploadDate(name)));
                System.out.println("\tDocumentationPath: " + reg.getModuleDocumentPath(name));
                String[] repositories = reg.getModuleRepositories(name);
                System.out.println("\trepositories: ");
                if(repositories != null) {
                    for(int i = 0;i < repositories.length;i++) {
                        System.out.println("\t\t" + repositories[i]);
                    }
                }
                String[] parameters = reg.getModuleParameterNames(name);
                System.out.println("\tparameters: ");
                if(parameters != null) {
                    for(int i = 0;i < parameters.length;i++) {
                        System.out.print("\t\t" + parameters[i]);
                        System.out.print(" = " + reg.getModuleParameter(name, parameters[i]));
                        System.out.print(" is " + reg.getModuleParameterType(name, parameters[i]));
                        System.out.println("  (" + reg.getModuleParameterDescription(name, parameters[i]) + ")");
                    }
                }
                System.out.println("\tWiew name: " + reg.getModuleViewName(name));
                System.out.println("\tWiew url: " + reg.getModuleViewUrl(name));
                System.out.println("\tDependencies");
                java.util.Vector modules = new java.util.Vector();
                java.util.Vector min = new java.util.Vector();
                java.util.Vector max = new java.util.Vector();
                reg.getModuleDependencies(name, modules, min, max);
                for(int i = 0;i < modules.size();i++) {
                    System.out.println("\t\t" + modules.elementAt(i) + ": min v" + min.elementAt(i) + " max v" + max.elementAt(i));
                }
            }
            else {
                System.out.println("No module with name " + name);
            }
        }
        catch(Exception exc) {
            CmsShell.printException(exc);
        }
    }

    /**
     * Returns the parent group of a group.
     *
     * @param groupname the name of the group.
     */
    public void getParent(String groupname) {
        try {
            System.out.println(m_cms.getParent(groupname));
        }
        catch(Exception exc) {
            CmsShell.printException(exc);
        }
    }

    /**
     * Returns a Vector with the subresources for a folder.<br>
     *
     * @param folder The name of the folder to get the subresources from.
     */
    public void getResourcesInFolder(String folder) {
        try {
            Vector res = m_cms.getResourcesInFolder(folder);
            for(int i = 0;i < res.size();i++) {
                System.out.println((CmsResource)res.elementAt(i));
            }
        }
        catch(Exception exc) {
            CmsShell.printException(exc);
        }
    }

    /**
     * Returns a Vector with all resources of the given type that have set the given property
     * to the given value.
     *
     * @param propertydef the name of the property-definition to check.
     * @param property the value of the property for the resource.
     * @param resourceType the type of the resource
     */
    public void getResourcesWithProperty(String propertyDefinition, String propertyValue, String resourceType) {
        try {
            int resTypeId = m_cms.getResourceType(resourceType).getResourceType();
            Vector resources = m_cms.getResourcesWithProperty(propertyDefinition, propertyValue, resTypeId);
            for(int i = 0;i < resources.size();i++) {
                System.out.println((CmsResource)resources.elementAt(i));
            }
        }
        catch(Exception exc) {
            CmsShell.printException(exc);
        }
    }
    /**
     * Returns a CmsResourceTypes.
     *
     * @param resourceType the name of the resource to get.
     */
    public void getResourceType(String resourceType) {
        try {
            System.out.println(m_cms.getResourceType(resourceType));
        }
        catch(Exception exc) {
            CmsShell.printException(exc);
        }
    }

    /**
     * Returns a Vector with all subfolders.<BR/>
     *
     * @param foldername the complete path to the folder.
     */
    public void getSubFolders(String foldername) {
        try {
            Vector folders = m_cms.getSubFolders(foldername);
            for(int i = 0;i < folders.size();i++) {
                System.out.println((CmsFolder)folders.elementAt(i));
            }
        }
        catch(Exception exc) {
            CmsShell.printException(exc);
        }
    }

    /**
     * Returns a value for a system-key.
     * E.g. <code>&lt;system&gt;&lt;mailserver&gt;mail.server.com&lt;/mailserver&gt;&lt;/system&gt;</code>
     * can be requested via <code>getSystemValue("mailserver");</code> and returns "mail.server.com.
     *
     * @parameter String the key of the system-value.
     */
    public void getSystemValue(String key) {
        try {
            I_CmsRegistry reg = m_cms.getRegistry();
            System.out.println(reg.getSystemValue(key));
        }
        catch(Exception exc) {
            CmsShell.printException(exc);
        }
    }

    /**
     * Returns all values for a system-key.
     *
     * @parameter String the key of the system-value.
     */
    public void getSystemValues(String sysKey) {
        try {
            I_CmsRegistry reg = m_cms.getRegistry();
            Hashtable res = reg.getSystemValues(sysKey);
            Enumeration keys = res.keys();
            while(keys.hasMoreElements()) {
                Object key = keys.nextElement();
                System.out.println(key + "->" + res.get(key));
            }
        }
        catch(Exception exc) {
            CmsShell.printException(exc);
        }
    }

    /**
     * Get a parameter value for a task.
     *
     * @param taskid the id of the task.
     * @param parname the name of the parameter.
     */
    public void getTaskPar(String taskid, String parname) {
        try {
            System.out.println(m_cms.getTaskPar(Integer.parseInt(taskid), parname));
        }
        catch(Exception exc) {
            CmsShell.printException(exc);
        }
    }

    /**
     * Get the template task id fo a given taskname.
     *
     * @param taskname the name of the task.
     */
    public void getTaskType(String taskname) {
        try {
            System.out.println(m_cms.getTaskType(taskname));
        }
        catch(Exception exc) {
            CmsShell.printException(exc);
        }
    }

    /**
     * Returns all users of the cms.
     */
    public void getUsers() {
        try {
            Vector users = m_cms.getUsers();
            for(int i = 0;i < users.size();i++) {
                System.out.println((CmsUser)users.elementAt(i));
            }
        }
        catch(Exception exc) {
            CmsShell.printException(exc);
        }
    }

    /**
     * Returns all users of the given type in the Cms.
     *
     * @param type the type of the users.
     */
    public void getUsers(String type) {
        try {
            Vector users = m_cms.getUsers(Integer.parseInt(type));
            for(int i = 0;i < users.size();i++) {
                System.out.println((CmsUser)users.elementAt(i));
            }
        }
        catch(Exception exc) {
            CmsShell.printException(exc);
        }
    }

    /**
     * Returns all groups of a user.
     *
     * @param groupname The name of the group.
     */
    public void getUsersOfGroup(String groupname) {
        try {
            Vector users = m_cms.getUsersOfGroup(groupname);
            for(int i = 0;i < users.size();i++) {

⌨️ 快捷键说明

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