Converts a map of properties from client format to server format.<p>

@param cms the CmsObject to use for VFS operations
@param props the map of properties
@param propConfig the property configuration

@return the converted property map
433831
public static Map<String, String> convertPropertiesToServerFormat(
        CmsObject cms,
        Map<String, String> props,
        Map<String, CmsXmlContentProperty> propConfig) {

        return convertProperties(cms, props, propConfig, false);
    }
167801
public static CmsClientProperty createClientProperty(CmsProperty prop, boolean preserveOrigin) {

        CmsClientProperty result = new CmsClientProperty(
            prop.getName(),
            prop.getStructureValue(),
            prop.getResourceValue());
        if (preserveOrigin) {
            result.setOrigin(prop.getOrigin());
        }
        return result;
    }
60582
private void buildField(
        Map<String, CmsClientProperty> ownProps,
        final String propName,
        CmsClientProperty.Mode mode,
        CmsUUID id) {

        CmsXmlContentProperty propDef = m_propertyConfig.get(propName);

        if (propDef == null) {
            String widget = CmsClientProperty.PROPERTY_TEMPLATE.equals(propName) ? "template" : "string";
            propDef = new CmsXmlContentProperty(
                propName,
                "string",
                widget,
                "",
                null,
                null,
                null,
                null,
                null,
                null,
                null);
        }

        if (mode != Mode.effective) {
            propDef = propDef.withNiceName(propName);
        }

        CmsClientProperty ownProp = ownProps.get(propName);
        CmsPathValue pathValue = CmsClientProperty.getPathValue(ownProp, mode).prepend(id + "/" + propName + "/");

        //CHECK: should fields other than NavText be really automatically allowed to be empty in navigation mode?
        CmsBasicFormField field = CmsBasicFormField.createField(
            propDef,
            pathValue.getPath(),
            this,
            Collections.<String, String> emptyMap(),
            true);

        CmsPair<String, String> defaultValueAndOrigin = getDefaultValueToDisplay(ownProp, mode);
        String defaultValue = "";
        String origin = "";
        if (defaultValueAndOrigin != null) {
            defaultValue = defaultValueAndOrigin.getFirst();
            origin = defaultValueAndOrigin.getSecond();
        }
        Widget w = (Widget)field.getWidget();
        I_CmsStringModel model = getStringModel(pathValue);
        field.bind(model);
        boolean ghost = CmsStringUtil.isEmptyOrWhitespaceOnly(pathValue.getValue());
        String initialValue = pathValue.getValue();
        if (w instanceof I_CmsHasGhostValue) {
            ((I_CmsHasGhostValue)w).setGhostValue(defaultValue, ghost);
            if (ghost) {
                initialValue = null;
            }
        }

        boolean isShowingGhost = ghost && !CmsStringUtil.isEmpty(defaultValue);

        if (isShowingGhost) {
            field.getLayoutData().put("info", origin);
        }
        if (!ghost || isShowingGhost) {
            field.getLayoutData().put(CmsPropertyPanel.LD_DISPLAY_VALUE, "true");
        }
        field.getLayoutData().put(CmsPropertyPanel.LD_PROPERTY, propName);
        m_form.addField(field, initialValue);
    }
1304325
private void parseServerHeader(Map<Object, Object> props) {
        // @PK15848
        String value = getProp(props, HttpConfigConstants.PROPNAME_SERVER_HEADER_VALUE);
        if (null == value || "".equals(value)) {
            // due to security change, do not default value in Server header. // PM87013 Start
        } else {
            if ("DefaultServerVersion".equalsIgnoreCase(value)) {
                value = "WebSphere Application Server";
            }
            this.baServerHeaderValue = GenericUtils.getEnglishBytes(value);
            if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
                Tr.event(tc, "Config: server header value [" + value + "]");
            }
        }
        // PM87013 (PM75371) End

        Object ov = props.get(HttpConfigConstants.PROPNAME_REMOVE_SERVER_HEADER);
        if (null != ov) {
            this.bRemoveServerHeader = convertBoolean(ov);
            if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
                Tr.event(tc, "Config: remove server header is " + removeServerHeader());
            }
        }
    }
803708
public static List<ExtPluginConfiguration> listPluginConfigurations(
            final Map<String, String> props,
            final String keyprefix,
            final String serviceName
    )
    {
        return listPluginConfigurations(props, keyprefix, serviceName, false);

    }
1285949
private boolean hasNavigationProperty(CmsObject cms, CmsResource resource) throws CmsException {

        List<CmsProperty> props = cms.readPropertyObjects(resource, false);
        Map<String, String> propMap = CmsProperty.toMap(props);
        return propMap.containsKey(CmsPropertyDefinition.PROPERTY_NAVPOS)
            || propMap.containsKey(CmsPropertyDefinition.PROPERTY_NAVTEXT);
    }
964246
public String readProperty(String propertyName) {

        String propVal = null;
        try {
            propVal = getCms().readPropertyObject(getParamResource(), propertyName, false).getValue();
        } catch (CmsException e) {
            if (LOG.isInfoEnabled()) {
                LOG.info(e.getLocalizedMessage());
            }
        }
        if (CmsStringUtil.isEmpty(propVal)) {
            propVal = "";
        }
        return propVal;
    }
210043
public static CmsPropertyConfig parseProperty(CmsObject cms, I_CmsXmlContentLocation field) {

        String name = getString(cms, field.getSubValue(N_PROPERTY_NAME));
        String includeName = getString(cms, field.getSubValue(N_INCLUDE_NAME));
        String widget = getString(cms, field.getSubValue(N_WIDGET));
        String widgetConfig = getString(cms, field.getSubValue(N_WIDGET_CONFIG));
        String ruleRegex = getString(cms, field.getSubValue(N_RULE_REGEX));
        String ruleType = getString(cms, field.getSubValue(N_RULE_TYPE));
        String default1 = getString(cms, field.getSubValue(N_DEFAULT));
        String error = getString(cms, field.getSubValue(N_ERROR));
        String niceName = getString(cms, field.getSubValue(N_DISPLAY_NAME));
        String description = getString(cms, field.getSubValue(N_DESCRIPTION));
        String preferFolder = getString(cms, field.getSubValue(N_PREFER_FOLDER));

        String disabledStr = getString(cms, field.getSubValue(N_DISABLED));
        boolean disabled = ((disabledStr != null) && Boolean.parseBoolean(disabledStr));

        String orderStr = getString(cms, field.getSubValue(N_ORDER));
        int order = I_CmsConfigurationObject.DEFAULT_ORDER;

        try {
            order = Integer.parseInt(orderStr);
        } catch (NumberFormatException e) {
            // noop
        }

        Visibility visibility;
        String visibilityStr = getString(cms, field.getSubValue(N_VISIBILITY));
        try {
            // to stay compatible with former visibility option values
            if ("both".equals(visibilityStr)) {
                visibilityStr = Visibility.elementAndParentIndividual.name();
            } else if ("parent".equals(visibilityStr)) {
                visibilityStr = Visibility.parentShared.name();
            }
            visibility = Visibility.valueOf(visibilityStr);
        } catch (Exception e) {
            visibility = null;
        }
        CmsXmlContentProperty prop = new CmsXmlContentProperty(
            name,
            "string",
            visibility,
            widget,
            widgetConfig,
            ruleRegex,
            ruleType,
            default1,
            niceName,
            description,
            error,
            preferFolder).withIncludeName(includeName);
        // since these are real properties, using type vfslist makes no sense, so we always use the "string" type
        CmsPropertyConfig propConfig = new CmsPropertyConfig(prop, disabled, order);
        return propConfig;

    }
1160838
protected CmsFormatterConfiguration getFormattersFromSchema(CmsObject cms, CmsResource res) {

        try {
            return OpenCms.getResourceManager().getResourceType(res.getTypeId()).getFormattersForResource(cms, res);
        } catch (CmsException e) {
            LOG.error(e.getLocalizedMessage(), e);
            return CmsFormatterConfiguration.EMPTY_CONFIGURATION;
        }
    }
43202
protected Map<String, CmsProperty> getPropertiesByName(List<CmsProperty> properties) {

        Map<String, CmsProperty> result = new HashMap<String, CmsProperty>();
        for (CmsProperty property : properties) {
            String key = property.getName();
            result.put(key, property.clone());
        }
        return result;
    }
1003640
public static CmsFlexBucketConfiguration loadFromProperties(Properties properties) {

        ArrayListMultimap<String, String> multimap = ArrayListMultimap.create();
        List<String> clearAll = Lists.newArrayList();
        for (Object keyObj : properties.keySet()) {
            String key = (String)keyObj;
            key = key.trim();
            String value = (String)(properties.get(key));
            value = value.trim();
            if (key.startsWith(KEY_PREFIX_BUCKET)) {
                String bucketName = key.substring(KEY_PREFIX_BUCKET.length());
                multimap.putAll(bucketName, Arrays.asList(value.trim().split(" *, *")));
            } else if (KEY_CLEAR_ALL.equals(key)) {
                clearAll = Arrays.asList(value.trim().split(" *, *"));
            }
        }
        CmsFlexBucketConfiguration result = new CmsFlexBucketConfiguration();
        if (!clearAll.isEmpty()) {
            result.setClearAll(clearAll);
        }
        for (String key : multimap.keySet()) {
            result.add(key, multimap.get(key));
        }
        result.freeze();
        return result;
    }
1205339
public static Map<String, I_CmsFormField> createFields(Collection<CmsXmlContentProperty> propertyConfigurations) {

        // using LinkedHashMap to preserve the order
        Map<String, I_CmsFormField> result = new LinkedHashMap<String, I_CmsFormField>();
        for (CmsXmlContentProperty propConfig : propertyConfigurations) {
            CmsBasicFormField field = createField(propConfig);
            result.put(propConfig.getName(), field);
        }
        return result;

    }
431673
private CmsTemplateMapperConfiguration getConfiguration(final CmsObject cms) {

        if (!m_enabled) {
            return CmsTemplateMapperConfiguration.EMPTY_CONFIG;
        }

        if (m_configPath == null) {
            m_configPath = OpenCms.getSystemInfo().getConfigFilePath(cms, "template-mapping.xml");
        }

        return (CmsTemplateMapperConfiguration)(CmsVfsMemoryObjectCache.getVfsMemoryObjectCache().loadVfsObject(
            cms,
            m_configPath,
            new Transformer() {

                @Override
                public Object transform(Object input) {

                    try {
                        CmsFile file = cms.readFile(m_configPath, CmsResourceFilter.IGNORE_EXPIRATION);
                        SAXReader saxBuilder = new SAXReader();
                        try (ByteArrayInputStream stream = new ByteArrayInputStream(file.getContents())) {
                            Document document = saxBuilder.read(stream);
                            CmsTemplateMapperConfiguration config = new CmsTemplateMapperConfiguration(cms, document);
                            return config;
                        }
                    } catch (Exception e) {
                        LOG.warn(e.getLocalizedMessage(), e);
                        return new CmsTemplateMapperConfiguration(); // empty configuration, does not do anything
                    }

                }
            }));
    }
1225169
private List<String> getPropertyNames(CmsObject cms) throws CmsException {

        List<CmsPropertyDefinition> propDefs = cms.readAllPropertyDefinitions();
        List<String> result = new ArrayList<String>();
        for (CmsPropertyDefinition propDef : propDefs) {
            result.add(propDef.getName());
        }
        return result;
    }
1079635
protected A_CmsPropertyEditor createEntryEditor(
        I_CmsPropertyEditorHandler handler,
        Map<String, CmsXmlContentProperty> propConfig) {

        if (CmsSitemapView.getInstance().isNavigationMode()) {
            return new CmsNavModePropertyEditor(propConfig, handler);
        } else {
            boolean isFolder = handler.isFolder();
            CmsVfsModePropertyEditor result = new CmsVfsModePropertyEditor(propConfig, handler);
            result.setShowResourceProperties(!isFolder);
            return result;
        }
    }
390618
public CmsPropertiesBean loadPropertyData(CmsUUID id) throws CmsException {

        CmsObject cms = m_cms;
        String originalSiteRoot = cms.getRequestContext().getSiteRoot();
        CmsPropertiesBean result = new CmsPropertiesBean();
        CmsResource resource = cms.readResource(id, CmsResourceFilter.IGNORE_EXPIRATION);
        result.setReadOnly(!isWritable(cms, resource));
        result.setFolder(resource.isFolder());
        result.setContainerPage(CmsResourceTypeXmlContainerPage.isContainerPage(resource));
        String sitePath = cms.getSitePath(resource);
        Map<String, CmsXmlContentProperty> propertyConfig = OpenCms.getADEManager().lookupConfiguration(
            cms,
            resource.getRootPath()).getPropertyConfigurationAsMap();
        Map<String, CmsXmlContentProperty> defaultProperties = getDefaultProperties(

            Collections.singletonList(resource.getStructureId())).get(resource.getStructureId());
        Map<String, CmsXmlContentProperty> mergedConfig = new LinkedHashMap<String, CmsXmlContentProperty>();
        mergedConfig.putAll(defaultProperties);
        mergedConfig.putAll(propertyConfig);
        propertyConfig = mergedConfig;

        // Resolve macros in the property configuration
        propertyConfig = CmsXmlContentPropertyHelper.resolveMacrosInProperties(
            propertyConfig,
            CmsMacroResolver.newWorkplaceLocaleResolver(cms));
        updateWysiwygConfig(propertyConfig, cms, resource);

        result.setPropertyDefinitions(new LinkedHashMap<String, CmsXmlContentProperty>(propertyConfig));
        try {
            cms.getRequestContext().setSiteRoot("");
            String parentPath = CmsResource.getParentFolder(resource.getRootPath());
            CmsResource parent = cms.readResource(parentPath, CmsResourceFilter.IGNORE_EXPIRATION);
            List<CmsProperty> parentProperties = cms.readPropertyObjects(parent, true);
            List<CmsProperty> ownProperties = cms.readPropertyObjects(resource, false);
            result.setOwnProperties(convertProperties(ownProperties));
            result.setInheritedProperties(convertProperties(parentProperties));
            result.setPageInfo(CmsVfsService.getPageInfo(cms, resource));
            List<CmsPropertyDefinition> propDefs = cms.readAllPropertyDefinitions();
            List<String> propNames = new ArrayList<String>();
            for (CmsPropertyDefinition propDef : propDefs) {
                propNames.add(propDef.getName());
            }
            CmsTemplateFinder templateFinder = new CmsTemplateFinder(cms);
            result.setTemplates(templateFinder.getTemplates());
            result.setAllProperties(propNames);
            result.setStructureId(id);
            result.setSitePath(sitePath);
            return result;
        } finally {
            cms.getRequestContext().setSiteRoot(originalSiteRoot);
        }
    }
941618
protected Map<String, CmsClientProperty> convertProperties(List<CmsProperty> properties) {

        Map<String, CmsClientProperty> result = new HashMap<String, CmsClientProperty>();
        for (CmsProperty prop : properties) {
            CmsClientProperty clientProp = new CmsClientProperty(
                prop.getName(),
                prop.getStructureValue(),
                prop.getResourceValue());
            clientProp.setOrigin(prop.getOrigin());
            result.put(clientProp.getName(), clientProp);
        }
        return result;
    }