tim@747: package de.intevation.gnv.state;
tim@747:
sascha@779: import de.intevation.artifactdatabase.Config;
sascha@779:
sascha@779: import de.intevation.artifacts.CallContext;
sascha@779:
sascha@779: import de.intevation.gnv.state.exception.StateException;
sascha@779:
tim@747: import java.util.ArrayList;
tim@747: import java.util.Collection;
tim@747: import java.util.Map;
tim@747:
tim@747: import org.w3c.dom.Element;
tim@747: import org.w3c.dom.Node;
tim@747:
tim@747: /**
sascha@780: * @author Tim Englich
tim@747: *
tim@747: */
tim@747: public class PreSettingsTransferCoordinateSelectionState extends CoordinateSelectionState {
tim@747:
tim@747:
tim@747: /**
tim@747: * The UID of this Class.
tim@747: */
tim@747: private static final long serialVersionUID = -3972304838976884048L;
tim@747:
tim@747: private String transferPreSettingsName = null;
sascha@778:
tim@747: private String transferInputDataname = null;
tim@747: /**
tim@747: * Constructor
tim@747: */
tim@747: public PreSettingsTransferCoordinateSelectionState() {
tim@747: super();
tim@747: }
tim@747:
tim@747: /**
tim@747: * @see de.intevation.gnv.state.StateBase#initialize(java.lang.String, de.intevation.artifacts.CallContext)
tim@747: */
tim@747: @Override
tim@747: public void initialize(String uuid, CallContext context)
tim@747: throws StateException {
tim@747: Map preSettings = this.getPreSettings();
tim@747: if (preSettings != null){
tim@747: InputData ip = preSettings.get(transferPreSettingsName);
tim@747: if (ip != null){
tim@747: Collection localInputdata = new ArrayList(1);
tim@747: localInputdata.add(new DefaultInputData(transferInputDataname,
tim@747: ip.getValue()));
tim@747: this.putInputData(localInputdata, uuid);
tim@747: }
tim@747: }
sascha@778:
tim@747: super.initialize(uuid, context);
tim@747: }
tim@747:
tim@747: /**
tim@747: * @see de.intevation.gnv.state.StateBase#setup(org.w3c.dom.Node)
tim@747: */
tim@747: @Override
tim@747: public void setup(Node configuration) {
sascha@778:
tim@747: Element preSettingsNode = (Element)Config.getNodeXPath(configuration,
tim@747: "presettings-transfer");
tim@747: if (preSettingsNode != null){
tim@747: this.transferPreSettingsName = preSettingsNode.getAttribute("presetting");
tim@747: this.transferInputDataname = preSettingsNode.getAttribute("inputvalue");
tim@747: }
tim@747: super.setup(configuration);
tim@747: }
sascha@778:
sascha@778:
tim@747:
tim@747: }