view gnv-artifacts/src/main/java/de/intevation/gnv/state/PreSettingsTransferState.java @ 616:93978859fa9e

Added the Configuration and the Classes for the new Product Layer. The Product does not generate any output at this Time. gnv-artifacts/trunk@686 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Tim Englich <tim.englich@intevation.de>
date Fri, 12 Feb 2010 18:04:58 +0000
parents e86d37008fd1
children 1a0ed4c521bd
line wrap: on
line source
/**
 *
 */
package de.intevation.gnv.state;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Map;

import org.w3c.dom.Element;
import org.w3c.dom.Node;

import de.intevation.artifactdatabase.Config;
import de.intevation.artifacts.CallContext;
import de.intevation.gnv.state.exception.StateException;

/**
 * @author Tim Englich <tim.englich@intevation.de>
 *
 */
public class PreSettingsTransferState extends DefaultState {

    /**
     * The UID of this Class
     */
    private static final long serialVersionUID = 573381812690806922L;

    private String transferPreSettingsName = null;
    
    private String transferInputDataname = null;
    /**
     * Constructor
     */
    public PreSettingsTransferState() {
        super();
    }

    /**
     * @see de.intevation.gnv.state.StateBase#initialize(java.lang.String, de.intevation.artifacts.CallContext)
     */
    @Override
    public void initialize(String uuid, CallContext context)
                                                            throws StateException {
        Map<String, InputData> preSettings = this.getPreSettings();
        if (preSettings != null){
            InputData ip = preSettings.get(transferPreSettingsName);
            if (ip != null){
                Collection<InputData> localInputdata = new ArrayList<InputData>(1);
                localInputdata.add(new DefaultInputData(transferInputDataname,
                                                        ip.getValue()));
                this.putInputData(localInputdata, uuid);
            }
        }
        
        super.initialize(uuid, context);
    }

    /**
     * @see de.intevation.gnv.state.StateBase#setup(org.w3c.dom.Node)
     */
    @Override
    public void setup(Node configuration) {
        
        Element preSettingsNode = (Element)Config.getNodeXPath(configuration,
                                                         "presettings-transfer");
        if (preSettingsNode != null){
            this.transferPreSettingsName = preSettingsNode.getAttribute("presetting");
            this.transferPreSettingsName = preSettingsNode.getAttribute("inputvalue");
        }
        super.setup(configuration);
    }
    
    

}

http://dive4elements.wald.intevation.org