public Element generateXml(Element parent) {

        // generate import/export node and subnodes
        Element importexportElement = parent.addElement(N_IMPORTEXPORT);

        Element resourceloadersElement = importexportElement.addElement(N_IMPORTEXPORTHANDLERS);
        List<I_CmsImportExportHandler> handlers = m_importExportManager.getImportExportHandlers();
        Iterator<I_CmsImportExportHandler> handlerIt = handlers.iterator();
        while (handlerIt.hasNext()) {
            I_CmsImportExportHandler handler = handlerIt.next();
            // add the handler node
            Element loaderNode = resourceloadersElement.addElement(N_IMPORTEXPORTHANDLER);
            loaderNode.addAttribute(A_CLASS, handler.getClass().getName());
        }

        Element importElement = importexportElement.addElement(N_IMPORT);

        // <overwrite> node
        importElement.addElement(N_OVERWRITE).setText(
            String.valueOf(m_importExportManager.overwriteCollidingResources()));

        // <convert> node
        importElement.addElement(N_CONVERT).setText(String.valueOf(m_importExportManager.convertToXmlPage()));

        // <oldwebappurl> node
        if (m_importExportManager.getOldWebAppUrl() != null) {
            importElement.addElement(N_OLDWEBAPPURL).setText(m_importExportManager.getOldWebAppUrl());
        }

        // <importversions> node
        Element resourcetypesElement = importElement.addElement(N_IMPORTVERSIONS);
        Iterator<I_CmsImport> importVersions = m_importExportManager.getImportVersionClasses().iterator();
        while (importVersions.hasNext()) {
            resourcetypesElement.addElement(N_IMPORTVERSION).addAttribute(
                A_CLASS,
                importVersions.next().getClass().getName());
        }

        // <immutables> node
        Element immutablesElement = importElement.addElement(N_IMMUTABLES);
        Iterator<String> immutables = m_importExportManager.getImmutableResources().iterator();
        while (immutables.hasNext()) {
            String uri = immutables.next();
            immutablesElement.addElement(N_RESOURCE).addAttribute(A_URI, uri);
        }

        // <principaltranslations> node
        Element principalsElement = importElement.addElement(N_PRINCIPALTRANSLATIONS);
        Iterator<String> userTranslationKeys = m_importExportManager.getImportUserTranslations().keySet().iterator();
        while (userTranslationKeys.hasNext()) {
            String from = userTranslationKeys.next();
            String to = m_importExportManager.getImportUserTranslations().get(from);
            principalsElement.addElement(N_PRINCIPALTRANSLATION).addAttribute(
                A_TYPE,
                I_CmsPrincipal.PRINCIPAL_USER).addAttribute(A_FROM, from).addAttribute(A_TO, to);
        }
        Iterator<String> groupTranslationKeys = m_importExportManager.getImportGroupTranslations().keySet().iterator();
        while (groupTranslationKeys.hasNext()) {
            String from = groupTranslationKeys.next();
            String to = m_importExportManager.getImportGroupTranslations().get(from);
            principalsElement.addElement(N_PRINCIPALTRANSLATION).addAttribute(
                A_TYPE,
                I_CmsPrincipal.PRINCIPAL_GROUP).addAttribute(A_FROM, from).addAttribute(A_TO, to);
        }

        // <ignoredproperties> node
        Element propertiesElement = importElement.addElement(N_IGNOREDPROPERTIES);
        Iterator<String> ignoredProperties = m_importExportManager.getIgnoredProperties().iterator();
        while (ignoredProperties.hasNext()) {
            String property = ignoredProperties.next();
            propertiesElement.addElement(N_PROPERTY).addAttribute(A_NAME, property);
        }

        // <export> node
        Element exportElement = importexportElement.addElement(N_EXPORT);
        Map<TimestampMode, List<String>> defaultTimestampModes = m_importExportManager.getDefaultTimestampModes();
        if (!defaultTimestampModes.isEmpty()) {

            // <defaulttimestampmodes>
            Element defaultTimestampModesElement = exportElement.addElement(N_EXPORT_DEFAULTTIMESTAMPMODES);
            for (TimestampMode mode : defaultTimestampModes.keySet()) {

                // <timestampmode>
                Element timestampModeElement = defaultTimestampModesElement.addElement(N_EXPORT_TIMESTAMPMODE);
                timestampModeElement.addAttribute(A_MODE, mode.toString().toLowerCase());
                for (String resourcetypeName : defaultTimestampModes.get(mode)) {

                    // <resourcetypename>
                    Element resourcetypeElement = timestampModeElement.addElement(N_EXPORT_RESOURCETYPENAME);
                    resourcetypeElement.addText(resourcetypeName);
                }
            }
        }

        List<String> tempExportpointPaths = m_importExportManager.getTempExportPointPaths();
        for (String path : tempExportpointPaths) {
            importexportElement.addElement(N_TEMP_EXPORTPONT_PATH).addText(path);
        }

        // <staticexport> node
        Element staticexportElement = parent.addElement(N_STATICEXPORT);
        staticexportElement.addAttribute(A_ENABLED, m_staticExportManager.getExportEnabled());

        // <staticexporthandler> node
        staticexportElement.addElement(N_STATICEXPORT_HANDLER).addText(
            m_staticExportManager.getHandler().getClass().getName());

        // <linksubstitutionhandler> node
        staticexportElement.addElement(N_LINKSUBSTITUTION_HANDLER).addText(
            m_staticExportManager.getLinkSubstitutionHandler().getClass().getName());

        // <exportpath> node
        String exportPathUnmodified = m_staticExportManager.getExportPathForConfiguration();
        // cut path seperator
        if (exportPathUnmodified.endsWith(File.separator)) {
            exportPathUnmodified = exportPathUnmodified.substring(0, exportPathUnmodified.length() - 1);
        }
        staticexportElement.addElement(N_STATICEXPORT_EXPORTPATH).addText(exportPathUnmodified);

        // <exportworkpath> node
        String exportWorkPathUnmodified = m_staticExportManager.getExportWorkPathForConfiguration();
        if (exportWorkPathUnmodified != null) {
            // cut path seperator
            if (exportWorkPathUnmodified.endsWith(File.separator)) {
                exportWorkPathUnmodified = exportWorkPathUnmodified.substring(0, exportWorkPathUnmodified.length() - 1);
            }
            staticexportElement.addElement(N_STATICEXPORT_EXPORTWORKPATH).addText(exportWorkPathUnmodified);
        }

        // <exportbackups> node
        if (m_staticExportManager.getExportBackups() != null) {
            String exportBackupsUnmodified = String.valueOf(m_staticExportManager.getExportBackups());
            staticexportElement.addElement(N_STATICEXPORT_EXPORTBACKUPS).addText(exportBackupsUnmodified);
        }

        // <defaultpropertyvalue> node
        staticexportElement.addElement(N_STATICEXPORT_DEFAULT).addText(m_staticExportManager.getDefault());

        // <defaultsuffixes> node and its <suffix> sub nodes
        Element defaultsuffixesElement = staticexportElement.addElement(N_STATICEXPORT_DEFAULTSUFFIXES);

        Iterator<String> exportSuffixes = m_staticExportManager.getExportSuffixes().iterator();
        while (exportSuffixes.hasNext()) {
            String suffix = exportSuffixes.next();
            Element suffixElement = defaultsuffixesElement.addElement(N_STATICEXPORT_SUFFIX);
            suffixElement.addAttribute(A_KEY, suffix);
        }

        // <exportheaders> node and its <header> sub nodes
        Iterator<String> exportHandlers = m_staticExportManager.getExportHeaders().iterator();
        if (exportHandlers.hasNext()) {
            Element exportheadersElement = staticexportElement.addElement(N_STATICEXPORT_EXPORTHEADERS);
            while (exportHandlers.hasNext()) {
                String header = exportHandlers.next();
                exportheadersElement.addElement(N_STATICEXPORT_HEADER).addText(header);
            }
        }
        // <requestheaders> node and the <acceptlanguage> and <acceptcharset> node
        String acceptlanguage = m_staticExportManager.getAcceptLanguageHeader();
        String acceptcharset = m_staticExportManager.getAcceptCharsetHeader();
        String remoteaddr = m_staticExportManager.getRemoteAddr();
        if ((acceptlanguage != null) || (acceptcharset != null) || (remoteaddr != null)) {
            Element requestheadersElement = staticexportElement.addElement(N_STATICEXPORT_REQUESTHEADERS);
            if (acceptlanguage != null) {
                requestheadersElement.addElement(N_STATICEXPORT_ACCEPTLANGUAGE).addText(acceptlanguage);
            }
            if (acceptcharset != null) {
                requestheadersElement.addElement(N_STATICEXPORT_ACCEPTCHARSET).addText(acceptcharset);
            }
            if (remoteaddr != null) {
                requestheadersElement.addElement(N_STATICEXPORT_REMOTEADDR).addText(remoteaddr);
            }
        }

        // <rendersettings> node
        Element rendersettingsElement = staticexportElement.addElement(N_STATICEXPORT_RENDERSETTINGS);

        // <rfsPrefix> node
        rendersettingsElement.addElement(N_STATICEXPORT_RFS_PREFIX).addText(
            m_staticExportManager.getRfsPrefixForConfiguration());

        // <vfsPrefix> node
        rendersettingsElement.addElement(N_STATICEXPORT_VFS_PREFIX).addText(
            m_staticExportManager.getVfsPrefixForConfiguration());

        // <userelativelinks> node
        rendersettingsElement.addElement(N_STATICEXPORT_RELATIVELINKS).addText(
            m_staticExportManager.getRelativeLinks());

        // <exporturl> node
        rendersettingsElement.addElement(N_STATICEXPORT_EXPORTURL).addText(
            m_staticExportManager.getExportUrlForConfiguration());

        // <plainoptimization> node
        rendersettingsElement.addElement(N_STATICEXPORT_PLAINOPTIMIZATION).addText(
            m_staticExportManager.getPlainExportOptimization());

        // <testresource> node
        Element testresourceElement = rendersettingsElement.addElement(N_STATICEXPORT_TESTRESOURCE);
        testresourceElement.addAttribute(A_URI, m_staticExportManager.getTestResource());

        // <resourcestorender> node and <regx> subnodes
        Element resourcetorenderElement = rendersettingsElement.addElement(N_STATICEXPORT_RESOURCESTORENDER);

        Iterator<String> exportFolderPatterns = m_staticExportManager.getExportFolderPatterns().iterator();
        while (exportFolderPatterns.hasNext()) {
            String pattern = exportFolderPatterns.next();
            resourcetorenderElement.addElement(N_STATICEXPORT_REGEX).addText(pattern);
        }

        if (!m_staticExportManager.getExportRules().isEmpty()) {
            // <export-rules> node
            Element exportRulesElement = resourcetorenderElement.addElement(N_STATICEXPORT_EXPORTRULES);

            Iterator<CmsStaticExportExportRule> exportRules = m_staticExportManager.getExportRules().iterator();
            while (exportRules.hasNext()) {
                CmsStaticExportExportRule rule = exportRules.next();
                // <export-rule> node
                Element exportRuleElement = exportRulesElement.addElement(N_STATICEXPORT_EXPORTRULE);
                exportRuleElement.addElement(N_STATICEXPORT_NAME).addText(rule.getName());
                exportRuleElement.addElement(N_STATICEXPORT_DESCRIPTION).addText(rule.getDescription());
                // <modified-resources> node and <regex> subnodes
                Element modifiedElement = exportRuleElement.addElement(N_STATICEXPORT_MODIFIED);
                Iterator<Pattern> itMods = rule.getModifiedResources().iterator();
                while (itMods.hasNext()) {
                    Pattern regex = itMods.next();
                    modifiedElement.addElement(N_STATICEXPORT_REGEX).addText(regex.pattern());
                }
                // <export-resources> node and <uri> subnodes
                Element exportResourcesElement = exportRuleElement.addElement(N_STATICEXPORT_EXPORT);
                Iterator<String> itExps = rule.getExportResourcePatterns().iterator();
                while (itExps.hasNext()) {
                    String uri = itExps.next();
                    exportResourcesElement.addElement(N_STATICEXPORT_URI).addText(uri);
                }
            }
        }

        if (!m_staticExportManager.getRfsRules().isEmpty()) {
            // <rfs-rules> node
            Element rfsRulesElement = rendersettingsElement.addElement(N_STATICEXPORT_RFS_RULES);

            Iterator<CmsStaticExportRfsRule> rfsRules = m_staticExportManager.getRfsRules().iterator();
            while (rfsRules.hasNext()) {
                CmsStaticExportRfsRule rule = rfsRules.next();
                // <rfs-rule> node and subnodes
                Element rfsRuleElement = rfsRulesElement.addElement(N_STATICEXPORT_RFS_RULE);
                rfsRuleElement.addElement(N_STATICEXPORT_NAME).addText(rule.getName());
                rfsRuleElement.addElement(N_STATICEXPORT_DESCRIPTION).addText(rule.getDescription());
                rfsRuleElement.addElement(N_STATICEXPORT_SOURCE).addText(rule.getSource().pattern());
                rfsRuleElement.addElement(N_STATICEXPORT_RFS_PREFIX).addText(rule.getRfsPrefixConfigured());
                rfsRuleElement.addElement(N_STATICEXPORT_EXPORTPATH).addText(rule.getExportPathConfigured());
                if (rule.getExportWorkPathConfigured() != null) {
                    rfsRuleElement.addElement(N_STATICEXPORT_EXPORTWORKPATH).addText(
                        rule.getExportWorkPathConfigured());
                }
                if (rule.getExportBackups() != null) {
                    rfsRuleElement.addElement(N_STATICEXPORT_EXPORTBACKUPS).addText(
                        String.valueOf(rule.getExportBackups()));
                }
                if (rule.getUseRelativeLinks() != null) {
                    rfsRuleElement.addElement(N_STATICEXPORT_RELATIVELINKS).addText(
                        rule.getUseRelativeLinks().toString());
                }
                Element relatedSystemRes = rfsRuleElement.addElement(N_STATICEXPORT_RELATED_SYSTEM_RES);
                Iterator<Pattern> itSystemRes = rule.getRelatedSystemResources().iterator();
                while (itSystemRes.hasNext()) {
                    Pattern sysRes = itSystemRes.next();
                    relatedSystemRes.addElement(N_STATICEXPORT_REGEX).addText(sysRes.pattern());
                }
            }

        }

        if (m_staticExportManager.getProtectedExportPath() != null) {
            Element streamingEl = parent.addElement(N_PROTECTED_EXPORT);
            streamingEl.addElement(N_STATICEXPORT_EXPORTPATH).setText(m_staticExportManager.getProtectedExportPath());
            Element exportpoints = streamingEl.addElement(I_CmsXmlConfiguration.N_EXPORTPOINTS);
            for (Entry<String, String> entry : m_staticExportManager.getProtectedExportPoints().entrySet()) {
                Element point = exportpoints.addElement(I_CmsXmlConfiguration.N_EXPORTPOINT);
                point.addAttribute(I_CmsXmlConfiguration.A_URI, entry.getKey());
                point.addAttribute(I_CmsXmlConfiguration.A_DESTINATION, entry.getValue());
            }
        }

        if (m_importExportManager.getUserExportSettings() != null) {
            // <usercsvexport>
            Element userExportElement = parent.addElement(N_USERCSVEXPORT);

            userExportElement.addElement(N_SEPARATOR).setText(
                m_importExportManager.getUserExportSettings().getSeparator());
            Element exportColumns = userExportElement.addElement(N_COLUMNS);
            List<String> exportColumnList = m_importExportManager.getUserExportSettings().getColumns();
            Iterator<String> itExportColumnList = exportColumnList.iterator();
            while (itExportColumnList.hasNext()) {
                exportColumns.addElement(N_COLUMN).setText(itExportColumnList.next());
            }
            // </usercsvexport>
        }

        if (m_repositoryManager.isConfigured()) {
            List<I_CmsRepository> repositories = m_repositoryManager.getRepositories();
            if (repositories != null) {

                // <repositories> node
                Element repositoriesElement = parent.addElement(N_REPOSITORIES);

                Iterator<I_CmsRepository> repositoriesIt = repositories.iterator();
                while (repositoriesIt.hasNext()) {

                    // <repository> node
                    I_CmsRepository repository = repositoriesIt.next();
                    Element repositoryElement = repositoriesElement.addElement(N_REPOSITORY);
                    repositoryElement.addAttribute(A_NAME, repository.getName());
                    repositoryElement.addAttribute(A_CLASS, repository.getClass().getName());

                    // <params> node
                    CmsParameterConfiguration config = repository.getConfiguration();
                    if ((config != null) && (config.size() > 0)) {
                        Element paramsElement = repositoryElement.addElement(N_PARAMS);
                        config.appendToXml(paramsElement);
                    }

                    // <filter> node
                    CmsRepositoryFilter filter = repository.getFilter();
                    if (filter != null) {
                        List<Pattern> rules = filter.getFilterRules();
                        if (rules.size() > 0) {
                            Element filterElement = repositoryElement.addElement(N_FILTER);
                            filterElement.addAttribute(A_TYPE, filter.getType());

                            // <regex> nodes
                            Iterator<Pattern> it = rules.iterator();
                            while (it.hasNext()) {
                                Pattern rule = it.next();
                                filterElement.addElement(N_REGEX).addText(rule.pattern());
                            }
                        }
                    }
                }
            }
        }
        CmsExtendedHtmlImportDefault htmlimport = m_importExportManager.getExtendedHtmlImportDefault(true);
        if (htmlimport != null) {
            // <extendedhtmlimport>
            Element htmlImportElement = parent.addElement(N_EXTHTMLIMPORT);
            // <destination> node
            if (!CmsStringUtil.isEmptyOrWhitespaceOnly(htmlimport.getDestinationDir())) {
                htmlImportElement.addElement(N_EXTHTMLIMPORT_DESTINATION).setText(htmlimport.getDestinationDir());
            }
            // <input> node
            if (!CmsStringUtil.isEmptyOrWhitespaceOnly(htmlimport.getInputDir())) {
                htmlImportElement.addElement(N_EXTHTMLIMPORT_INPUT).setText(htmlimport.getInputDir());
            }

            // <galleries> node
            Element galleryElement = htmlImportElement.addElement(N_EXTHTMLIMPORT_GALLERIES);
            // <download> node
            if (!CmsStringUtil.isEmptyOrWhitespaceOnly(htmlimport.getDownloadGallery())) {
                galleryElement.addElement(N_EXTHTMLIMPORT_DOWNLOAD).setText(htmlimport.getDownloadGallery());
            }
            // <image> node
            if (!CmsStringUtil.isEmptyOrWhitespaceOnly(htmlimport.getImageGallery())) {
                galleryElement.addElement(N_EXTHTMLIMPORT_IMAGE).setText(htmlimport.getImageGallery());
            }
            // <externallink> node
            if (!CmsStringUtil.isEmptyOrWhitespaceOnly(htmlimport.getLinkGallery())) {
                galleryElement.addElement(N_EXTHTMLIMPORT_EXTERNALLINK).setText(htmlimport.getLinkGallery());
            }

            // <settings> node
            Element settingElement = htmlImportElement.addElement(N_EXTHTMLIMPORT_SETTINGS);
            // <template> node
            settingElement.addElement(N_EXTHTMLIMPORT_TEMPLATE).setText(htmlimport.getTemplate());
            // <element> node
            settingElement.addElement(N_EXTHTMLIMPORT_ELEMENT).setText(htmlimport.getElement());
            // <locale> node
            settingElement.addElement(N_EXTHTMLIMPORT_LOCALE).setText(htmlimport.getLocale());
            // <encoding> node
            settingElement.addElement(N_EXTHTMLIMPORT_ENCODING).setText(htmlimport.getEncoding());

            // <pattern> node
            Element patternElement = settingElement.addElement(N_EXTHTMLIMPORT_PATTERN);
            // <start> node
            if (!CmsStringUtil.isEmptyOrWhitespaceOnly(htmlimport.getStartPattern())) {
                patternElement.addElement(N_EXTHTMLIMPORT_PATTERN_START).setText(htmlimport.getStartPattern());
            }
            // <end> node
            if (!CmsStringUtil.isEmptyOrWhitespaceOnly(htmlimport.getEndPattern())) {
                patternElement.addElement(N_EXTHTMLIMPORT_PATTERN_END).setText(htmlimport.getEndPattern());
            }

            // <overwrite> node
            settingElement.addElement(N_EXTHTMLIMPORT_OVERWRITE).setText(htmlimport.getOverwrite());
            // <keepbrokenlinks> node
            settingElement.addElement(N_EXTHTMLIMPORT_KEEPBROKENLINKS).setText(htmlimport.getKeepBrokenLinks());
            // </extendedhtmlimport>
        }

        // return the configured node
        return importexportElement;
    }
public Element generateXml ( Element parent ) { Element importexportElement = parent . addElement ( N_IMPORTEXPORT ) ; Element resourceloadersElement = importexportElement . addElement ( N_IMPORTEXPORTHANDLERS ) ; List < I_CmsImportExportHandler > handlers = m_importExportManager . getImportExportHandlers ( ) ; Iterator < I_CmsImportExportHandler > handlerIt = handlers . iterator ( ) ; while ( handlerIt . hasNext ( ) ) { I_CmsImportExportHandler handler = handlerIt . next ( ) ; Element loaderNode = resourceloadersElement . addElement ( N_IMPORTEXPORTHANDLER ) ; loaderNode . addAttribute ( A_CLASS , handler . getClass ( ) . getName ( ) ) ; } Element importElement = importexportElement . addElement ( N_IMPORT ) ; importElement . addElement ( N_OVERWRITE ) . setText ( String . valueOf ( m_importExportManager . overwriteCollidingResources ( ) ) ) ; importElement . addElement ( N_CONVERT ) . setText ( String . valueOf ( m_importExportManager . convertToXmlPage ( ) ) ) ; if ( m_importExportManager . getOldWebAppUrl ( ) != null ) { importElement . addElement ( N_OLDWEBAPPURL ) . setText ( m_importExportManager . getOldWebAppUrl ( ) ) ; } Element resourcetypesElement = importElement . addElement ( N_IMPORTVERSIONS ) ; Iterator < I_CmsImport > importVersions = m_importExportManager . getImportVersionClasses ( ) . iterator ( ) ; while ( importVersions . hasNext ( ) ) { resourcetypesElement . addElement ( N_IMPORTVERSION ) . addAttribute ( A_CLASS , importVersions . next ( ) . getClass ( ) . getName ( ) ) ; } Element immutablesElement = importElement . addElement ( N_IMMUTABLES ) ; Iterator < String > immutables = m_importExportManager . getImmutableResources ( ) . iterator ( ) ; while ( immutables . hasNext ( ) ) { String uri = immutables . next ( ) ; immutablesElement . addElement ( N_RESOURCE ) . addAttribute ( A_URI , uri ) ; } Element principalsElement = importElement . addElement ( N_PRINCIPALTRANSLATIONS ) ; Iterator < String > userTranslationKeys = m_importExportManager . getImportUserTranslations ( ) . keySet ( ) . iterator ( ) ; while ( userTranslationKeys . hasNext ( ) ) { String from = userTranslationKeys . next ( ) ; String to = m_importExportManager . getImportUserTranslations ( ) . get ( from ) ; principalsElement . addElement ( N_PRINCIPALTRANSLATION ) . addAttribute ( A_TYPE , I_CmsPrincipal . PRINCIPAL_USER ) . addAttribute ( A_FROM , from ) . addAttribute ( A_TO , to ) ; } Iterator < String > groupTranslationKeys = m_importExportManager . getImportGroupTranslations ( ) . keySet ( ) . iterator ( ) ; while ( groupTranslationKeys . hasNext ( ) ) { String from = groupTranslationKeys . next ( ) ; String to = m_importExportManager . getImportGroupTranslations ( ) . get ( from ) ; principalsElement . addElement ( N_PRINCIPALTRANSLATION ) . addAttribute ( A_TYPE , I_CmsPrincipal . PRINCIPAL_GROUP ) . addAttribute ( A_FROM , from ) . addAttribute ( A_TO , to ) ; } Element propertiesElement = importElement . addElement ( N_IGNOREDPROPERTIES ) ; Iterator < String > ignoredProperties = m_importExportManager . getIgnoredProperties ( ) . iterator ( ) ; while ( ignoredProperties . hasNext ( ) ) { String property = ignoredProperties . next ( ) ; propertiesElement . addElement ( N_PROPERTY ) . addAttribute ( A_NAME , property ) ; } Element exportElement = importexportElement . addElement ( N_EXPORT ) ; Map < TimestampMode , List < String > > defaultTimestampModes = m_importExportManager . getDefaultTimestampModes ( ) ; if ( ! defaultTimestampModes . isEmpty ( ) ) { Element defaultTimestampModesElement = exportElement . addElement ( N_EXPORT_DEFAULTTIMESTAMPMODES ) ; for ( TimestampMode mode : defaultTimestampModes . keySet ( ) ) { Element timestampModeElement = defaultTimestampModesElement . addElement ( N_EXPORT_TIMESTAMPMODE ) ; timestampModeElement . addAttribute ( A_MODE , mode . toString ( ) . toLowerCase ( ) ) ; for ( String resourcetypeName : defaultTimestampModes . get ( mode ) ) { Element resourcetypeElement = timestampModeElement . addElement ( N_EXPORT_RESOURCETYPENAME ) ; resourcetypeElement . addText ( resourcetypeName ) ; } } } List < String > tempExportpointPaths = m_importExportManager . getTempExportPointPaths ( ) ; for ( String path : tempExportpointPaths ) { importexportElement . addElement ( N_TEMP_EXPORTPONT_PATH ) . addText ( path ) ; } Element staticexportElement = parent . addElement ( N_STATICEXPORT ) ; staticexportElement . addAttribute ( A_ENABLED , m_staticExportManager . getExportEnabled ( ) ) ; staticexportElement . addElement ( N_STATICEXPORT_HANDLER ) . addText ( m_staticExportManager . getHandler ( ) . getClass ( ) . getName ( ) ) ; staticexportElement . addElement ( N_LINKSUBSTITUTION_HANDLER ) . addText ( m_staticExportManager . getLinkSubstitutionHandler ( ) . getClass ( ) . getName ( ) ) ; String exportPathUnmodified = m_staticExportManager . getExportPathForConfiguration ( ) ; if ( exportPathUnmodified . endsWith ( File . separator ) ) { exportPathUnmodified = exportPathUnmodified . substring ( 0 , exportPathUnmodified . length ( ) - 1 ) ; } staticexportElement . addElement ( N_STATICEXPORT_EXPORTPATH ) . addText ( exportPathUnmodified ) ; String exportWorkPathUnmodified = m_staticExportManager . getExportWorkPathForConfiguration ( ) ; if ( exportWorkPathUnmodified != null ) { if ( exportWorkPathUnmodified . endsWith ( File . separator ) ) { exportWorkPathUnmodified = exportWorkPathUnmodified . substring ( 0 , exportWorkPathUnmodified . length ( ) - 1 ) ; } staticexportElement . addElement ( N_STATICEXPORT_EXPORTWORKPATH ) . addText ( exportWorkPathUnmodified ) ; } if ( m_staticExportManager . getExportBackups ( ) != null ) { String exportBackupsUnmodified = String . valueOf ( m_staticExportManager . getExportBackups ( ) ) ; staticexportElement . addElement ( N_STATICEXPORT_EXPORTBACKUPS ) . addText ( exportBackupsUnmodified ) ; } staticexportElement . addElement ( N_STATICEXPORT_DEFAULT ) . addText ( m_staticExportManager . getDefault ( ) ) ; Element defaultsuffixesElement = staticexportElement . addElement ( N_STATICEXPORT_DEFAULTSUFFIXES ) ; Iterator < String > exportSuffixes = m_staticExportManager . getExportSuffixes ( ) . iterator ( ) ; while ( exportSuffixes . hasNext ( ) ) { String suffix = exportSuffixes . next ( ) ; Element suffixElement = defaultsuffixesElement . addElement ( N_STATICEXPORT_SUFFIX ) ; suffixElement . addAttribute ( A_KEY , suffix ) ; } Iterator < String > exportHandlers = m_staticExportManager . getExportHeaders ( ) . iterator ( ) ; if ( exportHandlers . hasNext ( ) ) { Element exportheadersElement = staticexportElement . addElement ( N_STATICEXPORT_EXPORTHEADERS ) ; while ( exportHandlers . hasNext ( ) ) { String header = exportHandlers . next ( ) ; exportheadersElement . addElement ( N_STATICEXPORT_HEADER ) . addText ( header ) ; } } String acceptlanguage = m_staticExportManager . getAcceptLanguageHeader ( ) ; String acceptcharset = m_staticExportManager . getAcceptCharsetHeader ( ) ; String remoteaddr = m_staticExportManager . getRemoteAddr ( ) ; if ( ( acceptlanguage != null ) || ( acceptcharset != null ) || ( remoteaddr != null ) ) { Element requestheadersElement = staticexportElement . addElement ( N_STATICEXPORT_REQUESTHEADERS ) ; if ( acceptlanguage != null ) { requestheadersElement . addElement ( N_STATICEXPORT_ACCEPTLANGUAGE ) . addText ( acceptlanguage ) ; } if ( acceptcharset != null ) { requestheadersElement . addElement ( N_STATICEXPORT_ACCEPTCHARSET ) . addText ( acceptcharset ) ; } if ( remoteaddr != null ) { requestheadersElement . addElement ( N_STATICEXPORT_REMOTEADDR ) . addText ( remoteaddr ) ; } } Element rendersettingsElement = staticexportElement . addElement ( N_STATICEXPORT_RENDERSETTINGS ) ; rendersettingsElement . addElement ( N_STATICEXPORT_RFS_PREFIX ) . addText ( m_staticExportManager . getRfsPrefixForConfiguration ( ) ) ; rendersettingsElement . addElement ( N_STATICEXPORT_VFS_PREFIX ) . addText ( m_staticExportManager . getVfsPrefixForConfiguration ( ) ) ; rendersettingsElement . addElement ( N_STATICEXPORT_RELATIVELINKS ) . addText ( m_staticExportManager . getRelativeLinks ( ) ) ; rendersettingsElement . addElement ( N_STATICEXPORT_EXPORTURL ) . addText ( m_staticExportManager . getExportUrlForConfiguration ( ) ) ; rendersettingsElement . addElement ( N_STATICEXPORT_PLAINOPTIMIZATION ) . addText ( m_staticExportManager . getPlainExportOptimization ( ) ) ; Element testresourceElement = rendersettingsElement . addElement ( N_STATICEXPORT_TESTRESOURCE ) ; testresourceElement . addAttribute ( A_URI , m_staticExportManager . getTestResource ( ) ) ; Element resourcetorenderElement = rendersettingsElement . addElement ( N_STATICEXPORT_RESOURCESTORENDER ) ; Iterator < String > exportFolderPatterns = m_staticExportManager . getExportFolderPatterns ( ) . iterator ( ) ; while ( exportFolderPatterns . hasNext ( ) ) { String pattern = exportFolderPatterns . next ( ) ; resourcetorenderElement . addElement ( N_STATICEXPORT_REGEX ) . addText ( pattern ) ; } if ( ! m_staticExportManager . getExportRules ( ) . isEmpty ( ) ) { Element exportRulesElement = resourcetorenderElement . addElement ( N_STATICEXPORT_EXPORTRULES ) ; Iterator < CmsStaticExportExportRule > exportRules = m_staticExportManager . getExportRules ( ) . iterator ( ) ; while ( exportRules . hasNext ( ) ) { CmsStaticExportExportRule rule = exportRules . next ( ) ; Element exportRuleElement = exportRulesElement . addElement ( N_STATICEXPORT_EXPORTRULE ) ; exportRuleElement . addElement ( N_STATICEXPORT_NAME ) . addText ( rule . getName ( ) ) ; exportRuleElement . addElement ( N_STATICEXPORT_DESCRIPTION ) . addText ( rule . getDescription ( ) ) ; Element modifiedElement = exportRuleElement . addElement ( N_STATICEXPORT_MODIFIED ) ; Iterator < Pattern > itMods = rule . getModifiedResources ( ) . iterator ( ) ; while ( itMods . hasNext ( ) ) { Pattern regex = itMods . next ( ) ; modifiedElement . addElement ( N_STATICEXPORT_REGEX ) . addText ( regex . pattern ( ) ) ; } Element exportResourcesElement = exportRuleElement . addElement ( N_STATICEXPORT_EXPORT ) ; Iterator < String > itExps = rule . getExportResourcePatterns ( ) . iterator ( ) ; while ( itExps . hasNext ( ) ) { String uri = itExps . next ( ) ; exportResourcesElement . addElement ( N_STATICEXPORT_URI ) . addText ( uri ) ; } } } if ( ! m_staticExportManager . getRfsRules ( ) . isEmpty ( ) ) { Element rfsRulesElement = rendersettingsElement . addElement ( N_STATICEXPORT_RFS_RULES ) ; Iterator < CmsStaticExportRfsRule > rfsRules = m_staticExportManager . getRfsRules ( ) . iterator ( ) ; while ( rfsRules . hasNext ( ) ) { CmsStaticExportRfsRule rule = rfsRules . next ( ) ; Element rfsRuleElement = rfsRulesElement . addElement ( N_STATICEXPORT_RFS_RULE ) ; rfsRuleElement . addElement ( N_STATICEXPORT_NAME ) . addText ( rule . getName ( ) ) ; rfsRuleElement . addElement ( N_STATICEXPORT_DESCRIPTION ) . addText ( rule . getDescription ( ) ) ; rfsRuleElement . addElement ( N_STATICEXPORT_SOURCE ) . addText ( rule . getSource ( ) . pattern ( ) ) ; rfsRuleElement . addElement ( N_STATICEXPORT_RFS_PREFIX ) . addText ( rule . getRfsPrefixConfigured ( ) ) ; rfsRuleElement . addElement ( N_STATICEXPORT_EXPORTPATH ) . addText ( rule . getExportPathConfigured ( ) ) ; if ( rule . getExportWorkPathConfigured ( ) != null ) { rfsRuleElement . addElement ( N_STATICEXPORT_EXPORTWORKPATH ) . addText ( rule . getExportWorkPathConfigured ( ) ) ; } if ( rule . getExportBackups ( ) != null ) { rfsRuleElement . addElement ( N_STATICEXPORT_EXPORTBACKUPS ) . addText ( String . valueOf ( rule . getExportBackups ( ) ) ) ; } if ( rule . getUseRelativeLinks ( ) != null ) { rfsRuleElement . addElement ( N_STATICEXPORT_RELATIVELINKS ) . addText ( rule . getUseRelativeLinks ( ) . toString ( ) ) ; } Element relatedSystemRes = rfsRuleElement . addElement ( N_STATICEXPORT_RELATED_SYSTEM_RES ) ; Iterator < Pattern > itSystemRes = rule . getRelatedSystemResources ( ) . iterator ( ) ; while ( itSystemRes . hasNext ( ) ) { Pattern sysRes = itSystemRes . next ( ) ; relatedSystemRes . addElement ( N_STATICEXPORT_REGEX ) . addText ( sysRes . pattern ( ) ) ; } } } if ( m_staticExportManager . getProtectedExportPath ( ) != null ) { Element streamingEl = parent . addElement ( N_PROTECTED_EXPORT ) ; streamingEl . addElement ( N_STATICEXPORT_EXPORTPATH ) . setText ( m_staticExportManager . getProtectedExportPath ( ) ) ; Element exportpoints = streamingEl . addElement ( I_CmsXmlConfiguration . N_EXPORTPOINTS ) ; for ( Entry < String , String > entry : m_staticExportManager . getProtectedExportPoints ( ) . entrySet ( ) ) { Element point = exportpoints . addElement ( I_CmsXmlConfiguration . N_EXPORTPOINT ) ; point . addAttribute ( I_CmsXmlConfiguration . A_URI , entry . getKey ( ) ) ; point . addAttribute ( I_CmsXmlConfiguration . A_DESTINATION , entry . getValue ( ) ) ; } } if ( m_importExportManager . getUserExportSettings ( ) != null ) { Element userExportElement = parent . addElement ( N_USERCSVEXPORT ) ; userExportElement . addElement ( N_SEPARATOR ) . setText ( m_importExportManager . getUserExportSettings ( ) . getSeparator ( ) ) ; Element exportColumns = userExportElement . addElement ( N_COLUMNS ) ; List < String > exportColumnList = m_importExportManager . getUserExportSettings ( ) . getColumns ( ) ; Iterator < String > itExportColumnList = exportColumnList . iterator ( ) ; while ( itExportColumnList . hasNext ( ) ) { exportColumns . addElement ( N_COLUMN ) . setText ( itExportColumnList . next ( ) ) ; } } if ( m_repositoryManager . isConfigured ( ) ) { List < I_CmsRepository > repositories = m_repositoryManager . getRepositories ( ) ; if ( repositories != null ) { Element repositoriesElement = parent . addElement ( N_REPOSITORIES ) ; Iterator < I_CmsRepository > repositoriesIt = repositories . iterator ( ) ; while ( repositoriesIt . hasNext ( ) ) { I_CmsRepository repository = repositoriesIt . next ( ) ; Element repositoryElement = repositoriesElement . addElement ( N_REPOSITORY ) ; repositoryElement . addAttribute ( A_NAME , repository . getName ( ) ) ; repositoryElement . addAttribute ( A_CLASS , repository . getClass ( ) . getName ( ) ) ; CmsParameterConfiguration config = repository . getConfiguration ( ) ; if ( ( config != null ) && ( config . size ( ) > 0 ) ) { Element paramsElement = repositoryElement . addElement ( N_PARAMS ) ; config . appendToXml ( paramsElement ) ; } CmsRepositoryFilter filter = repository . getFilter ( ) ; if ( filter != null ) { List < Pattern > rules = filter . getFilterRules ( ) ; if ( rules . size ( ) > 0 ) { Element filterElement = repositoryElement . addElement ( N_FILTER ) ; filterElement . addAttribute ( A_TYPE , filter . getType ( ) ) ; Iterator < Pattern > it = rules . iterator ( ) ; while ( it . hasNext ( ) ) { Pattern rule = it . next ( ) ; filterElement . addElement ( N_REGEX ) . addText ( rule . pattern ( ) ) ; } } } } } } CmsExtendedHtmlImportDefault htmlimport = m_importExportManager . getExtendedHtmlImportDefault ( true ) ; if ( htmlimport != null ) { Element htmlImportElement = parent . addElement ( N_EXTHTMLIMPORT ) ; if ( ! CmsStringUtil . isEmptyOrWhitespaceOnly ( htmlimport . getDestinationDir ( ) ) ) { htmlImportElement . addElement ( N_EXTHTMLIMPORT_DESTINATION ) . setText ( htmlimport . getDestinationDir ( ) ) ; } if ( ! CmsStringUtil . isEmptyOrWhitespaceOnly ( htmlimport . getInputDir ( ) ) ) { htmlImportElement . addElement ( N_EXTHTMLIMPORT_INPUT ) . setText ( htmlimport . getInputDir ( ) ) ; } Element galleryElement = htmlImportElement . addElement ( N_EXTHTMLIMPORT_GALLERIES ) ; if ( ! CmsStringUtil . isEmptyOrWhitespaceOnly ( htmlimport . getDownloadGallery ( ) ) ) { galleryElement . addElement ( N_EXTHTMLIMPORT_DOWNLOAD ) . setText ( htmlimport . getDownloadGallery ( ) ) ; } if ( ! CmsStringUtil . isEmptyOrWhitespaceOnly ( htmlimport . getImageGallery ( ) ) ) { galleryElement . addElement ( N_EXTHTMLIMPORT_IMAGE ) . setText ( htmlimport . getImageGallery ( ) ) ; } if ( ! CmsStringUtil . isEmptyOrWhitespaceOnly ( htmlimport . getLinkGallery ( ) ) ) { galleryElement . addElement ( N_EXTHTMLIMPORT_EXTERNALLINK ) . setText ( htmlimport . getLinkGallery ( ) ) ; } Element settingElement = htmlImportElement . addElement ( N_EXTHTMLIMPORT_SETTINGS ) ; settingElement . addElement ( N_EXTHTMLIMPORT_TEMPLATE ) . setText ( htmlimport . getTemplate ( ) ) ; settingElement . addElement ( N_EXTHTMLIMPORT_ELEMENT ) . setText ( htmlimport . getElement ( ) ) ; settingElement . addElement ( N_EXTHTMLIMPORT_LOCALE ) . setText ( htmlimport . getLocale ( ) ) ; settingElement . addElement ( N_EXTHTMLIMPORT_ENCODING ) . setText ( htmlimport . getEncoding ( ) ) ; Element patternElement = settingElement . addElement ( N_EXTHTMLIMPORT_PATTERN ) ; if ( ! CmsStringUtil . isEmptyOrWhitespaceOnly ( htmlimport . getStartPattern ( ) ) ) { patternElement . addElement ( N_EXTHTMLIMPORT_PATTERN_START ) . setText ( htmlimport . getStartPattern ( ) ) ; } if ( ! CmsStringUtil . isEmptyOrWhitespaceOnly ( htmlimport . getEndPattern ( ) ) ) { patternElement . addElement ( N_EXTHTMLIMPORT_PATTERN_END ) . setText ( htmlimport . getEndPattern ( ) ) ; } settingElement . addElement ( N_EXTHTMLIMPORT_OVERWRITE ) . setText ( htmlimport . getOverwrite ( ) ) ; settingElement . addElement ( N_EXTHTMLIMPORT_KEEPBROKENLINKS ) . setText ( htmlimport . getKeepBrokenLinks ( ) ) ; } return importexportElement ; }
@see org.opencms.configuration.I_CmsXmlConfiguration#generateXml(org.dom4j.Element)