Mercurial > dive4elements > river
annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/QSectorFacet.java @ 3786:4adc35aa655c
merged flys-artifacts/2.9.1
author | Thomas Arendsen Hein <thomas@intevation.de> |
---|---|
date | Fri, 28 Sep 2012 12:14:47 +0200 |
parents | 6442f317a0c7 |
children | 976ff4b74b96 |
rev | line source |
---|---|
3573
374c2d70b982
Added stub of QSector-Artifact-infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.flys.artifacts.model; |
374c2d70b982
Added stub of QSector-Artifact-infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
2 |
374c2d70b982
Added stub of QSector-Artifact-infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
3 import org.apache.log4j.Logger; |
374c2d70b982
Added stub of QSector-Artifact-infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
4 |
374c2d70b982
Added stub of QSector-Artifact-infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
5 import de.intevation.artifacts.Artifact; |
374c2d70b982
Added stub of QSector-Artifact-infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
6 import de.intevation.artifacts.CallContext; |
374c2d70b982
Added stub of QSector-Artifact-infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
7 |
374c2d70b982
Added stub of QSector-Artifact-infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
8 import de.intevation.flys.artifacts.QSectorArtifact; |
374c2d70b982
Added stub of QSector-Artifact-infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
9 |
374c2d70b982
Added stub of QSector-Artifact-infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
10 import de.intevation.artifactdatabase.state.DefaultFacet; |
374c2d70b982
Added stub of QSector-Artifact-infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
11 import de.intevation.artifactdatabase.state.Facet; |
374c2d70b982
Added stub of QSector-Artifact-infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
12 |
374c2d70b982
Added stub of QSector-Artifact-infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
13 |
374c2d70b982
Added stub of QSector-Artifact-infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
14 /** |
374c2d70b982
Added stub of QSector-Artifact-infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
15 * Facet to access QSector that where added by user. |
374c2d70b982
Added stub of QSector-Artifact-infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
16 */ |
374c2d70b982
Added stub of QSector-Artifact-infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
17 public class QSectorFacet |
374c2d70b982
Added stub of QSector-Artifact-infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
18 extends DefaultFacet |
374c2d70b982
Added stub of QSector-Artifact-infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
19 { |
374c2d70b982
Added stub of QSector-Artifact-infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
20 /** Logger for this class. */ |
374c2d70b982
Added stub of QSector-Artifact-infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
21 private static final Logger logger = Logger.getLogger(QSectorFacet.class); |
374c2d70b982
Added stub of QSector-Artifact-infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
22 |
374c2d70b982
Added stub of QSector-Artifact-infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
23 |
374c2d70b982
Added stub of QSector-Artifact-infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
24 /** |
374c2d70b982
Added stub of QSector-Artifact-infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
25 * Trivial Constructor. |
374c2d70b982
Added stub of QSector-Artifact-infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
26 */ |
374c2d70b982
Added stub of QSector-Artifact-infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
27 public QSectorFacet() { |
374c2d70b982
Added stub of QSector-Artifact-infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
28 } |
374c2d70b982
Added stub of QSector-Artifact-infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
29 |
374c2d70b982
Added stub of QSector-Artifact-infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
30 |
374c2d70b982
Added stub of QSector-Artifact-infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
31 /** |
374c2d70b982
Added stub of QSector-Artifact-infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
32 * Trivial Constructor for a QSectorFacet. |
374c2d70b982
Added stub of QSector-Artifact-infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
33 * |
374c2d70b982
Added stub of QSector-Artifact-infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
34 * @param index Database-Index to use. |
374c2d70b982
Added stub of QSector-Artifact-infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
35 * @param name Name (~type) of Facet. |
374c2d70b982
Added stub of QSector-Artifact-infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
36 * @param description Description of Facet. |
374c2d70b982
Added stub of QSector-Artifact-infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
37 */ |
374c2d70b982
Added stub of QSector-Artifact-infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
38 public QSectorFacet(int index, String name, String description) { |
374c2d70b982
Added stub of QSector-Artifact-infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
39 super(index, name, description); |
374c2d70b982
Added stub of QSector-Artifact-infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
40 } |
374c2d70b982
Added stub of QSector-Artifact-infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
41 |
374c2d70b982
Added stub of QSector-Artifact-infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
42 |
374c2d70b982
Added stub of QSector-Artifact-infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
43 /** |
374c2d70b982
Added stub of QSector-Artifact-infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
44 * Get List of QSector for river from Artifact. |
374c2d70b982
Added stub of QSector-Artifact-infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
45 * |
374c2d70b982
Added stub of QSector-Artifact-infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
46 * @param artifact (QSector-)Artifact to query for list of QSector. |
374c2d70b982
Added stub of QSector-Artifact-infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
47 * @param context Ignored. |
374c2d70b982
Added stub of QSector-Artifact-infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
48 */ |
374c2d70b982
Added stub of QSector-Artifact-infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
49 @Override |
374c2d70b982
Added stub of QSector-Artifact-infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
50 public Object getData(Artifact artifact, CallContext context) { |
374c2d70b982
Added stub of QSector-Artifact-infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
51 QSectorArtifact qsectorArtifact = (QSectorArtifact) artifact; |
374c2d70b982
Added stub of QSector-Artifact-infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
52 double currentKm = |
374c2d70b982
Added stub of QSector-Artifact-infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
53 ((Double)context.getContextValue("currentKm")).doubleValue(); |
3576
6442f317a0c7
i18n and renderering of qsectors in w/q diag.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3573
diff
changeset
|
54 return qsectorArtifact.getQSectors(currentKm, context); |
3573
374c2d70b982
Added stub of QSector-Artifact-infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
55 } |
374c2d70b982
Added stub of QSector-Artifact-infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
56 |
374c2d70b982
Added stub of QSector-Artifact-infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
57 |
374c2d70b982
Added stub of QSector-Artifact-infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
58 /** Do a deep copy. */ |
374c2d70b982
Added stub of QSector-Artifact-infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
59 @Override |
374c2d70b982
Added stub of QSector-Artifact-infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
60 public Facet deepCopy() { |
374c2d70b982
Added stub of QSector-Artifact-infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
61 QSectorFacet copy = new QSectorFacet(); |
374c2d70b982
Added stub of QSector-Artifact-infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
62 copy.set(this); |
374c2d70b982
Added stub of QSector-Artifact-infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
63 return copy; |
374c2d70b982
Added stub of QSector-Artifact-infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
64 } |
374c2d70b982
Added stub of QSector-Artifact-infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
65 } |
374c2d70b982
Added stub of QSector-Artifact-infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
66 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |