Mercurial > dive4elements > river
annotate artifacts/src/main/java/org/dive4elements/river/artifacts/states/QSectorSingleState.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 | e4606eae8ea5 |
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:
4433
diff
changeset
|
9 package org.dive4elements.river.artifacts.states; |
3575
e9c3285f2ee2
Added State for QSector artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
10 |
e9c3285f2ee2
Added State for QSector artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
11 import java.util.List; |
e9c3285f2ee2
Added State for QSector artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
12 |
e9c3285f2ee2
Added State for QSector artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
13 import org.apache.log4j.Logger; |
e9c3285f2ee2
Added State for QSector artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
14 |
5831
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4433
diff
changeset
|
15 import org.dive4elements.artifacts.CallMeta; |
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4433
diff
changeset
|
16 import org.dive4elements.artifacts.CallContext; |
3575
e9c3285f2ee2
Added State for QSector artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
17 |
5831
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4433
diff
changeset
|
18 import org.dive4elements.artifactdatabase.state.Facet; |
3575
e9c3285f2ee2
Added State for QSector artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
19 |
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; |
5831
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4433
diff
changeset
|
21 import org.dive4elements.river.artifacts.QSectorArtifact; |
3575
e9c3285f2ee2
Added State for QSector artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
22 |
5831
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4433
diff
changeset
|
23 import org.dive4elements.river.artifacts.model.FacetTypes; |
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4433
diff
changeset
|
24 import org.dive4elements.river.artifacts.model.QSectorFacet; |
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4433
diff
changeset
|
25 |
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4433
diff
changeset
|
26 import org.dive4elements.river.artifacts.resources.Resources; |
3575
e9c3285f2ee2
Added State for QSector artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
27 |
e9c3285f2ee2
Added State for QSector artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
28 /** |
e9c3285f2ee2
Added State for QSector artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
29 * The only state for an QSectorArtifact. |
e9c3285f2ee2
Added State for QSector artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
30 */ |
e9c3285f2ee2
Added State for QSector artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
31 public class QSectorSingleState |
e9c3285f2ee2
Added State for QSector artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
32 extends DefaultState |
e9c3285f2ee2
Added State for QSector artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
33 implements FacetTypes |
e9c3285f2ee2
Added State for QSector artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
34 { |
e9c3285f2ee2
Added State for QSector artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
35 /** Developer-centric description of facet. */ |
e9c3285f2ee2
Added State for QSector artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
36 public static final String I18N_DESCRIPTION |
e9c3285f2ee2
Added State for QSector artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
37 = "facet.qsector"; |
e9c3285f2ee2
Added State for QSector artifact.
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. */ |
e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5994
diff
changeset
|
40 private static final Logger log = |
3575
e9c3285f2ee2
Added State for QSector artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
41 Logger.getLogger(QSectorSingleState.class); |
e9c3285f2ee2
Added State for QSector artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
42 |
e9c3285f2ee2
Added State for QSector artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
43 |
e9c3285f2ee2
Added State for QSector artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
44 /** |
e9c3285f2ee2
Added State for QSector artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
45 * Add QSectorFacets to list of Facets. |
e9c3285f2ee2
Added State for QSector artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
46 * |
e9c3285f2ee2
Added State for QSector artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
47 * @param artifact Ignored. |
e9c3285f2ee2
Added State for QSector artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
48 * @param hash Ignored. |
e9c3285f2ee2
Added State for QSector artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
49 * @param meta CallMeta to be used for internationalization. |
e9c3285f2ee2
Added State for QSector artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
50 * @param facets List to add QSectorFacet to. |
e9c3285f2ee2
Added State for QSector artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
51 * |
e9c3285f2ee2
Added State for QSector artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
52 * @return null. |
e9c3285f2ee2
Added State for QSector artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
53 */ |
e9c3285f2ee2
Added State for QSector artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
54 public Object compute( |
5867
59ff03ff48f1
River artifacts: Renamed FLYSArtifact(Collection) to D4EArtifact(Collection).
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
55 D4EArtifact artifact, |
3575
e9c3285f2ee2
Added State for QSector artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
56 String hash, |
e9c3285f2ee2
Added State for QSector artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
57 CallMeta meta, |
e9c3285f2ee2
Added State for QSector artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
58 List<Facet> facets |
e9c3285f2ee2
Added State for QSector artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
59 ) { |
8202
e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5994
diff
changeset
|
60 log.debug("QSectorSingleState.compute()"); |
3575
e9c3285f2ee2
Added State for QSector artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
61 QSectorArtifact points = (QSectorArtifact) artifact; |
e9c3285f2ee2
Added State for QSector artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
62 |
e9c3285f2ee2
Added State for QSector artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
63 QSectorFacet qfacet = new QSectorFacet( |
e9c3285f2ee2
Added State for QSector artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
64 0, |
3576
6442f317a0c7
i18n and renderering of qsectors in w/q diag.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3575
diff
changeset
|
65 QSECTOR, |
4433
5b8919ef601d
Backed out changeset e8a4d2fd25cc
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4432
diff
changeset
|
66 Resources.getMsg(meta, "qsectors", "Q Sectors")); |
3575
e9c3285f2ee2
Added State for QSector artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
67 |
e9c3285f2ee2
Added State for QSector artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
68 facets.add(qfacet); |
e9c3285f2ee2
Added State for QSector artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
69 |
e9c3285f2ee2
Added State for QSector artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
70 return null; |
e9c3285f2ee2
Added State for QSector artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
71 } |
e9c3285f2ee2
Added State for QSector artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
72 |
e9c3285f2ee2
Added State for QSector artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
73 |
e9c3285f2ee2
Added State for QSector artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
74 /** Call compute. */ |
e9c3285f2ee2
Added State for QSector artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
75 @Override |
e9c3285f2ee2
Added State for QSector artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
76 public Object computeInit( |
5867
59ff03ff48f1
River artifacts: Renamed FLYSArtifact(Collection) to D4EArtifact(Collection).
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
77 D4EArtifact artifact, |
3575
e9c3285f2ee2
Added State for QSector artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
78 String hash, |
e9c3285f2ee2
Added State for QSector artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
79 Object context, |
e9c3285f2ee2
Added State for QSector artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
80 CallMeta meta, |
e9c3285f2ee2
Added State for QSector artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
81 List<Facet> facets |
e9c3285f2ee2
Added State for QSector artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
82 ) { |
e9c3285f2ee2
Added State for QSector artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
83 return compute(artifact, hash, meta, facets); |
e9c3285f2ee2
Added State for QSector artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
84 } |
e9c3285f2ee2
Added State for QSector artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
85 |
e9c3285f2ee2
Added State for QSector artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
86 |
e9c3285f2ee2
Added State for QSector artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
87 /** Call compute. */ |
e9c3285f2ee2
Added State for QSector artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
88 @Override |
e9c3285f2ee2
Added State for QSector artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
89 public Object computeFeed( |
5867
59ff03ff48f1
River artifacts: Renamed FLYSArtifact(Collection) to D4EArtifact(Collection).
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
90 D4EArtifact artifact, |
3575
e9c3285f2ee2
Added State for QSector artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
91 String hash, |
e9c3285f2ee2
Added State for QSector artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
92 CallContext context, |
e9c3285f2ee2
Added State for QSector artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
93 List<Facet> facets, |
e9c3285f2ee2
Added State for QSector artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
94 Object old |
e9c3285f2ee2
Added State for QSector artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
95 ) { |
e9c3285f2ee2
Added State for QSector artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
96 return compute(artifact, hash, context.getMeta(), facets); |
e9c3285f2ee2
Added State for QSector artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
97 } |
e9c3285f2ee2
Added State for QSector artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
98 } |
e9c3285f2ee2
Added State for QSector artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
99 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 : |