Updates the property configuration for properties using WYSIWYG widgets.<p>

@param propertyConfig the property configuration
@param cms the CMS context
@param resource the current resource (may be null)
351146
public static void updateWysiwygConfig(
        Map<String, CmsXmlContentProperty> propertyConfig,
        CmsObject cms,
        CmsResource resource) {

        Map<String, CmsXmlContentProperty> wysiwygUpdates = Maps.newHashMap();
        String wysiwygConfig = null;
        for (Map.Entry<String, CmsXmlContentProperty> entry : propertyConfig.entrySet()) {
            CmsXmlContentProperty prop = entry.getValue();
            if (prop.getWidget().equals("wysiwyg")) {
                if (wysiwygConfig == null) {
                    String configStr = "";
                    try {
                        String filePath = OpenCms.getSystemInfo().getConfigFilePath(cms, "wysiwyg/property-widget");
                        String configFromVfs = (String)CmsVfsMemoryObjectCache.getVfsMemoryObjectCache().loadVfsObject(
                            cms,
                            filePath,
                            new Transformer() {

                                public Object transform(Object rootPath) {

                                    try {
                                        CmsFile file = cms.readFile(
                                            (String)rootPath,
                                            CmsResourceFilter.IGNORE_EXPIRATION);
                                        return new String(file.getContents(), "UTF-8");
                                    } catch (Exception e) {
                                        return "";
                                    }
                                }
                            });
                        configStr = configFromVfs;
                    } catch (Exception e) {
                        LOG.error(e.getLocalizedMessage(), e);
                    }

                    CmsHtmlWidgetOption opt = new CmsHtmlWidgetOption(configStr);
                    Locale locale = resource != null
                    ? OpenCms.getLocaleManager().getDefaultLocale(cms, resource)
                    : Locale.ENGLISH;
                    String json = CmsHtmlWidget.getJSONConfiguration(opt, cms, resource, locale).toString();
                    List<String> nums = Lists.newArrayList();
                    try {
                        for (byte b : json.getBytes("UTF-8")) {
                            nums.add("" + b);
                        }
                    } catch (UnsupportedEncodingException e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                    }
                    wysiwygConfig = "v:" + CmsStringUtil.listAsString(nums, ",");
                }
                CmsXmlContentProperty prop2 = prop.withConfig(wysiwygConfig);
                wysiwygUpdates.put(entry.getKey(), prop2);
            }
        }
        propertyConfig.putAll(wysiwygUpdates);
    }
63076
public void initPreferences(CmsWorkplaceManager wpManager) {

        CURRENT_DEFAULT_SETTINGS = this;
        Class<?> accessorClass = CmsUserSettingsStringPropertyWrapper.class;

        // first initialize all built-in preferences. these are:
        // a) Bean properties of CmsUserSettingsStringPropertyWrapper
        // b) Editor setting preferences
        // c) Gallery setting preferences
        PropertyDescriptor[] propDescs = PropertyUtils.getPropertyDescriptors(accessorClass);
        for (PropertyDescriptor descriptor : propDescs) {
            String name = descriptor.getName();
            Method getter = descriptor.getReadMethod();
            Method setter = descriptor.getWriteMethod();
            if ((getter == null) || (setter == null)) {
                continue;
            }

            PrefMetadata metadata = getter.getAnnotation(PrefMetadata.class);
            if (metadata == null) {
                CmsBuiltinPreference preference = new CmsBuiltinPreference(name);
                m_preferences.put(preference.getName(), preference);
            } else {
                try {
                    Constructor<?> constructor = metadata.type().getConstructor(String.class);
                    I_CmsPreference pref = (I_CmsPreference)constructor.newInstance(name);
                    m_preferences.put(pref.getName(), pref);
                } catch (Exception e) {
                    throw new RuntimeException(e);
                }
            }
        }

        Map<String, String> editorValues = getEditorSettings();
        if (wpManager.getWorkplaceEditorManager() != null) {
            for (String resType : wpManager.getWorkplaceEditorManager().getConfigurableEditors().keySet()) {
                if (!editorValues.containsKey(resType)) {
                    editorValues.put(resType, null);
                }
            }
        }
        for (Map.Entry<String, String> editorSettingEntry : editorValues.entrySet()) {
            CmsEditorPreference pref = new CmsEditorPreference(
                editorSettingEntry.getKey(),
                editorSettingEntry.getValue());
            m_preferences.put(pref.getName(), pref);
        }

        Map<String, String> galleryValues = new HashMap<String, String>(getStartGalleriesSettings());
        for (String key : wpManager.getGalleries().keySet()) {
            if (!galleryValues.containsKey(key)) {
                galleryValues.put(key, null);
            }
        }
        for (Map.Entry<String, String> galleryEntry : galleryValues.entrySet()) {
            CmsStartGallleryPreference pref = new CmsStartGallleryPreference(
                galleryEntry.getKey(),
                galleryEntry.getValue());
            m_preferences.put(pref.getName(), pref);
        }

        // Now process configured preferences. Each configuration entry is either
        // for a built-in preference, in which case we create a wrapper around the existing preference,
        // or for a custom user-defined preference.
        for (CmsPreferenceData prefData : m_preferenceData) {
            String name = prefData.getName();
            I_CmsPreference pref = null;
            if (m_preferences.containsKey(name)) {
                // we first remove the existing preference, because in a LinkedHashMap, put(key, value) will not
                // update the position of the entry if the key already exists
                pref = new CmsWrapperPreference(prefData, m_preferences.remove(name));
            } else {
                pref = new CmsUserDefinedPreference(
                    prefData.getName(),
                    prefData.getDefaultValue(),
                    prefData.getPropertyDefinition(),
                    prefData.getTab());
            }
            m_preferences.put(pref.getName(), pref);
            pref.setValue(this, prefData.getDefaultValue());
        }
    }
162610
public void setAdminCms(CmsObject cms) {

        if (m_adminCms != null) {
            LOG.error("Can not set admin CmsObject of configuration manager because it is already set.");
            return;
        }
        for (I_CmsXmlConfiguration config : m_configurations) {
            if (config instanceof I_CmsXmlConfigurationWithUpdateHandler) {
                ((I_CmsXmlConfigurationWithUpdateHandler)config).setCmsObject(cms);
            }
        }
        m_adminCms = cms;
    }
322994
private void replaceProperties(Set<CmsResource> matchedResources) {

        for (CmsResource resource : matchedResources) {
            try {
                CmsProperty prop = getCms().readPropertyObject(resource, m_settings.getProperty().getName(), false);
                Matcher matcher = Pattern.compile(m_settings.getSearchpattern()).matcher(prop.getValue());
                if (m_settings.getReplacepattern().isEmpty()) {
                    prop.setValue("", "");
                } else {
                    prop.setValue(matcher.replaceAll(m_settings.getReplacepattern()), CmsProperty.TYPE_INDIVIDUAL);
                }
                getCms().lockResource(resource);
                getCms().writePropertyObjects(resource, Collections.singletonList(prop));
                getCms().unlockResource(resource);
            } catch (CmsException e) {
                LOG.error("Ubable to change property", e);
            }
        }
    }
145781
private void parseProperty(I_CmsXmlContentLocation field) {

        CmsPropertyConfig propConfig = parseProperty(m_cms, field);
        m_propertyConfigs.add(propConfig);
    }
753574
public void addProperty(String propertyType) {

        if (m_properties == null) {
            // this list will be used and clean up in the importResource method
            m_properties = new HashMap<String, CmsProperty>();
        }
        try {
            if ((m_propertyName == null) || getIgnoredProperties().contains(m_propertyName)) {
                // continue if the current property (name) should be ignored or is null
                return;
            }
            CmsProperty property = m_properties.get(m_propertyName);
            if (property == null) {
                property = new CmsProperty();
                property.setName(m_propertyName);
                property.setAutoCreatePropertyDefinition(true);
                m_properties.put(m_propertyName, property);
            }

            if (m_propertyValue == null) {
                m_propertyValue = "";
            }

            if ((propertyType != null) && propertyType.equals(PROPERTY_ATTRIB_TYPE_SHARED)) {
                // it is a shared/resource property value
                property.setResourceValue(m_propertyValue);
            } else {
                // it is an individual/structure value
                property.setStructureValue(m_propertyValue);
            }
        } finally {
            m_propertyName = null;
            m_propertyValue = null;
        }
    }
901628
public synchronized void updateFromConfiguration(CmsUgcConfiguration config) {

        m_enabled = config.needsQueue();
        m_interval = config.getQueueInterval().isPresent() ? config.getQueueInterval().get().longValue() : 0;
        m_maxLength = config.getMaxQueueLength().isPresent()
        ? config.getMaxQueueLength().get().intValue()
        : Integer.MAX_VALUE;
    }
60212
private void parseSettingsConfig(CmsResource resource, Map<CmsUUID, List<CmsXmlContentProperty>> settingConfigs) {

        List<CmsXmlContentProperty> settingConfig = new ArrayList<>();

        try {
            CmsFile settingFile = m_cms.readFile(resource);
            CmsXmlContent settingContent = CmsXmlContentFactory.unmarshal(m_cms, settingFile);
            CmsXmlContentRootLocation location = new CmsXmlContentRootLocation(settingContent, Locale.ENGLISH);
            for (I_CmsXmlContentValueLocation settingLoc : location.getSubValues(CmsFormatterBeanParser.N_SETTING)) {
                CmsXmlContentProperty setting = CmsConfigurationReader.parseProperty(
                    m_cms,
                    settingLoc).getPropertyData();
                settingConfig.add(setting);
            }
            settingConfigs.put(resource.getStructureId(), settingConfig);
        } catch (Exception e) {
            LOG.error(e.getLocalizedMessage(), e);
        }
    }
433233
public static void setPropertyValue(BeanDefinitionBuilder builder, String propertyValue, String propertyName) {
        if (StringUtils.hasText(propertyValue)) {
            builder.addPropertyValue(propertyName, propertyValue);
        }
    }
417767
protected void setConfigProperty(String propName, String propValue) {
        if (System.getProperty(propName) == null) {
            System.setProperty(propName, propValue);
        }
    }
1362482
public static void setFessConfig(final FessConfig fessConfig) {
        ComponentUtil.fessConfig = fessConfig;
        if (fessConfig == null) {
            FessProp.propMap.clear();
            componentMap.clear();
        }
    }
1098172
private void saveProperties(String resourcePath, Map<String, String> properties) throws CmsException {

        CmsResource resource;
        CmsObject cms = getCmsObject();
        int pos = resourcePath.indexOf("?");
        String resName = resourcePath;
        if (pos > -1) {
            resName = resourcePath.substring(0, pos);
        }
        resource = cms.readResource(resName);

        if (properties != null) {
            for (Entry<String, String> entry : properties.entrySet()) {
                String propertyName = entry.getKey();
                String propertyValue = entry.getValue();
                if (CmsStringUtil.isEmptyOrWhitespaceOnly(propertyValue)) {
                    propertyValue = "";
                }
                try {
                    CmsProperty currentProperty = cms.readPropertyObject(resource, propertyName, false);
                    // detect if property is a null property or not
                    if (currentProperty.isNullProperty()) {
                        // create new property object and set key and value
                        currentProperty = new CmsProperty();
                        currentProperty.setName(propertyName);
                        if (OpenCms.getWorkplaceManager().isDefaultPropertiesOnStructure()) {
                            // set structure value
                            currentProperty.setStructureValue(propertyValue);
                            currentProperty.setResourceValue(null);
                        } else {
                            // set resource value
                            currentProperty.setStructureValue(null);
                            currentProperty.setResourceValue(propertyValue);
                        }
                    } else if (currentProperty.getStructureValue() != null) {
                        // structure value has to be updated
                        currentProperty.setStructureValue(propertyValue);
                        currentProperty.setResourceValue(null);
                    } else {
                        // resource value has to be updated
                        currentProperty.setStructureValue(null);
                        currentProperty.setResourceValue(propertyValue);
                    }
                    CmsLock lock = cms.getLock(resource);
                    if (lock.isUnlocked()) {
                        // lock resource before operation
                        cms.lockResource(resName);
                    }
                    // write the property to the resource
                    cms.writePropertyObject(resName, currentProperty);
                    // unlock the resource
                    cms.unlockResource(resName);
                } catch (CmsException e) {
                    // writing the property failed, log error
                    log(e.getLocalizedMessage());
                }
            }
        }
    }
592241
private void setTemplate(CmsResource siteRootResource) {

        try {
            m_cms.lockResource(siteRootResource);
            // add template  property
            if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(m_template)) {
                CmsProperty prop = new CmsProperty(CmsPropertyDefinition.PROPERTY_TEMPLATE, m_template, m_template);
                m_cms.writePropertyObject(siteRootResource.getRootPath(), prop);
            }
            m_cms.unlockResource(siteRootResource);
        } catch (CmsException e) {
            LOG.error("Error on adding template", e);
        }
    }
879665
@Override
	public void configure(ConfigParams config) {
		_name = config.getAsStringWithDefault("name", _name);
		_name = config.getAsStringWithDefault("info.name", _name);

		_description = config.getAsStringWithDefault("description", _description);
		_description = config.getAsStringWithDefault("info.description", _description);

		_properties = config.getSection("properties");

	}
695608
public void init(CmsObject cms, List<CmsResource> resources) {

        m_cms = cms;
        m_resources = resources;
    }
54225
public void setWidget(I_CmsNotificationWidget widget) {

        if (m_widget != null) {
            m_widget.clearMessages();
        }
        m_widget = widget;
        m_widget.clearMessages();
        for (CmsNotificationMessage message : m_messages) {
            m_widget.addMessage(message);
        }
    }
292914
public synchronized void setConfigProperty(Config.ConfigProperty configProperty, Object configPropertyValue) {
        checkArgument(configProperty != null, "Config property cannot be null");
        checkArgument(checkNotInGlobalScope(configProperty),
                String.format("The configuration property (%s) is not supported in local config.", configProperty)); // NOSONAR
        checkArgument(configPropertyValue != null, "Config property value cannot be null");

        baseConfig.setProperty(configProperty.getName(), configPropertyValue);
    }