annotate artifacts/src/main/java/org/dive4elements/river/artifacts/states/AnnotationRiverState.java @ 9425:3f49835a00c3

Extended CrossSectionFacet so it may fetch different data from within the artifact result. Also allows to have acces to the potentially already computed artifact result via its normal computation cache.
author gernotbelger
date Fri, 17 Aug 2018 15:31:02 +0200
parents 5e38e2924c07
children 0a5239a1e46e
rev   line source
5863
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
1 /* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
2 * Software engineering by Intevation GmbH
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
3 *
5994
af13ceeba52a Removed trailing whitespace.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5867
diff changeset
4 * This file is Free Software under the GNU AGPL (>=v3)
5863
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
5 * and comes with ABSOLUTELY NO WARRANTY! Check out the
5994
af13ceeba52a Removed trailing whitespace.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5867
diff changeset
6 * documentation coming with Dive4Elements River for details.
5863
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
7 */
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
8
5831
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4017
diff changeset
9 package org.dive4elements.river.artifacts.states;
1026
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
10
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
11 import java.util.List;
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
12
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
13 import org.apache.log4j.Logger;
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
14
5831
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4017
diff changeset
15 import org.dive4elements.artifacts.CallMeta;
1026
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
16
5831
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4017
diff changeset
17 import org.dive4elements.artifactdatabase.state.Facet;
1026
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
18
5831
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4017
diff changeset
19 import org.dive4elements.river.artifacts.AnnotationArtifact;
5867
59ff03ff48f1 River artifacts: Renamed FLYSArtifact(Collection) to D4EArtifact(Collection).
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5863
diff changeset
20 import org.dive4elements.river.artifacts.D4EArtifact;
1026
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
21
5831
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4017
diff changeset
22 import org.dive4elements.river.artifacts.model.AnnotationFacet;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4017
diff changeset
23 import org.dive4elements.river.artifacts.model.FacetTypes;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4017
diff changeset
24
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4017
diff changeset
25 import org.dive4elements.river.artifacts.resources.Resources;
1026
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
26
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
27
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
28 /**
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
29 * The only state for an AnnotationArtifact (River is known).
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
30 */
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
31 public class AnnotationRiverState
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
32 extends DefaultState
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
33 implements FacetTypes
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
34 {
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
35 /** Developer-centric description of facet. */
8856
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8406
diff changeset
36 public static final String I18N_DESCRIPTION =
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8406
diff changeset
37 "facet.longitudinal_section.annotations";
1026
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
38
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5994
diff changeset
39 /** The log that is used in this state. */
8856
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8406
diff changeset
40 private static final Logger log = Logger.getLogger(
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8406
diff changeset
41 AnnotationRiverState.class);
1026
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
42
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
43
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
44 /**
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
45 * Add an AnnotationFacet to list of Facets.
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
46 *
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
47 * @param artifact Ignored.
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
48 * @param hash Ignored.
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
49 * @param context Ignored.
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
50 * @param meta CallMeta to be used for internationalization.
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
51 * @param facets List to add AnnotationFacet to.
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
52 *
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
53 * @return null.
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
54 */
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
55 @Override
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
56 public Object computeInit(
5867
59ff03ff48f1 River artifacts: Renamed FLYSArtifact(Collection) to D4EArtifact(Collection).
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5863
diff changeset
57 D4EArtifact artifact,
1026
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
58 String hash,
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
59 Object context,
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
60 CallMeta meta,
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
61 List<Facet> facets
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
62 ) {
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5994
diff changeset
63 log.debug("AnnotationRiverState.computeInit()");
1026
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
64
4017
e1691b74f3aa Let AnnotationFacet have name of type, if type was chosen.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1026
diff changeset
65 AnnotationArtifact annotationArtifact = (AnnotationArtifact) artifact;
e1691b74f3aa Let AnnotationFacet have name of type, if type was chosen.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1026
diff changeset
66
e1691b74f3aa Let AnnotationFacet have name of type, if type was chosen.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1026
diff changeset
67 String facetName = annotationArtifact.getFilterName();
e1691b74f3aa Let AnnotationFacet have name of type, if type was chosen.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1026
diff changeset
68 if (facetName == null) {
8406
6ae0c5116d58 Distinguish between types of measurement stations and filter appropriately (plus minor cleanup in related classes).
Tom Gottfried <tom@intevation.de>
parents: 8202
diff changeset
69 facetName = Resources.getMsg(meta, I18N_DESCRIPTION);
4017
e1691b74f3aa Let AnnotationFacet have name of type, if type was chosen.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1026
diff changeset
70 }
e1691b74f3aa Let AnnotationFacet have name of type, if type was chosen.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1026
diff changeset
71
1026
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
72 AnnotationFacet facet = new AnnotationFacet(
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
73 0,
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
74 LONGITUDINAL_ANNOTATION,
4017
e1691b74f3aa Let AnnotationFacet have name of type, if type was chosen.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1026
diff changeset
75 facetName);
1026
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
76 facets.add(facet);
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
77
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
78 return null;
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
79 }
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
80 }
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
81 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :

http://dive4elements.wald.intevation.org