Example usage for org.springframework.beans.propertyeditors PropertiesEditor getValue

List of usage examples for org.springframework.beans.propertyeditors PropertiesEditor getValue

Introduction

In this page you can find the example usage for org.springframework.beans.propertyeditors PropertiesEditor getValue.

Prototype

public Object getValue() 

Source Link

Document

Gets the value of the property.

Usage

From source file:org.openvpms.component.business.service.security.memory.UserMapEditor.java

@Override
public void setAsText(String str) throws IllegalArgumentException {
    UserMap userMap = new UserMap();

    if (StringUtils.hasText(str)) {
        // Use properties editor to tokenize the string
        PropertiesEditor propertiesEditor = new PropertiesEditor();
        propertiesEditor.setAsText(str);

        Properties props = (Properties) propertiesEditor.getValue();
        addUsersFromProperties(userMap, props);
    }/*  w  w  w . j  ava 2  s .  c om*/

    setValue(userMap);
}

From source file:org.acegisecurity.intercept.method.MethodDefinitionSourceEditor.java

public void setAsText(String s) throws IllegalArgumentException {
    MethodDefinitionMap source = new MethodDefinitionMap();

    if ((s == null) || "".equals(s)) {
        // Leave value in property editor null
    } else {/*  w  ww .j  a  v  a2 s  .c  o m*/
        // Use properties editor to tokenize the string
        PropertiesEditor propertiesEditor = new PropertiesEditor();
        propertiesEditor.setAsText(s);

        Properties props = (Properties) propertiesEditor.getValue();

        // Now we have properties, process each one individually
        List mappings = new ArrayList();

        for (Iterator iter = props.keySet().iterator(); iter.hasNext();) {
            String name = (String) iter.next();
            String value = props.getProperty(name);

            MethodDefinitionSourceMapping mapping = new MethodDefinitionSourceMapping();
            mapping.setMethodName(name);

            String[] tokens = StringUtils.commaDelimitedListToStringArray(value);

            for (int i = 0; i < tokens.length; i++) {
                mapping.addConfigAttribute(tokens[i].trim());
            }

            mappings.add(mapping);
        }
        source.setMappings(mappings);
    }

    setValue(source);
}

From source file:org.pentaho.platform.plugin.services.security.userrole.memory.PentahoUserMapEditor.java

public void setAsText(String s) throws IllegalArgumentException {
    PentahoUserMap userMap = new PentahoUserMap();

    if ((s == null) || "".equals(s)) {
        // Leave value in property editor null
        logger.debug("Leaving value in property editor null");
    } else {/*from  www  . j  a v a2 s . c  o m*/
        // Use properties editor to tokenize the string
        PropertiesEditor propertiesEditor = new PropertiesEditor();
        propertiesEditor.setAsText(s);

        Properties props = (Properties) propertiesEditor.getValue();
        addUsersFromProperties(userMap, props);
    }

    setValue(userMap);
}

From source file:org.springframework.transaction.interceptor.TransactionAttributeSourceEditor.java

public void setAsText(String s) throws IllegalArgumentException {
    MethodMapTransactionAttributeSource source = new MethodMapTransactionAttributeSource();
    if (s == null || "".equals(s)) {
        // Leave value in property editor <code>null</code>
    } else {//w w w.  j  a  v a2 s  .co  m
        // Use properties editor to tokenize the hold string
        PropertiesEditor propertiesEditor = new PropertiesEditor();
        propertiesEditor.setAsText(s);
        Properties props = (Properties) propertiesEditor.getValue();

        // Now we have properties, process each one individually
        TransactionAttributeEditor tae = new TransactionAttributeEditor();
        for (Iterator iter = props.keySet().iterator(); iter.hasNext();) {
            String name = (String) iter.next();
            String value = props.getProperty(name);

            // Convert value to a transaction attribute
            tae.setAsText(value);
            TransactionAttribute attr = (TransactionAttribute) tae.getValue();

            // Register name and attribute
            source.addTransactionalMethod(name, attr);
        }
    }
    setValue(source);
}