Mercurial > dive4elements > river
annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/WQKmsFacet.java @ 4837:9e25c7523485
Fixed calculation of effective width in MINFO SQ relation.
* Get all (including empty datasets) from db.
* Filter empty datasets when processing data of the same date.
* Added debug outputs.
author | Raimund Renkert <rrenkert@intevation.de> |
---|---|
date | Wed, 23 Jan 2013 11:14:41 +0100 |
parents | 0f7abd95c6e2 |
children |
rev | line source |
---|---|
1825
02cd002205a3
Added 'static' wqkms data access.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.flys.artifacts.model; |
02cd002205a3
Added 'static' wqkms data access.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
2 |
2124
a202a9e048a5
Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1825
diff
changeset
|
3 import org.apache.log4j.Logger; |
a202a9e048a5
Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1825
diff
changeset
|
4 |
1825
02cd002205a3
Added 'static' wqkms data access.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
5 import de.intevation.artifacts.Artifact; |
02cd002205a3
Added 'static' wqkms data access.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
6 import de.intevation.artifacts.CallContext; |
02cd002205a3
Added 'static' wqkms data access.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
7 |
02cd002205a3
Added 'static' wqkms data access.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
8 import de.intevation.flys.artifacts.StaticWQKmsArtifact; |
02cd002205a3
Added 'static' wqkms data access.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
9 |
2124
a202a9e048a5
Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1825
diff
changeset
|
10 import de.intevation.flys.artifacts.states.DefaultState.ComputeType; |
a202a9e048a5
Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1825
diff
changeset
|
11 |
a202a9e048a5
Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1825
diff
changeset
|
12 |
1825
02cd002205a3
Added 'static' wqkms data access.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
13 /** |
02cd002205a3
Added 'static' wqkms data access.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
14 * Facet to show W|Q|km Values. |
2124
a202a9e048a5
Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1825
diff
changeset
|
15 * We have following 'Types' (from FacetTypes): |
a202a9e048a5
Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1825
diff
changeset
|
16 * String STATIC_WQKMS = "other.wqkms"; |
a202a9e048a5
Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1825
diff
changeset
|
17 * String STATIC_WQMS_W = "other.wqkms.w"; |
a202a9e048a5
Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1825
diff
changeset
|
18 * String STATIC_WQKMS_Q = "other.wqkms.q"; |
1825
02cd002205a3
Added 'static' wqkms data access.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
19 */ |
02cd002205a3
Added 'static' wqkms data access.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
20 public class WQKmsFacet |
2124
a202a9e048a5
Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1825
diff
changeset
|
21 extends DataFacet |
1825
02cd002205a3
Added 'static' wqkms data access.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
22 implements FacetTypes { |
02cd002205a3
Added 'static' wqkms data access.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
23 |
2124
a202a9e048a5
Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1825
diff
changeset
|
24 /** House logger. */ |
a202a9e048a5
Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1825
diff
changeset
|
25 private static Logger logger = Logger.getLogger(WQKmsFacet.class); |
a202a9e048a5
Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1825
diff
changeset
|
26 |
1825
02cd002205a3
Added 'static' wqkms data access.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
27 /** Trivial Constructor. */ |
02cd002205a3
Added 'static' wqkms data access.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
28 public WQKmsFacet(String description) { |
02cd002205a3
Added 'static' wqkms data access.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
29 this(STATIC_WQKMS, description); |
02cd002205a3
Added 'static' wqkms data access.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
30 } |
02cd002205a3
Added 'static' wqkms data access.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
31 |
2124
a202a9e048a5
Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1825
diff
changeset
|
32 |
a202a9e048a5
Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1825
diff
changeset
|
33 /** |
a202a9e048a5
Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1825
diff
changeset
|
34 * @param name Name of this facet (we have at least two flavors (w and q). |
a202a9e048a5
Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1825
diff
changeset
|
35 */ |
1825
02cd002205a3
Added 'static' wqkms data access.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
36 public WQKmsFacet(String name, String description) { |
2124
a202a9e048a5
Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1825
diff
changeset
|
37 super(0, name, description, ComputeType.FEED, null, null); |
1825
02cd002205a3
Added 'static' wqkms data access.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
38 } |
02cd002205a3
Added 'static' wqkms data access.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
39 |
02cd002205a3
Added 'static' wqkms data access.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
40 |
02cd002205a3
Added 'static' wqkms data access.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
41 /** |
02cd002205a3
Added 'static' wqkms data access.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
42 * Returns the data this facet requires. |
02cd002205a3
Added 'static' wqkms data access.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
43 * |
02cd002205a3
Added 'static' wqkms data access.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
44 * @param artifact the owner artifact. |
02cd002205a3
Added 'static' wqkms data access.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
45 * @param context the CallContext (ignored). |
02cd002205a3
Added 'static' wqkms data access.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
46 * |
02cd002205a3
Added 'static' wqkms data access.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
47 * @return the data. |
02cd002205a3
Added 'static' wqkms data access.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
48 */ |
02cd002205a3
Added 'static' wqkms data access.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
49 @Override |
02cd002205a3
Added 'static' wqkms data access.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
50 public Object getData(Artifact artifact, CallContext context) { |
2124
a202a9e048a5
Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1825
diff
changeset
|
51 logger.debug("WQKmsFacet.getData"); |
a202a9e048a5
Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1825
diff
changeset
|
52 |
1825
02cd002205a3
Added 'static' wqkms data access.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
53 StaticWQKmsArtifact staticData = |
02cd002205a3
Added 'static' wqkms data access.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
54 (StaticWQKmsArtifact) artifact; |
2124
a202a9e048a5
Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1825
diff
changeset
|
55 Object res = staticData.compute(context, hash, stateId, type, false); |
a202a9e048a5
Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1825
diff
changeset
|
56 |
a202a9e048a5
Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1825
diff
changeset
|
57 return res; |
1825
02cd002205a3
Added 'static' wqkms data access.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
58 } |
02cd002205a3
Added 'static' wqkms data access.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
59 |
02cd002205a3
Added 'static' wqkms data access.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
60 |
02cd002205a3
Added 'static' wqkms data access.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
61 /** |
02cd002205a3
Added 'static' wqkms data access.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
62 * Create a deep copy of this Facet. |
02cd002205a3
Added 'static' wqkms data access.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
63 * @return a deep copy. |
02cd002205a3
Added 'static' wqkms data access.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
64 */ |
02cd002205a3
Added 'static' wqkms data access.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
65 @Override |
02cd002205a3
Added 'static' wqkms data access.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
66 public WQKmsFacet deepCopy() { |
02cd002205a3
Added 'static' wqkms data access.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
67 WQKmsFacet copy = new WQKmsFacet(description); |
02cd002205a3
Added 'static' wqkms data access.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
68 copy.set(this); |
02cd002205a3
Added 'static' wqkms data access.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
69 return copy; |
02cd002205a3
Added 'static' wqkms data access.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
70 } |
02cd002205a3
Added 'static' wqkms data access.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
71 } |
02cd002205a3
Added 'static' wqkms data access.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
72 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |