annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/AnnotationArtifact.java @ 1070:b1ed0ec0236f

Smaller Cosmetics. flys-artifacts/trunk@2554 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Wed, 24 Aug 2011 11:38:30 +0000
parents 61c051e53f9b
children 3067e700fc13
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 */
1070
b1ed0ec0236f Smaller Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1055
diff changeset
102 @Override
1026
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
103 public Document describe(Document data, CallContext context) {
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
104 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
105
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
106 if (logger.isDebugEnabled()) {
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
107 dumpArtifact();
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
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
110 FLYSContext flysContext = getFlysContext(context);
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
111 StateEngine stateEngine = (StateEngine) flysContext.get(
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
112 FLYSContext.STATE_ENGINE_KEY);
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
113
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
114 Document description = XMLUtils.newDocument();
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
115 XMLUtils.ElementCreator creator = new XMLUtils.ElementCreator(
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
116 description,
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
117 ArtifactNamespaceContext.NAMESPACE_URI,
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
118 ArtifactNamespaceContext.NAMESPACE_PREFIX);
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
119
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
120 Element root = ProtocolUtils.createRootNode(creator);
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
121 description.appendChild(root);
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
122
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
123 State current = getCurrentState(context);
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
124
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
125 ProtocolUtils.appendDescribeHeader(creator, root, identifier(), hash());
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
126 ProtocolUtils.appendState(creator, root, current);
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
127
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
128 Element name = ProtocolUtils.createArtNode(
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
129 creator, "name",
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
130 new String[] { "value" },
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
131 new String[] { getName() });
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
132
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
133 Element outs = ProtocolUtils.createArtNode(
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
134 creator, "outputmodes", null, null);
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
135 appendOutputModes(description, outs, context);
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
136
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
137 root.appendChild(name);
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
138 root.appendChild(outs);
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
139
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
140 return description;
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 /**
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
145 * Returns the name of the concrete artifact.
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
146 *
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
147 * @return the name of the concrete artifact.
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
148 */
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
149 public String getName() {
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
150 return ARTIFACT_NAME;
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 /**
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
155 * Append outputmode elements to given document.
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
156 *
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
157 * @param doc Document to add outputmodes to.
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
158 * @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
159 * @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
160 */
1070
b1ed0ec0236f Smaller Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1055
diff changeset
161 //@Override
1026
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
162 protected void appendOutputModes(
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
163 Document doc,
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
164 Element outs,
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
165 CallContext context)
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 List<String> stateIds = getPreviousStateIds();
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
168
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
169 XMLUtils.ElementCreator creator = new XMLUtils.ElementCreator(
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
170 doc,
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
171 ArtifactNamespaceContext.NAMESPACE_URI,
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
172 ArtifactNamespaceContext.NAMESPACE_PREFIX);
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
173
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
174 FLYSContext flysContext = getFlysContext(context);
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
175 StateEngine engine = (StateEngine) flysContext.get(
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
176 FLYSContext.STATE_ENGINE_KEY);
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
177
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
178 for (String stateId: stateIds) {
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
179 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
180 DefaultState state = (DefaultState) engine.getState(stateId);
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
181
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
182 List<Output> list = state.getOutputs();
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
183 if (list == null || list.size() == 0) {
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
184 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
185 continue;
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
186 }
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
187
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
188 List<Facet> fs = facets.get(stateId);
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
189 if (fs == null || fs.size() == 0) {
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
190 logger.debug("No facets found.");
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
191 continue;
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
192 }
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 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
195
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
196 List<Output> generated = generateOutputs(list, fs);
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 ProtocolUtils.appendOutputModes(doc, outs, generated);
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
199 }
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
200
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
201 try {
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
202 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
203 if (cur.validate(this)) {
1026
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
204 List<Output> list = cur.getOutputs();
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
205 if (list != null && list.size() > 0) {
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
206 logger.debug(
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
207 "Append output modes for state: " + cur.getID());
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
208
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
209 List<Facet> fs = facets.get(cur.getID());
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
210 if (fs != null && fs.size() > 0) {
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
211 List<Output> generated = generateOutputs(list, fs);
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
212
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
213 logger.debug("Found " + fs.size() + " current facets.");
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
214 if (!generated.isEmpty()) {
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
215 ProtocolUtils.appendOutputModes(
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
216 doc, outs, generated);
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
217 }
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
218 else{
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
219 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
220 }
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
221 }
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
222 else {
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
223 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
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 }
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
227 }
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
228 catch (IllegalArgumentException iae) {
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
229 // 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
230 }
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
231 }
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
232
1055
61c051e53f9b Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1050
diff changeset
233 public River getRiver() {
61c051e53f9b Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1050
diff changeset
234 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
235
61c051e53f9b Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1050
diff changeset
236 return dRiver != null
61c051e53f9b Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1050
diff changeset
237 ? 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
238 : null;
61c051e53f9b Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1050
diff changeset
239 }
1026
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
240
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 * 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
243 *
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
244 * @return list of Annotations.
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
245 */
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
246 public List<Annotation> getAnnotations() {
1032
abd2ab6dff4f Let AnnotationArtifact fetch "more correct" data.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1026
diff changeset
247 String river = getRiver().getName();
1026
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
248 logger.debug("Search annotations for river: " /*+ river*/);
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
249 //Cache cache = CacheFactory.getCache(CACHE_NAME);
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
250
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
251 List<Annotation> annotations = new ArrayList<Annotation>();
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
252
1032
abd2ab6dff4f Let AnnotationArtifact fetch "more correct" data.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1026
diff changeset
253 return getAnnotationsUncached(river);
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
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 * Gets Annotations from Session/Database.
abd2ab6dff4f Let AnnotationArtifact fetch "more correct" data.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1026
diff changeset
258 *
abd2ab6dff4f Let AnnotationArtifact fetch "more correct" data.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1026
diff changeset
259 * @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
260 * @see DistanceInfoService to access cached documents.
abd2ab6dff4f Let AnnotationArtifact fetch "more correct" data.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1026
diff changeset
261 */
abd2ab6dff4f Let AnnotationArtifact fetch "more correct" data.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1026
diff changeset
262 protected List<Annotation> getAnnotationsUncached(String river) {
abd2ab6dff4f Let AnnotationArtifact fetch "more correct" data.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1026
diff changeset
263 List<Annotation> annotations = new ArrayList<Annotation>();
1026
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
264 Session session = SessionHolder.acquire();
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
265 try {
1032
abd2ab6dff4f Let AnnotationArtifact fetch "more correct" data.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1026
diff changeset
266 annotations = AnnotationsFactory.getPointAnnotations(river);
1026
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
267 } finally {session.close(); SessionHolder.release();}
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
268 return annotations;
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
269 }
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
270 }
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
271 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org