view flys-client/src/main/java/de/intevation/flys/client/shared/model/PropertyGroup.java @ 5200:42bb6ff78d1b 2.9.11

Directly set the connectionInitSqls on the datasource Somehow the factory fails to set the connectionInitSqls if we add it to the dbcpProperties. So we now set it directly
author Andre Heinecke <aheinecke@intevation.de>
date Fri, 08 Mar 2013 11:48:33 +0100
parents 62332fa199bf
children
line wrap: on
line source
package de.intevation.flys.client.shared.model;

import java.util.ArrayList;
import java.util.List;

/**
 * A group of properties.
 * @author <a href="mailto:raimund.renkert@intevation.de">Raimund Renkert</a>
 */
public class PropertyGroup implements Property, Cloneable {

    /** The group name */
    protected String name;

    protected List<Property> properties;

    public PropertyGroup() {
    }

    public PropertyGroup(String name) {
        this.name = name;
    }

    public PropertyGroup(String name, List<Property> properties) {
        this.name = name;
        this.properties = properties;
    }

    public String getName() {
        return this.name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public List<Property> getProperties() {
        return this.properties;
    }

    public void setProperties(List<Property> properties) {
        this.properties = properties;
    }

    public Property getPropertyByName(String name) {
        for (int i = 0; i < properties.size(); i++) {
            if (properties.get(i).getName().equals(name)) {
                return properties.get(i);
            }
        }
        return null;
    }

    @Override
    public Object clone() {
        PropertyGroup clone = new PropertyGroup(this.getName());
        List<Property> cloneList = new ArrayList<Property>();
        for(Property p: properties) {
            cloneList.add((Property)p.clone());
        }
        clone.setProperties(cloneList);
        return clone;
    }

    @Override
    public String toString() {
        StringBuilder buf = new StringBuilder();

        for(Property p : properties) {
            buf.append(p.getName());
            buf.append("=");
            if(p instanceof PropertySetting) {
                buf.append(((PropertySetting)p).getValue().toString());
            }
            buf.append(" ");
        }

        return buf.toString();
    }
}

http://dive4elements.wald.intevation.org