Mercurial > dive4elements > river
annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/FLYSArtifact.java @ 2102:16e74c5e636f
Cosmetics.
flys-artifacts/trunk@3659 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Thu, 12 Jan 2012 12:20:56 +0000 |
parents | 8cb679d4ec49 |
children | 85d31c2620e5 |
rev | line source |
---|---|
119
84c0b151203e
Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.flys.artifacts; |
84c0b151203e
Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
2 |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
3 import de.intevation.artifactdatabase.ArtifactDatabaseImpl; |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
4 import de.intevation.artifactdatabase.DefaultArtifact; |
121
e0ded17a4846
Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
119
diff
changeset
|
5 |
1724
0349dd524f9c
Add convenience method to add default data as string.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1709
diff
changeset
|
6 import de.intevation.artifactdatabase.data.DefaultStateData; |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
7 import de.intevation.artifactdatabase.data.StateData; |
379
c21fb8de54f8
Enabled the FLYSArtifact to handle an array of inserted WQ values (without given ranges).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
377
diff
changeset
|
8 |
1057
d4a5d3941cc0
Build out/facet filter from XML document passed at creation time.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1056
diff
changeset
|
9 import de.intevation.artifactdatabase.state.DefaultFacet; |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
10 import de.intevation.artifactdatabase.state.DefaultOutput; |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
11 import de.intevation.artifactdatabase.state.Facet; |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
12 import de.intevation.artifactdatabase.state.Output; |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
13 import de.intevation.artifactdatabase.state.State; |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
14 import de.intevation.artifactdatabase.state.StateEngine; |
686
3dc61e00385e
Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
661
diff
changeset
|
15 |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
16 import de.intevation.artifactdatabase.transition.TransitionEngine; |
119
84c0b151203e
Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
17 |
940
f4439e015278
Append artifact recommendations to the artifact's describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
937
diff
changeset
|
18 import de.intevation.artifacts.Artifact; |
f4439e015278
Append artifact recommendations to the artifact's describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
937
diff
changeset
|
19 import de.intevation.artifacts.ArtifactDatabase; |
f4439e015278
Append artifact recommendations to the artifact's describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
937
diff
changeset
|
20 import de.intevation.artifacts.ArtifactDatabaseException; |
119
84c0b151203e
Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
21 import de.intevation.artifacts.ArtifactFactory; |
84c0b151203e
Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
22 import de.intevation.artifacts.CallContext; |
952
7399401f728c
Adapted the method of FLYSArtifact.setup() which has been changed in the artifact package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
944
diff
changeset
|
23 import de.intevation.artifacts.CallMeta; |
119
84c0b151203e
Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
24 |
84c0b151203e
Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
25 import de.intevation.artifacts.common.ArtifactNamespaceContext; |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
26 |
119
84c0b151203e
Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
27 import de.intevation.artifacts.common.utils.XMLUtils; |
84c0b151203e
Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
28 |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
29 import de.intevation.flys.artifacts.cache.CacheFactory; |
317
8f40a57229c3
FLYSArtifact provides methods to retrieve the real River, Gauge objects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
298
diff
changeset
|
30 |
119
84c0b151203e
Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
31 import de.intevation.flys.artifacts.context.FLYSContext; |
650
6695e03e9b82
Added parser for segments
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
637
diff
changeset
|
32 |
1777
a8aa343799a2
Extracet getFlysContext from FLYSArtifact to FLYSUtils.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1771
diff
changeset
|
33 import de.intevation.flys.artifacts.states.DefaultState; |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
34 import de.intevation.flys.artifacts.states.DefaultState.ComputeType; |
650
6695e03e9b82
Added parser for segments
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
637
diff
changeset
|
35 |
1777
a8aa343799a2
Extracet getFlysContext from FLYSArtifact to FLYSUtils.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1771
diff
changeset
|
36 import de.intevation.flys.utils.FLYSUtils; |
119
84c0b151203e
Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
37 |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
38 import java.util.ArrayList; |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
39 import java.util.Collection; |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
40 import java.util.HashMap; |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
41 import java.util.HashSet; |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
42 import java.util.List; |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
43 import java.util.Map; |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
44 import java.util.Set; |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
45 import java.util.TreeMap; |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
46 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
47 import javax.xml.xpath.XPathConstants; |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
48 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
49 import net.sf.ehcache.Cache; |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
50 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
51 import org.apache.log4j.Logger; |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
52 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
53 import org.w3c.dom.Document; |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
54 import org.w3c.dom.Element; |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
55 import org.w3c.dom.NodeList; |
119
84c0b151203e
Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
56 |
84c0b151203e
Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
57 /** |
84c0b151203e
Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
58 * The defaul FLYS artifact. |
84c0b151203e
Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
59 * |
84c0b151203e
Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
60 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> |
84c0b151203e
Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
61 */ |
84c0b151203e
Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
62 public abstract class FLYSArtifact extends DefaultArtifact { |
84c0b151203e
Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
63 |
1704
e8627d1e2db6
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1656
diff
changeset
|
64 /** The logger that is used in this artifact. */ |
119
84c0b151203e
Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
65 private static Logger logger = Logger.getLogger(FLYSArtifact.class); |
84c0b151203e
Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
66 |
686
3dc61e00385e
Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
661
diff
changeset
|
67 public static final String COMPUTING_CACHE = "computed.values"; |
3dc61e00385e
Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
661
diff
changeset
|
68 |
1704
e8627d1e2db6
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1656
diff
changeset
|
69 /** The XPath that points to the input data elements of the FEED document. */ |
121
e0ded17a4846
Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
119
diff
changeset
|
70 public static final String XPATH_FEED_INPUT = |
e0ded17a4846
Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
119
diff
changeset
|
71 "/art:action/art:data/art:input"; |
119
84c0b151203e
Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
72 |
1704
e8627d1e2db6
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1656
diff
changeset
|
73 /** The XPath that points to the name of the target state of ADVANCE. */ |
122
d3b8b0b1d010
Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
121
diff
changeset
|
74 public static final String XPATH_ADVANCE_TARGET = |
d3b8b0b1d010
Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
121
diff
changeset
|
75 "/art:action/art:target/@art:name"; |
d3b8b0b1d010
Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
121
diff
changeset
|
76 |
940
f4439e015278
Append artifact recommendations to the artifact's describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
937
diff
changeset
|
77 public static final String XPATH_MODEL_ARTIFACT = |
941
1b509e4cf99b
Added a computeInit() method to intialize data/facets after creating new artifacts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
940
diff
changeset
|
78 "/art:action/art:template/@uuid"; |
940
f4439e015278
Append artifact recommendations to the artifact's describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
937
diff
changeset
|
79 |
1057
d4a5d3941cc0
Build out/facet filter from XML document passed at creation time.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1056
diff
changeset
|
80 public static final String XPATH_FILTER = |
d4a5d3941cc0
Build out/facet filter from XML document passed at creation time.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1056
diff
changeset
|
81 "/art:action/art:filter/art:out"; |
d4a5d3941cc0
Build out/facet filter from XML document passed at creation time.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1056
diff
changeset
|
82 |
1704
e8627d1e2db6
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1656
diff
changeset
|
83 /** The constant string that shows that an operation was successful. */ |
122
d3b8b0b1d010
Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
121
diff
changeset
|
84 public static final String OPERATION_SUCCESSFUL = "SUCCESS"; |
d3b8b0b1d010
Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
121
diff
changeset
|
85 |
1704
e8627d1e2db6
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1656
diff
changeset
|
86 /** The constant string that shows that an operation failed. */ |
122
d3b8b0b1d010
Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
121
diff
changeset
|
87 public static final String OPERATION_FAILED = "FAILURE"; |
d3b8b0b1d010
Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
121
diff
changeset
|
88 |
119
84c0b151203e
Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
89 /** The identifier of the current state. */ |
84c0b151203e
Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
90 protected String currentStateId; |
84c0b151203e
Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
91 |
1704
e8627d1e2db6
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1656
diff
changeset
|
92 /** The identifiers of previous states on a stack. */ |
661
fdc898a134a7
Use java.util.List instead of java.util.Vector. Removed superfluous imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
658
diff
changeset
|
93 protected List<String> previousStateIds; |
122
d3b8b0b1d010
Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
121
diff
changeset
|
94 |
1704
e8627d1e2db6
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1656
diff
changeset
|
95 /** The name of the artifact. */ |
119
84c0b151203e
Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
96 protected String name; |
84c0b151203e
Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
97 |
1704
e8627d1e2db6
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1656
diff
changeset
|
98 /** The data that have been inserted into this artifact. */ |
121
e0ded17a4846
Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
119
diff
changeset
|
99 protected Map<String, StateData> data; |
e0ded17a4846
Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
119
diff
changeset
|
100 |
1771
c62ff9e72cea
Restore mapping of state id to facets (revert, rev 3083 and 3088).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1765
diff
changeset
|
101 /** Mapping of state names to created facets. */ |
c62ff9e72cea
Restore mapping of state id to facets (revert, rev 3083 and 3088).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1765
diff
changeset
|
102 protected Map<String, List<Facet>> facets; |
687
06689035024c
Added a compute() method to WINFOArtifact which acts as a dispatcher for different computations. It triggers a calculation based on ComputeCallbacks that are generated by the current states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
686
diff
changeset
|
103 |
1704
e8627d1e2db6
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1656
diff
changeset
|
104 /** |
e8627d1e2db6
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1656
diff
changeset
|
105 * Used to generates "view" on the facets (hides facets not matching the |
e8627d1e2db6
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1656
diff
changeset
|
106 * filter in output of collection); out -> facets. |
e8627d1e2db6
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1656
diff
changeset
|
107 */ |
1056
bd1b751deab3
Added optional positive filter for outs and facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1055
diff
changeset
|
108 protected Map<String, List<Facet>> filterFacets; |
bd1b751deab3
Added optional positive filter for outs and facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1055
diff
changeset
|
109 |
121
e0ded17a4846
Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
119
diff
changeset
|
110 |
e0ded17a4846
Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
119
diff
changeset
|
111 /** |
e0ded17a4846
Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
119
diff
changeset
|
112 * The default constructor that creates an empty FLYSArtifact. |
e0ded17a4846
Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
119
diff
changeset
|
113 */ |
e0ded17a4846
Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
119
diff
changeset
|
114 public FLYSArtifact() { |
686
3dc61e00385e
Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
661
diff
changeset
|
115 data = new TreeMap<String, StateData>(); |
661
fdc898a134a7
Use java.util.List instead of java.util.Vector. Removed superfluous imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
658
diff
changeset
|
116 previousStateIds = new ArrayList<String>(); |
1771
c62ff9e72cea
Restore mapping of state id to facets (revert, rev 3083 and 3088).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1765
diff
changeset
|
117 facets = new HashMap<String, List<Facet>>(); |
121
e0ded17a4846
Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
119
diff
changeset
|
118 } |
e0ded17a4846
Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
119
diff
changeset
|
119 |
e0ded17a4846
Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
119
diff
changeset
|
120 |
e0ded17a4846
Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
119
diff
changeset
|
121 /** |
e0ded17a4846
Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
119
diff
changeset
|
122 * Returns the name of the concrete artifact. |
e0ded17a4846
Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
119
diff
changeset
|
123 * |
e0ded17a4846
Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
119
diff
changeset
|
124 * @return the name of the concrete artifact. |
e0ded17a4846
Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
119
diff
changeset
|
125 */ |
1059
fdb0f4ef96f0
Made FLYS artifacts cloneable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1057
diff
changeset
|
126 public String getName() { |
fdb0f4ef96f0
Made FLYS artifacts cloneable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1057
diff
changeset
|
127 return name; |
fdb0f4ef96f0
Made FLYS artifacts cloneable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1057
diff
changeset
|
128 } |
121
e0ded17a4846
Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
119
diff
changeset
|
129 |
119
84c0b151203e
Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
130 |
84c0b151203e
Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
131 /** |
84c0b151203e
Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
132 * Initialize the artifact and insert new data if <code>data</code> contains |
84c0b151203e
Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
133 * information necessary for this artifact. |
84c0b151203e
Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
134 * |
84c0b151203e
Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
135 * @param identifier The UUID. |
84c0b151203e
Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
136 * @param factory The factory that is used to create this artifact. |
84c0b151203e
Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
137 * @param context The CallContext. |
84c0b151203e
Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
138 * @param data Some optional data. |
84c0b151203e
Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
139 */ |
84c0b151203e
Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
140 @Override |
84c0b151203e
Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
141 public void setup( |
84c0b151203e
Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
142 String identifier, |
84c0b151203e
Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
143 ArtifactFactory factory, |
84c0b151203e
Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
144 Object context, |
952
7399401f728c
Adapted the method of FLYSArtifact.setup() which has been changed in the artifact package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
944
diff
changeset
|
145 CallMeta callMeta, |
119
84c0b151203e
Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
146 Document data) |
84c0b151203e
Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
147 { |
84c0b151203e
Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
148 logger.debug("Setup this artifact with the uuid: " + identifier); |
84c0b151203e
Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
149 |
952
7399401f728c
Adapted the method of FLYSArtifact.setup() which has been changed in the artifact package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
944
diff
changeset
|
150 super.setup(identifier, factory, context, callMeta, data); |
119
84c0b151203e
Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
151 |
1777
a8aa343799a2
Extracet getFlysContext from FLYSArtifact to FLYSUtils.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1771
diff
changeset
|
152 FLYSContext flysContext = FLYSUtils.getFlysContext(context); |
1067
f364410c7bc9
Refactored (state access) to ease future development of more trivial artifacts.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1059
diff
changeset
|
153 |
f364410c7bc9
Refactored (state access) to ease future development of more trivial artifacts.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1059
diff
changeset
|
154 List<State> states = getStates(context); |
119
84c0b151203e
Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
155 |
121
e0ded17a4846
Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
119
diff
changeset
|
156 String name = getName(); |
e0ded17a4846
Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
119
diff
changeset
|
157 logger.debug("Set initial state for artifact '" + name + "'"); |
119
84c0b151203e
Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
158 |
84c0b151203e
Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
159 setCurrentState(states.get(0)); |
940
f4439e015278
Append artifact recommendations to the artifact's describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
937
diff
changeset
|
160 |
f4439e015278
Append artifact recommendations to the artifact's describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
937
diff
changeset
|
161 String model = XMLUtils.xpathString( |
f4439e015278
Append artifact recommendations to the artifact's describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
937
diff
changeset
|
162 data, |
f4439e015278
Append artifact recommendations to the artifact's describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
937
diff
changeset
|
163 XPATH_MODEL_ARTIFACT, |
f4439e015278
Append artifact recommendations to the artifact's describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
937
diff
changeset
|
164 ArtifactNamespaceContext.INSTANCE); |
f4439e015278
Append artifact recommendations to the artifact's describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
937
diff
changeset
|
165 |
f4439e015278
Append artifact recommendations to the artifact's describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
937
diff
changeset
|
166 if (model != null && model.length() > 0) { |
f4439e015278
Append artifact recommendations to the artifact's describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
937
diff
changeset
|
167 ArtifactDatabase db = (ArtifactDatabase) flysContext.get( |
f4439e015278
Append artifact recommendations to the artifact's describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
937
diff
changeset
|
168 ArtifactDatabaseImpl.GLOBAL_CONTEXT_KEY); |
f4439e015278
Append artifact recommendations to the artifact's describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
937
diff
changeset
|
169 |
f4439e015278
Append artifact recommendations to the artifact's describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
937
diff
changeset
|
170 try { |
952
7399401f728c
Adapted the method of FLYSArtifact.setup() which has been changed in the artifact package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
944
diff
changeset
|
171 initialize(db.getRawArtifact(model), context, callMeta); |
940
f4439e015278
Append artifact recommendations to the artifact's describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
937
diff
changeset
|
172 } |
f4439e015278
Append artifact recommendations to the artifact's describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
937
diff
changeset
|
173 catch (ArtifactDatabaseException adbe) { |
f4439e015278
Append artifact recommendations to the artifact's describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
937
diff
changeset
|
174 logger.error(adbe, adbe); |
f4439e015278
Append artifact recommendations to the artifact's describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
937
diff
changeset
|
175 } |
f4439e015278
Append artifact recommendations to the artifact's describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
937
diff
changeset
|
176 } |
1057
d4a5d3941cc0
Build out/facet filter from XML document passed at creation time.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1056
diff
changeset
|
177 |
d4a5d3941cc0
Build out/facet filter from XML document passed at creation time.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1056
diff
changeset
|
178 filterFacets = buildFilterFacets(data); |
940
f4439e015278
Append artifact recommendations to the artifact's describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
937
diff
changeset
|
179 } |
f4439e015278
Append artifact recommendations to the artifact's describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
937
diff
changeset
|
180 |
1763
0e748e8972b5
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1724
diff
changeset
|
181 |
1059
fdb0f4ef96f0
Made FLYS artifacts cloneable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1057
diff
changeset
|
182 protected List<String> clonePreviousStateIds() { |
fdb0f4ef96f0
Made FLYS artifacts cloneable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1057
diff
changeset
|
183 return new ArrayList<String>(previousStateIds); |
fdb0f4ef96f0
Made FLYS artifacts cloneable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1057
diff
changeset
|
184 } |
fdb0f4ef96f0
Made FLYS artifacts cloneable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1057
diff
changeset
|
185 |
1895
1be3a4636ee3
New convenience function to copy data from one artifact to another.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1809
diff
changeset
|
186 /** |
1be3a4636ee3
New convenience function to copy data from one artifact to another.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1809
diff
changeset
|
187 * Copies data item from other artifact to this artifact. |
1be3a4636ee3
New convenience function to copy data from one artifact to another.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1809
diff
changeset
|
188 * @param other Artifact from which to get data. |
1be3a4636ee3
New convenience function to copy data from one artifact to another.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1809
diff
changeset
|
189 * @param name Name of data. |
1be3a4636ee3
New convenience function to copy data from one artifact to another.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1809
diff
changeset
|
190 */ |
1be3a4636ee3
New convenience function to copy data from one artifact to another.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1809
diff
changeset
|
191 protected void importData(FLYSArtifact other, final String name) { |
1be3a4636ee3
New convenience function to copy data from one artifact to another.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1809
diff
changeset
|
192 if (other == null) { |
1be3a4636ee3
New convenience function to copy data from one artifact to another.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1809
diff
changeset
|
193 logger.error("No other art. to import data " + name + " from."); |
1be3a4636ee3
New convenience function to copy data from one artifact to another.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1809
diff
changeset
|
194 } |
1be3a4636ee3
New convenience function to copy data from one artifact to another.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1809
diff
changeset
|
195 |
1be3a4636ee3
New convenience function to copy data from one artifact to another.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1809
diff
changeset
|
196 StateData sd = other.getData(name); |
1be3a4636ee3
New convenience function to copy data from one artifact to another.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1809
diff
changeset
|
197 |
1be3a4636ee3
New convenience function to copy data from one artifact to another.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1809
diff
changeset
|
198 if (sd == null) { |
1be3a4636ee3
New convenience function to copy data from one artifact to another.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1809
diff
changeset
|
199 logger.warn("Other artifact has no data " + name + "."); |
1be3a4636ee3
New convenience function to copy data from one artifact to another.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1809
diff
changeset
|
200 return; |
1be3a4636ee3
New convenience function to copy data from one artifact to another.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1809
diff
changeset
|
201 } |
1be3a4636ee3
New convenience function to copy data from one artifact to another.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1809
diff
changeset
|
202 |
1be3a4636ee3
New convenience function to copy data from one artifact to another.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1809
diff
changeset
|
203 this.addData(name, sd); |
1be3a4636ee3
New convenience function to copy data from one artifact to another.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1809
diff
changeset
|
204 } |
1763
0e748e8972b5
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1724
diff
changeset
|
205 |
1059
fdb0f4ef96f0
Made FLYS artifacts cloneable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1057
diff
changeset
|
206 protected Map<String, StateData> cloneData() { |
fdb0f4ef96f0
Made FLYS artifacts cloneable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1057
diff
changeset
|
207 Map<String, StateData> copy = new TreeMap<String, StateData>(); |
fdb0f4ef96f0
Made FLYS artifacts cloneable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1057
diff
changeset
|
208 |
fdb0f4ef96f0
Made FLYS artifacts cloneable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1057
diff
changeset
|
209 for (Map.Entry<String, StateData> entry: data.entrySet()) { |
fdb0f4ef96f0
Made FLYS artifacts cloneable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1057
diff
changeset
|
210 copy.put(entry.getKey(), entry.getValue().deepCopy()); |
fdb0f4ef96f0
Made FLYS artifacts cloneable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1057
diff
changeset
|
211 } |
fdb0f4ef96f0
Made FLYS artifacts cloneable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1057
diff
changeset
|
212 |
fdb0f4ef96f0
Made FLYS artifacts cloneable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1057
diff
changeset
|
213 return copy; |
fdb0f4ef96f0
Made FLYS artifacts cloneable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1057
diff
changeset
|
214 } |
fdb0f4ef96f0
Made FLYS artifacts cloneable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1057
diff
changeset
|
215 |
1763
0e748e8972b5
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1724
diff
changeset
|
216 /** |
0e748e8972b5
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1724
diff
changeset
|
217 * Return a copy of the facet mapping. |
1771
c62ff9e72cea
Restore mapping of state id to facets (revert, rev 3083 and 3088).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1765
diff
changeset
|
218 * @return Mapping of state-ids to facets. |
1763
0e748e8972b5
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1724
diff
changeset
|
219 */ |
1771
c62ff9e72cea
Restore mapping of state id to facets (revert, rev 3083 and 3088).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1765
diff
changeset
|
220 protected Map<String, List<Facet>> cloneFacets() { |
c62ff9e72cea
Restore mapping of state id to facets (revert, rev 3083 and 3088).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1765
diff
changeset
|
221 Map copy = new HashMap<String, List<Facet>>(); |
1059
fdb0f4ef96f0
Made FLYS artifacts cloneable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1057
diff
changeset
|
222 |
1771
c62ff9e72cea
Restore mapping of state id to facets (revert, rev 3083 and 3088).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1765
diff
changeset
|
223 for (Map.Entry<String, List<Facet>> entry: facets.entrySet()) { |
c62ff9e72cea
Restore mapping of state id to facets (revert, rev 3083 and 3088).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1765
diff
changeset
|
224 List<Facet> facets = entry.getValue(); |
c62ff9e72cea
Restore mapping of state id to facets (revert, rev 3083 and 3088).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1765
diff
changeset
|
225 List<Facet> facetCopies = new ArrayList<Facet>(facets.size()); |
c62ff9e72cea
Restore mapping of state id to facets (revert, rev 3083 and 3088).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1765
diff
changeset
|
226 for (Facet facet: facets) { |
c62ff9e72cea
Restore mapping of state id to facets (revert, rev 3083 and 3088).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1765
diff
changeset
|
227 facetCopies.add(facet.deepCopy()); |
c62ff9e72cea
Restore mapping of state id to facets (revert, rev 3083 and 3088).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1765
diff
changeset
|
228 } |
c62ff9e72cea
Restore mapping of state id to facets (revert, rev 3083 and 3088).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1765
diff
changeset
|
229 copy.put(entry.getKey(), facetCopies); |
1059
fdb0f4ef96f0
Made FLYS artifacts cloneable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1057
diff
changeset
|
230 } |
fdb0f4ef96f0
Made FLYS artifacts cloneable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1057
diff
changeset
|
231 |
fdb0f4ef96f0
Made FLYS artifacts cloneable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1057
diff
changeset
|
232 return copy; |
fdb0f4ef96f0
Made FLYS artifacts cloneable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1057
diff
changeset
|
233 } |
940
f4439e015278
Append artifact recommendations to the artifact's describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
937
diff
changeset
|
234 |
1763
0e748e8972b5
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1724
diff
changeset
|
235 |
1765
5d8b3880a553
Do not store association of states to facets, let artifacts keep facets in a pure list.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1763
diff
changeset
|
236 /** |
5d8b3880a553
Do not store association of states to facets, let artifacts keep facets in a pure list.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1763
diff
changeset
|
237 * (called from setup). |
1771
c62ff9e72cea
Restore mapping of state id to facets (revert, rev 3083 and 3088).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1765
diff
changeset
|
238 * @param artifact master-artifact (if any, otherwise initialize is not called). |
1765
5d8b3880a553
Do not store association of states to facets, let artifacts keep facets in a pure list.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1763
diff
changeset
|
239 */ |
952
7399401f728c
Adapted the method of FLYSArtifact.setup() which has been changed in the artifact package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
944
diff
changeset
|
240 protected void initialize( |
7399401f728c
Adapted the method of FLYSArtifact.setup() which has been changed in the artifact package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
944
diff
changeset
|
241 Artifact artifact, |
7399401f728c
Adapted the method of FLYSArtifact.setup() which has been changed in the artifact package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
944
diff
changeset
|
242 Object context, |
7399401f728c
Adapted the method of FLYSArtifact.setup() which has been changed in the artifact package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
944
diff
changeset
|
243 CallMeta callMeta) |
7399401f728c
Adapted the method of FLYSArtifact.setup() which has been changed in the artifact package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
944
diff
changeset
|
244 { |
1059
fdb0f4ef96f0
Made FLYS artifacts cloneable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1057
diff
changeset
|
245 if (!(artifact instanceof FLYSArtifact)) { |
fdb0f4ef96f0
Made FLYS artifacts cloneable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1057
diff
changeset
|
246 return; |
fdb0f4ef96f0
Made FLYS artifacts cloneable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1057
diff
changeset
|
247 } |
fdb0f4ef96f0
Made FLYS artifacts cloneable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1057
diff
changeset
|
248 |
fdb0f4ef96f0
Made FLYS artifacts cloneable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1057
diff
changeset
|
249 FLYSArtifact flys = (FLYSArtifact)artifact; |
fdb0f4ef96f0
Made FLYS artifacts cloneable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1057
diff
changeset
|
250 |
fdb0f4ef96f0
Made FLYS artifacts cloneable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1057
diff
changeset
|
251 currentStateId = flys.currentStateId; |
fdb0f4ef96f0
Made FLYS artifacts cloneable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1057
diff
changeset
|
252 previousStateIds = flys.clonePreviousStateIds(); |
fdb0f4ef96f0
Made FLYS artifacts cloneable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1057
diff
changeset
|
253 name = flys.name; |
fdb0f4ef96f0
Made FLYS artifacts cloneable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1057
diff
changeset
|
254 data = flys.cloneData(); |
fdb0f4ef96f0
Made FLYS artifacts cloneable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1057
diff
changeset
|
255 facets = flys.cloneFacets(); |
fdb0f4ef96f0
Made FLYS artifacts cloneable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1057
diff
changeset
|
256 // Do not clone filter facets! |
2093
ebc2aa64c1be
Call State.initialize() for each State of an Artifact in FLYSArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2038
diff
changeset
|
257 |
ebc2aa64c1be
Call State.initialize() for each State of an Artifact in FLYSArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2038
diff
changeset
|
258 List<String> stateIds = getPreviousStateIds(); |
ebc2aa64c1be
Call State.initialize() for each State of an Artifact in FLYSArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2038
diff
changeset
|
259 stateIds.add(getCurrentStateId()); |
ebc2aa64c1be
Call State.initialize() for each State of an Artifact in FLYSArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2038
diff
changeset
|
260 |
ebc2aa64c1be
Call State.initialize() for each State of an Artifact in FLYSArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2038
diff
changeset
|
261 for (String stateId: stateIds) { |
ebc2aa64c1be
Call State.initialize() for each State of an Artifact in FLYSArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2038
diff
changeset
|
262 State state = getState(context, stateId); |
ebc2aa64c1be
Call State.initialize() for each State of an Artifact in FLYSArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2038
diff
changeset
|
263 |
ebc2aa64c1be
Call State.initialize() for each State of an Artifact in FLYSArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2038
diff
changeset
|
264 if (state != null) { |
2095
8cb679d4ec49
Implemented initialize() in FloodMapState to enable cloning floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2093
diff
changeset
|
265 state.initialize(artifact, this, context, callMeta); |
2093
ebc2aa64c1be
Call State.initialize() for each State of an Artifact in FLYSArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2038
diff
changeset
|
266 } |
ebc2aa64c1be
Call State.initialize() for each State of an Artifact in FLYSArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2038
diff
changeset
|
267 } |
119
84c0b151203e
Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
268 } |
84c0b151203e
Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
269 |
1704
e8627d1e2db6
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1656
diff
changeset
|
270 |
e8627d1e2db6
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1656
diff
changeset
|
271 /** |
e8627d1e2db6
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1656
diff
changeset
|
272 * Builds filter facets from document. |
e8627d1e2db6
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1656
diff
changeset
|
273 * @see filterFacets |
e8627d1e2db6
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1656
diff
changeset
|
274 */ |
1057
d4a5d3941cc0
Build out/facet filter from XML document passed at creation time.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1056
diff
changeset
|
275 protected Map<String, List<Facet>> buildFilterFacets(Document document) { |
d4a5d3941cc0
Build out/facet filter from XML document passed at creation time.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1056
diff
changeset
|
276 |
d4a5d3941cc0
Build out/facet filter from XML document passed at creation time.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1056
diff
changeset
|
277 NodeList nodes = (NodeList)XMLUtils.xpath( |
d4a5d3941cc0
Build out/facet filter from XML document passed at creation time.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1056
diff
changeset
|
278 document, |
d4a5d3941cc0
Build out/facet filter from XML document passed at creation time.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1056
diff
changeset
|
279 XPATH_FILTER, |
d4a5d3941cc0
Build out/facet filter from XML document passed at creation time.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1056
diff
changeset
|
280 XPathConstants.NODESET, |
d4a5d3941cc0
Build out/facet filter from XML document passed at creation time.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1056
diff
changeset
|
281 ArtifactNamespaceContext.INSTANCE); |
d4a5d3941cc0
Build out/facet filter from XML document passed at creation time.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1056
diff
changeset
|
282 |
d4a5d3941cc0
Build out/facet filter from XML document passed at creation time.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1056
diff
changeset
|
283 if (nodes == null || nodes.getLength() == 0) { |
d4a5d3941cc0
Build out/facet filter from XML document passed at creation time.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1056
diff
changeset
|
284 return null; |
d4a5d3941cc0
Build out/facet filter from XML document passed at creation time.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1056
diff
changeset
|
285 } |
d4a5d3941cc0
Build out/facet filter from XML document passed at creation time.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1056
diff
changeset
|
286 |
d4a5d3941cc0
Build out/facet filter from XML document passed at creation time.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1056
diff
changeset
|
287 Map<String, List<Facet>> result = new HashMap<String, List<Facet>>(); |
d4a5d3941cc0
Build out/facet filter from XML document passed at creation time.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1056
diff
changeset
|
288 |
d4a5d3941cc0
Build out/facet filter from XML document passed at creation time.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1056
diff
changeset
|
289 for (int i = 0, N = nodes.getLength(); i < N; ++i) { |
d4a5d3941cc0
Build out/facet filter from XML document passed at creation time.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1056
diff
changeset
|
290 Element element = (Element)nodes.item(i); |
d4a5d3941cc0
Build out/facet filter from XML document passed at creation time.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1056
diff
changeset
|
291 String oName = element.getAttribute("name"); |
d4a5d3941cc0
Build out/facet filter from XML document passed at creation time.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1056
diff
changeset
|
292 if (oName.length() == 0) { |
d4a5d3941cc0
Build out/facet filter from XML document passed at creation time.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1056
diff
changeset
|
293 continue; |
d4a5d3941cc0
Build out/facet filter from XML document passed at creation time.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1056
diff
changeset
|
294 } |
d4a5d3941cc0
Build out/facet filter from XML document passed at creation time.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1056
diff
changeset
|
295 |
d4a5d3941cc0
Build out/facet filter from XML document passed at creation time.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1056
diff
changeset
|
296 List<Facet> facets = new ArrayList<Facet>(); |
d4a5d3941cc0
Build out/facet filter from XML document passed at creation time.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1056
diff
changeset
|
297 |
d4a5d3941cc0
Build out/facet filter from XML document passed at creation time.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1056
diff
changeset
|
298 NodeList facetNodes = element.getElementsByTagNameNS( |
d4a5d3941cc0
Build out/facet filter from XML document passed at creation time.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1056
diff
changeset
|
299 ArtifactNamespaceContext.NAMESPACE_URI, |
d4a5d3941cc0
Build out/facet filter from XML document passed at creation time.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1056
diff
changeset
|
300 "facet"); |
d4a5d3941cc0
Build out/facet filter from XML document passed at creation time.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1056
diff
changeset
|
301 |
d4a5d3941cc0
Build out/facet filter from XML document passed at creation time.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1056
diff
changeset
|
302 for (int j = 0, M = facetNodes.getLength(); j < M; ++j) { |
d4a5d3941cc0
Build out/facet filter from XML document passed at creation time.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1056
diff
changeset
|
303 Element facetElement = (Element)facetNodes.item(j); |
d4a5d3941cc0
Build out/facet filter from XML document passed at creation time.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1056
diff
changeset
|
304 |
d4a5d3941cc0
Build out/facet filter from XML document passed at creation time.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1056
diff
changeset
|
305 String fName = facetElement.getAttribute("name"); |
d4a5d3941cc0
Build out/facet filter from XML document passed at creation time.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1056
diff
changeset
|
306 |
d4a5d3941cc0
Build out/facet filter from XML document passed at creation time.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1056
diff
changeset
|
307 int index; |
d4a5d3941cc0
Build out/facet filter from XML document passed at creation time.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1056
diff
changeset
|
308 try { |
d4a5d3941cc0
Build out/facet filter from XML document passed at creation time.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1056
diff
changeset
|
309 index = Integer.parseInt(facetElement.getAttribute("index")); |
d4a5d3941cc0
Build out/facet filter from XML document passed at creation time.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1056
diff
changeset
|
310 } |
d4a5d3941cc0
Build out/facet filter from XML document passed at creation time.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1056
diff
changeset
|
311 catch (NumberFormatException nfe) { |
d4a5d3941cc0
Build out/facet filter from XML document passed at creation time.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1056
diff
changeset
|
312 logger.warn(nfe); |
d4a5d3941cc0
Build out/facet filter from XML document passed at creation time.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1056
diff
changeset
|
313 index = 0; |
d4a5d3941cc0
Build out/facet filter from XML document passed at creation time.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1056
diff
changeset
|
314 } |
d4a5d3941cc0
Build out/facet filter from XML document passed at creation time.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1056
diff
changeset
|
315 facets.add(new DefaultFacet(index, fName, "")); |
d4a5d3941cc0
Build out/facet filter from XML document passed at creation time.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1056
diff
changeset
|
316 } |
d4a5d3941cc0
Build out/facet filter from XML document passed at creation time.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1056
diff
changeset
|
317 |
d4a5d3941cc0
Build out/facet filter from XML document passed at creation time.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1056
diff
changeset
|
318 if (!facets.isEmpty()) { |
d4a5d3941cc0
Build out/facet filter from XML document passed at creation time.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1056
diff
changeset
|
319 result.put(oName, facets); |
d4a5d3941cc0
Build out/facet filter from XML document passed at creation time.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1056
diff
changeset
|
320 } |
d4a5d3941cc0
Build out/facet filter from XML document passed at creation time.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1056
diff
changeset
|
321 } |
d4a5d3941cc0
Build out/facet filter from XML document passed at creation time.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1056
diff
changeset
|
322 |
d4a5d3941cc0
Build out/facet filter from XML document passed at creation time.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1056
diff
changeset
|
323 return result; |
d4a5d3941cc0
Build out/facet filter from XML document passed at creation time.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1056
diff
changeset
|
324 } |
d4a5d3941cc0
Build out/facet filter from XML document passed at creation time.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1056
diff
changeset
|
325 |
119
84c0b151203e
Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
326 |
84c0b151203e
Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
327 /** |
84c0b151203e
Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
328 * Insert new data included in <code>input</code> into the current state. |
84c0b151203e
Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
329 * |
84c0b151203e
Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
330 * @param target XML document that contains new data. |
84c0b151203e
Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
331 * @param context The CallContext. |
84c0b151203e
Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
332 * |
84c0b151203e
Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
333 * @return a document that contains a SUCCESS or FAILURE message. |
84c0b151203e
Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
334 */ |
84c0b151203e
Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
335 @Override |
84c0b151203e
Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
336 public Document feed(Document target, CallContext context) { |
123
ebb1cb69d847
The operations feed() and advance() return the current description of the artifact now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
122
diff
changeset
|
337 logger.info("FLYSArtifact.feed()"); |
ebb1cb69d847
The operations feed() and advance() return the current description of the artifact now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
122
diff
changeset
|
338 |
121
e0ded17a4846
Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
119
diff
changeset
|
339 Document doc = XMLUtils.newDocument(); |
119
84c0b151203e
Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
340 |
121
e0ded17a4846
Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
119
diff
changeset
|
341 XMLUtils.ElementCreator creator = new XMLUtils.ElementCreator( |
e0ded17a4846
Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
119
diff
changeset
|
342 doc, |
e0ded17a4846
Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
119
diff
changeset
|
343 ArtifactNamespaceContext.NAMESPACE_URI, |
e0ded17a4846
Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
119
diff
changeset
|
344 ArtifactNamespaceContext.NAMESPACE_PREFIX); |
119
84c0b151203e
Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
345 |
121
e0ded17a4846
Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
119
diff
changeset
|
346 Element result = creator.create("result"); |
e0ded17a4846
Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
119
diff
changeset
|
347 doc.appendChild(result); |
119
84c0b151203e
Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
348 |
121
e0ded17a4846
Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
119
diff
changeset
|
349 try { |
322
448d0dc64357
The inserted ranges (distance and WQ ranges) are validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
321
diff
changeset
|
350 saveData(target, XPATH_FEED_INPUT, context); |
689
f8ac04b2dbd0
Added two more compute() methods to ComputeCallback to distinguish between different phases of the artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
687
diff
changeset
|
351 |
705
853dceead0f4
Only generate facets when needed.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
704
diff
changeset
|
352 compute(context, ComputeType.FEED, true); |
689
f8ac04b2dbd0
Added two more compute() methods to ComputeCallback to distinguish between different phases of the artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
687
diff
changeset
|
353 |
123
ebb1cb69d847
The operations feed() and advance() return the current description of the artifact now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
122
diff
changeset
|
354 return describe(target, context); |
121
e0ded17a4846
Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
119
diff
changeset
|
355 } |
e0ded17a4846
Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
119
diff
changeset
|
356 catch (IllegalArgumentException iae) { |
658
ed7c901ee712
If Artifact.feed() fails do not store invalid values in database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
655
diff
changeset
|
357 // do not store state if validation fails. |
ed7c901ee712
If Artifact.feed() fails do not store invalid values in database.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
655
diff
changeset
|
358 context.afterCall(CallContext.NOTHING); |
122
d3b8b0b1d010
Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
121
diff
changeset
|
359 creator.addAttr(result, "type", OPERATION_FAILED, true); |
121
e0ded17a4846
Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
119
diff
changeset
|
360 |
e0ded17a4846
Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
119
diff
changeset
|
361 result.setTextContent(iae.getMessage()); |
e0ded17a4846
Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
119
diff
changeset
|
362 } |
e0ded17a4846
Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
119
diff
changeset
|
363 |
e0ded17a4846
Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
119
diff
changeset
|
364 return doc; |
119
84c0b151203e
Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
365 } |
84c0b151203e
Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
366 |
84c0b151203e
Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
367 |
84c0b151203e
Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
368 /** |
122
d3b8b0b1d010
Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
121
diff
changeset
|
369 * This method handles request for changing the current state of an |
d3b8b0b1d010
Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
121
diff
changeset
|
370 * artifact. It is possible to step forward or backward. |
d3b8b0b1d010
Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
121
diff
changeset
|
371 * |
d3b8b0b1d010
Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
121
diff
changeset
|
372 * @param target The incoming ADVANCE document. |
d3b8b0b1d010
Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
121
diff
changeset
|
373 * @param context The CallContext. |
d3b8b0b1d010
Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
121
diff
changeset
|
374 * |
d3b8b0b1d010
Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
121
diff
changeset
|
375 * @return a document that contains a SUCCESS or FAILURE message. |
d3b8b0b1d010
Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
121
diff
changeset
|
376 */ |
d3b8b0b1d010
Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
121
diff
changeset
|
377 public Document advance(Document target, CallContext context) { |
d3b8b0b1d010
Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
121
diff
changeset
|
378 Document doc = XMLUtils.newDocument(); |
d3b8b0b1d010
Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
121
diff
changeset
|
379 |
d3b8b0b1d010
Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
121
diff
changeset
|
380 XMLUtils.ElementCreator ec = new XMLUtils.ElementCreator( |
d3b8b0b1d010
Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
121
diff
changeset
|
381 doc, |
d3b8b0b1d010
Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
121
diff
changeset
|
382 ArtifactNamespaceContext.NAMESPACE_URI, |
d3b8b0b1d010
Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
121
diff
changeset
|
383 ArtifactNamespaceContext.NAMESPACE_PREFIX); |
d3b8b0b1d010
Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
121
diff
changeset
|
384 |
d3b8b0b1d010
Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
121
diff
changeset
|
385 Element result = ec.create("result"); |
d3b8b0b1d010
Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
121
diff
changeset
|
386 |
d3b8b0b1d010
Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
121
diff
changeset
|
387 String targetState = XMLUtils.xpathString( |
d3b8b0b1d010
Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
121
diff
changeset
|
388 target, XPATH_ADVANCE_TARGET, ArtifactNamespaceContext.INSTANCE); |
d3b8b0b1d010
Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
121
diff
changeset
|
389 |
140
43f03f6047b9
Implemented the step-back part of the advance() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
123
diff
changeset
|
390 logger.info("FLYSArtifact.advance() to '" + targetState + "'"); |
43f03f6047b9
Implemented the step-back part of the advance() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
123
diff
changeset
|
391 |
122
d3b8b0b1d010
Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
121
diff
changeset
|
392 if (isStateReachable(targetState, context)) { |
140
43f03f6047b9
Implemented the step-back part of the advance() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
123
diff
changeset
|
393 logger.info("Advance: Step forward"); |
122
d3b8b0b1d010
Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
121
diff
changeset
|
394 |
661
fdc898a134a7
Use java.util.List instead of java.util.Vector. Removed superfluous imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
658
diff
changeset
|
395 List<String> prev = getPreviousStateIds(); |
122
d3b8b0b1d010
Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
121
diff
changeset
|
396 prev.add(getCurrentStateId()); |
d3b8b0b1d010
Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
121
diff
changeset
|
397 |
d3b8b0b1d010
Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
121
diff
changeset
|
398 setCurrentStateId(targetState); |
d3b8b0b1d010
Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
121
diff
changeset
|
399 |
693
af393c5eb2c8
Write computed facets into artifacts describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
692
diff
changeset
|
400 logger.debug("Compute data for state: " + targetState); |
705
853dceead0f4
Only generate facets when needed.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
704
diff
changeset
|
401 compute(context, ComputeType.ADVANCE, true); |
693
af393c5eb2c8
Write computed facets into artifacts describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
692
diff
changeset
|
402 |
123
ebb1cb69d847
The operations feed() and advance() return the current description of the artifact now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
122
diff
changeset
|
403 return describe(target, context); |
122
d3b8b0b1d010
Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
121
diff
changeset
|
404 } |
140
43f03f6047b9
Implemented the step-back part of the advance() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
123
diff
changeset
|
405 else if (isPreviousState(targetState, context)) { |
43f03f6047b9
Implemented the step-back part of the advance() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
123
diff
changeset
|
406 logger.info("Advance: Step back to"); |
122
d3b8b0b1d010
Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
121
diff
changeset
|
407 |
1086
825ea312116d
Call State.endOfLife() for all States in the Artifact when Artifact.endOfLife() is called.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1084
diff
changeset
|
408 List<String> prevs = getPreviousStateIds(); |
140
43f03f6047b9
Implemented the step-back part of the advance() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
123
diff
changeset
|
409 int targetIdx = prevs.indexOf(targetState); |
43f03f6047b9
Implemented the step-back part of the advance() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
123
diff
changeset
|
410 int start = prevs.size() - 1; |
43f03f6047b9
Implemented the step-back part of the advance() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
123
diff
changeset
|
411 |
1086
825ea312116d
Call State.endOfLife() for all States in the Artifact when Artifact.endOfLife() is called.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1084
diff
changeset
|
412 destroyStates(prevs, context); |
1084
583314dafdb6
Call State.endOfLife() in FLYSArtifact when stepping back to a previous state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1067
diff
changeset
|
413 |
140
43f03f6047b9
Implemented the step-back part of the advance() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
123
diff
changeset
|
414 for (int i = start; i >= targetIdx; i--) { |
43f03f6047b9
Implemented the step-back part of the advance() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
123
diff
changeset
|
415 String prev = prevs.get(i); |
43f03f6047b9
Implemented the step-back part of the advance() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
123
diff
changeset
|
416 logger.debug("Remove state id '" + prev + "'"); |
1084
583314dafdb6
Call State.endOfLife() in FLYSArtifact when stepping back to a previous state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1067
diff
changeset
|
417 |
140
43f03f6047b9
Implemented the step-back part of the advance() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
123
diff
changeset
|
418 prevs.remove(prev); |
691
2600aa2c7319
Store facets for each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
690
diff
changeset
|
419 facets.remove(prev); |
140
43f03f6047b9
Implemented the step-back part of the advance() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
123
diff
changeset
|
420 } |
43f03f6047b9
Implemented the step-back part of the advance() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
123
diff
changeset
|
421 |
1094
b1c6d945848d
Added a new method to FLYSArtifact to destroy a single state (call its endOfLife).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1086
diff
changeset
|
422 destroyState(getCurrentStateId(), context); |
140
43f03f6047b9
Implemented the step-back part of the advance() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
123
diff
changeset
|
423 setCurrentStateId(targetState); |
43f03f6047b9
Implemented the step-back part of the advance() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
123
diff
changeset
|
424 |
43f03f6047b9
Implemented the step-back part of the advance() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
123
diff
changeset
|
425 return describe(target, context); |
43f03f6047b9
Implemented the step-back part of the advance() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
123
diff
changeset
|
426 } |
122
d3b8b0b1d010
Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
121
diff
changeset
|
427 |
d3b8b0b1d010
Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
121
diff
changeset
|
428 logger.warn("Advance: Cannot advance to '" + targetState + "'"); |
123
ebb1cb69d847
The operations feed() and advance() return the current description of the artifact now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
122
diff
changeset
|
429 ec.addAttr(result, "type", OPERATION_FAILED, true); |
122
d3b8b0b1d010
Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
121
diff
changeset
|
430 |
123
ebb1cb69d847
The operations feed() and advance() return the current description of the artifact now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
122
diff
changeset
|
431 doc.appendChild(result); |
122
d3b8b0b1d010
Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
121
diff
changeset
|
432 |
d3b8b0b1d010
Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
121
diff
changeset
|
433 return doc; |
d3b8b0b1d010
Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
121
diff
changeset
|
434 } |
d3b8b0b1d010
Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
121
diff
changeset
|
435 |
d3b8b0b1d010
Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
121
diff
changeset
|
436 |
d3b8b0b1d010
Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
121
diff
changeset
|
437 /** |
119
84c0b151203e
Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
438 * Returns the identifier of the current state. |
84c0b151203e
Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
439 * |
84c0b151203e
Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
440 * @return the identifier of the current state. |
84c0b151203e
Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
441 */ |
722
4800230fba8a
Improved situtation on rendering "Abflusskurve am Pegel". Not fully working, yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
708
diff
changeset
|
442 public String getCurrentStateId() { |
119
84c0b151203e
Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
443 return currentStateId; |
84c0b151203e
Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
444 } |
84c0b151203e
Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
445 |
84c0b151203e
Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
446 |
84c0b151203e
Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
447 /** |
84c0b151203e
Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
448 * Sets the identifier of the current state. |
84c0b151203e
Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
449 * |
84c0b151203e
Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
450 * @param id the identifier of a state. |
84c0b151203e
Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
451 */ |
84c0b151203e
Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
452 protected void setCurrentStateId(String id) { |
84c0b151203e
Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
453 currentStateId = id; |
84c0b151203e
Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
454 } |
84c0b151203e
Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
455 |
84c0b151203e
Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
456 |
84c0b151203e
Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
457 /** |
84c0b151203e
Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
458 * Set the current state of this artifact. <b>NOTE</b>We don't store the |
84c0b151203e
Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
459 * State object itself - which is not necessary - but its identifier. So |
84c0b151203e
Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
460 * this method will just call the setCurrentStateId() method with the |
84c0b151203e
Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
461 * identifier of <i>state</i>. |
84c0b151203e
Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
462 * |
84c0b151203e
Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
463 * @param state The new current state. |
84c0b151203e
Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
464 */ |
84c0b151203e
Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
465 protected void setCurrentState(State state) { |
84c0b151203e
Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
466 setCurrentStateId(state.getID()); |
84c0b151203e
Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
467 } |
84c0b151203e
Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
468 |
84c0b151203e
Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
469 |
84c0b151203e
Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
470 /** |
84c0b151203e
Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
471 * Returns the current state of the artifact. |
84c0b151203e
Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
472 * |
84c0b151203e
Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
473 * @return the current State of the artifact. |
84c0b151203e
Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
474 */ |
1654
33ade8153d74
Little modifications for making recommendations - will now work for states with background calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1628
diff
changeset
|
475 public State getCurrentState(Object context) { |
1067
f364410c7bc9
Refactored (state access) to ease future development of more trivial artifacts.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1059
diff
changeset
|
476 return getState(context, getCurrentStateId()); |
f364410c7bc9
Refactored (state access) to ease future development of more trivial artifacts.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1059
diff
changeset
|
477 } |
f364410c7bc9
Refactored (state access) to ease future development of more trivial artifacts.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1059
diff
changeset
|
478 |
f364410c7bc9
Refactored (state access) to ease future development of more trivial artifacts.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1059
diff
changeset
|
479 |
f364410c7bc9
Refactored (state access) to ease future development of more trivial artifacts.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1059
diff
changeset
|
480 /** |
f364410c7bc9
Refactored (state access) to ease future development of more trivial artifacts.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1059
diff
changeset
|
481 * Get list of existant states for this Artifact. |
f364410c7bc9
Refactored (state access) to ease future development of more trivial artifacts.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1059
diff
changeset
|
482 * @param context Contex to get StateEngine from. |
f364410c7bc9
Refactored (state access) to ease future development of more trivial artifacts.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1059
diff
changeset
|
483 * @return list of states. |
f364410c7bc9
Refactored (state access) to ease future development of more trivial artifacts.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1059
diff
changeset
|
484 */ |
f364410c7bc9
Refactored (state access) to ease future development of more trivial artifacts.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1059
diff
changeset
|
485 protected List<State> getStates(Object context) { |
1777
a8aa343799a2
Extracet getFlysContext from FLYSArtifact to FLYSUtils.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1771
diff
changeset
|
486 FLYSContext flysContext = FLYSUtils.getFlysContext(context); |
119
84c0b151203e
Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
487 StateEngine engine = (StateEngine) flysContext.get( |
84c0b151203e
Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
488 FLYSContext.STATE_ENGINE_KEY); |
1067
f364410c7bc9
Refactored (state access) to ease future development of more trivial artifacts.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1059
diff
changeset
|
489 return engine.getStates(getName()); |
119
84c0b151203e
Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
490 } |
84c0b151203e
Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
491 |
1067
f364410c7bc9
Refactored (state access) to ease future development of more trivial artifacts.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1059
diff
changeset
|
492 |
f364410c7bc9
Refactored (state access) to ease future development of more trivial artifacts.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1059
diff
changeset
|
493 /** |
f364410c7bc9
Refactored (state access) to ease future development of more trivial artifacts.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1059
diff
changeset
|
494 * Get state with given ID. |
f364410c7bc9
Refactored (state access) to ease future development of more trivial artifacts.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1059
diff
changeset
|
495 * @param context Context to get StateEngine from. |
f364410c7bc9
Refactored (state access) to ease future development of more trivial artifacts.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1059
diff
changeset
|
496 * @param stateID ID of state to get. |
f364410c7bc9
Refactored (state access) to ease future development of more trivial artifacts.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1059
diff
changeset
|
497 * @return state with given ID. |
f364410c7bc9
Refactored (state access) to ease future development of more trivial artifacts.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1059
diff
changeset
|
498 */ |
722
4800230fba8a
Improved situtation on rendering "Abflusskurve am Pegel". Not fully working, yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
708
diff
changeset
|
499 protected State getState(Object context, String stateID) { |
1777
a8aa343799a2
Extracet getFlysContext from FLYSArtifact to FLYSUtils.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1771
diff
changeset
|
500 FLYSContext flysContext = FLYSUtils.getFlysContext(context); |
722
4800230fba8a
Improved situtation on rendering "Abflusskurve am Pegel". Not fully working, yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
708
diff
changeset
|
501 StateEngine engine = (StateEngine) flysContext.get( |
4800230fba8a
Improved situtation on rendering "Abflusskurve am Pegel". Not fully working, yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
708
diff
changeset
|
502 FLYSContext.STATE_ENGINE_KEY); |
4800230fba8a
Improved situtation on rendering "Abflusskurve am Pegel". Not fully working, yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
708
diff
changeset
|
503 return engine.getState(stateID); |
4800230fba8a
Improved situtation on rendering "Abflusskurve am Pegel". Not fully working, yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
708
diff
changeset
|
504 } |
4800230fba8a
Improved situtation on rendering "Abflusskurve am Pegel". Not fully working, yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
708
diff
changeset
|
505 |
119
84c0b151203e
Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
506 |
84c0b151203e
Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
507 /** |
122
d3b8b0b1d010
Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
121
diff
changeset
|
508 * Returns the vector of previous state identifiers. |
d3b8b0b1d010
Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
121
diff
changeset
|
509 * |
d3b8b0b1d010
Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
121
diff
changeset
|
510 * @return the vector of previous state identifiers. |
d3b8b0b1d010
Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
121
diff
changeset
|
511 */ |
661
fdc898a134a7
Use java.util.List instead of java.util.Vector. Removed superfluous imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
658
diff
changeset
|
512 protected List<String> getPreviousStateIds() { |
122
d3b8b0b1d010
Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
121
diff
changeset
|
513 return previousStateIds; |
d3b8b0b1d010
Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
121
diff
changeset
|
514 } |
d3b8b0b1d010
Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
121
diff
changeset
|
515 |
d3b8b0b1d010
Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
121
diff
changeset
|
516 |
d3b8b0b1d010
Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
121
diff
changeset
|
517 /** |
1783
376c81aa7d55
Added method to FLYSArtifact to access ids of states.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1777
diff
changeset
|
518 * Get all previous and the current state id. |
376c81aa7d55
Added method to FLYSArtifact to access ids of states.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1777
diff
changeset
|
519 * @return #getPreviousStateIds() + #getCurrentStateId() |
376c81aa7d55
Added method to FLYSArtifact to access ids of states.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1777
diff
changeset
|
520 */ |
376c81aa7d55
Added method to FLYSArtifact to access ids of states.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1777
diff
changeset
|
521 public List<String> getStateHistoryIds() { |
376c81aa7d55
Added method to FLYSArtifact to access ids of states.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1777
diff
changeset
|
522 List<String> allIds = getPreviousStateIds(); |
376c81aa7d55
Added method to FLYSArtifact to access ids of states.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1777
diff
changeset
|
523 allIds.add(getCurrentStateId()); |
376c81aa7d55
Added method to FLYSArtifact to access ids of states.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1777
diff
changeset
|
524 return allIds; |
376c81aa7d55
Added method to FLYSArtifact to access ids of states.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1777
diff
changeset
|
525 } |
376c81aa7d55
Added method to FLYSArtifact to access ids of states.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1777
diff
changeset
|
526 |
376c81aa7d55
Added method to FLYSArtifact to access ids of states.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1777
diff
changeset
|
527 |
376c81aa7d55
Added method to FLYSArtifact to access ids of states.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1777
diff
changeset
|
528 /** |
121
e0ded17a4846
Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
119
diff
changeset
|
529 * Adds a new StateData item to the data pool of this artifact. |
e0ded17a4846
Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
119
diff
changeset
|
530 * |
e0ded17a4846
Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
119
diff
changeset
|
531 * @param name the name of the data object. |
e0ded17a4846
Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
119
diff
changeset
|
532 * @param data the data object itself. |
e0ded17a4846
Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
119
diff
changeset
|
533 */ |
e0ded17a4846
Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
119
diff
changeset
|
534 protected void addData(String name, StateData data) { |
e0ded17a4846
Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
119
diff
changeset
|
535 this.data.put(name, data); |
e0ded17a4846
Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
119
diff
changeset
|
536 } |
e0ded17a4846
Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
119
diff
changeset
|
537 |
e0ded17a4846
Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
119
diff
changeset
|
538 |
1656
94732906b094
Made feed() operation able to remove existing data items from Artifact's data pool.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1654
diff
changeset
|
539 protected StateData removeData(String name) { |
94732906b094
Made feed() operation able to remove existing data items from Artifact's data pool.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1654
diff
changeset
|
540 return this.data.remove(name); |
94732906b094
Made feed() operation able to remove existing data items from Artifact's data pool.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1654
diff
changeset
|
541 } |
94732906b094
Made feed() operation able to remove existing data items from Artifact's data pool.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1654
diff
changeset
|
542 |
94732906b094
Made feed() operation able to remove existing data items from Artifact's data pool.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1654
diff
changeset
|
543 |
121
e0ded17a4846
Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
119
diff
changeset
|
544 /** |
122
d3b8b0b1d010
Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
121
diff
changeset
|
545 * This method returns a specific StateData object that is stored in the |
d3b8b0b1d010
Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
121
diff
changeset
|
546 * data pool of this artifact. |
d3b8b0b1d010
Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
121
diff
changeset
|
547 * |
d3b8b0b1d010
Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
121
diff
changeset
|
548 * @param name The name of the data object. |
d3b8b0b1d010
Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
121
diff
changeset
|
549 * |
d3b8b0b1d010
Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
121
diff
changeset
|
550 * @return the StateData object if existing, otherwise null. |
d3b8b0b1d010
Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
121
diff
changeset
|
551 */ |
298
fc694a43a7e5
Changed the visibility of getData() method of FLYSArtifacts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
140
diff
changeset
|
552 public StateData getData(String name) { |
122
d3b8b0b1d010
Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
121
diff
changeset
|
553 return data.get(name); |
d3b8b0b1d010
Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
121
diff
changeset
|
554 } |
d3b8b0b1d010
Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
121
diff
changeset
|
555 |
d3b8b0b1d010
Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
121
diff
changeset
|
556 |
937
9e813e9137a5
Added a monitor that creates new artifacts for default themes in charts and maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
742
diff
changeset
|
557 public String getDataAsString(String name) { |
9e813e9137a5
Added a monitor that creates new artifacts for default themes in charts and maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
742
diff
changeset
|
558 StateData data = getData(name); |
9e813e9137a5
Added a monitor that creates new artifacts for default themes in charts and maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
742
diff
changeset
|
559 return data != null ? (String) data.getValue() : null; |
9e813e9137a5
Added a monitor that creates new artifacts for default themes in charts and maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
742
diff
changeset
|
560 } |
9e813e9137a5
Added a monitor that creates new artifacts for default themes in charts and maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
742
diff
changeset
|
561 |
1763
0e748e8972b5
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1724
diff
changeset
|
562 |
0e748e8972b5
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1724
diff
changeset
|
563 /** |
2013
9d5f339d83a3
#380 Validate the user selected DEM in the server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1895
diff
changeset
|
564 * This method returns the value of a StateData object stored in the data |
9d5f339d83a3
#380 Validate the user selected DEM in the server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1895
diff
changeset
|
565 * pool of this Artifact as Integer. |
9d5f339d83a3
#380 Validate the user selected DEM in the server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1895
diff
changeset
|
566 * |
9d5f339d83a3
#380 Validate the user selected DEM in the server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1895
diff
changeset
|
567 * @param name The name of the StateData object. |
9d5f339d83a3
#380 Validate the user selected DEM in the server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1895
diff
changeset
|
568 * |
9d5f339d83a3
#380 Validate the user selected DEM in the server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1895
diff
changeset
|
569 * @return an Integer representing the value of the data object or null if |
9d5f339d83a3
#380 Validate the user selected DEM in the server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1895
diff
changeset
|
570 * no object was found for <i>name</i>. |
9d5f339d83a3
#380 Validate the user selected DEM in the server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1895
diff
changeset
|
571 * |
9d5f339d83a3
#380 Validate the user selected DEM in the server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1895
diff
changeset
|
572 * @throws NumberFormatException if the value of the data object could not |
9d5f339d83a3
#380 Validate the user selected DEM in the server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1895
diff
changeset
|
573 * be transformed into an Integer. |
9d5f339d83a3
#380 Validate the user selected DEM in the server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1895
diff
changeset
|
574 */ |
9d5f339d83a3
#380 Validate the user selected DEM in the server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1895
diff
changeset
|
575 public Integer getDataAsInteger(String name) |
9d5f339d83a3
#380 Validate the user selected DEM in the server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1895
diff
changeset
|
576 throws NumberFormatException |
9d5f339d83a3
#380 Validate the user selected DEM in the server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1895
diff
changeset
|
577 { |
9d5f339d83a3
#380 Validate the user selected DEM in the server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1895
diff
changeset
|
578 String value = getDataAsString(name); |
9d5f339d83a3
#380 Validate the user selected DEM in the server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1895
diff
changeset
|
579 |
9d5f339d83a3
#380 Validate the user selected DEM in the server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1895
diff
changeset
|
580 if (value != null && value.length() > 0) { |
9d5f339d83a3
#380 Validate the user selected DEM in the server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1895
diff
changeset
|
581 return Integer.parseInt(value); |
9d5f339d83a3
#380 Validate the user selected DEM in the server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1895
diff
changeset
|
582 } |
9d5f339d83a3
#380 Validate the user selected DEM in the server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1895
diff
changeset
|
583 |
9d5f339d83a3
#380 Validate the user selected DEM in the server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1895
diff
changeset
|
584 return null; |
9d5f339d83a3
#380 Validate the user selected DEM in the server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1895
diff
changeset
|
585 } |
9d5f339d83a3
#380 Validate the user selected DEM in the server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1895
diff
changeset
|
586 |
9d5f339d83a3
#380 Validate the user selected DEM in the server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1895
diff
changeset
|
587 |
9d5f339d83a3
#380 Validate the user selected DEM in the server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1895
diff
changeset
|
588 /** |
2038
f73036b991e2
Bugfix: repaired broken named values in exports - the last solution had bad side effects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2013
diff
changeset
|
589 * This method returns the value of a StateData object stored in the data |
f73036b991e2
Bugfix: repaired broken named values in exports - the last solution had bad side effects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2013
diff
changeset
|
590 * pool of this Artifact is Boolean using Boolean.valueOf(). |
f73036b991e2
Bugfix: repaired broken named values in exports - the last solution had bad side effects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2013
diff
changeset
|
591 * |
f73036b991e2
Bugfix: repaired broken named values in exports - the last solution had bad side effects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2013
diff
changeset
|
592 * @param name The name of the StateData object. |
f73036b991e2
Bugfix: repaired broken named values in exports - the last solution had bad side effects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2013
diff
changeset
|
593 * |
f73036b991e2
Bugfix: repaired broken named values in exports - the last solution had bad side effects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2013
diff
changeset
|
594 * @return a Boolean representing the value of the data object or null if no |
f73036b991e2
Bugfix: repaired broken named values in exports - the last solution had bad side effects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2013
diff
changeset
|
595 * such object is existing. |
f73036b991e2
Bugfix: repaired broken named values in exports - the last solution had bad side effects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2013
diff
changeset
|
596 */ |
f73036b991e2
Bugfix: repaired broken named values in exports - the last solution had bad side effects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2013
diff
changeset
|
597 public Boolean getDataAsBoolean(String name) { |
f73036b991e2
Bugfix: repaired broken named values in exports - the last solution had bad side effects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2013
diff
changeset
|
598 String value = getDataAsString(name); |
f73036b991e2
Bugfix: repaired broken named values in exports - the last solution had bad side effects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2013
diff
changeset
|
599 |
f73036b991e2
Bugfix: repaired broken named values in exports - the last solution had bad side effects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2013
diff
changeset
|
600 if (value == null || value.length() == 0) { |
f73036b991e2
Bugfix: repaired broken named values in exports - the last solution had bad side effects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2013
diff
changeset
|
601 return null; |
f73036b991e2
Bugfix: repaired broken named values in exports - the last solution had bad side effects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2013
diff
changeset
|
602 } |
f73036b991e2
Bugfix: repaired broken named values in exports - the last solution had bad side effects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2013
diff
changeset
|
603 |
f73036b991e2
Bugfix: repaired broken named values in exports - the last solution had bad side effects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2013
diff
changeset
|
604 return Boolean.valueOf(value); |
f73036b991e2
Bugfix: repaired broken named values in exports - the last solution had bad side effects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2013
diff
changeset
|
605 } |
f73036b991e2
Bugfix: repaired broken named values in exports - the last solution had bad side effects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2013
diff
changeset
|
606 |
f73036b991e2
Bugfix: repaired broken named values in exports - the last solution had bad side effects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2013
diff
changeset
|
607 |
f73036b991e2
Bugfix: repaired broken named values in exports - the last solution had bad side effects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2013
diff
changeset
|
608 /** |
1763
0e748e8972b5
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1724
diff
changeset
|
609 * Add StateData containing a given string. |
0e748e8972b5
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1724
diff
changeset
|
610 * @param name Name of the data object. |
0e748e8972b5
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1724
diff
changeset
|
611 * @param value String to store. |
0e748e8972b5
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1724
diff
changeset
|
612 */ |
1724
0349dd524f9c
Add convenience method to add default data as string.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1709
diff
changeset
|
613 public void addStringData(String name, String value) { |
0349dd524f9c
Add convenience method to add default data as string.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1709
diff
changeset
|
614 addData(name, new DefaultStateData(name, null, null, value)); |
0349dd524f9c
Add convenience method to add default data as string.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1709
diff
changeset
|
615 } |
0349dd524f9c
Add convenience method to add default data as string.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1709
diff
changeset
|
616 |
1763
0e748e8972b5
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1724
diff
changeset
|
617 |
960
92027887775a
DataCage: Added a recommend() method to generate recommendations for
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
958
diff
changeset
|
618 public Collection<StateData> getAllData() { |
92027887775a
DataCage: Added a recommend() method to generate recommendations for
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
958
diff
changeset
|
619 return data.values(); |
92027887775a
DataCage: Added a recommend() method to generate recommendations for
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
958
diff
changeset
|
620 } |
92027887775a
DataCage: Added a recommend() method to generate recommendations for
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
958
diff
changeset
|
621 |
937
9e813e9137a5
Added a monitor that creates new artifacts for default themes in charts and maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
742
diff
changeset
|
622 |
2095
8cb679d4ec49
Implemented initialize() in FloodMapState to enable cloning floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2093
diff
changeset
|
623 public List<Facet> getFacets() { |
8cb679d4ec49
Implemented initialize() in FloodMapState to enable cloning floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2093
diff
changeset
|
624 List<Facet> all = new ArrayList<Facet>(); |
8cb679d4ec49
Implemented initialize() in FloodMapState to enable cloning floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2093
diff
changeset
|
625 |
8cb679d4ec49
Implemented initialize() in FloodMapState to enable cloning floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2093
diff
changeset
|
626 Set<Map.Entry<String, List<Facet>>> entries = facets.entrySet(); |
8cb679d4ec49
Implemented initialize() in FloodMapState to enable cloning floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2093
diff
changeset
|
627 for (Map.Entry<String, List<Facet>> entry: entries) { |
8cb679d4ec49
Implemented initialize() in FloodMapState to enable cloning floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2093
diff
changeset
|
628 List<Facet> fs = entry.getValue(); |
8cb679d4ec49
Implemented initialize() in FloodMapState to enable cloning floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2093
diff
changeset
|
629 for (Facet f: fs) { |
8cb679d4ec49
Implemented initialize() in FloodMapState to enable cloning floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2093
diff
changeset
|
630 all.add(f); |
8cb679d4ec49
Implemented initialize() in FloodMapState to enable cloning floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2093
diff
changeset
|
631 } |
8cb679d4ec49
Implemented initialize() in FloodMapState to enable cloning floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2093
diff
changeset
|
632 } |
8cb679d4ec49
Implemented initialize() in FloodMapState to enable cloning floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2093
diff
changeset
|
633 |
8cb679d4ec49
Implemented initialize() in FloodMapState to enable cloning floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2093
diff
changeset
|
634 return all; |
8cb679d4ec49
Implemented initialize() in FloodMapState to enable cloning floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2093
diff
changeset
|
635 } |
8cb679d4ec49
Implemented initialize() in FloodMapState to enable cloning floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2093
diff
changeset
|
636 |
8cb679d4ec49
Implemented initialize() in FloodMapState to enable cloning floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2093
diff
changeset
|
637 |
1771
c62ff9e72cea
Restore mapping of state id to facets (revert, rev 3083 and 3088).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1765
diff
changeset
|
638 /** |
c62ff9e72cea
Restore mapping of state id to facets (revert, rev 3083 and 3088).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1765
diff
changeset
|
639 * Get facet as stored internally, with equalling name and index than given |
c62ff9e72cea
Restore mapping of state id to facets (revert, rev 3083 and 3088).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1765
diff
changeset
|
640 * facet. |
c62ff9e72cea
Restore mapping of state id to facets (revert, rev 3083 and 3088).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1765
diff
changeset
|
641 * @param facet that defines index and name of facet searched. |
c62ff9e72cea
Restore mapping of state id to facets (revert, rev 3083 and 3088).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1765
diff
changeset
|
642 * @return facet instance or null if not found. |
c62ff9e72cea
Restore mapping of state id to facets (revert, rev 3083 and 3088).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1765
diff
changeset
|
643 */ |
696
708b270dfd30
OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
693
diff
changeset
|
644 public Facet getNativeFacet(Facet facet) { |
708b270dfd30
OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
693
diff
changeset
|
645 String name = facet.getName(); |
708b270dfd30
OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
693
diff
changeset
|
646 int index = facet.getIndex(); |
708b270dfd30
OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
693
diff
changeset
|
647 |
1771
c62ff9e72cea
Restore mapping of state id to facets (revert, rev 3083 and 3088).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1765
diff
changeset
|
648 for (Map.Entry<String, List<Facet>> facetList: facets.entrySet()) { |
c62ff9e72cea
Restore mapping of state id to facets (revert, rev 3083 and 3088).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1765
diff
changeset
|
649 for (Facet f: facetList.getValue()) { |
c62ff9e72cea
Restore mapping of state id to facets (revert, rev 3083 and 3088).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1765
diff
changeset
|
650 if (f.getIndex() == index && f.getName().equals(name)) { |
c62ff9e72cea
Restore mapping of state id to facets (revert, rev 3083 and 3088).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1765
diff
changeset
|
651 return f; |
c62ff9e72cea
Restore mapping of state id to facets (revert, rev 3083 and 3088).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1765
diff
changeset
|
652 } |
696
708b270dfd30
OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
693
diff
changeset
|
653 } |
708b270dfd30
OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
693
diff
changeset
|
654 } |
708b270dfd30
OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
693
diff
changeset
|
655 |
708b270dfd30
OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
693
diff
changeset
|
656 logger.warn("Could not find facet: " + name + " at " + index); |
708b270dfd30
OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
693
diff
changeset
|
657 return null; |
708b270dfd30
OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
693
diff
changeset
|
658 } |
708b270dfd30
OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
693
diff
changeset
|
659 |
708b270dfd30
OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
693
diff
changeset
|
660 |
122
d3b8b0b1d010
Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
121
diff
changeset
|
661 /** |
121
e0ded17a4846
Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
119
diff
changeset
|
662 * This method stores the data that is contained in the FEED document. |
119
84c0b151203e
Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
663 * |
84c0b151203e
Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
664 * @param feed The FEED document. |
84c0b151203e
Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
665 * @param xpath The XPath that points to the data nodes. |
84c0b151203e
Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
666 */ |
322
448d0dc64357
The inserted ranges (distance and WQ ranges) are validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
321
diff
changeset
|
667 public void saveData(Document feed, String xpath, CallContext context) |
121
e0ded17a4846
Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
119
diff
changeset
|
668 throws IllegalArgumentException |
e0ded17a4846
Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
119
diff
changeset
|
669 { |
e0ded17a4846
Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
119
diff
changeset
|
670 if (feed == null || xpath == null || xpath.length() == 0) { |
325
7a0907742cc0
Changed the error key that is written to the result document of the feed operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
322
diff
changeset
|
671 throw new IllegalArgumentException("error_feed_no_data"); |
121
e0ded17a4846
Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
119
diff
changeset
|
672 } |
119
84c0b151203e
Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
673 |
121
e0ded17a4846
Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
119
diff
changeset
|
674 NodeList nodes = (NodeList) XMLUtils.xpath( |
e0ded17a4846
Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
119
diff
changeset
|
675 feed, |
e0ded17a4846
Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
119
diff
changeset
|
676 xpath, |
e0ded17a4846
Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
119
diff
changeset
|
677 XPathConstants.NODESET, |
e0ded17a4846
Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
119
diff
changeset
|
678 ArtifactNamespaceContext.INSTANCE); |
e0ded17a4846
Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
119
diff
changeset
|
679 |
e0ded17a4846
Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
119
diff
changeset
|
680 if (nodes == null || nodes.getLength() == 0) { |
325
7a0907742cc0
Changed the error key that is written to the result document of the feed operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
322
diff
changeset
|
681 throw new IllegalArgumentException("error_feed_no_data"); |
121
e0ded17a4846
Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
119
diff
changeset
|
682 } |
e0ded17a4846
Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
119
diff
changeset
|
683 |
e0ded17a4846
Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
119
diff
changeset
|
684 int count = nodes.getLength(); |
e0ded17a4846
Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
119
diff
changeset
|
685 logger.debug("Try to save " + count + " data items."); |
e0ded17a4846
Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
119
diff
changeset
|
686 |
708
757ff56b43b3
Added calculation "am Pegel" version to the "Wasserspiegellage" calculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
707
diff
changeset
|
687 String uri = ArtifactNamespaceContext.NAMESPACE_URI; |
121
e0ded17a4846
Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
119
diff
changeset
|
688 |
1176
28154920e0b3
Introduced the possibility for States to transform/modify input before the data is added to FLYSArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1137
diff
changeset
|
689 DefaultState current = (DefaultState) getCurrentState(context); |
28154920e0b3
Introduced the possibility for States to transform/modify input before the data is added to FLYSArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1137
diff
changeset
|
690 |
708
757ff56b43b3
Added calculation "am Pegel" version to the "Wasserspiegellage" calculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
707
diff
changeset
|
691 for (int i = 0; i < count; i++) { |
757ff56b43b3
Added calculation "am Pegel" version to the "Wasserspiegellage" calculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
707
diff
changeset
|
692 Element node = (Element)nodes.item(i); |
121
e0ded17a4846
Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
119
diff
changeset
|
693 |
708
757ff56b43b3
Added calculation "am Pegel" version to the "Wasserspiegellage" calculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
707
diff
changeset
|
694 String name = node.getAttributeNS(uri, "name"); |
757ff56b43b3
Added calculation "am Pegel" version to the "Wasserspiegellage" calculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
707
diff
changeset
|
695 String value = node.getAttributeNS(uri, "value"); |
757ff56b43b3
Added calculation "am Pegel" version to the "Wasserspiegellage" calculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
707
diff
changeset
|
696 |
757ff56b43b3
Added calculation "am Pegel" version to the "Wasserspiegellage" calculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
707
diff
changeset
|
697 if (name.length() > 0 && value.length() > 0) { |
121
e0ded17a4846
Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
119
diff
changeset
|
698 logger.debug("Save data item for '" + name + "' : " + value); |
e0ded17a4846
Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
119
diff
changeset
|
699 |
1176
28154920e0b3
Introduced the possibility for States to transform/modify input before the data is added to FLYSArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1137
diff
changeset
|
700 addData(name, current.transform(this, context, name, value)); |
121
e0ded17a4846
Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
119
diff
changeset
|
701 } |
1656
94732906b094
Made feed() operation able to remove existing data items from Artifact's data pool.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1654
diff
changeset
|
702 else if (name.length() > 0 && value.length() == 0) { |
94732906b094
Made feed() operation able to remove existing data items from Artifact's data pool.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1654
diff
changeset
|
703 if (removeData(name) != null) { |
94732906b094
Made feed() operation able to remove existing data items from Artifact's data pool.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1654
diff
changeset
|
704 logger.debug("Removed data '" + name + "' successfully."); |
94732906b094
Made feed() operation able to remove existing data items from Artifact's data pool.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1654
diff
changeset
|
705 } |
94732906b094
Made feed() operation able to remove existing data items from Artifact's data pool.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1654
diff
changeset
|
706 } |
121
e0ded17a4846
Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
119
diff
changeset
|
707 } |
322
448d0dc64357
The inserted ranges (distance and WQ ranges) are validated in the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
321
diff
changeset
|
708 |
1050
eccf966fb677
State engine: Removed CallContext from state validation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
981
diff
changeset
|
709 current.validate(this); |
122
d3b8b0b1d010
Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
121
diff
changeset
|
710 } |
d3b8b0b1d010
Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
121
diff
changeset
|
711 |
d3b8b0b1d010
Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
121
diff
changeset
|
712 |
d3b8b0b1d010
Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
121
diff
changeset
|
713 /** |
d3b8b0b1d010
Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
121
diff
changeset
|
714 * Determines if the state with the identifier <i>stateId</i> is reachable |
d3b8b0b1d010
Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
121
diff
changeset
|
715 * from the current state. The determination itself takes place in the |
d3b8b0b1d010
Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
121
diff
changeset
|
716 * TransitionEngine. |
d3b8b0b1d010
Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
121
diff
changeset
|
717 * |
d3b8b0b1d010
Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
121
diff
changeset
|
718 * @param stateId The identifier of a state. |
d3b8b0b1d010
Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
121
diff
changeset
|
719 * @param context The context object. |
d3b8b0b1d010
Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
121
diff
changeset
|
720 * |
d3b8b0b1d010
Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
121
diff
changeset
|
721 * @return true, if the state specified by <i>stateId</i> is reacahble, |
d3b8b0b1d010
Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
121
diff
changeset
|
722 * otherwise false. |
d3b8b0b1d010
Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
121
diff
changeset
|
723 */ |
d3b8b0b1d010
Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
121
diff
changeset
|
724 protected boolean isStateReachable(String stateId, Object context) { |
d3b8b0b1d010
Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
121
diff
changeset
|
725 logger.debug("Determine if the state '" + stateId + "' is reachable."); |
d3b8b0b1d010
Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
121
diff
changeset
|
726 |
1777
a8aa343799a2
Extracet getFlysContext from FLYSArtifact to FLYSUtils.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1771
diff
changeset
|
727 FLYSContext flysContext = FLYSUtils.getFlysContext(context); |
122
d3b8b0b1d010
Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
121
diff
changeset
|
728 |
624
929137ee8154
ISSUE-62 (part I/II) States are no longer filled with data - if a state needs user input, it needs to query the owner artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
623
diff
changeset
|
729 State currentState = getCurrentState(context); |
122
d3b8b0b1d010
Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
121
diff
changeset
|
730 StateEngine sEngine = (StateEngine) flysContext.get( |
d3b8b0b1d010
Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
121
diff
changeset
|
731 FLYSContext.STATE_ENGINE_KEY); |
d3b8b0b1d010
Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
121
diff
changeset
|
732 |
d3b8b0b1d010
Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
121
diff
changeset
|
733 TransitionEngine tEngine = (TransitionEngine) flysContext.get( |
d3b8b0b1d010
Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
121
diff
changeset
|
734 FLYSContext.TRANSITION_ENGINE_KEY); |
d3b8b0b1d010
Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
121
diff
changeset
|
735 |
355
d97982627596
Bugfixes: Adapted a broken method call of TransitionEngine.isStateReachable() and added the outputs of a current state to the DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
325
diff
changeset
|
736 return tEngine.isStateReachable(this, stateId, currentState, sEngine); |
122
d3b8b0b1d010
Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
121
diff
changeset
|
737 } |
140
43f03f6047b9
Implemented the step-back part of the advance() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
123
diff
changeset
|
738 |
43f03f6047b9
Implemented the step-back part of the advance() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
123
diff
changeset
|
739 |
43f03f6047b9
Implemented the step-back part of the advance() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
123
diff
changeset
|
740 /** |
43f03f6047b9
Implemented the step-back part of the advance() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
123
diff
changeset
|
741 * Determines if the state with the identifier <i>stateId</i> is a previous |
43f03f6047b9
Implemented the step-back part of the advance() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
123
diff
changeset
|
742 * state of the current state. |
43f03f6047b9
Implemented the step-back part of the advance() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
123
diff
changeset
|
743 * |
43f03f6047b9
Implemented the step-back part of the advance() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
123
diff
changeset
|
744 * @param stateId The target state identifier. |
43f03f6047b9
Implemented the step-back part of the advance() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
123
diff
changeset
|
745 * @param context The context object. |
43f03f6047b9
Implemented the step-back part of the advance() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
123
diff
changeset
|
746 */ |
43f03f6047b9
Implemented the step-back part of the advance() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
123
diff
changeset
|
747 protected boolean isPreviousState(String stateId, Object context) { |
43f03f6047b9
Implemented the step-back part of the advance() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
123
diff
changeset
|
748 logger.debug("Determine if the state '" + stateId + "' is old."); |
43f03f6047b9
Implemented the step-back part of the advance() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
123
diff
changeset
|
749 |
661
fdc898a134a7
Use java.util.List instead of java.util.Vector. Removed superfluous imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
658
diff
changeset
|
750 List<String> prevs = getPreviousStateIds(); |
140
43f03f6047b9
Implemented the step-back part of the advance() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
123
diff
changeset
|
751 if (prevs.contains(stateId)) { |
43f03f6047b9
Implemented the step-back part of the advance() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
123
diff
changeset
|
752 return true; |
43f03f6047b9
Implemented the step-back part of the advance() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
123
diff
changeset
|
753 } |
43f03f6047b9
Implemented the step-back part of the advance() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
123
diff
changeset
|
754 |
43f03f6047b9
Implemented the step-back part of the advance() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
123
diff
changeset
|
755 return false; |
43f03f6047b9
Implemented the step-back part of the advance() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
123
diff
changeset
|
756 } |
317
8f40a57229c3
FLYSArtifact provides methods to retrieve the real River, Gauge objects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
298
diff
changeset
|
757 |
8f40a57229c3
FLYSArtifact provides methods to retrieve the real River, Gauge objects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
298
diff
changeset
|
758 |
8f40a57229c3
FLYSArtifact provides methods to retrieve the real River, Gauge objects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
298
diff
changeset
|
759 /** |
686
3dc61e00385e
Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
661
diff
changeset
|
760 * Computes the hash code of the entered values. |
3dc61e00385e
Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
661
diff
changeset
|
761 * |
3dc61e00385e
Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
661
diff
changeset
|
762 * @return a hash code. |
3dc61e00385e
Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
661
diff
changeset
|
763 */ |
3dc61e00385e
Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
661
diff
changeset
|
764 @Override |
3dc61e00385e
Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
661
diff
changeset
|
765 public String hash() { |
3dc61e00385e
Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
661
diff
changeset
|
766 Set<Map.Entry<String, StateData>> entries = data.entrySet(); |
3dc61e00385e
Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
661
diff
changeset
|
767 |
705
853dceead0f4
Only generate facets when needed.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
704
diff
changeset
|
768 long hash = 0L; |
853dceead0f4
Only generate facets when needed.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
704
diff
changeset
|
769 int shift = 3; |
686
3dc61e00385e
Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
661
diff
changeset
|
770 |
3dc61e00385e
Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
661
diff
changeset
|
771 for (Map.Entry<String, StateData> entry: entries) { |
3dc61e00385e
Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
661
diff
changeset
|
772 String key = entry.getKey(); |
3dc61e00385e
Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
661
diff
changeset
|
773 Object value = entry.getValue().getValue(); |
3dc61e00385e
Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
661
diff
changeset
|
774 |
742
c09c9e05ecfa
Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
741
diff
changeset
|
775 hash ^= ((long)key.hashCode() << shift) |
722
4800230fba8a
Improved situtation on rendering "Abflusskurve am Pegel". Not fully working, yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
708
diff
changeset
|
776 | ((long)value.hashCode() << (shift + 3)); |
686
3dc61e00385e
Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
661
diff
changeset
|
777 shift += 2; |
3dc61e00385e
Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
661
diff
changeset
|
778 } |
3dc61e00385e
Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
661
diff
changeset
|
779 |
3dc61e00385e
Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
661
diff
changeset
|
780 return getCurrentStateId() + hash; |
3dc61e00385e
Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
661
diff
changeset
|
781 } |
3dc61e00385e
Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
661
diff
changeset
|
782 |
1628
16c74ca3586e
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1187
diff
changeset
|
783 |
16c74ca3586e
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1187
diff
changeset
|
784 /** |
1763
0e748e8972b5
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1724
diff
changeset
|
785 * Return List of outputs, where combinations of outputname and filtername |
0e748e8972b5
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1724
diff
changeset
|
786 * that match content in filterFacets is left out. |
0e748e8972b5
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1724
diff
changeset
|
787 * @return filtered Outputlist. |
1628
16c74ca3586e
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1187
diff
changeset
|
788 */ |
1056
bd1b751deab3
Added optional positive filter for outs and facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1055
diff
changeset
|
789 protected List<Output> filterOutputs(List<Output> outs) { |
bd1b751deab3
Added optional positive filter for outs and facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1055
diff
changeset
|
790 if (filterFacets == null || filterFacets.isEmpty()) { |
1704
e8627d1e2db6
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1656
diff
changeset
|
791 logger.debug("No filter for Outputs."); |
1056
bd1b751deab3
Added optional positive filter for outs and facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1055
diff
changeset
|
792 return outs; |
bd1b751deab3
Added optional positive filter for outs and facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1055
diff
changeset
|
793 } |
bd1b751deab3
Added optional positive filter for outs and facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1055
diff
changeset
|
794 |
2095
8cb679d4ec49
Implemented initialize() in FloodMapState to enable cloning floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2093
diff
changeset
|
795 logger.debug("Filter Facets with " + filterFacets.size() + " filters."); |
8cb679d4ec49
Implemented initialize() in FloodMapState to enable cloning floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2093
diff
changeset
|
796 |
1056
bd1b751deab3
Added optional positive filter for outs and facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1055
diff
changeset
|
797 List<Output> filtered = new ArrayList<Output>(); |
bd1b751deab3
Added optional positive filter for outs and facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1055
diff
changeset
|
798 |
bd1b751deab3
Added optional positive filter for outs and facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1055
diff
changeset
|
799 for (Output out: outs) { |
2095
8cb679d4ec49
Implemented initialize() in FloodMapState to enable cloning floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2093
diff
changeset
|
800 String outName = out.getName(); |
1056
bd1b751deab3
Added optional positive filter for outs and facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1055
diff
changeset
|
801 |
2095
8cb679d4ec49
Implemented initialize() in FloodMapState to enable cloning floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2093
diff
changeset
|
802 logger.debug(" filter Facets for Output: " + outName); |
8cb679d4ec49
Implemented initialize() in FloodMapState to enable cloning floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2093
diff
changeset
|
803 |
8cb679d4ec49
Implemented initialize() in FloodMapState to enable cloning floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2093
diff
changeset
|
804 List<Facet> fFacets = filterFacets.get(outName); |
1056
bd1b751deab3
Added optional positive filter for outs and facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1055
diff
changeset
|
805 if (fFacets != null) { |
2095
8cb679d4ec49
Implemented initialize() in FloodMapState to enable cloning floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2093
diff
changeset
|
806 logger.debug("" + fFacets.size() + " filters for: " + outName); |
8cb679d4ec49
Implemented initialize() in FloodMapState to enable cloning floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2093
diff
changeset
|
807 |
8cb679d4ec49
Implemented initialize() in FloodMapState to enable cloning floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2093
diff
changeset
|
808 if (logger.isDebugEnabled()) { |
8cb679d4ec49
Implemented initialize() in FloodMapState to enable cloning floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2093
diff
changeset
|
809 for (Facet tmp: fFacets) { |
8cb679d4ec49
Implemented initialize() in FloodMapState to enable cloning floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2093
diff
changeset
|
810 logger.debug(" filter = '" + tmp.getName() + "'"); |
8cb679d4ec49
Implemented initialize() in FloodMapState to enable cloning floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2093
diff
changeset
|
811 } |
8cb679d4ec49
Implemented initialize() in FloodMapState to enable cloning floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2093
diff
changeset
|
812 } |
1056
bd1b751deab3
Added optional positive filter for outs and facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1055
diff
changeset
|
813 |
bd1b751deab3
Added optional positive filter for outs and facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1055
diff
changeset
|
814 List<Facet> resultFacets = new ArrayList<Facet>(); |
bd1b751deab3
Added optional positive filter for outs and facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1055
diff
changeset
|
815 |
bd1b751deab3
Added optional positive filter for outs and facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1055
diff
changeset
|
816 for (Facet facet: out.getFacets()) { |
bd1b751deab3
Added optional positive filter for outs and facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1055
diff
changeset
|
817 for (Facet fFacet: fFacets) { |
bd1b751deab3
Added optional positive filter for outs and facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1055
diff
changeset
|
818 if (facet.getIndex() == fFacet.getIndex() |
bd1b751deab3
Added optional positive filter for outs and facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1055
diff
changeset
|
819 && facet.getName().equals(fFacet.getName())) { |
bd1b751deab3
Added optional positive filter for outs and facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1055
diff
changeset
|
820 resultFacets.add(facet); |
bd1b751deab3
Added optional positive filter for outs and facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1055
diff
changeset
|
821 break; |
bd1b751deab3
Added optional positive filter for outs and facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1055
diff
changeset
|
822 } |
bd1b751deab3
Added optional positive filter for outs and facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1055
diff
changeset
|
823 } |
bd1b751deab3
Added optional positive filter for outs and facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1055
diff
changeset
|
824 } |
bd1b751deab3
Added optional positive filter for outs and facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1055
diff
changeset
|
825 |
2095
8cb679d4ec49
Implemented initialize() in FloodMapState to enable cloning floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2093
diff
changeset
|
826 logger.debug("Facets after filtering = " + resultFacets.size()); |
8cb679d4ec49
Implemented initialize() in FloodMapState to enable cloning floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2093
diff
changeset
|
827 |
1056
bd1b751deab3
Added optional positive filter for outs and facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1055
diff
changeset
|
828 if (!resultFacets.isEmpty()) { |
bd1b751deab3
Added optional positive filter for outs and facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1055
diff
changeset
|
829 DefaultOutput nout = new DefaultOutput( |
bd1b751deab3
Added optional positive filter for outs and facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1055
diff
changeset
|
830 out.getName(), |
bd1b751deab3
Added optional positive filter for outs and facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1055
diff
changeset
|
831 out.getDescription(), |
bd1b751deab3
Added optional positive filter for outs and facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1055
diff
changeset
|
832 out.getMimeType(), |
bd1b751deab3
Added optional positive filter for outs and facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1055
diff
changeset
|
833 resultFacets); |
bd1b751deab3
Added optional positive filter for outs and facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1055
diff
changeset
|
834 filtered.add(nout); |
bd1b751deab3
Added optional positive filter for outs and facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1055
diff
changeset
|
835 } |
bd1b751deab3
Added optional positive filter for outs and facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1055
diff
changeset
|
836 } |
bd1b751deab3
Added optional positive filter for outs and facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1055
diff
changeset
|
837 } |
bd1b751deab3
Added optional positive filter for outs and facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1055
diff
changeset
|
838 |
2095
8cb679d4ec49
Implemented initialize() in FloodMapState to enable cloning floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2093
diff
changeset
|
839 logger.debug("All Facets after filtering = " + filtered.size()); |
8cb679d4ec49
Implemented initialize() in FloodMapState to enable cloning floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2093
diff
changeset
|
840 |
1056
bd1b751deab3
Added optional positive filter for outs and facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1055
diff
changeset
|
841 return filtered; |
bd1b751deab3
Added optional positive filter for outs and facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1055
diff
changeset
|
842 } |
bd1b751deab3
Added optional positive filter for outs and facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1055
diff
changeset
|
843 |
686
3dc61e00385e
Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
661
diff
changeset
|
844 |
1765
5d8b3880a553
Do not store association of states to facets, let artifacts keep facets in a pure list.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1763
diff
changeset
|
845 /** |
5d8b3880a553
Do not store association of states to facets, let artifacts keep facets in a pure list.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1763
diff
changeset
|
846 * Get all outputs that the Artifact can do in this state (which includes |
5d8b3880a553
Do not store association of states to facets, let artifacts keep facets in a pure list.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1763
diff
changeset
|
847 * all previous states). |
5d8b3880a553
Do not store association of states to facets, let artifacts keep facets in a pure list.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1763
diff
changeset
|
848 * |
5d8b3880a553
Do not store association of states to facets, let artifacts keep facets in a pure list.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1763
diff
changeset
|
849 * @return list of outputs |
5d8b3880a553
Do not store association of states to facets, let artifacts keep facets in a pure list.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1763
diff
changeset
|
850 */ |
1050
eccf966fb677
State engine: Removed CallContext from state validation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
981
diff
changeset
|
851 public List<Output> getOutputs(Object context) { |
2095
8cb679d4ec49
Implemented initialize() in FloodMapState to enable cloning floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2093
diff
changeset
|
852 logger.debug("##### Get Outputs for: " + identifier() + " #####"); |
8cb679d4ec49
Implemented initialize() in FloodMapState to enable cloning floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2093
diff
changeset
|
853 |
965
79251b1d47da
Modified the CollectionMonitor to recommend artifacts for the current state's outputs only.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
960
diff
changeset
|
854 List<String> stateIds = getPreviousStateIds(); |
944
c256061287d7
Simplified the code to read all provided Outputs of an Artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
942
diff
changeset
|
855 List<Output> generated = new ArrayList<Output>(); |
c256061287d7
Simplified the code to read all provided Outputs of an Artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
942
diff
changeset
|
856 |
c256061287d7
Simplified the code to read all provided Outputs of an Artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
942
diff
changeset
|
857 for (String stateId: stateIds) { |
1067
f364410c7bc9
Refactored (state access) to ease future development of more trivial artifacts.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1059
diff
changeset
|
858 DefaultState state = (DefaultState) getState(context, stateId); |
981
799c7108ea6d
datacage: prepared access to outs of artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
965
diff
changeset
|
859 generated.addAll(getOutputForState(state)); |
944
c256061287d7
Simplified the code to read all provided Outputs of an Artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
942
diff
changeset
|
860 } |
c256061287d7
Simplified the code to read all provided Outputs of an Artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
942
diff
changeset
|
861 |
965
79251b1d47da
Modified the CollectionMonitor to recommend artifacts for the current state's outputs only.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
960
diff
changeset
|
862 generated.addAll(getCurrentOutputs(context)); |
944
c256061287d7
Simplified the code to read all provided Outputs of an Artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
942
diff
changeset
|
863 |
1056
bd1b751deab3
Added optional positive filter for outs and facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1055
diff
changeset
|
864 return filterOutputs(generated); |
944
c256061287d7
Simplified the code to read all provided Outputs of an Artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
942
diff
changeset
|
865 } |
c256061287d7
Simplified the code to read all provided Outputs of an Artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
942
diff
changeset
|
866 |
c256061287d7
Simplified the code to read all provided Outputs of an Artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
942
diff
changeset
|
867 |
1765
5d8b3880a553
Do not store association of states to facets, let artifacts keep facets in a pure list.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1763
diff
changeset
|
868 /** |
5d8b3880a553
Do not store association of states to facets, let artifacts keep facets in a pure list.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1763
diff
changeset
|
869 * Get output(s) for current state. |
5d8b3880a553
Do not store association of states to facets, let artifacts keep facets in a pure list.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1763
diff
changeset
|
870 * @return list of outputs for current state. |
5d8b3880a553
Do not store association of states to facets, let artifacts keep facets in a pure list.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1763
diff
changeset
|
871 */ |
1050
eccf966fb677
State engine: Removed CallContext from state validation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
981
diff
changeset
|
872 public List<Output> getCurrentOutputs(Object context) { |
965
79251b1d47da
Modified the CollectionMonitor to recommend artifacts for the current state's outputs only.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
960
diff
changeset
|
873 DefaultState cur = (DefaultState) getCurrentState(context); |
79251b1d47da
Modified the CollectionMonitor to recommend artifacts for the current state's outputs only.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
960
diff
changeset
|
874 |
79251b1d47da
Modified the CollectionMonitor to recommend artifacts for the current state's outputs only.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
960
diff
changeset
|
875 try { |
1050
eccf966fb677
State engine: Removed CallContext from state validation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
981
diff
changeset
|
876 if (cur.validate(this)) { |
981
799c7108ea6d
datacage: prepared access to outs of artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
965
diff
changeset
|
877 return getOutputForState(cur); |
965
79251b1d47da
Modified the CollectionMonitor to recommend artifacts for the current state's outputs only.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
960
diff
changeset
|
878 } |
79251b1d47da
Modified the CollectionMonitor to recommend artifacts for the current state's outputs only.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
960
diff
changeset
|
879 } |
79251b1d47da
Modified the CollectionMonitor to recommend artifacts for the current state's outputs only.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
960
diff
changeset
|
880 catch (IllegalArgumentException iae) { } |
79251b1d47da
Modified the CollectionMonitor to recommend artifacts for the current state's outputs only.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
960
diff
changeset
|
881 |
79251b1d47da
Modified the CollectionMonitor to recommend artifacts for the current state's outputs only.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
960
diff
changeset
|
882 return new ArrayList<Output>(); |
79251b1d47da
Modified the CollectionMonitor to recommend artifacts for the current state's outputs only.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
960
diff
changeset
|
883 } |
79251b1d47da
Modified the CollectionMonitor to recommend artifacts for the current state's outputs only.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
960
diff
changeset
|
884 |
1137
073c36bb94ed
Minor cosmetics
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1117
diff
changeset
|
885 |
1765
5d8b3880a553
Do not store association of states to facets, let artifacts keep facets in a pure list.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1763
diff
changeset
|
886 /** |
5d8b3880a553
Do not store association of states to facets, let artifacts keep facets in a pure list.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1763
diff
changeset
|
887 * Get output(s) for a specific state. |
5d8b3880a553
Do not store association of states to facets, let artifacts keep facets in a pure list.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1763
diff
changeset
|
888 * @param state State of interest |
5d8b3880a553
Do not store association of states to facets, let artifacts keep facets in a pure list.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1763
diff
changeset
|
889 * @return list of output(s) for given state. |
5d8b3880a553
Do not store association of states to facets, let artifacts keep facets in a pure list.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1763
diff
changeset
|
890 */ |
981
799c7108ea6d
datacage: prepared access to outs of artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
965
diff
changeset
|
891 protected List<Output> getOutputForState(DefaultState state) { |
2095
8cb679d4ec49
Implemented initialize() in FloodMapState to enable cloning floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2093
diff
changeset
|
892 logger.debug("Find Outputs for State: " + state.getID()); |
8cb679d4ec49
Implemented initialize() in FloodMapState to enable cloning floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2093
diff
changeset
|
893 |
965
79251b1d47da
Modified the CollectionMonitor to recommend artifacts for the current state's outputs only.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
960
diff
changeset
|
894 List<Output> list = state.getOutputs(); |
79251b1d47da
Modified the CollectionMonitor to recommend artifacts for the current state's outputs only.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
960
diff
changeset
|
895 if (list == null || list.size() == 0) { |
79251b1d47da
Modified the CollectionMonitor to recommend artifacts for the current state's outputs only.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
960
diff
changeset
|
896 logger.debug("-> No output modes for this state."); |
79251b1d47da
Modified the CollectionMonitor to recommend artifacts for the current state's outputs only.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
960
diff
changeset
|
897 return new ArrayList<Output>(); |
79251b1d47da
Modified the CollectionMonitor to recommend artifacts for the current state's outputs only.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
960
diff
changeset
|
898 } |
79251b1d47da
Modified the CollectionMonitor to recommend artifacts for the current state's outputs only.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
960
diff
changeset
|
899 |
2095
8cb679d4ec49
Implemented initialize() in FloodMapState to enable cloning floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2093
diff
changeset
|
900 String stateId = state.getID(); |
8cb679d4ec49
Implemented initialize() in FloodMapState to enable cloning floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2093
diff
changeset
|
901 |
8cb679d4ec49
Implemented initialize() in FloodMapState to enable cloning floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2093
diff
changeset
|
902 List<Facet> fs = facets.get(stateId); |
1771
c62ff9e72cea
Restore mapping of state id to facets (revert, rev 3083 and 3088).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1765
diff
changeset
|
903 |
c62ff9e72cea
Restore mapping of state id to facets (revert, rev 3083 and 3088).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1765
diff
changeset
|
904 if (fs == null || fs.size() == 0) { |
965
79251b1d47da
Modified the CollectionMonitor to recommend artifacts for the current state's outputs only.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
960
diff
changeset
|
905 logger.debug("No facets found."); |
79251b1d47da
Modified the CollectionMonitor to recommend artifacts for the current state's outputs only.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
960
diff
changeset
|
906 return new ArrayList<Output>(); |
79251b1d47da
Modified the CollectionMonitor to recommend artifacts for the current state's outputs only.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
960
diff
changeset
|
907 } |
79251b1d47da
Modified the CollectionMonitor to recommend artifacts for the current state's outputs only.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
960
diff
changeset
|
908 |
2095
8cb679d4ec49
Implemented initialize() in FloodMapState to enable cloning floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2093
diff
changeset
|
909 List<Output> gen = generateOutputs(list, fs); |
8cb679d4ec49
Implemented initialize() in FloodMapState to enable cloning floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2093
diff
changeset
|
910 |
8cb679d4ec49
Implemented initialize() in FloodMapState to enable cloning floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2093
diff
changeset
|
911 logger.debug("State '" + stateId + "' has " + gen.size() + " outs"); |
8cb679d4ec49
Implemented initialize() in FloodMapState to enable cloning floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2093
diff
changeset
|
912 |
8cb679d4ec49
Implemented initialize() in FloodMapState to enable cloning floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2093
diff
changeset
|
913 return gen; |
965
79251b1d47da
Modified the CollectionMonitor to recommend artifacts for the current state's outputs only.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
960
diff
changeset
|
914 } |
79251b1d47da
Modified the CollectionMonitor to recommend artifacts for the current state's outputs only.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
960
diff
changeset
|
915 |
79251b1d47da
Modified the CollectionMonitor to recommend artifacts for the current state's outputs only.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
960
diff
changeset
|
916 |
1763
0e748e8972b5
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1724
diff
changeset
|
917 /** |
0e748e8972b5
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1724
diff
changeset
|
918 * Generate a list of outputs with facets from fs if type is found in list |
0e748e8972b5
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1724
diff
changeset
|
919 * of output. |
0e748e8972b5
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1724
diff
changeset
|
920 * |
0e748e8972b5
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1724
diff
changeset
|
921 * @param list List of outputs |
0e748e8972b5
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1724
diff
changeset
|
922 * @param fs List of facets |
0e748e8972b5
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1724
diff
changeset
|
923 */ |
937
9e813e9137a5
Added a monitor that creates new artifacts for default themes in charts and maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
742
diff
changeset
|
924 protected List<Output> generateOutputs(List<Output> list, List<Facet> fs) { |
9e813e9137a5
Added a monitor that creates new artifacts for default themes in charts and maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
742
diff
changeset
|
925 List<Output> generated = new ArrayList<Output>(); |
9e813e9137a5
Added a monitor that creates new artifacts for default themes in charts and maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
742
diff
changeset
|
926 |
9e813e9137a5
Added a monitor that creates new artifacts for default themes in charts and maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
742
diff
changeset
|
927 boolean debug = logger.isDebugEnabled(); |
9e813e9137a5
Added a monitor that creates new artifacts for default themes in charts and maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
742
diff
changeset
|
928 |
9e813e9137a5
Added a monitor that creates new artifacts for default themes in charts and maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
742
diff
changeset
|
929 for (Output out: list) { |
9e813e9137a5
Added a monitor that creates new artifacts for default themes in charts and maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
742
diff
changeset
|
930 Output o = new DefaultOutput( |
9e813e9137a5
Added a monitor that creates new artifacts for default themes in charts and maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
742
diff
changeset
|
931 out.getName(), |
9e813e9137a5
Added a monitor that creates new artifacts for default themes in charts and maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
742
diff
changeset
|
932 out.getDescription(), |
9e813e9137a5
Added a monitor that creates new artifacts for default themes in charts and maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
742
diff
changeset
|
933 out.getMimeType(), |
9e813e9137a5
Added a monitor that creates new artifacts for default themes in charts and maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
742
diff
changeset
|
934 out.getType()); |
9e813e9137a5
Added a monitor that creates new artifacts for default themes in charts and maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
742
diff
changeset
|
935 |
9e813e9137a5
Added a monitor that creates new artifacts for default themes in charts and maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
742
diff
changeset
|
936 Set<String> outTypes = new HashSet<String>(); |
9e813e9137a5
Added a monitor that creates new artifacts for default themes in charts and maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
742
diff
changeset
|
937 |
9e813e9137a5
Added a monitor that creates new artifacts for default themes in charts and maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
742
diff
changeset
|
938 for (Facet f: out.getFacets()) { |
9e813e9137a5
Added a monitor that creates new artifacts for default themes in charts and maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
742
diff
changeset
|
939 if (outTypes.add(f.getName()) && debug) { |
9e813e9137a5
Added a monitor that creates new artifacts for default themes in charts and maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
742
diff
changeset
|
940 logger.debug("configured facet " + f); |
9e813e9137a5
Added a monitor that creates new artifacts for default themes in charts and maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
742
diff
changeset
|
941 } |
9e813e9137a5
Added a monitor that creates new artifacts for default themes in charts and maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
742
diff
changeset
|
942 } |
9e813e9137a5
Added a monitor that creates new artifacts for default themes in charts and maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
742
diff
changeset
|
943 |
9e813e9137a5
Added a monitor that creates new artifacts for default themes in charts and maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
742
diff
changeset
|
944 boolean facetAdded = false; |
9e813e9137a5
Added a monitor that creates new artifacts for default themes in charts and maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
742
diff
changeset
|
945 for (Facet f: fs) { |
9e813e9137a5
Added a monitor that creates new artifacts for default themes in charts and maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
742
diff
changeset
|
946 String type = f.getName(); |
9e813e9137a5
Added a monitor that creates new artifacts for default themes in charts and maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
742
diff
changeset
|
947 |
9e813e9137a5
Added a monitor that creates new artifacts for default themes in charts and maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
742
diff
changeset
|
948 if (outTypes.contains(type)) { |
9e813e9137a5
Added a monitor that creates new artifacts for default themes in charts and maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
742
diff
changeset
|
949 if (debug) { |
9e813e9137a5
Added a monitor that creates new artifacts for default themes in charts and maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
742
diff
changeset
|
950 logger.debug("Add facet " + f); |
9e813e9137a5
Added a monitor that creates new artifacts for default themes in charts and maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
742
diff
changeset
|
951 } |
9e813e9137a5
Added a monitor that creates new artifacts for default themes in charts and maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
742
diff
changeset
|
952 facetAdded = true; |
9e813e9137a5
Added a monitor that creates new artifacts for default themes in charts and maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
742
diff
changeset
|
953 o.addFacet(f); |
9e813e9137a5
Added a monitor that creates new artifacts for default themes in charts and maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
742
diff
changeset
|
954 } |
9e813e9137a5
Added a monitor that creates new artifacts for default themes in charts and maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
742
diff
changeset
|
955 } |
9e813e9137a5
Added a monitor that creates new artifacts for default themes in charts and maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
742
diff
changeset
|
956 |
9e813e9137a5
Added a monitor that creates new artifacts for default themes in charts and maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
742
diff
changeset
|
957 if (facetAdded) { |
9e813e9137a5
Added a monitor that creates new artifacts for default themes in charts and maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
742
diff
changeset
|
958 generated.add(o); |
9e813e9137a5
Added a monitor that creates new artifacts for default themes in charts and maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
742
diff
changeset
|
959 } |
9e813e9137a5
Added a monitor that creates new artifacts for default themes in charts and maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
742
diff
changeset
|
960 } |
9e813e9137a5
Added a monitor that creates new artifacts for default themes in charts and maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
742
diff
changeset
|
961 |
9e813e9137a5
Added a monitor that creates new artifacts for default themes in charts and maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
742
diff
changeset
|
962 return generated; |
9e813e9137a5
Added a monitor that creates new artifacts for default themes in charts and maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
742
diff
changeset
|
963 } |
9e813e9137a5
Added a monitor that creates new artifacts for default themes in charts and maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
742
diff
changeset
|
964 |
9e813e9137a5
Added a monitor that creates new artifacts for default themes in charts and maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
742
diff
changeset
|
965 |
689
f8ac04b2dbd0
Added two more compute() methods to ComputeCallback to distinguish between different phases of the artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
687
diff
changeset
|
966 /** |
f8ac04b2dbd0
Added two more compute() methods to ComputeCallback to distinguish between different phases of the artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
687
diff
changeset
|
967 * Dispatches the computation request to compute(CallContext context, String |
f8ac04b2dbd0
Added two more compute() methods to ComputeCallback to distinguish between different phases of the artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
687
diff
changeset
|
968 * hash) with the current hash value of the artifact which is provided by |
f8ac04b2dbd0
Added two more compute() methods to ComputeCallback to distinguish between different phases of the artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
687
diff
changeset
|
969 * hash(). |
f8ac04b2dbd0
Added two more compute() methods to ComputeCallback to distinguish between different phases of the artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
687
diff
changeset
|
970 * |
f8ac04b2dbd0
Added two more compute() methods to ComputeCallback to distinguish between different phases of the artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
687
diff
changeset
|
971 * @param context The CallContext. |
f8ac04b2dbd0
Added two more compute() methods to ComputeCallback to distinguish between different phases of the artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
687
diff
changeset
|
972 */ |
705
853dceead0f4
Only generate facets when needed.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
704
diff
changeset
|
973 public Object compute( |
742
c09c9e05ecfa
Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
741
diff
changeset
|
974 CallContext context, |
c09c9e05ecfa
Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
741
diff
changeset
|
975 ComputeType type, |
705
853dceead0f4
Only generate facets when needed.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
704
diff
changeset
|
976 boolean generateFacets |
853dceead0f4
Only generate facets when needed.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
704
diff
changeset
|
977 ) { |
853dceead0f4
Only generate facets when needed.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
704
diff
changeset
|
978 return compute(context, hash(), type, generateFacets); |
689
f8ac04b2dbd0
Added two more compute() methods to ComputeCallback to distinguish between different phases of the artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
687
diff
changeset
|
979 } |
f8ac04b2dbd0
Added two more compute() methods to ComputeCallback to distinguish between different phases of the artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
687
diff
changeset
|
980 |
f8ac04b2dbd0
Added two more compute() methods to ComputeCallback to distinguish between different phases of the artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
687
diff
changeset
|
981 |
f8ac04b2dbd0
Added two more compute() methods to ComputeCallback to distinguish between different phases of the artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
687
diff
changeset
|
982 /** |
f8ac04b2dbd0
Added two more compute() methods to ComputeCallback to distinguish between different phases of the artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
687
diff
changeset
|
983 * Dispatches computation requests to the current state which needs to |
f8ac04b2dbd0
Added two more compute() methods to ComputeCallback to distinguish between different phases of the artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
687
diff
changeset
|
984 * implement a createComputeCallback(String hash, FLYSArtifact artifact) |
f8ac04b2dbd0
Added two more compute() methods to ComputeCallback to distinguish between different phases of the artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
687
diff
changeset
|
985 * method. |
f8ac04b2dbd0
Added two more compute() methods to ComputeCallback to distinguish between different phases of the artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
687
diff
changeset
|
986 * |
f8ac04b2dbd0
Added two more compute() methods to ComputeCallback to distinguish between different phases of the artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
687
diff
changeset
|
987 * @param context The CallContext. |
f8ac04b2dbd0
Added two more compute() methods to ComputeCallback to distinguish between different phases of the artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
687
diff
changeset
|
988 * @param hash The hash value which is used to fetch computed data from |
f8ac04b2dbd0
Added two more compute() methods to ComputeCallback to distinguish between different phases of the artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
687
diff
changeset
|
989 * cache. |
f8ac04b2dbd0
Added two more compute() methods to ComputeCallback to distinguish between different phases of the artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
687
diff
changeset
|
990 * |
f8ac04b2dbd0
Added two more compute() methods to ComputeCallback to distinguish between different phases of the artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
687
diff
changeset
|
991 * @return the computed data. |
f8ac04b2dbd0
Added two more compute() methods to ComputeCallback to distinguish between different phases of the artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
687
diff
changeset
|
992 */ |
705
853dceead0f4
Only generate facets when needed.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
704
diff
changeset
|
993 public Object compute( |
853dceead0f4
Only generate facets when needed.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
704
diff
changeset
|
994 CallContext context, |
853dceead0f4
Only generate facets when needed.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
704
diff
changeset
|
995 String hash, |
742
c09c9e05ecfa
Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
741
diff
changeset
|
996 ComputeType type, |
705
853dceead0f4
Only generate facets when needed.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
704
diff
changeset
|
997 boolean generateFacets |
853dceead0f4
Only generate facets when needed.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
704
diff
changeset
|
998 ) { |
693
af393c5eb2c8
Write computed facets into artifacts describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
692
diff
changeset
|
999 DefaultState current = (DefaultState) getCurrentState(context); |
722
4800230fba8a
Improved situtation on rendering "Abflusskurve am Pegel". Not fully working, yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
708
diff
changeset
|
1000 return compute(context, hash, current, type, generateFacets); |
4800230fba8a
Improved situtation on rendering "Abflusskurve am Pegel". Not fully working, yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
708
diff
changeset
|
1001 } |
689
f8ac04b2dbd0
Added two more compute() methods to ComputeCallback to distinguish between different phases of the artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
687
diff
changeset
|
1002 |
1704
e8627d1e2db6
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1656
diff
changeset
|
1003 |
e8627d1e2db6
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1656
diff
changeset
|
1004 /** |
e8627d1e2db6
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1656
diff
changeset
|
1005 * Like compute, but identify State by it id (string). |
e8627d1e2db6
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1656
diff
changeset
|
1006 */ |
722
4800230fba8a
Improved situtation on rendering "Abflusskurve am Pegel". Not fully working, yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
708
diff
changeset
|
1007 public Object compute( |
4800230fba8a
Improved situtation on rendering "Abflusskurve am Pegel". Not fully working, yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
708
diff
changeset
|
1008 CallContext context, |
1117
ea80e652f033
Reordered some parameters in a FLYSArtifact method.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1094
diff
changeset
|
1009 String hash, |
722
4800230fba8a
Improved situtation on rendering "Abflusskurve am Pegel". Not fully working, yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
708
diff
changeset
|
1010 String stateID, |
742
c09c9e05ecfa
Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
741
diff
changeset
|
1011 ComputeType type, |
722
4800230fba8a
Improved situtation on rendering "Abflusskurve am Pegel". Not fully working, yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
708
diff
changeset
|
1012 boolean generateFacets |
4800230fba8a
Improved situtation on rendering "Abflusskurve am Pegel". Not fully working, yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
708
diff
changeset
|
1013 ) { |
4800230fba8a
Improved situtation on rendering "Abflusskurve am Pegel". Not fully working, yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
708
diff
changeset
|
1014 DefaultState current = stateID == null |
4800230fba8a
Improved situtation on rendering "Abflusskurve am Pegel". Not fully working, yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
708
diff
changeset
|
1015 ? (DefaultState)getCurrentState(context) |
4800230fba8a
Improved situtation on rendering "Abflusskurve am Pegel". Not fully working, yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
708
diff
changeset
|
1016 : (DefaultState)getState(context, stateID); |
4800230fba8a
Improved situtation on rendering "Abflusskurve am Pegel". Not fully working, yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
708
diff
changeset
|
1017 |
4800230fba8a
Improved situtation on rendering "Abflusskurve am Pegel". Not fully working, yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
708
diff
changeset
|
1018 if (hash == null) { |
4800230fba8a
Improved situtation on rendering "Abflusskurve am Pegel". Not fully working, yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
708
diff
changeset
|
1019 hash = hash(); |
4800230fba8a
Improved situtation on rendering "Abflusskurve am Pegel". Not fully working, yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
708
diff
changeset
|
1020 } |
689
f8ac04b2dbd0
Added two more compute() methods to ComputeCallback to distinguish between different phases of the artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
687
diff
changeset
|
1021 |
705
853dceead0f4
Only generate facets when needed.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
704
diff
changeset
|
1022 return compute(context, hash, current, type, generateFacets); |
689
f8ac04b2dbd0
Added two more compute() methods to ComputeCallback to distinguish between different phases of the artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
687
diff
changeset
|
1023 } |
f8ac04b2dbd0
Added two more compute() methods to ComputeCallback to distinguish between different phases of the artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
687
diff
changeset
|
1024 |
1137
073c36bb94ed
Minor cosmetics
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1117
diff
changeset
|
1025 |
073c36bb94ed
Minor cosmetics
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1117
diff
changeset
|
1026 /** |
1765
5d8b3880a553
Do not store association of states to facets, let artifacts keep facets in a pure list.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1763
diff
changeset
|
1027 * Let current state compute and register facets. |
5d8b3880a553
Do not store association of states to facets, let artifacts keep facets in a pure list.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1763
diff
changeset
|
1028 * |
1137
073c36bb94ed
Minor cosmetics
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1117
diff
changeset
|
1029 * @param key key of state |
073c36bb94ed
Minor cosmetics
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1117
diff
changeset
|
1030 * @param state state |
073c36bb94ed
Minor cosmetics
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1117
diff
changeset
|
1031 * @param type Type of compute |
073c36bb94ed
Minor cosmetics
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1117
diff
changeset
|
1032 * @param generateFacets Whether new facets shall be generated. |
073c36bb94ed
Minor cosmetics
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1117
diff
changeset
|
1033 */ |
690
3481cd37e609
Use enums to dispatch computeFeed() and computeAdvance().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
689
diff
changeset
|
1034 public Object compute( |
697
b972eba2ed8a
Removed ComputeCallback because this was thought too complicated. Fixed issue with facets not be re-generated if same state is entered again.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
696
diff
changeset
|
1035 CallContext context, |
b972eba2ed8a
Removed ComputeCallback because this was thought too complicated. Fixed issue with facets not be re-generated if same state is entered again.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
696
diff
changeset
|
1036 String key, |
b972eba2ed8a
Removed ComputeCallback because this was thought too complicated. Fixed issue with facets not be re-generated if same state is entered again.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
696
diff
changeset
|
1037 DefaultState state, |
705
853dceead0f4
Only generate facets when needed.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
704
diff
changeset
|
1038 ComputeType type, |
853dceead0f4
Only generate facets when needed.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
704
diff
changeset
|
1039 boolean generateFacets |
697
b972eba2ed8a
Removed ComputeCallback because this was thought too complicated. Fixed issue with facets not be re-generated if same state is entered again.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
696
diff
changeset
|
1040 ) { |
b972eba2ed8a
Removed ComputeCallback because this was thought too complicated. Fixed issue with facets not be re-generated if same state is entered again.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
696
diff
changeset
|
1041 String stateID = state.getID(); |
691
2600aa2c7319
Store facets for each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
690
diff
changeset
|
1042 |
1137
073c36bb94ed
Minor cosmetics
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1117
diff
changeset
|
1043 List<Facet> fs = (generateFacets) ? new ArrayList<Facet>() : null; |
697
b972eba2ed8a
Removed ComputeCallback because this was thought too complicated. Fixed issue with facets not be re-generated if same state is entered again.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
696
diff
changeset
|
1044 |
b972eba2ed8a
Removed ComputeCallback because this was thought too complicated. Fixed issue with facets not be re-generated if same state is entered again.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
696
diff
changeset
|
1045 try { |
b972eba2ed8a
Removed ComputeCallback because this was thought too complicated. Fixed issue with facets not be re-generated if same state is entered again.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
696
diff
changeset
|
1046 Cache cache = CacheFactory.getCache(COMPUTING_CACHE); |
b972eba2ed8a
Removed ComputeCallback because this was thought too complicated. Fixed issue with facets not be re-generated if same state is entered again.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
696
diff
changeset
|
1047 |
b972eba2ed8a
Removed ComputeCallback because this was thought too complicated. Fixed issue with facets not be re-generated if same state is entered again.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
696
diff
changeset
|
1048 Object old = null; |
b972eba2ed8a
Removed ComputeCallback because this was thought too complicated. Fixed issue with facets not be re-generated if same state is entered again.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
696
diff
changeset
|
1049 |
b972eba2ed8a
Removed ComputeCallback because this was thought too complicated. Fixed issue with facets not be re-generated if same state is entered again.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
696
diff
changeset
|
1050 if (cache != null) { |
b972eba2ed8a
Removed ComputeCallback because this was thought too complicated. Fixed issue with facets not be re-generated if same state is entered again.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
696
diff
changeset
|
1051 net.sf.ehcache.Element element = cache.get(key); |
b972eba2ed8a
Removed ComputeCallback because this was thought too complicated. Fixed issue with facets not be re-generated if same state is entered again.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
696
diff
changeset
|
1052 if (element != null) { |
b972eba2ed8a
Removed ComputeCallback because this was thought too complicated. Fixed issue with facets not be re-generated if same state is entered again.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
696
diff
changeset
|
1053 logger.debug("Got computation result from cache."); |
b972eba2ed8a
Removed ComputeCallback because this was thought too complicated. Fixed issue with facets not be re-generated if same state is entered again.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
696
diff
changeset
|
1054 old = element.getValue(); |
b972eba2ed8a
Removed ComputeCallback because this was thought too complicated. Fixed issue with facets not be re-generated if same state is entered again.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
696
diff
changeset
|
1055 } |
b972eba2ed8a
Removed ComputeCallback because this was thought too complicated. Fixed issue with facets not be re-generated if same state is entered again.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
696
diff
changeset
|
1056 } |
b972eba2ed8a
Removed ComputeCallback because this was thought too complicated. Fixed issue with facets not be re-generated if same state is entered again.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
696
diff
changeset
|
1057 |
b972eba2ed8a
Removed ComputeCallback because this was thought too complicated. Fixed issue with facets not be re-generated if same state is entered again.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
696
diff
changeset
|
1058 Object res; |
690
3481cd37e609
Use enums to dispatch computeFeed() and computeAdvance().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
689
diff
changeset
|
1059 switch (type) { |
3481cd37e609
Use enums to dispatch computeFeed() and computeAdvance().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
689
diff
changeset
|
1060 case FEED: |
697
b972eba2ed8a
Removed ComputeCallback because this was thought too complicated. Fixed issue with facets not be re-generated if same state is entered again.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
696
diff
changeset
|
1061 res = state.computeFeed(this, key, context, fs, old); |
b972eba2ed8a
Removed ComputeCallback because this was thought too complicated. Fixed issue with facets not be re-generated if same state is entered again.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
696
diff
changeset
|
1062 break; |
b972eba2ed8a
Removed ComputeCallback because this was thought too complicated. Fixed issue with facets not be re-generated if same state is entered again.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
696
diff
changeset
|
1063 case ADVANCE: |
700
94f0f91be11c
call computeAdvance() if we want to advance.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
699
diff
changeset
|
1064 res = state.computeAdvance(this, key, context, fs, old); |
697
b972eba2ed8a
Removed ComputeCallback because this was thought too complicated. Fixed issue with facets not be re-generated if same state is entered again.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
696
diff
changeset
|
1065 break; |
942
796c54058dc4
Added artifacts/states for WMS background an river axis and a configuration for the output-defaults.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
941
diff
changeset
|
1066 case INIT: |
958
ae198bef4ba0
Added configurations for river WMSe (currently for Saar, Mosel, Elbe).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
952
diff
changeset
|
1067 res = state.computeInit(this, key, context, context.getMeta(), fs); |
697
b972eba2ed8a
Removed ComputeCallback because this was thought too complicated. Fixed issue with facets not be re-generated if same state is entered again.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
696
diff
changeset
|
1068 default: |
b972eba2ed8a
Removed ComputeCallback because this was thought too complicated. Fixed issue with facets not be re-generated if same state is entered again.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
696
diff
changeset
|
1069 res = null; |
b972eba2ed8a
Removed ComputeCallback because this was thought too complicated. Fixed issue with facets not be re-generated if same state is entered again.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
696
diff
changeset
|
1070 } |
690
3481cd37e609
Use enums to dispatch computeFeed() and computeAdvance().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
689
diff
changeset
|
1071 |
697
b972eba2ed8a
Removed ComputeCallback because this was thought too complicated. Fixed issue with facets not be re-generated if same state is entered again.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
696
diff
changeset
|
1072 if (cache != null && old != res && res != null) { |
b972eba2ed8a
Removed ComputeCallback because this was thought too complicated. Fixed issue with facets not be re-generated if same state is entered again.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
696
diff
changeset
|
1073 logger.debug("Store computation result to cache."); |
b972eba2ed8a
Removed ComputeCallback because this was thought too complicated. Fixed issue with facets not be re-generated if same state is entered again.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
696
diff
changeset
|
1074 net.sf.ehcache.Element element = |
b972eba2ed8a
Removed ComputeCallback because this was thought too complicated. Fixed issue with facets not be re-generated if same state is entered again.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
696
diff
changeset
|
1075 new net.sf.ehcache.Element(key, res); |
b972eba2ed8a
Removed ComputeCallback because this was thought too complicated. Fixed issue with facets not be re-generated if same state is entered again.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
696
diff
changeset
|
1076 cache.put(element); |
b972eba2ed8a
Removed ComputeCallback because this was thought too complicated. Fixed issue with facets not be re-generated if same state is entered again.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
696
diff
changeset
|
1077 } |
b972eba2ed8a
Removed ComputeCallback because this was thought too complicated. Fixed issue with facets not be re-generated if same state is entered again.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
696
diff
changeset
|
1078 |
b972eba2ed8a
Removed ComputeCallback because this was thought too complicated. Fixed issue with facets not be re-generated if same state is entered again.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
696
diff
changeset
|
1079 return res; |
b972eba2ed8a
Removed ComputeCallback because this was thought too complicated. Fixed issue with facets not be re-generated if same state is entered again.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
696
diff
changeset
|
1080 } |
b972eba2ed8a
Removed ComputeCallback because this was thought too complicated. Fixed issue with facets not be re-generated if same state is entered again.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
696
diff
changeset
|
1081 finally { |
705
853dceead0f4
Only generate facets when needed.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
704
diff
changeset
|
1082 if (generateFacets) { |
853dceead0f4
Only generate facets when needed.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
704
diff
changeset
|
1083 if (fs.isEmpty()) { |
1771
c62ff9e72cea
Restore mapping of state id to facets (revert, rev 3083 and 3088).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1765
diff
changeset
|
1084 facets.remove(stateID); |
705
853dceead0f4
Only generate facets when needed.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
704
diff
changeset
|
1085 } |
853dceead0f4
Only generate facets when needed.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
704
diff
changeset
|
1086 else { |
1771
c62ff9e72cea
Restore mapping of state id to facets (revert, rev 3083 and 3088).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1765
diff
changeset
|
1087 facets.put(stateID, fs); |
705
853dceead0f4
Only generate facets when needed.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
704
diff
changeset
|
1088 } |
690
3481cd37e609
Use enums to dispatch computeFeed() and computeAdvance().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
689
diff
changeset
|
1089 } |
686
3dc61e00385e
Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
661
diff
changeset
|
1090 } |
3dc61e00385e
Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
661
diff
changeset
|
1091 } |
3dc61e00385e
Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
661
diff
changeset
|
1092 |
3dc61e00385e
Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
661
diff
changeset
|
1093 |
623
aa64fe4df8ab
Added a method to dump the artifacts state/data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
459
diff
changeset
|
1094 /** |
aa64fe4df8ab
Added a method to dump the artifacts state/data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
459
diff
changeset
|
1095 * Method to dump the artifacts state/data. |
aa64fe4df8ab
Added a method to dump the artifacts state/data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
459
diff
changeset
|
1096 */ |
aa64fe4df8ab
Added a method to dump the artifacts state/data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
459
diff
changeset
|
1097 protected void dumpArtifact() { |
aa64fe4df8ab
Added a method to dump the artifacts state/data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
459
diff
changeset
|
1098 if (logger.isDebugEnabled()) { |
aa64fe4df8ab
Added a method to dump the artifacts state/data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
459
diff
changeset
|
1099 logger.debug("++++++++++++++ DUMP ARTIFACT DATA +++++++++++++++++"); |
aa64fe4df8ab
Added a method to dump the artifacts state/data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
459
diff
changeset
|
1100 |
aa64fe4df8ab
Added a method to dump the artifacts state/data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
459
diff
changeset
|
1101 logger.debug("------ DUMP DATA ------"); |
aa64fe4df8ab
Added a method to dump the artifacts state/data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
459
diff
changeset
|
1102 Collection<StateData> allData = data.values(); |
aa64fe4df8ab
Added a method to dump the artifacts state/data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
459
diff
changeset
|
1103 |
aa64fe4df8ab
Added a method to dump the artifacts state/data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
459
diff
changeset
|
1104 for (StateData d: allData) { |
aa64fe4df8ab
Added a method to dump the artifacts state/data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
459
diff
changeset
|
1105 String name = d.getName(); |
aa64fe4df8ab
Added a method to dump the artifacts state/data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
459
diff
changeset
|
1106 String value = (String) d.getValue(); |
aa64fe4df8ab
Added a method to dump the artifacts state/data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
459
diff
changeset
|
1107 |
aa64fe4df8ab
Added a method to dump the artifacts state/data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
459
diff
changeset
|
1108 logger.debug("- " + name + ": " + value); |
aa64fe4df8ab
Added a method to dump the artifacts state/data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
459
diff
changeset
|
1109 } |
aa64fe4df8ab
Added a method to dump the artifacts state/data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
459
diff
changeset
|
1110 |
aa64fe4df8ab
Added a method to dump the artifacts state/data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
459
diff
changeset
|
1111 logger.debug("------ DUMP PREVIOUS STATES ------"); |
661
fdc898a134a7
Use java.util.List instead of java.util.Vector. Removed superfluous imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
658
diff
changeset
|
1112 List<String> stateIds = getPreviousStateIds(); |
623
aa64fe4df8ab
Added a method to dump the artifacts state/data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
459
diff
changeset
|
1113 |
aa64fe4df8ab
Added a method to dump the artifacts state/data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
459
diff
changeset
|
1114 for (String id: stateIds) { |
aa64fe4df8ab
Added a method to dump the artifacts state/data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
459
diff
changeset
|
1115 logger.debug("- State: " + id); |
aa64fe4df8ab
Added a method to dump the artifacts state/data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
459
diff
changeset
|
1116 } |
aa64fe4df8ab
Added a method to dump the artifacts state/data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
459
diff
changeset
|
1117 |
aa64fe4df8ab
Added a method to dump the artifacts state/data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
459
diff
changeset
|
1118 logger.debug("CURRENT STATE: " + getCurrentStateId()); |
aa64fe4df8ab
Added a method to dump the artifacts state/data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
459
diff
changeset
|
1119 |
2095
8cb679d4ec49
Implemented initialize() in FloodMapState to enable cloning floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2093
diff
changeset
|
1120 debugFacets(); |
8cb679d4ec49
Implemented initialize() in FloodMapState to enable cloning floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2093
diff
changeset
|
1121 dumpFilterFacets(); |
8cb679d4ec49
Implemented initialize() in FloodMapState to enable cloning floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2093
diff
changeset
|
1122 |
623
aa64fe4df8ab
Added a method to dump the artifacts state/data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
459
diff
changeset
|
1123 logger.debug("++++++++++++++ END ARTIFACT DUMP +++++++++++++++++"); |
aa64fe4df8ab
Added a method to dump the artifacts state/data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
459
diff
changeset
|
1124 } |
aa64fe4df8ab
Added a method to dump the artifacts state/data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
459
diff
changeset
|
1125 } |
1086
825ea312116d
Call State.endOfLife() for all States in the Artifact when Artifact.endOfLife() is called.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1084
diff
changeset
|
1126 |
825ea312116d
Call State.endOfLife() for all States in the Artifact when Artifact.endOfLife() is called.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1084
diff
changeset
|
1127 |
2095
8cb679d4ec49
Implemented initialize() in FloodMapState to enable cloning floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2093
diff
changeset
|
1128 protected void debugFacets() { |
8cb679d4ec49
Implemented initialize() in FloodMapState to enable cloning floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2093
diff
changeset
|
1129 logger.debug("######### FACETS #########"); |
8cb679d4ec49
Implemented initialize() in FloodMapState to enable cloning floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2093
diff
changeset
|
1130 Set<Map.Entry<String, List<Facet>>> entries = facets.entrySet(); |
8cb679d4ec49
Implemented initialize() in FloodMapState to enable cloning floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2093
diff
changeset
|
1131 |
8cb679d4ec49
Implemented initialize() in FloodMapState to enable cloning floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2093
diff
changeset
|
1132 for (Map.Entry<String, List<Facet>> entry: entries) { |
8cb679d4ec49
Implemented initialize() in FloodMapState to enable cloning floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2093
diff
changeset
|
1133 String out = entry.getKey(); |
8cb679d4ec49
Implemented initialize() in FloodMapState to enable cloning floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2093
diff
changeset
|
1134 List<Facet> fs = entry.getValue(); |
8cb679d4ec49
Implemented initialize() in FloodMapState to enable cloning floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2093
diff
changeset
|
1135 for (Facet f: fs) { |
8cb679d4ec49
Implemented initialize() in FloodMapState to enable cloning floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2093
diff
changeset
|
1136 logger.debug(" # " + out + " : " + f.getName()); |
8cb679d4ec49
Implemented initialize() in FloodMapState to enable cloning floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2093
diff
changeset
|
1137 } |
8cb679d4ec49
Implemented initialize() in FloodMapState to enable cloning floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2093
diff
changeset
|
1138 } |
8cb679d4ec49
Implemented initialize() in FloodMapState to enable cloning floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2093
diff
changeset
|
1139 |
8cb679d4ec49
Implemented initialize() in FloodMapState to enable cloning floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2093
diff
changeset
|
1140 logger.debug("######## FACETS END ########"); |
8cb679d4ec49
Implemented initialize() in FloodMapState to enable cloning floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2093
diff
changeset
|
1141 } |
8cb679d4ec49
Implemented initialize() in FloodMapState to enable cloning floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2093
diff
changeset
|
1142 |
8cb679d4ec49
Implemented initialize() in FloodMapState to enable cloning floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2093
diff
changeset
|
1143 |
8cb679d4ec49
Implemented initialize() in FloodMapState to enable cloning floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2093
diff
changeset
|
1144 protected void dumpFilterFacets() { |
8cb679d4ec49
Implemented initialize() in FloodMapState to enable cloning floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2093
diff
changeset
|
1145 logger.debug("######## FILTER FACETS ########"); |
8cb679d4ec49
Implemented initialize() in FloodMapState to enable cloning floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2093
diff
changeset
|
1146 |
8cb679d4ec49
Implemented initialize() in FloodMapState to enable cloning floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2093
diff
changeset
|
1147 if (filterFacets == null || filterFacets.isEmpty()) { |
8cb679d4ec49
Implemented initialize() in FloodMapState to enable cloning floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2093
diff
changeset
|
1148 logger.debug("No Filter Facets defined."); |
8cb679d4ec49
Implemented initialize() in FloodMapState to enable cloning floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2093
diff
changeset
|
1149 return; |
8cb679d4ec49
Implemented initialize() in FloodMapState to enable cloning floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2093
diff
changeset
|
1150 } |
8cb679d4ec49
Implemented initialize() in FloodMapState to enable cloning floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2093
diff
changeset
|
1151 |
8cb679d4ec49
Implemented initialize() in FloodMapState to enable cloning floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2093
diff
changeset
|
1152 Set<Map.Entry<String, List<Facet>>> entries = filterFacets.entrySet(); |
8cb679d4ec49
Implemented initialize() in FloodMapState to enable cloning floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2093
diff
changeset
|
1153 for (Map.Entry<String, List<Facet>> entry: entries) { |
8cb679d4ec49
Implemented initialize() in FloodMapState to enable cloning floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2093
diff
changeset
|
1154 String out = entry.getKey(); |
8cb679d4ec49
Implemented initialize() in FloodMapState to enable cloning floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2093
diff
changeset
|
1155 List<Facet> filters = entry.getValue(); |
8cb679d4ec49
Implemented initialize() in FloodMapState to enable cloning floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2093
diff
changeset
|
1156 |
8cb679d4ec49
Implemented initialize() in FloodMapState to enable cloning floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2093
diff
changeset
|
1157 logger.debug("There are " + filters.size() + " filters for: " +out); |
8cb679d4ec49
Implemented initialize() in FloodMapState to enable cloning floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2093
diff
changeset
|
1158 |
8cb679d4ec49
Implemented initialize() in FloodMapState to enable cloning floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2093
diff
changeset
|
1159 for (Facet filter: filters) { |
8cb679d4ec49
Implemented initialize() in FloodMapState to enable cloning floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2093
diff
changeset
|
1160 logger.debug(" filter: " + filter.getName()); |
8cb679d4ec49
Implemented initialize() in FloodMapState to enable cloning floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2093
diff
changeset
|
1161 } |
8cb679d4ec49
Implemented initialize() in FloodMapState to enable cloning floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2093
diff
changeset
|
1162 } |
8cb679d4ec49
Implemented initialize() in FloodMapState to enable cloning floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2093
diff
changeset
|
1163 |
8cb679d4ec49
Implemented initialize() in FloodMapState to enable cloning floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2093
diff
changeset
|
1164 logger.debug("######## FILTER FACETS END ########"); |
8cb679d4ec49
Implemented initialize() in FloodMapState to enable cloning floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2093
diff
changeset
|
1165 } |
8cb679d4ec49
Implemented initialize() in FloodMapState to enable cloning floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2093
diff
changeset
|
1166 |
8cb679d4ec49
Implemented initialize() in FloodMapState to enable cloning floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2093
diff
changeset
|
1167 |
1094
b1c6d945848d
Added a new method to FLYSArtifact to destroy a single state (call its endOfLife).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1086
diff
changeset
|
1168 protected void destroyState(String id, Object context) { |
b1c6d945848d
Added a new method to FLYSArtifact to destroy a single state (call its endOfLife).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1086
diff
changeset
|
1169 State s = getState(context, id); |
b1c6d945848d
Added a new method to FLYSArtifact to destroy a single state (call its endOfLife).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1086
diff
changeset
|
1170 s.endOfLife(this, context); |
b1c6d945848d
Added a new method to FLYSArtifact to destroy a single state (call its endOfLife).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1086
diff
changeset
|
1171 } |
b1c6d945848d
Added a new method to FLYSArtifact to destroy a single state (call its endOfLife).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1086
diff
changeset
|
1172 |
b1c6d945848d
Added a new method to FLYSArtifact to destroy a single state (call its endOfLife).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1086
diff
changeset
|
1173 |
1086
825ea312116d
Call State.endOfLife() for all States in the Artifact when Artifact.endOfLife() is called.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1084
diff
changeset
|
1174 /** |
825ea312116d
Call State.endOfLife() for all States in the Artifact when Artifact.endOfLife() is called.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1084
diff
changeset
|
1175 * Calls endOfLife() for each state in the list <i>ids</i>. |
825ea312116d
Call State.endOfLife() for all States in the Artifact when Artifact.endOfLife() is called.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1084
diff
changeset
|
1176 * |
825ea312116d
Call State.endOfLife() for all States in the Artifact when Artifact.endOfLife() is called.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1084
diff
changeset
|
1177 * @param ids The State IDs that should be destroyed. |
825ea312116d
Call State.endOfLife() for all States in the Artifact when Artifact.endOfLife() is called.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1084
diff
changeset
|
1178 * @param context The FLYSContext. |
825ea312116d
Call State.endOfLife() for all States in the Artifact when Artifact.endOfLife() is called.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1084
diff
changeset
|
1179 */ |
825ea312116d
Call State.endOfLife() for all States in the Artifact when Artifact.endOfLife() is called.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1084
diff
changeset
|
1180 protected void destroyStates(List<String> ids, Object context) { |
825ea312116d
Call State.endOfLife() for all States in the Artifact when Artifact.endOfLife() is called.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1084
diff
changeset
|
1181 for (int i = 0, num = ids.size(); i < num; i++) { |
1094
b1c6d945848d
Added a new method to FLYSArtifact to destroy a single state (call its endOfLife).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1086
diff
changeset
|
1182 destroyState(ids.get(i), context); |
1086
825ea312116d
Call State.endOfLife() for all States in the Artifact when Artifact.endOfLife() is called.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1084
diff
changeset
|
1183 } |
825ea312116d
Call State.endOfLife() for all States in the Artifact when Artifact.endOfLife() is called.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1084
diff
changeset
|
1184 } |
825ea312116d
Call State.endOfLife() for all States in the Artifact when Artifact.endOfLife() is called.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1084
diff
changeset
|
1185 |
825ea312116d
Call State.endOfLife() for all States in the Artifact when Artifact.endOfLife() is called.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1084
diff
changeset
|
1186 |
1763
0e748e8972b5
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1724
diff
changeset
|
1187 /** |
0e748e8972b5
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1724
diff
changeset
|
1188 * Destroy the states. |
0e748e8972b5
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1724
diff
changeset
|
1189 */ |
1086
825ea312116d
Call State.endOfLife() for all States in the Artifact when Artifact.endOfLife() is called.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1084
diff
changeset
|
1190 @Override |
825ea312116d
Call State.endOfLife() for all States in the Artifact when Artifact.endOfLife() is called.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1084
diff
changeset
|
1191 public void endOfLife(Object context) { |
825ea312116d
Call State.endOfLife() for all States in the Artifact when Artifact.endOfLife() is called.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1084
diff
changeset
|
1192 logger.info("FLYSArtifact.endOfLife: " + identifier()); |
825ea312116d
Call State.endOfLife() for all States in the Artifact when Artifact.endOfLife() is called.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1084
diff
changeset
|
1193 |
825ea312116d
Call State.endOfLife() for all States in the Artifact when Artifact.endOfLife() is called.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1084
diff
changeset
|
1194 List<String> ids = getPreviousStateIds(); |
825ea312116d
Call State.endOfLife() for all States in the Artifact when Artifact.endOfLife() is called.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1084
diff
changeset
|
1195 ids.add(getCurrentStateId()); |
825ea312116d
Call State.endOfLife() for all States in the Artifact when Artifact.endOfLife() is called.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1084
diff
changeset
|
1196 |
825ea312116d
Call State.endOfLife() for all States in the Artifact when Artifact.endOfLife() is called.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1084
diff
changeset
|
1197 destroyStates(ids, context); |
825ea312116d
Call State.endOfLife() for all States in the Artifact when Artifact.endOfLife() is called.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1084
diff
changeset
|
1198 } |
1709
f643ea084213
Allow simple codepaths to have Facets initially being 'inactive' (wrt rendering).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1704
diff
changeset
|
1199 |
f643ea084213
Allow simple codepaths to have Facets initially being 'inactive' (wrt rendering).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1704
diff
changeset
|
1200 |
f643ea084213
Allow simple codepaths to have Facets initially being 'inactive' (wrt rendering).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1704
diff
changeset
|
1201 /** |
f643ea084213
Allow simple codepaths to have Facets initially being 'inactive' (wrt rendering).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1704
diff
changeset
|
1202 * Determines Facets initial disposition regarding activity (think of |
f643ea084213
Allow simple codepaths to have Facets initially being 'inactive' (wrt rendering).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1704
diff
changeset
|
1203 * selection in Client ThemeList GUI). This will be checked one time |
f643ea084213
Allow simple codepaths to have Facets initially being 'inactive' (wrt rendering).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1704
diff
changeset
|
1204 * when the facet enters a collections describe document. |
f643ea084213
Allow simple codepaths to have Facets initially being 'inactive' (wrt rendering).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1704
diff
changeset
|
1205 * |
1809
f6a190f6aaff
Give outputname to artifacts getInitialFacetActivity, generate second pair of MainvalueFacets for discharge curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1783
diff
changeset
|
1206 * @param facetName name of the facet. |
f6a190f6aaff
Give outputname to artifacts getInitialFacetActivity, generate second pair of MainvalueFacets for discharge curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1783
diff
changeset
|
1207 * @param outputName name of the output. |
f6a190f6aaff
Give outputname to artifacts getInitialFacetActivity, generate second pair of MainvalueFacets for discharge curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1783
diff
changeset
|
1208 * @param index index of the facet. |
1709
f643ea084213
Allow simple codepaths to have Facets initially being 'inactive' (wrt rendering).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1704
diff
changeset
|
1209 * |
f643ea084213
Allow simple codepaths to have Facets initially being 'inactive' (wrt rendering).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1704
diff
changeset
|
1210 * @return 1 if wished to be initally active, 0 if not. FLYSArtifact |
f643ea084213
Allow simple codepaths to have Facets initially being 'inactive' (wrt rendering).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1704
diff
changeset
|
1211 * defaults to "1". |
f643ea084213
Allow simple codepaths to have Facets initially being 'inactive' (wrt rendering).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1704
diff
changeset
|
1212 */ |
1809
f6a190f6aaff
Give outputname to artifacts getInitialFacetActivity, generate second pair of MainvalueFacets for discharge curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1783
diff
changeset
|
1213 public int getInitialFacetActivity( |
f6a190f6aaff
Give outputname to artifacts getInitialFacetActivity, generate second pair of MainvalueFacets for discharge curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1783
diff
changeset
|
1214 String outputName, |
f6a190f6aaff
Give outputname to artifacts getInitialFacetActivity, generate second pair of MainvalueFacets for discharge curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1783
diff
changeset
|
1215 String facetName, |
f6a190f6aaff
Give outputname to artifacts getInitialFacetActivity, generate second pair of MainvalueFacets for discharge curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1783
diff
changeset
|
1216 int index) |
f6a190f6aaff
Give outputname to artifacts getInitialFacetActivity, generate second pair of MainvalueFacets for discharge curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1783
diff
changeset
|
1217 { |
1709
f643ea084213
Allow simple codepaths to have Facets initially being 'inactive' (wrt rendering).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1704
diff
changeset
|
1218 return 1; |
f643ea084213
Allow simple codepaths to have Facets initially being 'inactive' (wrt rendering).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1704
diff
changeset
|
1219 } |
119
84c0b151203e
Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
1220 } |
84c0b151203e
Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
1221 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |