Mercurial > dive4elements > river
annotate artifacts/src/main/java/org/dive4elements/river/artifacts/bundu/BUNDUArtifact.java @ 9444:ecadc9ed0ba0
Added heights and depths of cross section fields in the bundu bzws calculation and longitudinal section charts
author | mschaefer |
---|---|
date | Tue, 21 Aug 2018 13:41:18 +0200 |
parents | d194c5b24bf8 |
children | 8d6e56e57c4a |
rev | line source |
---|---|
9071 | 1 /* Copyright (C) 2017 by Bundesanstalt für Gewässerkunde |
2 * Software engineering by | |
3 * Björnsen Beratende Ingenieure GmbH | |
4 * Dr. Schumacher Ingenieurbüro für Wasser und Umwelt | |
5 * | |
6 * This file is Free Software under the GNU AGPL (>=v3) | |
7 * and comes with ABSOLUTELY NO WARRANTY! Check out the | |
8 * documentation coming with Dive4Elements River for details. | |
9 */ | |
10 package org.dive4elements.river.artifacts.bundu; | |
11 | |
12 import org.apache.commons.lang.StringUtils; | |
9072
02739b8c010d
bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents:
9071
diff
changeset
|
13 import org.dive4elements.artifactdatabase.state.Facet; |
9071 | 14 import org.dive4elements.artifactdatabase.state.FacetActivity; |
9072
02739b8c010d
bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents:
9071
diff
changeset
|
15 import org.dive4elements.artifacts.Artifact; |
9071 | 16 import org.dive4elements.river.artifacts.D4EArtifact; |
9444
ecadc9ed0ba0
Added heights and depths of cross section fields in the bundu bzws calculation and longitudinal section charts
mschaefer
parents:
9432
diff
changeset
|
17 import org.dive4elements.river.artifacts.bundu.bezugswst.BezugswstDepthProcessor; |
ecadc9ed0ba0
Added heights and depths of cross section fields in the bundu bzws calculation and longitudinal section charts
mschaefer
parents:
9432
diff
changeset
|
18 import org.dive4elements.river.artifacts.bundu.bezugswst.BezugswstHeightProcessor; |
9432
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9072
diff
changeset
|
19 import org.dive4elements.river.artifacts.model.FacetTypes; |
9071 | 20 |
21 /** | |
22 * The default BUNDU artifact. | |
23 * | |
24 * @author Gernot Belger | |
25 */ | |
26 public class BUNDUArtifact extends D4EArtifact { | |
27 | |
28 private static final long serialVersionUID = 1L; | |
29 | |
30 /** Error message that is thrown if no mode has been chosen. */ | |
31 private static final String ERROR_NO_CALCULATION_MODE = "error_feed_no_calculation_mode"; | |
32 | |
33 /** | |
34 * Error message that is thrown if an invalid calculation mode has been chosen. | |
35 */ | |
36 private static final String ERROR_INVALID_CALCULATION_MODE = "error_feed_invalid_calculation_mode"; | |
37 | |
38 /** The name of the artifact. */ | |
39 private static final String ARTIFACT_NAME = "bundu"; | |
40 | |
41 private static final String FIELD_RIVER = "river"; | |
42 | |
43 private static final String FIELD_MODE = "calculation_mode"; | |
44 | |
45 static { | |
46 // Active/deactivate facets. | |
9432
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9072
diff
changeset
|
47 // BEWARE: we can only define one activity for "bundu", so we use the artifact |
9071 | 48 // as place for this |
9072
02739b8c010d
bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents:
9071
diff
changeset
|
49 FacetActivity.Registry.getInstance().register(ARTIFACT_NAME, new FacetActivity() { |
02739b8c010d
bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents:
9071
diff
changeset
|
50 @Override |
02739b8c010d
bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents:
9071
diff
changeset
|
51 public Boolean isInitialActive(final Artifact artifact, final Facet facet, final String output) { |
9432
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9072
diff
changeset
|
52 |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9072
diff
changeset
|
53 final String name = facet.getName(); |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9072
diff
changeset
|
54 |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9072
diff
changeset
|
55 if (FacetTypes.LONGITUDINAL_Q.equals(name)) |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9072
diff
changeset
|
56 return Boolean.FALSE; |
9444
ecadc9ed0ba0
Added heights and depths of cross section fields in the bundu bzws calculation and longitudinal section charts
mschaefer
parents:
9432
diff
changeset
|
57 if (name.startsWith(BezugswstHeightProcessor.FACET_FIELD_BEDHEIGHT_PREFIX)) |
ecadc9ed0ba0
Added heights and depths of cross section fields in the bundu bzws calculation and longitudinal section charts
mschaefer
parents:
9432
diff
changeset
|
58 return Boolean.FALSE; |
ecadc9ed0ba0
Added heights and depths of cross section fields in the bundu bzws calculation and longitudinal section charts
mschaefer
parents:
9432
diff
changeset
|
59 if (name.startsWith(BezugswstDepthProcessor.FACET_FIELD_DEPTH_PREFIX)) |
ecadc9ed0ba0
Added heights and depths of cross section fields in the bundu bzws calculation and longitudinal section charts
mschaefer
parents:
9432
diff
changeset
|
60 return Boolean.FALSE; |
9432
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9072
diff
changeset
|
61 |
9072
02739b8c010d
bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents:
9071
diff
changeset
|
62 return null; |
02739b8c010d
bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents:
9071
diff
changeset
|
63 } |
02739b8c010d
bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents:
9071
diff
changeset
|
64 }); |
9071 | 65 } |
66 | |
67 /** | |
68 * Default constructor, because it's serializable. | |
69 */ | |
70 public BUNDUArtifact() { | |
71 } | |
72 | |
73 /** | |
74 * Returns the name of the concrete artifact. | |
75 * | |
76 * @return the name of the concrete artifact. | |
77 */ | |
78 @Override | |
79 public String getName() { | |
80 return ARTIFACT_NAME; | |
81 } | |
82 | |
83 public BunduCalcMode getCalculationMode() { | |
84 | |
85 final String calc = getDataAsString(FIELD_MODE); | |
86 if (calc == null) { | |
87 throw new IllegalArgumentException(ERROR_NO_CALCULATION_MODE); | |
88 } | |
89 | |
90 try { | |
91 return BunduCalcMode.valueOf(StringUtils.trimToEmpty(calc).toLowerCase()); | |
92 } | |
93 catch (final Exception e) { | |
94 throw new IllegalArgumentException(ERROR_INVALID_CALCULATION_MODE, e); | |
95 } | |
96 } | |
97 | |
98 public String getRiver() { | |
99 return getDataAsString(FIELD_RIVER); | |
100 } | |
101 } |