# HG changeset patch # User Ingo Weinzierl # Date 1308047880 0 # Node ID 9a035ef7b595bbbe206bd9bbb93c1a200d57e1df # Parent 19a3185822a46d7b7a8d0cb95e073f4b5613fcf3 The state that is used to enter locations writes the river's range into the DESCRIBE now. flys-artifacts/trunk@2103 c6561f87-3c4e-4783-a992-168aeb5c3f6f diff -r 19a3185822a4 -r 9a035ef7b595 flys-artifacts/ChangeLog --- a/flys-artifacts/ChangeLog Fri Jun 10 15:59:47 2011 +0000 +++ b/flys-artifacts/ChangeLog Tue Jun 14 10:38:00 2011 +0000 @@ -1,3 +1,9 @@ +2011-06-14 Ingo Weinzierl + + * src/main/java/de/intevation/flys/artifacts/states/LocationSelect.java: + This state that is used to retrieve locations will now write the + kilometer range of the selected river into the DESCRIBE document. + 2011-06-10 Sascha L. Teichmann * src/main/java/de/intevation/flys/artifacts/model/Calculation1.java: diff -r 19a3185822a4 -r 9a035ef7b595 flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/LocationSelect.java --- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/LocationSelect.java Fri Jun 10 15:59:47 2011 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/LocationSelect.java Tue Jun 14 10:38:00 2011 +0000 @@ -4,9 +4,13 @@ import org.apache.log4j.Logger; +import org.w3c.dom.Element; + import de.intevation.artifacts.Artifact; import de.intevation.artifacts.CallContext; +import de.intevation.artifacts.common.utils.XMLUtils; + import de.intevation.artifactdatabase.data.StateData; import de.intevation.flys.artifacts.FLYSArtifact; @@ -40,6 +44,42 @@ @Override + protected Element[] createItems( + XMLUtils.ElementCreator cr, + Artifact artifact, + String name, + CallContext context) + { + double[] minmax = getMinMaxDistance(artifact); + + double minVal = Double.MIN_VALUE; + double maxVal = Double.MAX_VALUE; + + if (minmax != null) { + minVal = minmax[0]; + maxVal = minmax[1]; + } + else { + logger.warn("Could not read min/max distance values!"); + } + + if (name.equals(FIELD_LOCATIONS)) { + Element min = createItem( + cr, + new String[] {"min", new Double(minVal).toString()}); + + Element max = createItem( + cr, + new String[] {"max", new Double(maxVal).toString()}); + + return new Element[] { min, max }; + } + + return null; + } + + + @Override public boolean validate(Artifact artifact, CallContext context) throws IllegalArgumentException {