Example usage for org.apache.commons.configuration HierarchicalConfiguration setProperty

List of usage examples for org.apache.commons.configuration HierarchicalConfiguration setProperty

Introduction

In this page you can find the example usage for org.apache.commons.configuration HierarchicalConfiguration setProperty.

Prototype

public void setProperty(String key, Object value) 

Source Link

Document

Sets the value of the specified property.

Usage

From source file:org.pivot4j.ui.condition.CellTypeCondition.java

/**
 * @see org.pivot4j.ui.condition.AbstractCondition#saveSettings(org.apache.commons.configuration.HierarchicalConfiguration)
 *//*from   ww  w . j av a 2s. co m*/
@Override
public void saveSettings(HierarchicalConfiguration configuration) {
    super.saveSettings(configuration);

    if (cellType == null) {
        return;
    }

    configuration.setProperty("value", cellType);
}

From source file:org.pivot4j.ui.property.DefaultRenderPropertyList.java

/**
 * @see org.pivot4j.state.Configurable#saveSettings(org.apache.commons.configuration.HierarchicalConfiguration)
 */// w ww  . jav a  2  s.c om
@Override
public void saveSettings(HierarchicalConfiguration configuration) {
    int index = 0;

    for (RenderProperty property : properties.values()) {
        String name = String.format("property(%s)", index++);

        configuration.setProperty(name, "");

        SubnodeConfiguration propertyConfig = configuration.configurationAt(name);
        property.saveSettings(propertyConfig);
    }
}

From source file:org.talend.mdm.commmon.util.core.EncryptUtil.java

private static void encryptByXpath(HierarchicalConfiguration config, String xpath) throws Exception {
    String password = config.getString(xpath);
    if (StringUtils.isNotEmpty(password) && !password.endsWith(Crypt.ENCRYPT)) {
        config.setProperty(xpath, Crypt.encrypt(password));
        updated = true;//www. ja v  a  2  s .c om
    }
}

From source file:org.zaproxy.zap.control.AddOnLoader.java

private static void saveAddOnsRunState(Map<AddOn, List<String>> runnableAddOns) {
    HierarchicalConfiguration config = (HierarchicalConfiguration) Model.getSingleton().getOptionsParam()
            .getConfig();//from ww  w  .  j a va 2s.  co  m
    config.clearTree(ADDONS_RUNNABLE_BASE_KEY);

    int i = 0;
    for (Map.Entry<AddOn, List<String>> runnableAddOnEntry : runnableAddOns.entrySet()) {
        String elementBaseKey = ADDONS_RUNNABLE_KEY + "(" + i + ").";
        AddOn addOn = runnableAddOnEntry.getKey();

        config.setProperty(elementBaseKey + ADDON_RUNNABLE_ID_KEY, addOn.getId());
        config.setProperty(elementBaseKey + ADDON_RUNNABLE_VERSION_KEY,
                Integer.valueOf(addOn.getFileVersion()));

        String extensionBaseKey = elementBaseKey + ADDON_RUNNABLE_ALL_EXTENSIONS_KEY;
        for (String extension : runnableAddOnEntry.getValue()) {
            config.addProperty(extensionBaseKey, extension);
        }

        i++;
    }

    try {
        Model.getSingleton().getOptionsParam().getConfig().save();
    } catch (ConfigurationException e) {
        logger.error("Failed to save state of runnable add-ons:", e);
    }
}