Mercurial > dive4elements > river
comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/FLYSArtifact.java @ 322:448d0dc64357
The inserted ranges (distance and WQ ranges) are validated in the feed() operation.
flys-artifacts/trunk@1716 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Mon, 18 Apr 2011 12:36:08 +0000 |
parents | 9581b88f2920 |
children | 7a0907742cc0 |
comparison
equal
deleted
inserted
replaced
321:9581b88f2920 | 322:448d0dc64357 |
---|---|
31 import de.intevation.flys.model.Gauge; | 31 import de.intevation.flys.model.Gauge; |
32 import de.intevation.flys.model.River; | 32 import de.intevation.flys.model.River; |
33 | 33 |
34 import de.intevation.flys.artifacts.context.FLYSContext; | 34 import de.intevation.flys.artifacts.context.FLYSContext; |
35 import de.intevation.flys.artifacts.model.RiverFactory; | 35 import de.intevation.flys.artifacts.model.RiverFactory; |
36 import de.intevation.flys.artifacts.states.DefaultState; | |
36 | 37 |
37 | 38 |
38 /** | 39 /** |
39 * The defaul FLYS artifact. | 40 * The defaul FLYS artifact. |
40 * | 41 * |
159 | 160 |
160 Element result = creator.create("result"); | 161 Element result = creator.create("result"); |
161 doc.appendChild(result); | 162 doc.appendChild(result); |
162 | 163 |
163 try { | 164 try { |
164 saveData(target, XPATH_FEED_INPUT); | 165 saveData(target, XPATH_FEED_INPUT, context); |
165 return describe(target, context); | 166 return describe(target, context); |
166 } | 167 } |
167 catch (IllegalArgumentException iae) { | 168 catch (IllegalArgumentException iae) { |
168 creator.addAttr(result, "type", OPERATION_FAILED, true); | 169 creator.addAttr(result, "type", OPERATION_FAILED, true); |
169 | 170 |
170 // TODO I18N this message - getMessage() returns a lookup string, no | |
171 // human readable error message | |
172 result.setTextContent(iae.getMessage()); | 171 result.setTextContent(iae.getMessage()); |
173 } | 172 } |
174 | 173 |
175 return doc; | 174 return doc; |
176 } | 175 } |
322 * This method stores the data that is contained in the FEED document. | 321 * This method stores the data that is contained in the FEED document. |
323 * | 322 * |
324 * @param feed The FEED document. | 323 * @param feed The FEED document. |
325 * @param xpath The XPath that points to the data nodes. | 324 * @param xpath The XPath that points to the data nodes. |
326 */ | 325 */ |
327 public void saveData(Document feed, String xpath) | 326 public void saveData(Document feed, String xpath, CallContext context) |
328 throws IllegalArgumentException | 327 throws IllegalArgumentException |
329 { | 328 { |
330 if (feed == null || xpath == null || xpath.length() == 0) { | 329 if (feed == null || xpath == null || xpath.length() == 0) { |
331 throw new IllegalArgumentException("feed.no.input.data"); | 330 throw new IllegalArgumentException("feed.no.input.data"); |
332 } | 331 } |
353 node, "@art:value", ArtifactNamespaceContext.INSTANCE); | 352 node, "@art:value", ArtifactNamespaceContext.INSTANCE); |
354 | 353 |
355 if (name != null && value != null) { | 354 if (name != null && value != null) { |
356 logger.debug("Save data item for '" + name + "' : " + value); | 355 logger.debug("Save data item for '" + name + "' : " + value); |
357 | 356 |
358 // TODO ADD INPUT VALIDATION! | |
359 addData(name, new DefaultStateData(name, null, null, value)); | 357 addData(name, new DefaultStateData(name, null, null, value)); |
360 } | 358 } |
361 } | 359 } |
360 | |
361 State current = getCurrentState(context); | |
362 DefaultState toValidate = (DefaultState) fillState(current); | |
363 | |
364 toValidate.validate(this, context); | |
362 } | 365 } |
363 | 366 |
364 | 367 |
365 /** | 368 /** |
366 * This method fills a state object with the data that have been inserted to | 369 * This method fills a state object with the data that have been inserted to |