Mercurial > dive4elements > gnv-client
diff gnv-artifacts/src/main/java/de/intevation/gnv/state/DefaultInputData.java @ 634:58c32df1a44d
Improved the describe document so that we are able to render a measurement-parameter-matrix with these data.
gnv-artifacts/trunk@713 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Fri, 26 Feb 2010 13:53:05 +0000 |
parents | 01054ddccb0f |
children | c4156275c1e1 |
line wrap: on
line diff
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/state/DefaultInputData.java Thu Feb 25 09:11:56 2010 +0000 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/state/DefaultInputData.java Fri Feb 26 13:53:05 2010 +0000 @@ -1,11 +1,13 @@ -/** - * - */ package de.intevation.gnv.state; +import java.util.HashMap; +import java.util.Map; + +import org.apache.log4j.Logger; + /** - * @author Tim Englich <tim.englich@intevation.de> - * + * @author Tim Englich (tim.englich@intevation.de) + * @author Ingo Weinzierl (ingo.weinzierl@intevation.de) */ public class DefaultInputData implements InputData { @@ -13,14 +15,16 @@ * */ private static final long serialVersionUID = 4308041648698108066L; - + + private static final Logger logger = Logger.getLogger(DefaultInputData.class); + private final static String VALUE_SEPARATOR = " , "; - protected String name; - protected String value; - protected String[] description; - protected Object object; - + protected String name; + protected String value; + protected Map description; + protected Object object; + /** * Constructor @@ -57,12 +61,42 @@ return object; } + public String getDescription(String key) { + if (description == null) + return null; + + return (String) description.get(key); + } + public String[] getDescription() { + String[] values = splitValue(); + int length = values.length; + + String[] description = new String[length]; + for (int i = 0; i < length; i++) { + description[i] = (String) this.description.get(values[i]); + } + return description; } public void setDescription(String[] description) { - this.description = description; + if (this.description == null) + this.description = new HashMap(); + + String[] values = splitValue(); + + int length = values.length; + int descLength = description.length; + + for (int i = 0; i < length; i++) { + if (i < descLength) { + this.description.put(values[i], description[i]); + } + else { + break; + } + } } /**