Mercurial > dive4elements > river
annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/AnnotationArtifact.java @ 1065:193c49b7f6a3
Minor changes to stub MainValuesArtifact.
flys-artifacts/trunk@2545 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Wed, 24 Aug 2011 08:42:31 +0000 |
parents | 61c051e53f9b |
children | b1ed0ec0236f |
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; |
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 java.util.ArrayList; |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
4 import java.util.List; |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
5 |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
6 import org.w3c.dom.Document; |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
7 import org.w3c.dom.Element; |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
8 |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
9 import org.apache.log4j.Logger; |
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 org.hibernate.Session; |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
12 |
1032
abd2ab6dff4f
Let AnnotationArtifact fetch "more correct" data.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1026
diff
changeset
|
13 //import net.sf.ehcache.Cache; |
1026
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
14 |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
15 import de.intevation.artifacts.Artifact; |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
16 import de.intevation.artifacts.ArtifactNamespaceContext; |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
17 import de.intevation.artifacts.CallContext; |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
18 import de.intevation.artifacts.CallMeta; |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
19 |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
20 import de.intevation.artifactdatabase.ProtocolUtils; |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
21 import de.intevation.artifactdatabase.state.Facet; |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
22 import de.intevation.artifactdatabase.state.Output; |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
23 import de.intevation.artifactdatabase.state.State; |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
24 import de.intevation.artifactdatabase.state.StateEngine; |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
25 |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
26 import de.intevation.artifactdatabase.data.StateData; |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
27 |
1026
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
28 import de.intevation.artifacts.common.utils.XMLUtils; |
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 import de.intevation.flys.artifacts.states.DefaultState; |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
31 import de.intevation.flys.artifacts.context.FLYSContext; |
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 import de.intevation.flys.backend.SessionHolder; |
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 import de.intevation.flys.artifacts.cache.CacheFactory; |
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 import de.intevation.flys.model.Annotation; |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
38 import de.intevation.flys.artifacts.model.AnnotationsFactory; |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
39 |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
40 import de.intevation.flys.model.River; |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
41 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
42 import de.intevation.flys.artifacts.model.RiverFactory; |
1026
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 * Artifact to access names of Points Of Interest along a segment of a river. |
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 public class AnnotationArtifact extends StaticFLYSArtifact { |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
48 |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
49 /** The logger for this class. */ |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
50 private static Logger logger = Logger.getLogger(WINFOArtifact.class); |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
51 |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
52 /** The name of the artifact. */ |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
53 public static final String ARTIFACT_NAME = "annotation"; |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
54 |
1032
abd2ab6dff4f
Let AnnotationArtifact fetch "more correct" data.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1026
diff
changeset
|
55 /* Name of cache. */ |
abd2ab6dff4f
Let AnnotationArtifact fetch "more correct" data.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1026
diff
changeset
|
56 //public static final String CACHE_NAME = "annotations"; |
1026
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
57 |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
58 @Override |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
59 protected void initialize(Artifact artifact, Object context, CallMeta meta) { |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
60 logger.debug("Initialize internal state of AnnotationArtifact with: " + artifact.identifier()); |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
61 |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
62 FLYSArtifact flys = (FLYSArtifact) artifact; |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
63 addData("river", flys.getData("river")); |
1032
abd2ab6dff4f
Let AnnotationArtifact fetch "more correct" data.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1026
diff
changeset
|
64 /* |
abd2ab6dff4f
Let AnnotationArtifact fetch "more correct" data.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1026
diff
changeset
|
65 logger.debug("Could set ranges to " + |
abd2ab6dff4f
Let AnnotationArtifact fetch "more correct" data.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1026
diff
changeset
|
66 AnnotationsFactory.getAnnotationsBreadth( |
abd2ab6dff4f
Let AnnotationArtifact fetch "more correct" data.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1026
diff
changeset
|
67 getRiver().getName())[0]); |
abd2ab6dff4f
Let AnnotationArtifact fetch "more correct" data.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1026
diff
changeset
|
68 */ |
1026
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
69 |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
70 List<Facet> fs = new ArrayList<Facet>(); |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
71 |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
72 // TODO Add CallMeta (duplicate TODO in RiverAxisArtifact.java). |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
73 DefaultState state = (DefaultState) getCurrentState(context); |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
74 state.computeInit(this, hash(), context, meta, fs); |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
75 |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
76 if (!fs.isEmpty()) { |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
77 logger.debug("Facets to add in AnnotationsArtifact.initialize ."); |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
78 facets.put(getCurrentStateId(), fs); |
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 else { |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
81 logger.debug("No facets to add in AnnotationsArtifact.initialize ."); |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
82 } |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
83 } |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
84 |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
85 |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
86 public double[] getDistance() { |
1032
abd2ab6dff4f
Let AnnotationArtifact fetch "more correct" data.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1026
diff
changeset
|
87 /** TODO In initialize(), access maximal range of river (via |
abd2ab6dff4f
Let AnnotationArtifact fetch "more correct" data.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1026
diff
changeset
|
88 * AnnotationFactory) instead of overriding getDistance, |
abd2ab6dff4f
Let AnnotationArtifact fetch "more correct" data.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1026
diff
changeset
|
89 * important for diagram generation. */ |
1026
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
90 return new double[] {0f, 1000f}; |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
91 } |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
92 |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
93 |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
94 /** |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
95 * Create the description of this AnnotationArtifact-instance. |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
96 * |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
97 * @param data Some data. |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
98 * @param context The CallContext. |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
99 * |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
100 * @return the description of this artifact. |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
101 */ |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
102 public Document describe(Document data, CallContext context) { |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
103 logger.debug("Describe: the current state is: " + getCurrentStateId()); |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
104 |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
105 if (logger.isDebugEnabled()) { |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
106 dumpArtifact(); |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
107 } |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
108 |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
109 FLYSContext flysContext = getFlysContext(context); |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
110 StateEngine stateEngine = (StateEngine) flysContext.get( |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
111 FLYSContext.STATE_ENGINE_KEY); |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
112 |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
113 Document description = XMLUtils.newDocument(); |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
114 XMLUtils.ElementCreator creator = new XMLUtils.ElementCreator( |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
115 description, |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
116 ArtifactNamespaceContext.NAMESPACE_URI, |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
117 ArtifactNamespaceContext.NAMESPACE_PREFIX); |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
118 |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
119 Element root = ProtocolUtils.createRootNode(creator); |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
120 description.appendChild(root); |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
121 |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
122 State current = getCurrentState(context); |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
123 |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
124 ProtocolUtils.appendDescribeHeader(creator, root, identifier(), hash()); |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
125 ProtocolUtils.appendState(creator, root, current); |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
126 |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
127 Element name = ProtocolUtils.createArtNode( |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
128 creator, "name", |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
129 new String[] { "value" }, |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
130 new String[] { getName() }); |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
131 |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
132 Element outs = ProtocolUtils.createArtNode( |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
133 creator, "outputmodes", null, null); |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
134 appendOutputModes(description, outs, context); |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
135 |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
136 root.appendChild(name); |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
137 root.appendChild(outs); |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
138 |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
139 return description; |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
140 } |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
141 |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
142 |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
143 /** |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
144 * Returns the name of the concrete artifact. |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
145 * |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
146 * @return the name of the concrete artifact. |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
147 */ |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
148 public String getName() { |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
149 return ARTIFACT_NAME; |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
150 } |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
151 |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
152 |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
153 /** |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
154 * Append outputmode elements to given document. |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
155 * |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
156 * @param doc Document to add outputmodes to. |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
157 * @param outs Element to add outputmode elements to. |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
158 * @param context The given CallContext (mostly for internationalization). |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
159 */ |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
160 protected void appendOutputModes( |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
161 Document doc, |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
162 Element outs, |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
163 CallContext context) |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
164 { |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
165 List<String> stateIds = getPreviousStateIds(); |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
166 |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
167 XMLUtils.ElementCreator creator = new XMLUtils.ElementCreator( |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
168 doc, |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
169 ArtifactNamespaceContext.NAMESPACE_URI, |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
170 ArtifactNamespaceContext.NAMESPACE_PREFIX); |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
171 |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
172 FLYSContext flysContext = getFlysContext(context); |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
173 StateEngine engine = (StateEngine) flysContext.get( |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
174 FLYSContext.STATE_ENGINE_KEY); |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
175 |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
176 for (String stateId: stateIds) { |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
177 logger.debug("Append output modes for state: " + stateId); |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
178 DefaultState state = (DefaultState) engine.getState(stateId); |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
179 |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
180 List<Output> list = state.getOutputs(); |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
181 if (list == null || list.size() == 0) { |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
182 logger.debug("-> No output modes for this state."); |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
183 continue; |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
184 } |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
185 |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
186 List<Facet> fs = facets.get(stateId); |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
187 if (fs == null || fs.size() == 0) { |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
188 logger.debug("No facets found."); |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
189 continue; |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
190 } |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
191 |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
192 logger.debug("Found " + fs.size() + " facets in previous states."); |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
193 |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
194 List<Output> generated = generateOutputs(list, fs); |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
195 |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
196 ProtocolUtils.appendOutputModes(doc, outs, generated); |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
197 } |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
198 |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
199 try { |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
200 DefaultState cur = (DefaultState) getCurrentState(context); |
1050
eccf966fb677
State engine: Removed CallContext from state validation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1033
diff
changeset
|
201 if (cur.validate(this)) { |
1026
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
202 List<Output> list = cur.getOutputs(); |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
203 if (list != null && list.size() > 0) { |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
204 logger.debug( |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
205 "Append output modes for state: " + cur.getID()); |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
206 |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
207 List<Facet> fs = facets.get(cur.getID()); |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
208 if (fs != null && fs.size() > 0) { |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
209 List<Output> generated = generateOutputs(list, fs); |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
210 |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
211 logger.debug("Found " + fs.size() + " current facets."); |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
212 if (!generated.isEmpty()) { |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
213 ProtocolUtils.appendOutputModes( |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
214 doc, outs, generated); |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
215 } |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
216 else{ |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
217 logger.debug("Cannot append output to generated document."); |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
218 } |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
219 } |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
220 else { |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
221 logger.debug("No facets found for the current state."); |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
222 } |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
223 } |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
224 } |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
225 } |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
226 catch (IllegalArgumentException iae) { |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
227 // state is not valid, so we do not append its outputs. |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
228 } |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
229 } |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
230 |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
231 public River getRiver() { |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
232 StateData dRiver = getData("river"); |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
233 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
234 return dRiver != null |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
235 ? RiverFactory.getRiver((String) dRiver.getValue()) |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
236 : null; |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
237 } |
1026
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
238 |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
239 /** |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
240 * Get Annotations for Points (opposed to segments) in river in range. |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
241 * |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
242 * @return list of Annotations. |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
243 */ |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
244 public List<Annotation> getAnnotations() { |
1032
abd2ab6dff4f
Let AnnotationArtifact fetch "more correct" data.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1026
diff
changeset
|
245 String river = getRiver().getName(); |
1026
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
246 logger.debug("Search annotations for river: " /*+ river*/); |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
247 //Cache cache = CacheFactory.getCache(CACHE_NAME); |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
248 |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
249 List<Annotation> annotations = new ArrayList<Annotation>(); |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
250 |
1032
abd2ab6dff4f
Let AnnotationArtifact fetch "more correct" data.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1026
diff
changeset
|
251 return getAnnotationsUncached(river); |
abd2ab6dff4f
Let AnnotationArtifact fetch "more correct" data.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1026
diff
changeset
|
252 } |
abd2ab6dff4f
Let AnnotationArtifact fetch "more correct" data.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1026
diff
changeset
|
253 |
abd2ab6dff4f
Let AnnotationArtifact fetch "more correct" data.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1026
diff
changeset
|
254 /** |
abd2ab6dff4f
Let AnnotationArtifact fetch "more correct" data.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1026
diff
changeset
|
255 * Gets Annotations from Session/Database. |
abd2ab6dff4f
Let AnnotationArtifact fetch "more correct" data.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1026
diff
changeset
|
256 * |
abd2ab6dff4f
Let AnnotationArtifact fetch "more correct" data.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1026
diff
changeset
|
257 * @return List of Annotations fetched fresh from session/database. |
abd2ab6dff4f
Let AnnotationArtifact fetch "more correct" data.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1026
diff
changeset
|
258 * @see DistanceInfoService to access cached documents. |
abd2ab6dff4f
Let AnnotationArtifact fetch "more correct" data.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1026
diff
changeset
|
259 */ |
abd2ab6dff4f
Let AnnotationArtifact fetch "more correct" data.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1026
diff
changeset
|
260 protected List<Annotation> getAnnotationsUncached(String river) { |
abd2ab6dff4f
Let AnnotationArtifact fetch "more correct" data.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1026
diff
changeset
|
261 List<Annotation> annotations = new ArrayList<Annotation>(); |
1026
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
262 Session session = SessionHolder.acquire(); |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
263 try { |
1032
abd2ab6dff4f
Let AnnotationArtifact fetch "more correct" data.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1026
diff
changeset
|
264 annotations = AnnotationsFactory.getPointAnnotations(river); |
1026
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
265 } finally {session.close(); SessionHolder.release();} |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
266 return annotations; |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
267 } |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
268 } |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
269 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |