Mercurial > dive4elements > river
annotate artifacts/src/main/java/org/dive4elements/river/artifacts/bundu/bezugswst/BunduWstWQFixing.java @ 9636:ac41551a8e4d
Bundu/Bzws: Error message for missing channel/year, Nachtrag Pos. 20: import of two levels of infrastructure types
author | mschaefer |
---|---|
date | Mon, 11 Nov 2019 16:29:36 +0100 |
parents | 82c67b859aa7 |
children |
rev | line source |
---|---|
9276 | 1 /* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde |
2 * Software engineering by Intevation GmbH | |
3 * | |
4 * This file is Free Software under the GNU AGPL (>=v3) | |
5 * and comes with ABSOLUTELY NO WARRANTY! Check out the | |
6 * documentation coming with Dive4Elements River for details. | |
7 */ | |
8 package org.dive4elements.river.artifacts.bundu.bezugswst; | |
9 | |
10 import org.apache.log4j.Logger; | |
11 import org.dive4elements.artifacts.Artifact; | |
9277 | 12 import org.dive4elements.artifacts.CallContext; |
13 import org.dive4elements.artifacts.common.utils.XMLUtils; | |
9276 | 14 import org.dive4elements.river.artifacts.D4EArtifact; |
15 import org.dive4elements.river.artifacts.states.WQAdapted; | |
9277 | 16 import org.w3c.dom.Element; |
9276 | 17 |
18 /** | |
19 * State to input W/Q data for fixings | |
9277 | 20 * |
9276 | 21 * @author <a href="mailto:aheinecke@intevation.de">Andre Heinecke</a> |
22 */ | |
23 public class BunduWstWQFixing extends WQAdapted { | |
24 | |
9288
82c67b859aa7
bundu.bezugswst worklflow incl. service impl for mainValues to be calculated
gernotbelger
parents:
9277
diff
changeset
|
25 private static final long serialVersionUID = 1L; |
82c67b859aa7
bundu.bezugswst worklflow incl. service impl for mainValues to be calculated
gernotbelger
parents:
9277
diff
changeset
|
26 |
9276 | 27 /** The log used in this state. */ |
28 private static Logger log = Logger.getLogger(BunduWstWQFixing.class); | |
29 | |
9277 | 30 @Override |
31 protected String getUIProvider() { | |
32 return "bundu_wst_wq_panel"; | |
33 } | |
34 | |
9276 | 35 @Override |
36 public boolean validate(final Artifact artifact) throws IllegalArgumentException { | |
37 | |
9288
82c67b859aa7
bundu.bezugswst worklflow incl. service impl for mainValues to be calculated
gernotbelger
parents:
9277
diff
changeset
|
38 // Validation is done on client side. No wrong inputs should arrive here. |
82c67b859aa7
bundu.bezugswst worklflow incl. service impl for mainValues to be calculated
gernotbelger
parents:
9277
diff
changeset
|
39 // Validation in Super is not suitable for this case |
9276 | 40 return true; |
41 } | |
42 | |
9277 | 43 // adding bezugsjahr and dauer to client |
9276 | 44 @Override |
9277 | 45 protected Element[] createItems(final XMLUtils.ElementCreator ec, final Artifact artifact, final String name, final CallContext context) { |
46 | |
47 final Element[] defaultElements = super.createItems(ec, artifact, name, context); | |
9288
82c67b859aa7
bundu.bezugswst worklflow incl. service impl for mainValues to be calculated
gernotbelger
parents:
9277
diff
changeset
|
48 if (name.equals("bundu.wst.mode")) { // random-name eines DataItems vom state (s. bundu.xml), sodass verhindert wird, dass an alle DataItems |
82c67b859aa7
bundu.bezugswst worklflow incl. service impl for mainValues to be calculated
gernotbelger
parents:
9277
diff
changeset
|
49 // length+bezugsjahr drangehängt werden |
82c67b859aa7
bundu.bezugswst worklflow incl. service impl for mainValues to be calculated
gernotbelger
parents:
9277
diff
changeset
|
50 final BunduAccess access = new BunduAccess((D4EArtifact) artifact); |
9277 | 51 |
9288
82c67b859aa7
bundu.bezugswst worklflow incl. service impl for mainValues to be calculated
gernotbelger
parents:
9277
diff
changeset
|
52 final int bezugsjahr = access.getBezugsJahr(); |
82c67b859aa7
bundu.bezugswst worklflow incl. service impl for mainValues to be calculated
gernotbelger
parents:
9277
diff
changeset
|
53 final int qSeriesLength = access.getQSeriesLength(); |
82c67b859aa7
bundu.bezugswst worklflow incl. service impl for mainValues to be calculated
gernotbelger
parents:
9277
diff
changeset
|
54 final String[] keys = new String[] { "ignore_q_series_length", "ignore_bezugsjahr" }; |
82c67b859aa7
bundu.bezugswst worklflow incl. service impl for mainValues to be calculated
gernotbelger
parents:
9277
diff
changeset
|
55 final String[] values = new String[] { String.valueOf(qSeriesLength), String.valueOf(bezugsjahr) }; |
9277 | 56 |
9288
82c67b859aa7
bundu.bezugswst worklflow incl. service impl for mainValues to be calculated
gernotbelger
parents:
9277
diff
changeset
|
57 return FixationChoice.appendElements(ec, defaultElements, keys, values); |
82c67b859aa7
bundu.bezugswst worklflow incl. service impl for mainValues to be calculated
gernotbelger
parents:
9277
diff
changeset
|
58 } else |
82c67b859aa7
bundu.bezugswst worklflow incl. service impl for mainValues to be calculated
gernotbelger
parents:
9277
diff
changeset
|
59 return defaultElements; |
9276 | 60 } |
9288
82c67b859aa7
bundu.bezugswst worklflow incl. service impl for mainValues to be calculated
gernotbelger
parents:
9277
diff
changeset
|
61 } |