Mercurial > dive4elements > river
annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/AnnotationFacet.java @ 1095:f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
flys-artifacts/trunk@2598 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Fri, 26 Aug 2011 14:58:35 +0000 |
parents | 3067e700fc13 |
children | dd9dfe1e48fa |
rev | line source |
---|---|
1026
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.flys.artifacts.model; |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
2 |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
3 import org.apache.log4j.Logger; |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
4 |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
5 import de.intevation.artifacts.Artifact; |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
6 import de.intevation.artifacts.CallContext; |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
7 |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
8 import de.intevation.flys.artifacts.AnnotationArtifact; |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
9 |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
10 import de.intevation.artifactdatabase.state.DefaultFacet; |
1061
b1b0a0b61845
Made facets cloneable with the right type.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1026
diff
changeset
|
11 import de.intevation.artifactdatabase.state.Facet; |
1026
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 /** |
1077
3067e700fc13
Minor cosmetics and docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1061
diff
changeset
|
14 * Facet to access Annotations (landmarks, POIs) of a river. |
1026
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
15 */ |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
16 public class AnnotationFacet |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
17 extends DefaultFacet |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
18 { |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
19 /** Logger for this class. */ |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
20 private static final Logger logger = Logger.getLogger(AnnotationFacet.class); |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
21 |
1077
3067e700fc13
Minor cosmetics and docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1061
diff
changeset
|
22 |
3067e700fc13
Minor cosmetics and docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1061
diff
changeset
|
23 /** |
3067e700fc13
Minor cosmetics and docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1061
diff
changeset
|
24 * Trivial Constructor. |
3067e700fc13
Minor cosmetics and docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1061
diff
changeset
|
25 */ |
1061
b1b0a0b61845
Made facets cloneable with the right type.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1026
diff
changeset
|
26 public AnnotationFacet() { |
b1b0a0b61845
Made facets cloneable with the right type.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1026
diff
changeset
|
27 } |
b1b0a0b61845
Made facets cloneable with the right type.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1026
diff
changeset
|
28 |
1026
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
29 |
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 * Trivial Constructor for a AnnotationFacet. |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
32 * |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
33 * @param index Database-Index to use. |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
34 * @param name Name (~type) of Facet. |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
35 * @param description Description of Facet. |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
36 */ |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
37 public AnnotationFacet(int index, String name, String description) { |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
38 super(index, name, description); |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
39 } |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
40 |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
41 |
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 * Get List of Annotations for river from Artifact. |
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 * @param artifact (Annotation-)Artifact to query for list of Annotations. |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
46 * @param context Ignored. |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
47 */ |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
48 @Override |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
49 public Object getData(Artifact artifact, CallContext context) { |
1077
3067e700fc13
Minor cosmetics and docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1061
diff
changeset
|
50 AnnotationArtifact annotationArtifact = (AnnotationArtifact) artifact; |
1026
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
51 return annotationArtifact.getAnnotations(); |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
52 } |
1061
b1b0a0b61845
Made facets cloneable with the right type.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1026
diff
changeset
|
53 |
1077
3067e700fc13
Minor cosmetics and docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1061
diff
changeset
|
54 |
1061
b1b0a0b61845
Made facets cloneable with the right type.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1026
diff
changeset
|
55 @Override |
b1b0a0b61845
Made facets cloneable with the right type.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1026
diff
changeset
|
56 public Facet deepCopy() { |
b1b0a0b61845
Made facets cloneable with the right type.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1026
diff
changeset
|
57 AnnotationFacet copy = new AnnotationFacet(); |
b1b0a0b61845
Made facets cloneable with the right type.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1026
diff
changeset
|
58 copy.set(this); |
b1b0a0b61845
Made facets cloneable with the right type.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1026
diff
changeset
|
59 return copy; |
b1b0a0b61845
Made facets cloneable with the right type.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1026
diff
changeset
|
60 } |
1026
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
61 } |