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

📄 cmsworkplaceconfiguration.java

📁 OpenCms 是一个J2EE的产品
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
            + "/"
            + N_DEFAULTPREFERENCES
            + "/"
            + N_WORKFLOWPREFERENCES
            + "/"
            + N_WORKFLOWDEFAULTSETTINGS
            + "/"
            + N_MESSAGEFORWARDED, "setTaskMessageForwarded", 0);
        digester.addCallMethod("*/"
            + N_WORKPLACE
            + "/"
            + N_DEFAULTPREFERENCES
            + "/"
            + N_WORKFLOWPREFERENCES
            + "/"
            + N_WORKFLOWDEFAULTSETTINGS
            + "/"
            + N_MESSAGECOMPLETED, "setTaskMessageCompleted", 0);
        digester.addCallMethod("*/"
            + N_WORKPLACE
            + "/"
            + N_DEFAULTPREFERENCES
            + "/"
            + N_WORKFLOWPREFERENCES
            + "/"
            + N_WORKFLOWDEFAULTSETTINGS
            + "/"
            + N_INFORMROLEMEMBERS, "setTaskMessageMembers", 0);

        // add tool-manager
        String rulePath = "*/" + N_TOOLMANAGER;
        digester.addObjectCreate(rulePath, CmsToolManager.class);
        digester.addSetNext(rulePath, "setToolManager");
        // add tool-manager roots
        rulePath += "/" + N_ROOTS + "/" + N_ROOT;
        digester.addObjectCreate(rulePath, CmsToolRootHandler.class);
        digester.addSetNext(rulePath, "addToolRoot");
        digester.addBeanPropertySetter(rulePath + "/" + N_KEY);
        digester.addBeanPropertySetter(rulePath + "/" + N_URI);
        digester.addBeanPropertySetter(rulePath + "/" + N_NAME);
        digester.addBeanPropertySetter(rulePath + "/" + N_HELPTEXT, "helpText");
    }

    /**
     * @see org.opencms.configuration.I_CmsXmlConfiguration#generateXml(org.dom4j.Element)
     */
    public Element generateXml(Element parent) {

        // generate workplace node and subnodes
        Element workplaceElement = parent.addElement(N_WORKPLACE);
        Iterator i;

        // add default locale
        workplaceElement.addElement(N_DEFAULTLOCALE).setText(m_workplaceManager.getDefaultLocale().toString());

        // add <localizedfolders> subnode
        Element localizedElement = workplaceElement.addElement(N_LOCALIZEDFOLDERS);
        Iterator localizedIterator = m_workplaceManager.getLocalizedFolders().iterator();
        while (localizedIterator.hasNext()) {
            // add <resource uri=""/> element(s)
            localizedElement.addElement(N_RESOURCE).addAttribute(A_URI, (String)localizedIterator.next());
        }

        // add <dialoghandlers> subnode
        Element dialogElement = workplaceElement.addElement(N_DIALOGHANDLERS);
        Map dialogs = m_workplaceManager.getDialogHandler();
        String[] keys = (String[])dialogs.keySet().toArray(new String[0]);
        Arrays.sort(keys);

        for (int j = 0; j < keys.length; j++) {
            String name = keys[j];
            dialogElement.addElement(N_DIALOGHANDLER).addAttribute(A_CLASS, dialogs.get(name).getClass().getName());
        }

        // add miscellaneous editor subnodes
        workplaceElement.addElement(N_EDITORHANDLER).addAttribute(
            A_CLASS,
            m_workplaceManager.getEditorHandler().getClass().getName());
        workplaceElement.addElement(N_EDITORACTION).addAttribute(
            A_CLASS,
            m_workplaceManager.getEditorActionHandler().getClass().getName());

        // add <exportpoints> subnode
        Element resourceloadersElement = workplaceElement.addElement(N_EXPORTPOINTS);
        Set points = m_workplaceManager.getExportPoints();
        i = points.iterator();
        while (i.hasNext()) {
            CmsExportPoint point = (CmsExportPoint)i.next();
            resourceloadersElement.addElement(N_EXPORTPOINT).addAttribute(A_URI, point.getUri()).addAttribute(
                A_DESTINATION,
                point.getConfiguredDestination());
        }

        // add miscellaneous configuration nodes
        workplaceElement.addElement(N_AUTOLOCK).setText(new Boolean(m_workplaceManager.autoLockResources()).toString());
        workplaceElement.addElement(N_ENABLEUSERMGMT).setText(
            new Boolean(m_workplaceManager.showUserGroupIcon()).toString());
        workplaceElement.addElement(N_DEFAULTPROPERTIESONSTRUCTURE).setText(
            new Boolean(m_workplaceManager.isDefaultPropertiesOnStructure()).toString());
        workplaceElement.addElement(N_ENABLEADVANCEDPROPERTYTABS).setText(
            new Boolean(m_workplaceManager.isEnableAdvancedPropertyTabs()).toString());
        workplaceElement.addElement(N_MAXUPLOADSIZE).setText(
            new Integer(m_workplaceManager.getFileMaxUploadSize()).toString());

        // add <labeledfolders> resource list
        Element labeledElement = workplaceElement.addElement(N_LABELEDFOLDERS);
        i = m_workplaceManager.getLabelSiteFolders().iterator();
        while (i.hasNext()) {
            labeledElement.addElement(N_RESOURCE).addAttribute(A_URI, (String)i.next());
        }

        // add <workflow> node
        if (m_workplaceManager.isEnableWorkflowMessages()) {
            Element workflow = workplaceElement.addElement(N_WORKFLOW);
            workflow.addElement(N_SHOWMESSAGES).setText(
                new Boolean(m_workplaceManager.isEnableWorkflowMessages()).toString());
        }

        // add <rfsfileviewsettings> node
        CmsRfsFileViewer viewSettings = m_workplaceManager.getFileViewSettings();
        Element fileViewElement = workplaceElement.addElement(N_RFSFILEVIEWESETTINGS);
        String filePath = viewSettings.getFilePath();
        if (filePath != null) {
            fileViewElement.addElement(N_FILEPATH).setText(filePath);
        }
        fileViewElement.addElement(N_ENABLED).setText(String.valueOf(viewSettings.isEnabled()));
        fileViewElement.addElement(N_FILEENCODING).setText(viewSettings.getFileEncoding());
        fileViewElement.addElement(N_ISLOGFILE).setText(String.valueOf(viewSettings.getIsLogfile()));
        fileViewElement.addElement(N_WINDOWSIZE).setText(String.valueOf(viewSettings.getWindowSize()));

        // add <explorertypes> node
        Element explorerTypesElement = workplaceElement.addElement(N_EXPLORERTYPES);
        List explorerTypes = m_workplaceManager.getExplorerTypeSettings();
        generateExplorerTypesXml(explorerTypesElement, explorerTypes, false);

        // add the <defaultaccesscontrol> node
        Element defaultAccessControlElement = explorerTypesElement.addElement(N_DEFAULTACCESSCONTROL);
        // create subnode <accesscontrol>            
        List accessEntries = new ArrayList();
        // sort accessEntries   
        CmsExplorerTypeAccess access = m_workplaceManager.getDefaultAccess();
        Iterator iter = access.getAccessEntries().keySet().iterator();
        while (iter.hasNext()) {
            accessEntries.add(iter.next());
        }
        Collections.sort(accessEntries);

        if (accessEntries.size() > 0) {
            Element accessControlElement = defaultAccessControlElement.addElement(N_ACCESSCONTROL);
            Iterator k = accessEntries.iterator();

            while (k.hasNext()) {
                String key = (String)k.next();
                String value = (String)m_workplaceManager.getDefaultAccess().getAccessEntries().get(key);
                Element accessEntryElement = accessControlElement.addElement(N_ACCESSENTRY);
                accessEntryElement.addAttribute(A_PRINCIPAL, key);
                accessEntryElement.addAttribute(A_PERMISSIONS, value);
            }
        }

        // add the <multicontextmenu> node
        i = m_workplaceManager.getMultiContextMenu().getAllEntries().iterator();
        if (i.hasNext()) {
            // only generate the node if entries are defined
            Element contextMenuElement = explorerTypesElement.addElement(N_MULTICONTEXTMENU);
            while (i.hasNext()) {
                CmsExplorerContextMenuItem item = (CmsExplorerContextMenuItem)i.next();
                Element itemElement;
                if (CmsExplorerContextMenuItem.TYPE_ENTRY.equals(item.getType())) {
                    // create an <entry> node
                    itemElement = contextMenuElement.addElement(N_ENTRY);
                    itemElement.addAttribute(A_KEY, item.getKey());
                    itemElement.addAttribute(A_URI, item.getUri());
                    if (item.getTarget() != null) {
                        itemElement.addAttribute(A_TARGET, item.getTarget());
                    }
                    String rules = item.getRules();
                    if (CmsStringUtil.isEmptyOrWhitespaceOnly(rules)) {
                        rules = "";
                    }
                    itemElement.addAttribute(A_RULES, rules);
                } else {
                    // create a <separator> node
                    itemElement = contextMenuElement.addElement(N_SEPARATOR);
                }
                itemElement.addAttribute(A_ORDER, "" + item.getOrder());
            }
        }

        // add the <default-preferences> user settings main node
        Element defaultPreferences = workplaceElement.addElement(N_DEFAULTPREFERENCES);
        // add the <workplace-preferences> node
        Element workplacePreferences = defaultPreferences.addElement(N_WORKPLACEPREFERENCES);
        // add the <workplace-generaloptions> node
        Element workplaceGeneraloptions = workplacePreferences.addElement(N_WORKPLACEGENERALOPTIONS);
        // add the <buttonstyle> node
        workplaceGeneraloptions.addElement(N_BUTTONSTYLE).setText(
            m_workplaceManager.getDefaultUserSettings().getWorkplaceButtonStyleString());
        // add the <reporttype> node
        workplaceGeneraloptions.addElement(N_REPORTTYPE).setText(
            m_workplaceManager.getDefaultUserSettings().getWorkplaceReportType());
        // add the <uploadapplet> node
        workplaceGeneraloptions.addElement(N_UPLOADAPPLET).setText(
            m_workplaceManager.getDefaultUserSettings().getUploadAppletString());
        // add the <publishbuttonappearance> node if not empty
        if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(m_workplaceManager.getDefaultUserSettings().getPublishButtonAppearance())) {
            workplaceGeneraloptions.addElement(N_PUBLISHBUTTONAPPEARANCE).setText(
                m_workplaceManager.getDefaultUserSettings().getPublishButtonAppearance());
        }
        // add the <workplace-startupsettings> node
        Element workplaceStartupsettings = workplacePreferences.addElement(N_WORKPLACESTARTUPSETTINGS);
        // add the <locale> node
        workplaceStartupsettings.addElement(N_LOCALE).setText(
            m_workplaceManager.getDefaultUserSettings().getLocale().toString());
        // add the <project> node
        workplaceStartupsettings.addElement(N_PROJECT).setText(
            m_workplaceManager.getDefaultUserSettings().getStartProject());
        // add the <view> node
        workplaceStartupsettings.addElement(N_WORKPLACEVIEW).setText(
            m_workplaceManager.getDefaultUserSettings().getStartView());
        // add the <folder> node
        workplaceStartupsettings.addElement(N_FOLDER).setText(
            m_workplaceManager.getDefaultUserSettings().getStartFolder());
        // add the <site> node
        workplaceStartupsettings.addElement(N_SITE).setText(m_workplaceManager.getDefaultUserSettings().getStartSite());
        // add the <restrictexplorerview> node
        workplaceStartupsettings.addElement(N_RESTRICTEXPLORERVIEW).setText(
            m_workplaceManager.getDefaultUserSettings().getRestrictExplorerViewString());

        // add the <explorer-preferences> node
        Element explorerPreferences = defaultPreferences.addElement(N_EXPLORERPREFERENCES);
        // add the <explorer-generaloptions> node
        Element explorerGeneraloptions = explorerPreferences.addElement(N_EXPLORERGENERALOPTIONS);
        // add the <buttonstyle> node
        explorerGeneraloptions.addElement(N_BUTTONSTYLE).setText(
            m_workplaceManager.getDefaultUserSettings().getExplorerButtonStyleString());
        // add the <reporttype> node
        explorerGeneraloptions.addElement(N_ENTRIES).setText(
            "" + m_workplaceManager.getDefaultUserSettings().getExplorerFileEntries());
        // add the <explorer-displayoption> node
        Element explorerDisplayoptions = explorerPreferences.addElement(N_EXPLORERDISPLAYOPTIONS);
        // add the <show-title> node
        explorerDisplayoptions.addElement(N_TITLE).setText(
            m_workplaceManager.getDefaultUserSettings().getShowExplorerFileTitle());
        // add the <show-type> node
        explorerDisplayoptions.addElement(N_TYPE).setText(
            m_workplaceManager.getDefaultUserSettings().getShowExplorerFileType());
        // add the <show-datelastmodified> node
        explorerDisplayoptions.addElement(N_DATELASTMODIFIED).setText(
            m_workplaceManager.getDefaultUserSettings().getShowExplorerFileDateLastModified());
        // add the <show-datecreated> node
        explorerDisplayoptions.addElement(N_DATECREATED).setText(
            m_workplaceManager.getDefaultUserSettings().getShowExplorerFileDateCreated());
        // add the <show-lockedby> node
        explorerDisplayoptions.addElement(N_LOCKEDBY).setText(
            m_workplaceManager.getDefaultUserSettings().getShowExplorerFileLockedBy());
        // add the <show-permissions> node
        explorerDisplayoptions.addElement(N_PERMISSIONS).setText(
            m_workplaceManager.getDefaultUserSettings().getShowExplorerFilePermissions());
        // add the <show-size> node
        explorerDisplayoptions.addElement(N_SIZE).setText(
            m_workplaceManager.getDefaultUserSettings().getShowExplorerFileSize());
        // add the <show-state> node
        explorerDisplayoptions.addElement(N_STATE).setText(
            m_workplaceManager.getDefaultUserSettings().getShowExplorerFileState());
        // add the <show-userlastmodified> node
        explorerDisplayoptions.addElement(N_USERLASTMODIFIED).setText(
            m_workplaceManager.getDefaultUserSettings().getShowExplorerFileUserLastModified());
        // add the <show-usercreated> node
        explorerDisplayoptions.addElement(N_USERCREATED).setText(
            m_workplaceManager.getDefaultUserSettings().getShowExplorerFileUserCreated());
        // add the <show-datereleased> node
        explorerDisplayoptions.addElement(N_DATERELEASED).setText(
            m_workplaceManager.getDefaultUserSettings().getShowExplorerFileDateReleased());
        // add the <show-dateexpired> node
        explorerDisplayoptions.addElement(N_DATEEXPIRED).setText(
            m_workplaceManager.getDefaultUserSettings().getShowExplorerFileDateExpired());

        // add the <dialog-preferences> node
        Element dialogPreferences = defaultPreferences.addElement(N_DIALOGSPREFERENCES);
        // add the <dialog-defaultsettings> node
        Element dialogDefaultSettings = dialogPreferences.addElement(N_DIALOGSDEFAULTSETTINGS);
        // add the <filecopy> node
        dialogDefaultSettings.addElement(N_FILECOPY).setText(
            m_workplaceManager.getDefaultUserSettings().getDialogCopyFileModeString());
        // add the <foldercopy> node
        dialogDefaultSettings.addElement(N_FOLDERCOPY).setText(
            m_workplaceManager.getDefaultUserSettings().getDialogCopyFolderModeString());
        // add the <filedeletion> node
        dialogDefaultSettings.addElement(N_FILEDELETION).setText(
            m_workplaceManager.getDefaultUserSettings().getDialogDeleteFileModeString());
        // add the <directpublish> node
        dialogDefaultSettings.addElement(N_DIRECTPUBLISH).setText(
            m_workplaceManager.getDefaultUserSettings().getDialogPublishSiblingsString());
        // add the <showlock> node
        dialogDefaultSettings.addElement(N_SHOWLOCK).setText(
            m_workplaceManager.getDefaultUserSettings().getDialogShowLockString());
        // add the <showexportsettings> node
        dialogDefaultSettings.addElement(N_SHOWEXPORTSETTINGS).setText(
            m_workplaceManager.getDefaultUserSettings().getDialogShowExportSettingsString());
        // add the <expand-permissionsuser> node
        dialogDefaultSettings.addElement(N_EXPANDPERMISSIONSUSER).setText(
            m_workplaceManager.getDefaultUserSettings().getDialogExpandUserPermissionsString());
        // add the <expand-permissionsinherited> node
        dialogDefaultSettings.addElement(N_EXPANDPERMISSIONSINHERITED

⌨️ 快捷键说明

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