tim@61: /** tim@61: * tim@61: */ tim@61: package de.intevation.gnv.transition; tim@61: tim@61: import java.util.ArrayList; tim@61: import java.util.Collection; tim@61: tim@61: import org.apache.log4j.Logger; tim@61: tim@61: import de.intevation.gnv.geobackend.base.Result; tim@61: import de.intevation.gnv.transition.describedata.DefaultMinMaxDescribeData; tim@61: import de.intevation.gnv.transition.describedata.DescribeData; tim@61: tim@61: /** tim@61: * @author Tim Englich tim@61: * tim@61: */ tim@61: public class MinMaxTransition extends TransitionBase { tim@61: tim@61: /** tim@61: * the logger, used to log exceptions and additonaly information tim@61: */ tim@61: private static Logger log = Logger.getLogger(MinMaxTransition.class); tim@61: tim@61: /** tim@61: * Constructor tim@61: */ tim@61: public MinMaxTransition() { tim@61: super(); tim@61: } tim@99: tim@61: /** tim@99: * @see de.intevation.gnv.transition.TransitionBase#purifyResult(java.util.Collection, java.lang.String) tim@61: */ tim@61: @Override tim@99: protected void purifyResult(Collection result, String uuid) { tim@61: log.debug("MinMaxTransition.purifyResult"); tim@61: if (this.descibeData == null){ tim@61: this.descibeData = new ArrayList(); tim@61: } tim@61: if (result != null && result.size() == 1){ tim@79: tim@79: Object[] names = this.inputValueNames.toArray(); tim@79: String minName = names[names.length-2].toString(); tim@79: String maxName = names[names.length-1].toString(); tim@61: Result value = result.iterator().next(); tim@79: DescribeData describeData = new DefaultMinMaxDescribeData(minName, maxName,value.getObject("MIN"), value.getObject("MAX")); tim@61: log.debug(describeData.toString()); tim@61: this.descibeData.add(describeData); tim@61: }else{ tim@61: log.warn("Result cannot be handled as MinMax Resultset"); tim@61: } tim@61: tim@61: } tim@61: tim@61: /** tim@61: * @see de.intevation.gnv.transition.Transition#validate() tim@61: */ tim@61: public boolean validate() { tim@61: // TODO: Implement ME tim@61: return true; tim@61: } tim@61: tim@61: }