annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/AnnotationArtifact.java @ 2112:2d0b22602fc2

Cosmetics. flys-artifacts/trunk@3675 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Fri, 13 Jan 2012 11:41:05 +0000
parents a8aa343799a2
children a4bdf7d8527e
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
1675
19d0eb41e923 AnnotationArtifact: Bugfixes and enabled cache support.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1631
diff changeset
11 import net.sf.ehcache.Cache;
1026
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
12
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
13 import de.intevation.artifacts.Artifact;
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
14 import de.intevation.artifacts.ArtifactNamespaceContext;
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
15 import de.intevation.artifacts.CallContext;
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
16 import de.intevation.artifacts.CallMeta;
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
17
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
18 import de.intevation.artifactdatabase.ProtocolUtils;
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
19 import de.intevation.artifactdatabase.state.Facet;
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
20 import de.intevation.artifactdatabase.state.Output;
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
21 import de.intevation.artifactdatabase.state.State;
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
22 import de.intevation.artifactdatabase.state.StateEngine;
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
23
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
24 import de.intevation.artifacts.common.utils.XMLUtils;
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
25
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
26 import de.intevation.flys.artifacts.states.DefaultState;
1099
af73f196eccc Refactored to use new FLYSUtils, moved getRiver-functionality inside.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1077
diff changeset
27 import de.intevation.flys.artifacts.cache.CacheFactory;
1026
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
28 import de.intevation.flys.artifacts.context.FLYSContext;
1099
af73f196eccc Refactored to use new FLYSUtils, moved getRiver-functionality inside.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1077
diff changeset
29 import de.intevation.flys.artifacts.model.AnnotationsFactory;
1026
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
30
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
31 import de.intevation.flys.model.Annotation;
1055
61c051e53f9b Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1050
diff changeset
32
1099
af73f196eccc Refactored to use new FLYSUtils, moved getRiver-functionality inside.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1077
diff changeset
33 import de.intevation.flys.utils.FLYSUtils;
1026
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 /**
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
36 * 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
37 */
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
38 public class AnnotationArtifact extends StaticFLYSArtifact {
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
39
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
40 /** The logger for this class. */
1675
19d0eb41e923 AnnotationArtifact: Bugfixes and enabled cache support.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1631
diff changeset
41 private static Logger logger = Logger.getLogger(AnnotationArtifact.class);
1026
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
42
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
43 /** The name of the artifact. */
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
44 public static final String ARTIFACT_NAME = "annotation";
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
45
2112
2d0b22602fc2 Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1777
diff changeset
46 /** Name of cache. */
1675
19d0eb41e923 AnnotationArtifact: Bugfixes and enabled cache support.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1631
diff changeset
47 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
48
2112
2d0b22602fc2 Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1777
diff changeset
49 /** Get river, setup Facets. */
1026
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
50 @Override
1077
3067e700fc13 Minor cosmetics and docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1070
diff changeset
51 protected void initialize(Artifact artifact, Object context,
3067e700fc13 Minor cosmetics and docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1070
diff changeset
52 CallMeta meta) {
3067e700fc13 Minor cosmetics and docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1070
diff changeset
53 logger.debug("AnnotationArtifact.initialize, id: "
2112
2d0b22602fc2 Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1777
diff changeset
54 + artifact.identifier());
1026
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
55
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
56 FLYSArtifact flys = (FLYSArtifact) artifact;
2112
2d0b22602fc2 Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1777
diff changeset
57 importData(flys, "river");
1026
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
58
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
59 List<Facet> fs = new ArrayList<Facet>();
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
60
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
61 // 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
62 DefaultState state = (DefaultState) getCurrentState(context);
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
63 state.computeInit(this, hash(), context, meta, fs);
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
64
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
65 if (!fs.isEmpty()) {
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
66 logger.debug("Facets to add in AnnotationsArtifact.initialize .");
1771
c62ff9e72cea Restore mapping of state id to facets (revert, rev 3083 and 3088).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1765
diff changeset
67 facets.put(getCurrentStateId(), fs);
1026
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
68 }
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
69 else {
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
70 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
71 }
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
72 }
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
73
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
74
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
75 public double[] getDistance() {
1032
abd2ab6dff4f Let AnnotationArtifact fetch "more correct" data.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1026
diff changeset
76 /** 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
77 * AnnotationFactory) instead of overriding getDistance,
abd2ab6dff4f Let AnnotationArtifact fetch "more correct" data.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1026
diff changeset
78 * important for diagram generation. */
1026
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
79 return new double[] {0f, 1000f};
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
80 }
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
81
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 * Create the description of this AnnotationArtifact-instance.
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 * @param data Some data.
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
87 * @param context The CallContext.
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
88 *
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
89 * @return the description of this artifact.
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
90 */
1070
b1ed0ec0236f Smaller Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1055
diff changeset
91 @Override
1026
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
92 public Document describe(Document data, CallContext context) {
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
93 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
94
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
95 if (logger.isDebugEnabled()) {
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
96 dumpArtifact();
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
97 }
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
98
1777
a8aa343799a2 Extracet getFlysContext from FLYSArtifact to FLYSUtils.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1771
diff changeset
99 FLYSContext flysContext = FLYSUtils.getFlysContext(context);
1026
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
100 StateEngine stateEngine = (StateEngine) flysContext.get(
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
101 FLYSContext.STATE_ENGINE_KEY);
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
102
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
103 Document description = XMLUtils.newDocument();
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
104 XMLUtils.ElementCreator creator = new XMLUtils.ElementCreator(
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
105 description,
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
106 ArtifactNamespaceContext.NAMESPACE_URI,
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
107 ArtifactNamespaceContext.NAMESPACE_PREFIX);
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 Element root = ProtocolUtils.createRootNode(creator);
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
110 description.appendChild(root);
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
111
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
112 State current = getCurrentState(context);
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 ProtocolUtils.appendDescribeHeader(creator, root, identifier(), hash());
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
115 ProtocolUtils.appendState(creator, root, current);
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
116
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
117 Element name = ProtocolUtils.createArtNode(
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
118 creator, "name",
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
119 new String[] { "value" },
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
120 new String[] { getName() });
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 Element outs = ProtocolUtils.createArtNode(
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
123 creator, "outputmodes", null, null);
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
124 appendOutputModes(description, outs, context);
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
125
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
126 root.appendChild(name);
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
127 root.appendChild(outs);
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
128
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
129 return description;
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
130 }
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
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
133 /**
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
134 * Returns the name of the concrete artifact.
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 * @return the name of the concrete artifact.
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
137 */
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
138 public String getName() {
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
139 return ARTIFACT_NAME;
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 * Append outputmode elements to given document.
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 * @param doc Document to add outputmodes to.
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
147 * @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
148 * @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
149 */
1070
b1ed0ec0236f Smaller Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1055
diff changeset
150 //@Override
1026
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
151 protected void appendOutputModes(
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
152 Document doc,
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
153 Element outs,
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
154 CallContext context)
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 List<String> stateIds = getPreviousStateIds();
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
157
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
158 XMLUtils.ElementCreator creator = new XMLUtils.ElementCreator(
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
159 doc,
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
160 ArtifactNamespaceContext.NAMESPACE_URI,
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
161 ArtifactNamespaceContext.NAMESPACE_PREFIX);
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
162
1777
a8aa343799a2 Extracet getFlysContext from FLYSArtifact to FLYSUtils.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1771
diff changeset
163 FLYSContext flysContext = FLYSUtils.getFlysContext(context);
1026
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
164 StateEngine engine = (StateEngine) flysContext.get(
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
165 FLYSContext.STATE_ENGINE_KEY);
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 for (String stateId: stateIds) {
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
168 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
169 DefaultState state = (DefaultState) engine.getState(stateId);
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
170
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
171 List<Output> list = state.getOutputs();
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
172 if (list == null || list.size() == 0) {
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
173 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
174 continue;
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
1771
c62ff9e72cea Restore mapping of state id to facets (revert, rev 3083 and 3088).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1765
diff changeset
177 List<Facet> fs = facets.get(stateId);
c62ff9e72cea Restore mapping of state id to facets (revert, rev 3083 and 3088).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1765
diff changeset
178 if (fs == null || fs.size() == 0) {
1026
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
179 logger.debug("No facets found.");
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
180 continue;
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
1771
c62ff9e72cea Restore mapping of state id to facets (revert, rev 3083 and 3088).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1765
diff changeset
183 logger.debug("Found " + fs.size() + " facets in previous states.");
1026
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
184
1771
c62ff9e72cea Restore mapping of state id to facets (revert, rev 3083 and 3088).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1765
diff changeset
185 List<Output> generated = generateOutputs(list, fs);
1026
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 ProtocolUtils.appendOutputModes(doc, outs, generated);
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
188 }
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
189
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
190 try {
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
191 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
192 if (cur.validate(this)) {
1026
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
193 List<Output> list = cur.getOutputs();
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
194 if (list != null && list.size() > 0) {
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
195 logger.debug(
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
196 "Append output modes for state: " + cur.getID());
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
197
1771
c62ff9e72cea Restore mapping of state id to facets (revert, rev 3083 and 3088).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1765
diff changeset
198 List<Facet> fs = facets.get(cur.getID());
c62ff9e72cea Restore mapping of state id to facets (revert, rev 3083 and 3088).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1765
diff changeset
199 if (fs != null && fs.size() > 0) {
c62ff9e72cea Restore mapping of state id to facets (revert, rev 3083 and 3088).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1765
diff changeset
200 List<Output> generated = generateOutputs(list, fs);
1026
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
201
1771
c62ff9e72cea Restore mapping of state id to facets (revert, rev 3083 and 3088).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1765
diff changeset
202 logger.debug("Found " + fs.size() + " current facets.");
1026
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
203 if (!generated.isEmpty()) {
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
204 ProtocolUtils.appendOutputModes(
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
205 doc, outs, generated);
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 else{
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
208 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
209 }
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 else {
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
212 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
213 }
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
214 }
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 }
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
217 catch (IllegalArgumentException iae) {
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
218 // 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
219 }
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
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 * 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
225 *
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
226 * @return list of Annotations.
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 public List<Annotation> getAnnotations() {
1099
af73f196eccc Refactored to use new FLYSUtils, moved getRiver-functionality inside.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1077
diff changeset
229 String river = FLYSUtils.getRiver(this).getName();
1675
19d0eb41e923 AnnotationArtifact: Bugfixes and enabled cache support.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1631
diff changeset
230 logger.debug("Search annotations for river: " + river);
1026
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
231
1675
19d0eb41e923 AnnotationArtifact: Bugfixes and enabled cache support.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1631
diff changeset
232 Cache cache = CacheFactory.getCache(CACHE_NAME);
19d0eb41e923 AnnotationArtifact: Bugfixes and enabled cache support.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1631
diff changeset
233 String key = river;
19d0eb41e923 AnnotationArtifact: Bugfixes and enabled cache support.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1631
diff changeset
234 Object old = null;
1026
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
235
1675
19d0eb41e923 AnnotationArtifact: Bugfixes and enabled cache support.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1631
diff changeset
236 if (cache != null) {
19d0eb41e923 AnnotationArtifact: Bugfixes and enabled cache support.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1631
diff changeset
237 logger.debug("We are using a cache for annotations.");
19d0eb41e923 AnnotationArtifact: Bugfixes and enabled cache support.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1631
diff changeset
238
19d0eb41e923 AnnotationArtifact: Bugfixes and enabled cache support.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1631
diff changeset
239 net.sf.ehcache.Element element = cache.get(key);
19d0eb41e923 AnnotationArtifact: Bugfixes and enabled cache support.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1631
diff changeset
240 if (element != null) {
19d0eb41e923 AnnotationArtifact: Bugfixes and enabled cache support.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1631
diff changeset
241 logger.info("Fetched annotations from cache.");
19d0eb41e923 AnnotationArtifact: Bugfixes and enabled cache support.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1631
diff changeset
242 old = element.getValue();
19d0eb41e923 AnnotationArtifact: Bugfixes and enabled cache support.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1631
diff changeset
243 }
19d0eb41e923 AnnotationArtifact: Bugfixes and enabled cache support.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1631
diff changeset
244 }
19d0eb41e923 AnnotationArtifact: Bugfixes and enabled cache support.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1631
diff changeset
245
19d0eb41e923 AnnotationArtifact: Bugfixes and enabled cache support.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1631
diff changeset
246 if (old == null) {
19d0eb41e923 AnnotationArtifact: Bugfixes and enabled cache support.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1631
diff changeset
247 old = getAnnotationsUncached(river);
19d0eb41e923 AnnotationArtifact: Bugfixes and enabled cache support.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1631
diff changeset
248 }
19d0eb41e923 AnnotationArtifact: Bugfixes and enabled cache support.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1631
diff changeset
249
19d0eb41e923 AnnotationArtifact: Bugfixes and enabled cache support.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1631
diff changeset
250 if (cache != null && old != null) {
19d0eb41e923 AnnotationArtifact: Bugfixes and enabled cache support.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1631
diff changeset
251 cache.put(new net.sf.ehcache.Element(key, old));
19d0eb41e923 AnnotationArtifact: Bugfixes and enabled cache support.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1631
diff changeset
252 }
19d0eb41e923 AnnotationArtifact: Bugfixes and enabled cache support.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1631
diff changeset
253
19d0eb41e923 AnnotationArtifact: Bugfixes and enabled cache support.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1631
diff changeset
254 return old != null
19d0eb41e923 AnnotationArtifact: Bugfixes and enabled cache support.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1631
diff changeset
255 ? (List<Annotation>) old
19d0eb41e923 AnnotationArtifact: Bugfixes and enabled cache support.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1631
diff changeset
256 : new ArrayList<Annotation>();
1032
abd2ab6dff4f Let AnnotationArtifact fetch "more correct" data.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1026
diff changeset
257 }
abd2ab6dff4f Let AnnotationArtifact fetch "more correct" data.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1026
diff changeset
258
2112
2d0b22602fc2 Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1777
diff changeset
259
1032
abd2ab6dff4f Let AnnotationArtifact fetch "more correct" data.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1026
diff changeset
260 /**
abd2ab6dff4f Let AnnotationArtifact fetch "more correct" data.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1026
diff changeset
261 * Gets Annotations from Session/Database.
abd2ab6dff4f Let AnnotationArtifact fetch "more correct" data.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1026
diff changeset
262 *
abd2ab6dff4f Let AnnotationArtifact fetch "more correct" data.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1026
diff changeset
263 * @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
264 * @see DistanceInfoService to access cached documents.
abd2ab6dff4f Let AnnotationArtifact fetch "more correct" data.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1026
diff changeset
265 */
abd2ab6dff4f Let AnnotationArtifact fetch "more correct" data.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1026
diff changeset
266 protected List<Annotation> getAnnotationsUncached(String river) {
1675
19d0eb41e923 AnnotationArtifact: Bugfixes and enabled cache support.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1631
diff changeset
267 logger.info("Fetch annotations from database.");
19d0eb41e923 AnnotationArtifact: Bugfixes and enabled cache support.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1631
diff changeset
268
1032
abd2ab6dff4f Let AnnotationArtifact fetch "more correct" data.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1026
diff changeset
269 List<Annotation> annotations = new ArrayList<Annotation>();
1631
26e19cdaed5e Improved database session handling in services and artifacts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1624
diff changeset
270 annotations = AnnotationsFactory.getPointAnnotations(river);
26e19cdaed5e Improved database session handling in services and artifacts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1624
diff changeset
271
1026
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
272 return annotations;
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
273 }
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
274 }
a39511688679 Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
275 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org