Mercurial > dive4elements > river
comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/LocationSelect.java @ 624:929137ee8154
ISSUE-62 (part I/II) States are no longer filled with data - if a state needs user input, it needs to query the owner artifact.
flys-artifacts/trunk@1982 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Mon, 23 May 2011 15:11:55 +0000 |
parents | 478940d06876 |
children | 9a035ef7b595 |
comparison
equal
deleted
inserted
replaced
623:aa64fe4df8ab | 624:929137ee8154 |
---|---|
1 package de.intevation.flys.artifacts.states; | 1 package de.intevation.flys.artifacts.states; |
2 | |
3 import java.util.Map; | |
4 | 2 |
5 import gnu.trove.TDoubleArrayList; | 3 import gnu.trove.TDoubleArrayList; |
6 | 4 |
7 import org.apache.log4j.Logger; | 5 import org.apache.log4j.Logger; |
8 | 6 |
9 import de.intevation.artifacts.Artifact; | 7 import de.intevation.artifacts.Artifact; |
10 import de.intevation.artifacts.CallContext; | 8 import de.intevation.artifacts.CallContext; |
11 | 9 |
12 import de.intevation.artifactdatabase.data.StateData; | 10 import de.intevation.artifactdatabase.data.StateData; |
11 | |
12 import de.intevation.flys.artifacts.FLYSArtifact; | |
13 | 13 |
14 | 14 |
15 /** | 15 /** |
16 * This state is used to realize the input of multiple locations as string. The | 16 * This state is used to realize the input of multiple locations as string. The |
17 * string should be a whitespace separated list of double values where each | 17 * string should be a whitespace separated list of double values where each |
43 public boolean validate(Artifact artifact, CallContext context) | 43 public boolean validate(Artifact artifact, CallContext context) |
44 throws IllegalArgumentException | 44 throws IllegalArgumentException |
45 { | 45 { |
46 logger.debug("LocationSelect.validate"); | 46 logger.debug("LocationSelect.validate"); |
47 | 47 |
48 Map<String, StateData> data = getData(); | 48 FLYSArtifact flys = (FLYSArtifact) artifact; |
49 StateData data = getData(flys, FIELD_LOCATIONS); | |
49 | 50 |
50 String locationStr = (String) data.get(FIELD_LOCATIONS).getValue(); | 51 String locationStr = data != null ? (String) data.getValue() : null; |
51 | 52 |
52 if (locationStr == null || locationStr.length() == 0) { | 53 if (locationStr == null || locationStr.length() == 0) { |
53 logger.error("No locations given."); | 54 logger.error("No locations given."); |
54 throw new IllegalArgumentException("error_empty_state"); | 55 throw new IllegalArgumentException("error_empty_state"); |
55 } | 56 } |