annotate artifacts/src/main/java/org/dive4elements/river/artifacts/D4EArtifact.java @ 8202:e4606eae8ea5

sed src/**/*.java 's/logger/log/g'
author Sascha L. Teichmann <teichmann@intevation.de>
date Fri, 05 Sep 2014 12:58:17 +0200
parents 49daff6c11ca
children abef2584c9a7
rev   line source
5863
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
1 /* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
2 * Software engineering by Intevation GmbH
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
3 *
5994
af13ceeba52a Removed trailing whitespace.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5975
diff changeset
4 * This file is Free Software under the GNU AGPL (>=v3)
5863
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
5 * and comes with ABSOLUTELY NO WARRANTY! Check out the
5994
af13ceeba52a Removed trailing whitespace.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5975
diff changeset
6 * documentation coming with Dive4Elements River for details.
5863
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
7 */
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
8
5831
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4497
diff changeset
9 package org.dive4elements.river.artifacts;
119
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
10
3883
f858028dde5f Manual points (work in progress)
Christian Lins <christian.lins@intevation.de>
parents: 3556
diff changeset
11 import java.util.ArrayList;
f858028dde5f Manual points (work in progress)
Christian Lins <christian.lins@intevation.de>
parents: 3556
diff changeset
12 import java.util.Collection;
f858028dde5f Manual points (work in progress)
Christian Lins <christian.lins@intevation.de>
parents: 3556
diff changeset
13 import java.util.HashMap;
f858028dde5f Manual points (work in progress)
Christian Lins <christian.lins@intevation.de>
parents: 3556
diff changeset
14 import java.util.HashSet;
f858028dde5f Manual points (work in progress)
Christian Lins <christian.lins@intevation.de>
parents: 3556
diff changeset
15 import java.util.LinkedList;
f858028dde5f Manual points (work in progress)
Christian Lins <christian.lins@intevation.de>
parents: 3556
diff changeset
16 import java.util.List;
f858028dde5f Manual points (work in progress)
Christian Lins <christian.lins@intevation.de>
parents: 3556
diff changeset
17 import java.util.Map;
f858028dde5f Manual points (work in progress)
Christian Lins <christian.lins@intevation.de>
parents: 3556
diff changeset
18 import java.util.Set;
f858028dde5f Manual points (work in progress)
Christian Lins <christian.lins@intevation.de>
parents: 3556
diff changeset
19 import java.util.TreeMap;
f858028dde5f Manual points (work in progress)
Christian Lins <christian.lins@intevation.de>
parents: 3556
diff changeset
20
f858028dde5f Manual points (work in progress)
Christian Lins <christian.lins@intevation.de>
parents: 3556
diff changeset
21 import javax.xml.xpath.XPathConstants;
f858028dde5f Manual points (work in progress)
Christian Lins <christian.lins@intevation.de>
parents: 3556
diff changeset
22
f858028dde5f Manual points (work in progress)
Christian Lins <christian.lins@intevation.de>
parents: 3556
diff changeset
23 import net.sf.ehcache.Cache;
f858028dde5f Manual points (work in progress)
Christian Lins <christian.lins@intevation.de>
parents: 3556
diff changeset
24
f858028dde5f Manual points (work in progress)
Christian Lins <christian.lins@intevation.de>
parents: 3556
diff changeset
25 import org.apache.log4j.Logger;
f858028dde5f Manual points (work in progress)
Christian Lins <christian.lins@intevation.de>
parents: 3556
diff changeset
26 import org.w3c.dom.Document;
f858028dde5f Manual points (work in progress)
Christian Lins <christian.lins@intevation.de>
parents: 3556
diff changeset
27 import org.w3c.dom.Element;
f858028dde5f Manual points (work in progress)
Christian Lins <christian.lins@intevation.de>
parents: 3556
diff changeset
28 import org.w3c.dom.Node;
f858028dde5f Manual points (work in progress)
Christian Lins <christian.lins@intevation.de>
parents: 3556
diff changeset
29 import org.w3c.dom.NodeList;
f858028dde5f Manual points (work in progress)
Christian Lins <christian.lins@intevation.de>
parents: 3556
diff changeset
30
5831
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4497
diff changeset
31 import org.dive4elements.artifactdatabase.ArtifactDatabaseImpl;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4497
diff changeset
32 import org.dive4elements.artifactdatabase.DefaultArtifact;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4497
diff changeset
33 import org.dive4elements.artifactdatabase.ProtocolUtils;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4497
diff changeset
34 import org.dive4elements.artifactdatabase.data.DefaultStateData;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4497
diff changeset
35 import org.dive4elements.artifactdatabase.data.StateData;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4497
diff changeset
36 import org.dive4elements.artifactdatabase.state.DefaultFacet;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4497
diff changeset
37 import org.dive4elements.artifactdatabase.state.DefaultOutput;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4497
diff changeset
38 import org.dive4elements.artifactdatabase.state.Facet;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4497
diff changeset
39 import org.dive4elements.artifactdatabase.state.Output;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4497
diff changeset
40 import org.dive4elements.artifactdatabase.state.State;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4497
diff changeset
41 import org.dive4elements.artifactdatabase.state.StateEngine;
7845
4e264d6c6e06 Build static facets in D4EArtifact.
Raimund Renkert <rrenkert@intevation.de>
parents: 7844
diff changeset
42 import org.dive4elements.artifactdatabase.state.StaticFacet;
5831
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4497
diff changeset
43 import org.dive4elements.artifactdatabase.transition.TransitionEngine;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4497
diff changeset
44 import org.dive4elements.artifacts.Artifact;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4497
diff changeset
45 import org.dive4elements.artifacts.ArtifactDatabase;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4497
diff changeset
46 import org.dive4elements.artifacts.ArtifactDatabaseException;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4497
diff changeset
47 import org.dive4elements.artifacts.ArtifactFactory;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4497
diff changeset
48 import org.dive4elements.artifacts.CallContext;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4497
diff changeset
49 import org.dive4elements.artifacts.CallMeta;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4497
diff changeset
50 import org.dive4elements.artifacts.Message;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4497
diff changeset
51 import org.dive4elements.artifacts.common.ArtifactNamespaceContext;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4497
diff changeset
52 import org.dive4elements.artifacts.common.utils.XMLUtils;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4497
diff changeset
53 import org.dive4elements.artifacts.common.utils.XMLUtils.ElementCreator;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4497
diff changeset
54 import org.dive4elements.river.artifacts.cache.CacheFactory;
5866
9a6741ccf6d4 FLYS artifacts: Renamed FLYSContext(Factory) to RiverContext(Factory).
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5865
diff changeset
55 import org.dive4elements.river.artifacts.context.RiverContext;
7227
744df5a03337 Use diagram configuration and there processors to define compatible facets in loaded data.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7178
diff changeset
56 import org.dive4elements.river.artifacts.context.RiverContextFactory;
5831
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4497
diff changeset
57 import org.dive4elements.river.artifacts.model.CalculationMessage;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4497
diff changeset
58 import org.dive4elements.river.artifacts.states.DefaultState;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4497
diff changeset
59 import org.dive4elements.river.artifacts.states.DefaultState.ComputeType;
5865
73da40528cf2 River artifacts: Renamed FLYSUtils to RiverUtils.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5863
diff changeset
60 import org.dive4elements.river.utils.RiverUtils;
119
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 /**
2169
b817e680cf18 Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2141
diff changeset
63 * The default FLYS artifact with convenience added.
b817e680cf18 Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2141
diff changeset
64 * (Subclass to get fully functional artifacts).
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 *
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
66 * @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
67 */
7843
2e45ff3f249b D4EArtifact is no longer abstract.
Raimund Renkert <rrenkert@intevation.de>
parents: 7842
diff changeset
68 public class D4EArtifact extends DefaultArtifact {
119
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
69
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7888
diff changeset
70 /** The log that is used in this artifact. */
5867
59ff03ff48f1 River artifacts: Renamed FLYSArtifact(Collection) to D4EArtifact(Collection).
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5866
diff changeset
71 private static Logger log = Logger.getLogger(D4EArtifact.class);
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
686
3dc61e00385e Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 661
diff changeset
73 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
74
1704
e8627d1e2db6 Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1656
diff changeset
75 /** 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
76 public static final String XPATH_FEED_INPUT =
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
77 "/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
78
1704
e8627d1e2db6 Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1656
diff changeset
79 /** 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
80 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
81 "/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
82
940
f4439e015278 Append artifact recommendations to the artifact's describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 937
diff changeset
83 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
84 "/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
85
1057
d4a5d3941cc0 Build out/facet filter from XML document passed at creation time.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1056
diff changeset
86 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
87 "/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
88
5975
95b9e40bbad0 Add handling for OUT id's parameter to D4EArtifact
Andre Heinecke <aheinecke@intevation.de>
parents: 5867
diff changeset
89 /** Path to 'ids' (data) in doc that comes from datacage. */
95b9e40bbad0 Add handling for OUT id's parameter to D4EArtifact
Andre Heinecke <aheinecke@intevation.de>
parents: 5867
diff changeset
90 public static final String XPATH_IDS = "/art:action/art:ids/@value";
95b9e40bbad0 Add handling for OUT id's parameter to D4EArtifact
Andre Heinecke <aheinecke@intevation.de>
parents: 5867
diff changeset
91
6140
60b94dec104b Add handling of bound artifacts.
Andre Heinecke <aheinecke@intevation.de>
parents: 5994
diff changeset
92 /** Path to 'target_out' (data) in doc that comes from datacage. */
60b94dec104b Add handling of bound artifacts.
Andre Heinecke <aheinecke@intevation.de>
parents: 5994
diff changeset
93 public static final String XPATH_TARGET_OUT = "/art:action/art:target_out/@value";
5975
95b9e40bbad0 Add handling for OUT id's parameter to D4EArtifact
Andre Heinecke <aheinecke@intevation.de>
parents: 5867
diff changeset
94
1704
e8627d1e2db6 Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1656
diff changeset
95 /** 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
96 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
97
1704
e8627d1e2db6 Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1656
diff changeset
98 /** 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
99 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
100
119
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
101 /** 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
102 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
103
1704
e8627d1e2db6 Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1656
diff changeset
104 /** 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
105 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
106
1704
e8627d1e2db6 Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1656
diff changeset
107 /** The data that have been inserted into this artifact. */
3920
8483d190b2e7 Convert FKYSArtifact data member to a private variable
Bjoern Ricks <bjoern.ricks@intevation.de>
parents: 3883
diff changeset
108 private Map<String, StateData> data;
121
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
109
1771
c62ff9e72cea Restore mapping of state id to facets (revert, rev 3083 and 3088).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1765
diff changeset
110 /** Mapping of state names to created facets. */
4497
a2735a4bf75e Change facets member variable to private
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4496
diff changeset
111 private 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
112
1704
e8627d1e2db6 Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1656
diff changeset
113 /**
e8627d1e2db6 Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1656
diff changeset
114 * 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
115 * filter in output of collection); out -&gt; facets.
e8627d1e2db6 Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1656
diff changeset
116 */
1056
bd1b751deab3 Added optional positive filter for outs and facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1055
diff changeset
117 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
118
7676
da412a6c4f39 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7593
diff changeset
119 /** To which out this artifacts facets are bound by default. */
6140
60b94dec104b Add handling of bound artifacts.
Andre Heinecke <aheinecke@intevation.de>
parents: 5994
diff changeset
120 private String boundToOut;
5975
95b9e40bbad0 Add handling for OUT id's parameter to D4EArtifact
Andre Heinecke <aheinecke@intevation.de>
parents: 5867
diff changeset
121
7676
da412a6c4f39 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7593
diff changeset
122
7227
744df5a03337 Use diagram configuration and there processors to define compatible facets in loaded data.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7178
diff changeset
123 /**
744df5a03337 Use diagram configuration and there processors to define compatible facets in loaded data.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7178
diff changeset
124 * Interface to a global facet filter.
744df5a03337 Use diagram configuration and there processors to define compatible facets in loaded data.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7178
diff changeset
125 */
744df5a03337 Use diagram configuration and there processors to define compatible facets in loaded data.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7178
diff changeset
126 public interface FacetFilter {
744df5a03337 Use diagram configuration and there processors to define compatible facets in loaded data.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7178
diff changeset
127 boolean accept(String outName, String facetName);
744df5a03337 Use diagram configuration and there processors to define compatible facets in loaded data.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7178
diff changeset
128 } // interface FacetFilter
744df5a03337 Use diagram configuration and there processors to define compatible facets in loaded data.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7178
diff changeset
129
121
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
130
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
131 /**
5867
59ff03ff48f1 River artifacts: Renamed FLYSArtifact(Collection) to D4EArtifact(Collection).
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5866
diff changeset
132 * The default constructor that creates an empty D4EArtifact.
121
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
133 */
5867
59ff03ff48f1 River artifacts: Renamed FLYSArtifact(Collection) to D4EArtifact(Collection).
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5866
diff changeset
134 public D4EArtifact() {
686
3dc61e00385e Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 661
diff changeset
135 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
136 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
137 facets = new HashMap<String, List<Facet>>();
121
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
138 }
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
139
4147
db0b9cff8496 Cosmetics, documentation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4050
diff changeset
140
3193
2f922be407ea Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2766
diff changeset
141 /**
2f922be407ea Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2766
diff changeset
142 * This method appends the static data - that has already been inserted by
2f922be407ea Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2766
diff changeset
143 * the user - to the static node of the DESCRIBE document.
2f922be407ea Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2766
diff changeset
144 *
2f922be407ea Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2766
diff changeset
145 * @param doc The document.
2f922be407ea Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2766
diff changeset
146 * @param ui The root node.
2f922be407ea Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2766
diff changeset
147 * @param context The CallContext.
2f922be407ea Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2766
diff changeset
148 * @param uuid The identifier of the artifact.
2f922be407ea Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2766
diff changeset
149 */
2f922be407ea Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2766
diff changeset
150 protected void appendStaticUI(
2f922be407ea Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2766
diff changeset
151 Document doc,
2f922be407ea Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2766
diff changeset
152 Node ui,
2f922be407ea Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2766
diff changeset
153 CallContext context,
2f922be407ea Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2766
diff changeset
154 String uuid)
2f922be407ea Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2766
diff changeset
155 {
2f922be407ea Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2766
diff changeset
156 List<String> stateIds = getPreviousStateIds();
2f922be407ea Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2766
diff changeset
157
5866
9a6741ccf6d4 FLYS artifacts: Renamed FLYSContext(Factory) to RiverContext(Factory).
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5865
diff changeset
158 RiverContext flysContext = RiverUtils.getFlysContext(context);
3193
2f922be407ea Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2766
diff changeset
159 StateEngine engine = (StateEngine) flysContext.get(
5866
9a6741ccf6d4 FLYS artifacts: Renamed FLYSContext(Factory) to RiverContext(Factory).
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5865
diff changeset
160 RiverContext.STATE_ENGINE_KEY);
3193
2f922be407ea Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2766
diff changeset
161
3554
9b356ed24411 FLYSArtifact: Lowered logging output level from info to debug. Made some more debug outputs conditional.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3553
diff changeset
162 boolean debug = log.isDebugEnabled();
9b356ed24411 FLYSArtifact: Lowered logging output level from info to debug. Made some more debug outputs conditional.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3553
diff changeset
163
3193
2f922be407ea Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2766
diff changeset
164 for (String stateId: stateIds) {
3554
9b356ed24411 FLYSArtifact: Lowered logging output level from info to debug. Made some more debug outputs conditional.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3553
diff changeset
165 if (debug) {
9b356ed24411 FLYSArtifact: Lowered logging output level from info to debug. Made some more debug outputs conditional.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3553
diff changeset
166 log.debug("Append static data for state: " + stateId);
9b356ed24411 FLYSArtifact: Lowered logging output level from info to debug. Made some more debug outputs conditional.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3553
diff changeset
167 }
3193
2f922be407ea Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2766
diff changeset
168 DefaultState state = (DefaultState) engine.getState(stateId);
2f922be407ea Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2766
diff changeset
169
2f922be407ea Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2766
diff changeset
170 ui.appendChild(state.describeStatic(this, doc, ui, context, uuid));
2f922be407ea Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2766
diff changeset
171 }
2f922be407ea Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2766
diff changeset
172 }
2f922be407ea Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2766
diff changeset
173
121
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
174
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
175 /**
119
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
176 * 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
177 * 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
178 *
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
179 * @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
180 * @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
181 * @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
182 * @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
183 */
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
184 @Override
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
185 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
186 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
187 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
188 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
189 CallMeta callMeta,
7842
8d5ca5175038 Updated signature of artifacts setup method; Removed unnecessary setup overrides.
Raimund Renkert <rrenkert@intevation.de>
parents: 7746
diff changeset
190 Document data,
8d5ca5175038 Updated signature of artifacts setup method; Removed unnecessary setup overrides.
Raimund Renkert <rrenkert@intevation.de>
parents: 7746
diff changeset
191 List<Class> facets)
119
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
192 {
6140
60b94dec104b Add handling of bound artifacts.
Andre Heinecke <aheinecke@intevation.de>
parents: 5994
diff changeset
193 log.debug("Setup this artifact with the uuid: " + identifier);
119
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
194
7842
8d5ca5175038 Updated signature of artifacts setup method; Removed unnecessary setup overrides.
Raimund Renkert <rrenkert@intevation.de>
parents: 7746
diff changeset
195 super.setup(identifier, factory, context, callMeta, data, facets);
119
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
196
5866
9a6741ccf6d4 FLYS artifacts: Renamed FLYSContext(Factory) to RiverContext(Factory).
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5865
diff changeset
197 RiverContext flysContext = RiverUtils.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
198
f364410c7bc9 Refactored (state access) to ease future development of more trivial artifacts.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1059
diff changeset
199 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
200
121
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
201 String name = getName();
3554
9b356ed24411 FLYSArtifact: Lowered logging output level from info to debug. Made some more debug outputs conditional.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3553
diff changeset
202
6140
60b94dec104b Add handling of bound artifacts.
Andre Heinecke <aheinecke@intevation.de>
parents: 5994
diff changeset
203 log.debug("setup(): 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
204
2169
b817e680cf18 Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2141
diff changeset
205 if (states == null) {
3554
9b356ed24411 FLYSArtifact: Lowered logging output level from info to debug. Made some more debug outputs conditional.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3553
diff changeset
206 log.error("No states found from which an initial "
2766
7dc4681a2bed Allow easy change of sticky axis for annotations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2701
diff changeset
207 + "state could be picked.");
2169
b817e680cf18 Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2141
diff changeset
208 }
119
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
209 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
210
7746
56001dce01dd Upcoming issue1532: Extracted method where 'cloning/initialize' takes place.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7676
diff changeset
211 handleInitModel(data, context, callMeta);
56001dce01dd Upcoming issue1532: Extracted method where 'cloning/initialize' takes place.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7676
diff changeset
212
7888
49daff6c11ca Use the new way of building static facets if such facets exist else ignore this way.
Raimund Renkert <rrenkert@intevation.de>
parents: 7845
diff changeset
213 if (!facets.isEmpty()) {
49daff6c11ca Use the new way of building static facets if such facets exist else ignore this way.
Raimund Renkert <rrenkert@intevation.de>
parents: 7845
diff changeset
214 buildStaticFacets(data, facets, callMeta);
49daff6c11ca Use the new way of building static facets if such facets exist else ignore this way.
Raimund Renkert <rrenkert@intevation.de>
parents: 7845
diff changeset
215 }
7845
4e264d6c6e06 Build static facets in D4EArtifact.
Raimund Renkert <rrenkert@intevation.de>
parents: 7844
diff changeset
216
7746
56001dce01dd Upcoming issue1532: Extracted method where 'cloning/initialize' takes place.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7676
diff changeset
217 filterFacets = buildFilterFacets(data);
56001dce01dd Upcoming issue1532: Extracted method where 'cloning/initialize' takes place.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7676
diff changeset
218
56001dce01dd Upcoming issue1532: Extracted method where 'cloning/initialize' takes place.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7676
diff changeset
219 extractOut(data);
56001dce01dd Upcoming issue1532: Extracted method where 'cloning/initialize' takes place.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7676
diff changeset
220 }
56001dce01dd Upcoming issue1532: Extracted method where 'cloning/initialize' takes place.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7676
diff changeset
221
7845
4e264d6c6e06 Build static facets in D4EArtifact.
Raimund Renkert <rrenkert@intevation.de>
parents: 7844
diff changeset
222 protected void buildStaticFacets(
4e264d6c6e06 Build static facets in D4EArtifact.
Raimund Renkert <rrenkert@intevation.de>
parents: 7844
diff changeset
223 Document data,
4e264d6c6e06 Build static facets in D4EArtifact.
Raimund Renkert <rrenkert@intevation.de>
parents: 7844
diff changeset
224 List<Class> facets,
4e264d6c6e06 Build static facets in D4EArtifact.
Raimund Renkert <rrenkert@intevation.de>
parents: 7844
diff changeset
225 CallMeta callMeta)
4e264d6c6e06 Build static facets in D4EArtifact.
Raimund Renkert <rrenkert@intevation.de>
parents: 7844
diff changeset
226 {
4e264d6c6e06 Build static facets in D4EArtifact.
Raimund Renkert <rrenkert@intevation.de>
parents: 7844
diff changeset
227 List<Facet> staticFacets = new ArrayList<Facet>();
4e264d6c6e06 Build static facets in D4EArtifact.
Raimund Renkert <rrenkert@intevation.de>
parents: 7844
diff changeset
228 String currentState = getCurrentStateId();
4e264d6c6e06 Build static facets in D4EArtifact.
Raimund Renkert <rrenkert@intevation.de>
parents: 7844
diff changeset
229 for (int i = 0; i < facets.size(); i++) {
4e264d6c6e06 Build static facets in D4EArtifact.
Raimund Renkert <rrenkert@intevation.de>
parents: 7844
diff changeset
230 try {
4e264d6c6e06 Build static facets in D4EArtifact.
Raimund Renkert <rrenkert@intevation.de>
parents: 7844
diff changeset
231 StaticFacet facet = (StaticFacet)facets.get(i).newInstance();
4e264d6c6e06 Build static facets in D4EArtifact.
Raimund Renkert <rrenkert@intevation.de>
parents: 7844
diff changeset
232 facet.setup(this, data, callMeta);
4e264d6c6e06 Build static facets in D4EArtifact.
Raimund Renkert <rrenkert@intevation.de>
parents: 7844
diff changeset
233 staticFacets.add(facet);
4e264d6c6e06 Build static facets in D4EArtifact.
Raimund Renkert <rrenkert@intevation.de>
parents: 7844
diff changeset
234 }
4e264d6c6e06 Build static facets in D4EArtifact.
Raimund Renkert <rrenkert@intevation.de>
parents: 7844
diff changeset
235 catch (InstantiationException ie) {
4e264d6c6e06 Build static facets in D4EArtifact.
Raimund Renkert <rrenkert@intevation.de>
parents: 7844
diff changeset
236 log.error(ie.getLocalizedMessage(), ie);
4e264d6c6e06 Build static facets in D4EArtifact.
Raimund Renkert <rrenkert@intevation.de>
parents: 7844
diff changeset
237 }
4e264d6c6e06 Build static facets in D4EArtifact.
Raimund Renkert <rrenkert@intevation.de>
parents: 7844
diff changeset
238 catch (IllegalAccessException iae) {
4e264d6c6e06 Build static facets in D4EArtifact.
Raimund Renkert <rrenkert@intevation.de>
parents: 7844
diff changeset
239 log.error(iae.getLocalizedMessage(), iae);
4e264d6c6e06 Build static facets in D4EArtifact.
Raimund Renkert <rrenkert@intevation.de>
parents: 7844
diff changeset
240 }
4e264d6c6e06 Build static facets in D4EArtifact.
Raimund Renkert <rrenkert@intevation.de>
parents: 7844
diff changeset
241 }
4e264d6c6e06 Build static facets in D4EArtifact.
Raimund Renkert <rrenkert@intevation.de>
parents: 7844
diff changeset
242 this.facets.put(currentState, staticFacets);
4e264d6c6e06 Build static facets in D4EArtifact.
Raimund Renkert <rrenkert@intevation.de>
parents: 7844
diff changeset
243 }
4e264d6c6e06 Build static facets in D4EArtifact.
Raimund Renkert <rrenkert@intevation.de>
parents: 7844
diff changeset
244
7746
56001dce01dd Upcoming issue1532: Extracted method where 'cloning/initialize' takes place.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7676
diff changeset
245 protected void handleInitModel(Document data, Object context, CallMeta callMeta) {
56001dce01dd Upcoming issue1532: Extracted method where 'cloning/initialize' takes place.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7676
diff changeset
246 RiverContext flysContext = RiverUtils.getFlysContext(context);
56001dce01dd Upcoming issue1532: Extracted method where 'cloning/initialize' takes place.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7676
diff changeset
247
940
f4439e015278 Append artifact recommendations to the artifact's describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 937
diff changeset
248 String model = XMLUtils.xpathString(
f4439e015278 Append artifact recommendations to the artifact's describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 937
diff changeset
249 data,
f4439e015278 Append artifact recommendations to the artifact's describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 937
diff changeset
250 XPATH_MODEL_ARTIFACT,
f4439e015278 Append artifact recommendations to the artifact's describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 937
diff changeset
251 ArtifactNamespaceContext.INSTANCE);
f4439e015278 Append artifact recommendations to the artifact's describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 937
diff changeset
252
f4439e015278 Append artifact recommendations to the artifact's describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 937
diff changeset
253 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
254 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
255 ArtifactDatabaseImpl.GLOBAL_CONTEXT_KEY);
f4439e015278 Append artifact recommendations to the artifact's describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 937
diff changeset
256
f4439e015278 Append artifact recommendations to the artifact's describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 937
diff changeset
257 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
258 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
259 }
f4439e015278 Append artifact recommendations to the artifact's describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 937
diff changeset
260 catch (ArtifactDatabaseException adbe) {
3554
9b356ed24411 FLYSArtifact: Lowered logging output level from info to debug. Made some more debug outputs conditional.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3553
diff changeset
261 log.error(adbe, adbe);
940
f4439e015278 Append artifact recommendations to the artifact's describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 937
diff changeset
262 }
f4439e015278 Append artifact recommendations to the artifact's describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 937
diff changeset
263 }
f4439e015278 Append artifact recommendations to the artifact's describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 937
diff changeset
264 }
f4439e015278 Append artifact recommendations to the artifact's describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 937
diff changeset
265
5975
95b9e40bbad0 Add handling for OUT id's parameter to D4EArtifact
Andre Heinecke <aheinecke@intevation.de>
parents: 5867
diff changeset
266 protected void extractOut(Document data) {
6140
60b94dec104b Add handling of bound artifacts.
Andre Heinecke <aheinecke@intevation.de>
parents: 5994
diff changeset
267 String targetOut = XMLUtils.xpathString(data, XPATH_TARGET_OUT,
5975
95b9e40bbad0 Add handling for OUT id's parameter to D4EArtifact
Andre Heinecke <aheinecke@intevation.de>
parents: 5867
diff changeset
268 ArtifactNamespaceContext.INSTANCE);
6140
60b94dec104b Add handling of bound artifacts.
Andre Heinecke <aheinecke@intevation.de>
parents: 5994
diff changeset
269 if (targetOut.isEmpty()) {
60b94dec104b Add handling of bound artifacts.
Andre Heinecke <aheinecke@intevation.de>
parents: 5994
diff changeset
270 targetOut = null;
60b94dec104b Add handling of bound artifacts.
Andre Heinecke <aheinecke@intevation.de>
parents: 5994
diff changeset
271 }
5975
95b9e40bbad0 Add handling for OUT id's parameter to D4EArtifact
Andre Heinecke <aheinecke@intevation.de>
parents: 5867
diff changeset
272
6140
60b94dec104b Add handling of bound artifacts.
Andre Heinecke <aheinecke@intevation.de>
parents: 5994
diff changeset
273 setBoundToOut(targetOut);
5975
95b9e40bbad0 Add handling for OUT id's parameter to D4EArtifact
Andre Heinecke <aheinecke@intevation.de>
parents: 5867
diff changeset
274 }
95b9e40bbad0 Add handling for OUT id's parameter to D4EArtifact
Andre Heinecke <aheinecke@intevation.de>
parents: 5867
diff changeset
275
95b9e40bbad0 Add handling for OUT id's parameter to D4EArtifact
Andre Heinecke <aheinecke@intevation.de>
parents: 5867
diff changeset
276 /**
95b9e40bbad0 Add handling for OUT id's parameter to D4EArtifact
Andre Heinecke <aheinecke@intevation.de>
parents: 5867
diff changeset
277 * Return the value of id element in Datacage data document.
95b9e40bbad0 Add handling for OUT id's parameter to D4EArtifact
Andre Heinecke <aheinecke@intevation.de>
parents: 5867
diff changeset
278 * @param data Document as passed by datacage.
95b9e40bbad0 Add handling for OUT id's parameter to D4EArtifact
Andre Heinecke <aheinecke@intevation.de>
parents: 5867
diff changeset
279 * @return the id element value of data document.
95b9e40bbad0 Add handling for OUT id's parameter to D4EArtifact
Andre Heinecke <aheinecke@intevation.de>
parents: 5867
diff changeset
280 */
95b9e40bbad0 Add handling for OUT id's parameter to D4EArtifact
Andre Heinecke <aheinecke@intevation.de>
parents: 5867
diff changeset
281 public static String getDatacageIDValue(Document data) {
95b9e40bbad0 Add handling for OUT id's parameter to D4EArtifact
Andre Heinecke <aheinecke@intevation.de>
parents: 5867
diff changeset
282 String ids = XMLUtils.xpathString(data, XPATH_IDS,
95b9e40bbad0 Add handling for OUT id's parameter to D4EArtifact
Andre Heinecke <aheinecke@intevation.de>
parents: 5867
diff changeset
283 ArtifactNamespaceContext.INSTANCE);
95b9e40bbad0 Add handling for OUT id's parameter to D4EArtifact
Andre Heinecke <aheinecke@intevation.de>
parents: 5867
diff changeset
284
95b9e40bbad0 Add handling for OUT id's parameter to D4EArtifact
Andre Heinecke <aheinecke@intevation.de>
parents: 5867
diff changeset
285 return ids;
95b9e40bbad0 Add handling for OUT id's parameter to D4EArtifact
Andre Heinecke <aheinecke@intevation.de>
parents: 5867
diff changeset
286 }
95b9e40bbad0 Add handling for OUT id's parameter to D4EArtifact
Andre Heinecke <aheinecke@intevation.de>
parents: 5867
diff changeset
287
95b9e40bbad0 Add handling for OUT id's parameter to D4EArtifact
Andre Heinecke <aheinecke@intevation.de>
parents: 5867
diff changeset
288
1763
0e748e8972b5 Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1724
diff changeset
289
2141
79a94c4171cb Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2128
diff changeset
290 /** Get copy of previous state ids as Strings in list. */
1059
fdb0f4ef96f0 Made FLYS artifacts cloneable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1057
diff changeset
291 protected List<String> clonePreviousStateIds() {
fdb0f4ef96f0 Made FLYS artifacts cloneable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1057
diff changeset
292 return new ArrayList<String>(previousStateIds);
fdb0f4ef96f0 Made FLYS artifacts cloneable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1057
diff changeset
293 }
fdb0f4ef96f0 Made FLYS artifacts cloneable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1057
diff changeset
294
2141
79a94c4171cb Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2128
diff changeset
295
1895
1be3a4636ee3 New convenience function to copy data from one artifact to another.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1809
diff changeset
296 /**
1be3a4636ee3 New convenience function to copy data from one artifact to another.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1809
diff changeset
297 * Copies data item from other artifact to this artifact.
2111
85d31c2620e5 Avoid an unlikely NPE.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2095
diff changeset
298 *
1895
1be3a4636ee3 New convenience function to copy data from one artifact to another.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1809
diff changeset
299 * @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
300 * @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
301 */
5867
59ff03ff48f1 River artifacts: Renamed FLYSArtifact(Collection) to D4EArtifact(Collection).
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5866
diff changeset
302 protected void importData(D4EArtifact other, final String name) {
1895
1be3a4636ee3 New convenience function to copy data from one artifact to another.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1809
diff changeset
303 if (other == null) {
3554
9b356ed24411 FLYSArtifact: Lowered logging output level from info to debug. Made some more debug outputs conditional.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3553
diff changeset
304 log.error("No other art. to import data " + name + " from.");
2111
85d31c2620e5 Avoid an unlikely NPE.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2095
diff changeset
305 return;
1895
1be3a4636ee3 New convenience function to copy data from one artifact to another.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1809
diff changeset
306 }
1be3a4636ee3 New convenience function to copy data from one artifact to another.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1809
diff changeset
307
1be3a4636ee3 New convenience function to copy data from one artifact to another.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1809
diff changeset
308 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
309
1be3a4636ee3 New convenience function to copy data from one artifact to another.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1809
diff changeset
310 if (sd == null) {
3554
9b356ed24411 FLYSArtifact: Lowered logging output level from info to debug. Made some more debug outputs conditional.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3553
diff changeset
311 log.warn("Other artifact has no data " + name + ".");
1895
1be3a4636ee3 New convenience function to copy data from one artifact to another.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1809
diff changeset
312 return;
1be3a4636ee3 New convenience function to copy data from one artifact to another.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1809
diff changeset
313 }
1be3a4636ee3 New convenience function to copy data from one artifact to another.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1809
diff changeset
314
1be3a4636ee3 New convenience function to copy data from one artifact to another.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1809
diff changeset
315 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
316 }
1763
0e748e8972b5 Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1724
diff changeset
317
2169
b817e680cf18 Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2141
diff changeset
318
4206
6b0683f5c530 Documentation added, cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4147
diff changeset
319 /** Clone the internal map of map of state-name to state-data. */
1059
fdb0f4ef96f0 Made FLYS artifacts cloneable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1057
diff changeset
320 protected Map<String, StateData> cloneData() {
fdb0f4ef96f0 Made FLYS artifacts cloneable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1057
diff changeset
321 Map<String, StateData> copy = new TreeMap<String, StateData>();
fdb0f4ef96f0 Made FLYS artifacts cloneable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1057
diff changeset
322
fdb0f4ef96f0 Made FLYS artifacts cloneable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1057
diff changeset
323 for (Map.Entry<String, StateData> entry: data.entrySet()) {
fdb0f4ef96f0 Made FLYS artifacts cloneable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1057
diff changeset
324 copy.put(entry.getKey(), entry.getValue().deepCopy());
fdb0f4ef96f0 Made FLYS artifacts cloneable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1057
diff changeset
325 }
fdb0f4ef96f0 Made FLYS artifacts cloneable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1057
diff changeset
326
fdb0f4ef96f0 Made FLYS artifacts cloneable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1057
diff changeset
327 return copy;
fdb0f4ef96f0 Made FLYS artifacts cloneable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1057
diff changeset
328 }
fdb0f4ef96f0 Made FLYS artifacts cloneable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1057
diff changeset
329
4147
db0b9cff8496 Cosmetics, documentation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4050
diff changeset
330
1763
0e748e8972b5 Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1724
diff changeset
331 /**
0e748e8972b5 Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1724
diff changeset
332 * 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
333 * @return Mapping of state-ids to facets.
1763
0e748e8972b5 Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1724
diff changeset
334 */
1771
c62ff9e72cea Restore mapping of state id to facets (revert, rev 3083 and 3088).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1765
diff changeset
335 protected Map<String, List<Facet>> cloneFacets() {
3306
1b41dc00b1f7 Create shapefile directory instead of shapefile 'file'
Christian Lins <christian.lins@intevation.de>
parents: 3203
diff changeset
336 Map<String, List<Facet>> copy = new HashMap<String, List<Facet>>();
1059
fdb0f4ef96f0 Made FLYS artifacts cloneable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1057
diff changeset
337
1771
c62ff9e72cea Restore mapping of state id to facets (revert, rev 3083 and 3088).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1765
diff changeset
338 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
339 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
340 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
341 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
342 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
343 }
c62ff9e72cea Restore mapping of state id to facets (revert, rev 3083 and 3088).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1765
diff changeset
344 copy.put(entry.getKey(), facetCopies);
1059
fdb0f4ef96f0 Made FLYS artifacts cloneable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1057
diff changeset
345 }
fdb0f4ef96f0 Made FLYS artifacts cloneable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1057
diff changeset
346
fdb0f4ef96f0 Made FLYS artifacts cloneable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1057
diff changeset
347 return copy;
fdb0f4ef96f0 Made FLYS artifacts cloneable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1057
diff changeset
348 }
940
f4439e015278 Append artifact recommendations to the artifact's describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 937
diff changeset
349
1763
0e748e8972b5 Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1724
diff changeset
350
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
351 /**
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
352 * (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
353 * @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
354 */
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
355 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
356 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
357 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
358 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
359 {
5867
59ff03ff48f1 River artifacts: Renamed FLYSArtifact(Collection) to D4EArtifact(Collection).
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5866
diff changeset
360 if (!(artifact instanceof D4EArtifact)) {
1059
fdb0f4ef96f0 Made FLYS artifacts cloneable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1057
diff changeset
361 return;
fdb0f4ef96f0 Made FLYS artifacts cloneable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1057
diff changeset
362 }
fdb0f4ef96f0 Made FLYS artifacts cloneable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1057
diff changeset
363
5867
59ff03ff48f1 River artifacts: Renamed FLYSArtifact(Collection) to D4EArtifact(Collection).
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5866
diff changeset
364 D4EArtifact flys = (D4EArtifact)artifact;
1059
fdb0f4ef96f0 Made FLYS artifacts cloneable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1057
diff changeset
365
fdb0f4ef96f0 Made FLYS artifacts cloneable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1057
diff changeset
366 currentStateId = flys.currentStateId;
fdb0f4ef96f0 Made FLYS artifacts cloneable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1057
diff changeset
367 previousStateIds = flys.clonePreviousStateIds();
fdb0f4ef96f0 Made FLYS artifacts cloneable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1057
diff changeset
368 name = flys.name;
fdb0f4ef96f0 Made FLYS artifacts cloneable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1057
diff changeset
369 data = flys.cloneData();
fdb0f4ef96f0 Made FLYS artifacts cloneable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1057
diff changeset
370 facets = flys.cloneFacets();
fdb0f4ef96f0 Made FLYS artifacts cloneable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1057
diff changeset
371 // 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
372
2606
619f6dfec901 #460 Fixed duplicated Outputs in DESCRIBE documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2205
diff changeset
373 ArrayList<String> stateIds = (ArrayList<String>) getPreviousStateIds();
619f6dfec901 #460 Fixed duplicated Outputs in DESCRIBE documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2205
diff changeset
374 ArrayList<String> toInitialize = (ArrayList<String>) stateIds.clone();
2093
ebc2aa64c1be Call State.initialize() for each State of an Artifact in FLYSArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2038
diff changeset
375
2606
619f6dfec901 #460 Fixed duplicated Outputs in DESCRIBE documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2205
diff changeset
376 toInitialize.add(getCurrentStateId());
619f6dfec901 #460 Fixed duplicated Outputs in DESCRIBE documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2205
diff changeset
377
619f6dfec901 #460 Fixed duplicated Outputs in DESCRIBE documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2205
diff changeset
378 for (String stateId: toInitialize) {
2093
ebc2aa64c1be Call State.initialize() for each State of an Artifact in FLYSArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2038
diff changeset
379 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
380
ebc2aa64c1be Call State.initialize() for each State of an Artifact in FLYSArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2038
diff changeset
381 if (state != null) {
2095
8cb679d4ec49 Implemented initialize() in FloodMapState to enable cloning floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2093
diff changeset
382 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
383 }
ebc2aa64c1be Call State.initialize() for each State of an Artifact in FLYSArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2038
diff changeset
384 }
119
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
385 }
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
386
1704
e8627d1e2db6 Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1656
diff changeset
387
e8627d1e2db6 Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1656
diff changeset
388 /**
e8627d1e2db6 Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1656
diff changeset
389 * Builds filter facets from document.
e8627d1e2db6 Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1656
diff changeset
390 * @see filterFacets
e8627d1e2db6 Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1656
diff changeset
391 */
1057
d4a5d3941cc0 Build out/facet filter from XML document passed at creation time.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1056
diff changeset
392 protected Map<String, List<Facet>> buildFilterFacets(Document document) {
4403
d4f88fda6ed3 Improve debugging inf FLYSArtifact
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4206
diff changeset
393 if (log.isDebugEnabled()) {
d4f88fda6ed3 Improve debugging inf FLYSArtifact
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4206
diff changeset
394 log.debug("Building filter factes for artifact " + this.getName());
d4f88fda6ed3 Improve debugging inf FLYSArtifact
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4206
diff changeset
395 }
1057
d4a5d3941cc0 Build out/facet filter from XML document passed at creation time.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1056
diff changeset
396
d4a5d3941cc0 Build out/facet filter from XML document passed at creation time.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1056
diff changeset
397 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
398 document,
d4a5d3941cc0 Build out/facet filter from XML document passed at creation time.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1056
diff changeset
399 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
400 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
401 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
402
d4a5d3941cc0 Build out/facet filter from XML document passed at creation time.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1056
diff changeset
403 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
404 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
405 }
d4a5d3941cc0 Build out/facet filter from XML document passed at creation time.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1056
diff changeset
406
d4a5d3941cc0 Build out/facet filter from XML document passed at creation time.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1056
diff changeset
407 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
408
d4a5d3941cc0 Build out/facet filter from XML document passed at creation time.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1056
diff changeset
409 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
410 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
411 String oName = element.getAttribute("name");
4403
d4f88fda6ed3 Improve debugging inf FLYSArtifact
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4206
diff changeset
412 if (oName == null || oName.isEmpty()) {
1057
d4a5d3941cc0 Build out/facet filter from XML document passed at creation time.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1056
diff changeset
413 continue;
d4a5d3941cc0 Build out/facet filter from XML document passed at creation time.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1056
diff changeset
414 }
d4a5d3941cc0 Build out/facet filter from XML document passed at creation time.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1056
diff changeset
415
d4a5d3941cc0 Build out/facet filter from XML document passed at creation time.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1056
diff changeset
416 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
417
d4a5d3941cc0 Build out/facet filter from XML document passed at creation time.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1056
diff changeset
418 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
419 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
420 "facet");
d4a5d3941cc0 Build out/facet filter from XML document passed at creation time.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1056
diff changeset
421
d4a5d3941cc0 Build out/facet filter from XML document passed at creation time.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1056
diff changeset
422 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
423 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
424
d4a5d3941cc0 Build out/facet filter from XML document passed at creation time.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1056
diff changeset
425 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
426
d4a5d3941cc0 Build out/facet filter from XML document passed at creation time.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1056
diff changeset
427 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
428 try {
d4a5d3941cc0 Build out/facet filter from XML document passed at creation time.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1056
diff changeset
429 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
430 }
d4a5d3941cc0 Build out/facet filter from XML document passed at creation time.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1056
diff changeset
431 catch (NumberFormatException nfe) {
3554
9b356ed24411 FLYSArtifact: Lowered logging output level from info to debug. Made some more debug outputs conditional.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3553
diff changeset
432 log.warn(nfe);
1057
d4a5d3941cc0 Build out/facet filter from XML document passed at creation time.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1056
diff changeset
433 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
434 }
4403
d4f88fda6ed3 Improve debugging inf FLYSArtifact
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4206
diff changeset
435 if (log.isDebugEnabled()) {
d4f88fda6ed3 Improve debugging inf FLYSArtifact
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4206
diff changeset
436 log.debug("Creating filter facet " + fName + " with index " + index +
d4f88fda6ed3 Improve debugging inf FLYSArtifact
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4206
diff changeset
437 " for out " + oName);
d4f88fda6ed3 Improve debugging inf FLYSArtifact
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4206
diff changeset
438 }
1057
d4a5d3941cc0 Build out/facet filter from XML document passed at creation time.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1056
diff changeset
439 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
440 }
d4a5d3941cc0 Build out/facet filter from XML document passed at creation time.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1056
diff changeset
441
d4a5d3941cc0 Build out/facet filter from XML document passed at creation time.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1056
diff changeset
442 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
443 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
444 }
d4a5d3941cc0 Build out/facet filter from XML document passed at creation time.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1056
diff changeset
445 }
d4a5d3941cc0 Build out/facet filter from XML document passed at creation time.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1056
diff changeset
446
d4a5d3941cc0 Build out/facet filter from XML document passed at creation time.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1056
diff changeset
447 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
448 }
d4a5d3941cc0 Build out/facet filter from XML document passed at creation time.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1056
diff changeset
449
119
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
450
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 * 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
453 *
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
454 * @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
455 * @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
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 * @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
458 */
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
459 @Override
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
460 public Document feed(Document target, CallContext context) {
5867
59ff03ff48f1 River artifacts: Renamed FLYSArtifact(Collection) to D4EArtifact(Collection).
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5866
diff changeset
461 log.debug("D4EArtifact.feed()");
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
462
121
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
463 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
464
121
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
465 XMLUtils.ElementCreator creator = new XMLUtils.ElementCreator(
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
466 doc,
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
467 ArtifactNamespaceContext.NAMESPACE_URI,
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
468 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
469
121
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
470 Element result = creator.create("result");
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
471 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
472
121
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
473 try {
3553
5da58c5c1517 FLYSArtifact: Some code simplifications.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3436
diff changeset
474 saveData(target, 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
475
705
853dceead0f4 Only generate facets when needed.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 704
diff changeset
476 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
477
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
478 return describe(target, context);
121
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
479 }
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
480 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
481 // 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
482 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
483 creator.addAttr(result, "type", OPERATION_FAILED, true);
121
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
484
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
485 result.setTextContent(iae.getMessage());
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
486 }
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
487
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
488 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
489 }
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
490
4147
db0b9cff8496 Cosmetics, documentation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4050
diff changeset
491
3193
2f922be407ea Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2766
diff changeset
492 /**
2f922be407ea Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2766
diff changeset
493 * This method returns a description of this artifact.
2f922be407ea Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2766
diff changeset
494 *
2f922be407ea Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2766
diff changeset
495 * @param data Some data.
2f922be407ea Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2766
diff changeset
496 * @param context The CallContext.
2f922be407ea Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2766
diff changeset
497 *
2f922be407ea Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2766
diff changeset
498 * @return the description of this artifact.
2f922be407ea Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2766
diff changeset
499 */
3306
1b41dc00b1f7 Create shapefile directory instead of shapefile 'file'
Christian Lins <christian.lins@intevation.de>
parents: 3203
diff changeset
500 @Override
3193
2f922be407ea Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2766
diff changeset
501 public Document describe(Document data, CallContext context) {
2f922be407ea Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2766
diff changeset
502
3554
9b356ed24411 FLYSArtifact: Lowered logging output level from info to debug. Made some more debug outputs conditional.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3553
diff changeset
503 if (log.isDebugEnabled()) {
9b356ed24411 FLYSArtifact: Lowered logging output level from info to debug. Made some more debug outputs conditional.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3553
diff changeset
504 log.debug(
9b356ed24411 FLYSArtifact: Lowered logging output level from info to debug. Made some more debug outputs conditional.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3553
diff changeset
505 "Describe: the current state is: " + getCurrentStateId());
3193
2f922be407ea Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2766
diff changeset
506 dumpArtifact();
2f922be407ea Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2766
diff changeset
507 }
2f922be407ea Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2766
diff changeset
508
5866
9a6741ccf6d4 FLYS artifacts: Renamed FLYSContext(Factory) to RiverContext(Factory).
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5865
diff changeset
509 RiverContext flysContext = RiverUtils.getFlysContext(context);
3193
2f922be407ea Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2766
diff changeset
510
2f922be407ea Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2766
diff changeset
511 StateEngine stateEngine = (StateEngine) flysContext.get(
5866
9a6741ccf6d4 FLYS artifacts: Renamed FLYSContext(Factory) to RiverContext(Factory).
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5865
diff changeset
512 RiverContext.STATE_ENGINE_KEY);
3193
2f922be407ea Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2766
diff changeset
513
2f922be407ea Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2766
diff changeset
514 TransitionEngine transitionEngine = (TransitionEngine) flysContext.get(
5866
9a6741ccf6d4 FLYS artifacts: Renamed FLYSContext(Factory) to RiverContext(Factory).
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5865
diff changeset
515 RiverContext.TRANSITION_ENGINE_KEY);
3193
2f922be407ea Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2766
diff changeset
516
2f922be407ea Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2766
diff changeset
517 List<State> reachable = transitionEngine.getReachableStates(
2f922be407ea Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2766
diff changeset
518 this, getCurrentState(context), stateEngine);
2f922be407ea Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2766
diff changeset
519
2f922be407ea Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2766
diff changeset
520 Document description = XMLUtils.newDocument();
2f922be407ea Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2766
diff changeset
521 XMLUtils.ElementCreator creator = new XMLUtils.ElementCreator(
2f922be407ea Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2766
diff changeset
522 description,
2f922be407ea Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2766
diff changeset
523 ArtifactNamespaceContext.NAMESPACE_URI,
2f922be407ea Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2766
diff changeset
524 ArtifactNamespaceContext.NAMESPACE_PREFIX);
2f922be407ea Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2766
diff changeset
525
2f922be407ea Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2766
diff changeset
526 Element root = ProtocolUtils.createRootNode(creator);
2f922be407ea Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2766
diff changeset
527 description.appendChild(root);
2f922be407ea Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2766
diff changeset
528
2f922be407ea Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2766
diff changeset
529 State current = getCurrentState(context);
2f922be407ea Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2766
diff changeset
530
2f922be407ea Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2766
diff changeset
531 ProtocolUtils.appendDescribeHeader(creator, root, identifier(), hash());
2f922be407ea Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2766
diff changeset
532 ProtocolUtils.appendState(creator, root, current);
2f922be407ea Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2766
diff changeset
533 ProtocolUtils.appendReachableStates(creator, root, reachable);
2f922be407ea Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2766
diff changeset
534
2f922be407ea Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2766
diff changeset
535 appendBackgroundActivity(creator, root, context);
2f922be407ea Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2766
diff changeset
536
2f922be407ea Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2766
diff changeset
537 Element ui = ProtocolUtils.createArtNode(
2f922be407ea Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2766
diff changeset
538 creator, "ui", null, null);
2f922be407ea Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2766
diff changeset
539
2f922be407ea Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2766
diff changeset
540 Element staticUI = ProtocolUtils.createArtNode(
2f922be407ea Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2766
diff changeset
541 creator, "static", null, null);
2f922be407ea Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2766
diff changeset
542
2f922be407ea Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2766
diff changeset
543 Element outs = ProtocolUtils.createArtNode(
2f922be407ea Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2766
diff changeset
544 creator, "outputmodes", null, null);
2f922be407ea Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2766
diff changeset
545 appendOutputModes(description, outs, context, identifier());
2f922be407ea Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2766
diff changeset
546
2f922be407ea Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2766
diff changeset
547 appendStaticUI(description, staticUI, context, identifier());
2f922be407ea Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2766
diff changeset
548
2f922be407ea Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2766
diff changeset
549 Element name = ProtocolUtils.createArtNode(
2f922be407ea Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2766
diff changeset
550 creator, "name",
2f922be407ea Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2766
diff changeset
551 new String[] { "value" },
2f922be407ea Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2766
diff changeset
552 new String[] { getName() });
2f922be407ea Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2766
diff changeset
553
2f922be407ea Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2766
diff changeset
554 Element dynamic = current.describe(
2f922be407ea Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2766
diff changeset
555 this,
2f922be407ea Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2766
diff changeset
556 description,
2f922be407ea Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2766
diff changeset
557 root,
2f922be407ea Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2766
diff changeset
558 context,
2f922be407ea Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2766
diff changeset
559 identifier());
2f922be407ea Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2766
diff changeset
560
2f922be407ea Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2766
diff changeset
561 if (dynamic != null) {
2f922be407ea Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2766
diff changeset
562 ui.appendChild(dynamic);
2f922be407ea Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2766
diff changeset
563 }
2f922be407ea Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2766
diff changeset
564
2f922be407ea Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2766
diff changeset
565 ui.appendChild(staticUI);
2f922be407ea Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2766
diff changeset
566
2f922be407ea Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2766
diff changeset
567 root.appendChild(name);
2f922be407ea Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2766
diff changeset
568 root.appendChild(ui);
2f922be407ea Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2766
diff changeset
569 root.appendChild(outs);
2f922be407ea Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2766
diff changeset
570
2f922be407ea Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2766
diff changeset
571 return description;
2f922be407ea Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2766
diff changeset
572 }
2f922be407ea Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2766
diff changeset
573
2f922be407ea Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2766
diff changeset
574 /** Override me! */
2f922be407ea Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2766
diff changeset
575
2f922be407ea Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2766
diff changeset
576 protected void appendBackgroundActivity(
2f922be407ea Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2766
diff changeset
577 ElementCreator cr,
2f922be407ea Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2766
diff changeset
578 Element root,
2f922be407ea Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2766
diff changeset
579 CallContext context
2f922be407ea Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2766
diff changeset
580 ) {
2f922be407ea Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2766
diff changeset
581 LinkedList<Message> messages = context.getBackgroundMessages();
2f922be407ea Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2766
diff changeset
582
2f922be407ea Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2766
diff changeset
583 if (messages == null) {
2f922be407ea Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2766
diff changeset
584 return;
2f922be407ea Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2766
diff changeset
585 }
2f922be407ea Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2766
diff changeset
586
2f922be407ea Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2766
diff changeset
587 Element inBackground = cr.create("background-processing");
2f922be407ea Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2766
diff changeset
588 root.appendChild(inBackground);
2f922be407ea Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2766
diff changeset
589
2f922be407ea Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2766
diff changeset
590 cr.addAttr(
2f922be407ea Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2766
diff changeset
591 inBackground,
2f922be407ea Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2766
diff changeset
592 "value",
2f922be407ea Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2766
diff changeset
593 String.valueOf(context.isInBackground()),
2f922be407ea Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2766
diff changeset
594 true);
2f922be407ea Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2766
diff changeset
595
4206
6b0683f5c530 Documentation added, cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4147
diff changeset
596 CalculationMessage message = (CalculationMessage) messages.getLast();
3193
2f922be407ea Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2766
diff changeset
597 cr.addAttr(
2f922be407ea Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2766
diff changeset
598 inBackground,
2f922be407ea Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2766
diff changeset
599 "steps",
2f922be407ea Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2766
diff changeset
600 String.valueOf(message.getSteps()),
2f922be407ea Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2766
diff changeset
601 true);
2f922be407ea Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2766
diff changeset
602
2f922be407ea Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2766
diff changeset
603 cr.addAttr(
2f922be407ea Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2766
diff changeset
604 inBackground,
2f922be407ea Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2766
diff changeset
605 "currentStep",
2f922be407ea Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2766
diff changeset
606 String.valueOf(message.getCurrentStep()),
2f922be407ea Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2766
diff changeset
607 true);
2f922be407ea Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2766
diff changeset
608
2f922be407ea Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2766
diff changeset
609 inBackground.setTextContent(message.getMessage());
2f922be407ea Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2766
diff changeset
610 }
2f922be407ea Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2766
diff changeset
611
2f922be407ea Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2766
diff changeset
612 /**
2f922be407ea Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2766
diff changeset
613 * Append output mode nodes to a document.
2f922be407ea Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2766
diff changeset
614 */
2f922be407ea Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2766
diff changeset
615 protected void appendOutputModes(
2f922be407ea Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2766
diff changeset
616 Document doc,
2f922be407ea Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2766
diff changeset
617 Element outs,
2f922be407ea Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2766
diff changeset
618 CallContext context,
2f922be407ea Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2766
diff changeset
619 String uuid)
2f922be407ea Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2766
diff changeset
620 {
2f922be407ea Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2766
diff changeset
621 List<Output> generated = getOutputs(context);
3554
9b356ed24411 FLYSArtifact: Lowered logging output level from info to debug. Made some more debug outputs conditional.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3553
diff changeset
622
9b356ed24411 FLYSArtifact: Lowered logging output level from info to debug. Made some more debug outputs conditional.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3553
diff changeset
623 if (log.isDebugEnabled()) {
9b356ed24411 FLYSArtifact: Lowered logging output level from info to debug. Made some more debug outputs conditional.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3553
diff changeset
624 log.debug("This Artifact has " + generated.size() + " Outputs.");
9b356ed24411 FLYSArtifact: Lowered logging output level from info to debug. Made some more debug outputs conditional.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3553
diff changeset
625 }
3193
2f922be407ea Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2766
diff changeset
626
2f922be407ea Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2766
diff changeset
627 ProtocolUtils.appendOutputModes(doc, outs, generated);
2f922be407ea Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2766
diff changeset
628 }
2f922be407ea Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2766
diff changeset
629
119
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
630
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
631 /**
122
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
632 * 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
633 * 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
634 *
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
635 * @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
636 * @param context The CallContext.
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
637 *
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
638 * @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
639 */
3306
1b41dc00b1f7 Create shapefile directory instead of shapefile 'file'
Christian Lins <christian.lins@intevation.de>
parents: 3203
diff changeset
640 @Override
122
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
641 public Document advance(Document target, CallContext context) {
3554
9b356ed24411 FLYSArtifact: Lowered logging output level from info to debug. Made some more debug outputs conditional.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3553
diff changeset
642
9b356ed24411 FLYSArtifact: Lowered logging output level from info to debug. Made some more debug outputs conditional.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3553
diff changeset
643 boolean debug = log.isDebugEnabled();
9b356ed24411 FLYSArtifact: Lowered logging output level from info to debug. Made some more debug outputs conditional.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3553
diff changeset
644
122
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
645 Document doc = XMLUtils.newDocument();
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
646
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
647 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
648 doc,
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
649 ArtifactNamespaceContext.NAMESPACE_URI,
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
650 ArtifactNamespaceContext.NAMESPACE_PREFIX);
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
651
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
652 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
653
2606
619f6dfec901 #460 Fixed duplicated Outputs in DESCRIBE documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2205
diff changeset
654 String currentStateId = getCurrentStateId();
619f6dfec901 #460 Fixed duplicated Outputs in DESCRIBE documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2205
diff changeset
655 String targetState = XMLUtils.xpathString(
122
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
656 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
657
3554
9b356ed24411 FLYSArtifact: Lowered logging output level from info to debug. Made some more debug outputs conditional.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3553
diff changeset
658 if (debug) {
5867
59ff03ff48f1 River artifacts: Renamed FLYSArtifact(Collection) to D4EArtifact(Collection).
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5866
diff changeset
659 log.debug("D4EArtifact.advance() to '" + targetState + "'");
3554
9b356ed24411 FLYSArtifact: Lowered logging output level from info to debug. Made some more debug outputs conditional.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3553
diff changeset
660 }
140
43f03f6047b9 Implemented the step-back part of the advance() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 123
diff changeset
661
2606
619f6dfec901 #460 Fixed duplicated Outputs in DESCRIBE documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2205
diff changeset
662 if (!currentStateId.equals(targetState)
619f6dfec901 #460 Fixed duplicated Outputs in DESCRIBE documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2205
diff changeset
663 && isStateReachable(targetState, context))
619f6dfec901 #460 Fixed duplicated Outputs in DESCRIBE documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2205
diff changeset
664 {
3554
9b356ed24411 FLYSArtifact: Lowered logging output level from info to debug. Made some more debug outputs conditional.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3553
diff changeset
665 if (debug) {
9b356ed24411 FLYSArtifact: Lowered logging output level from info to debug. Made some more debug outputs conditional.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3553
diff changeset
666 log.debug("Advance: Step forward");
9b356ed24411 FLYSArtifact: Lowered logging output level from info to debug. Made some more debug outputs conditional.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3553
diff changeset
667 }
122
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
668
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
669 List<String> prev = getPreviousStateIds();
2606
619f6dfec901 #460 Fixed duplicated Outputs in DESCRIBE documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2205
diff changeset
670 prev.add(currentStateId);
122
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
671
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
672 setCurrentStateId(targetState);
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
673
3554
9b356ed24411 FLYSArtifact: Lowered logging output level from info to debug. Made some more debug outputs conditional.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3553
diff changeset
674 if (debug) {
9b356ed24411 FLYSArtifact: Lowered logging output level from info to debug. Made some more debug outputs conditional.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3553
diff changeset
675 log.debug("Compute data for state: " + targetState);
9b356ed24411 FLYSArtifact: Lowered logging output level from info to debug. Made some more debug outputs conditional.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3553
diff changeset
676 }
705
853dceead0f4 Only generate facets when needed.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 704
diff changeset
677 compute(context, ComputeType.ADVANCE, true);
693
af393c5eb2c8 Write computed facets into artifacts describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 692
diff changeset
678
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
679 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
680 }
140
43f03f6047b9 Implemented the step-back part of the advance() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 123
diff changeset
681 else if (isPreviousState(targetState, context)) {
3554
9b356ed24411 FLYSArtifact: Lowered logging output level from info to debug. Made some more debug outputs conditional.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3553
diff changeset
682 if (debug) {
9b356ed24411 FLYSArtifact: Lowered logging output level from info to debug. Made some more debug outputs conditional.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3553
diff changeset
683 log.debug("Advance: Step back to");
9b356ed24411 FLYSArtifact: Lowered logging output level from info to debug. Made some more debug outputs conditional.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3553
diff changeset
684 }
122
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
685
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
686 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
687 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
688 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
689
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
690 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
691
140
43f03f6047b9 Implemented the step-back part of the advance() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 123
diff changeset
692 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
693 String prev = prevs.get(i);
3554
9b356ed24411 FLYSArtifact: Lowered logging output level from info to debug. Made some more debug outputs conditional.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3553
diff changeset
694 if (debug) {
9b356ed24411 FLYSArtifact: Lowered logging output level from info to debug. Made some more debug outputs conditional.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3553
diff changeset
695 log.debug("Remove state id '" + prev + "'");
9b356ed24411 FLYSArtifact: Lowered logging output level from info to debug. Made some more debug outputs conditional.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3553
diff changeset
696 }
1084
583314dafdb6 Call State.endOfLife() in FLYSArtifact when stepping back to a previous state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1067
diff changeset
697
140
43f03f6047b9 Implemented the step-back part of the advance() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 123
diff changeset
698 prevs.remove(prev);
691
2600aa2c7319 Store facets for each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 690
diff changeset
699 facets.remove(prev);
140
43f03f6047b9 Implemented the step-back part of the advance() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 123
diff changeset
700 }
43f03f6047b9 Implemented the step-back part of the advance() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 123
diff changeset
701
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
702 destroyState(getCurrentStateId(), context);
140
43f03f6047b9 Implemented the step-back part of the advance() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 123
diff changeset
703 setCurrentStateId(targetState);
43f03f6047b9 Implemented the step-back part of the advance() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 123
diff changeset
704
43f03f6047b9 Implemented the step-back part of the advance() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 123
diff changeset
705 return describe(target, context);
43f03f6047b9 Implemented the step-back part of the advance() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 123
diff changeset
706 }
122
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
707
3554
9b356ed24411 FLYSArtifact: Lowered logging output level from info to debug. Made some more debug outputs conditional.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3553
diff changeset
708 log.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
709 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
710
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
711 doc.appendChild(result);
122
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 return doc;
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
714 }
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
715
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
716
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
717 /**
119
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
718 * 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
719 *
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
720 * @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
721 */
722
4800230fba8a Improved situtation on rendering "Abflusskurve am Pegel". Not fully working, yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 708
diff changeset
722 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
723 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
724 }
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
725
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
726
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
727 /**
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
728 * 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
729 *
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
730 * @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
731 */
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
732 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
733 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
734 }
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
735
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
736
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
737 /**
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
738 * 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
739 * 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
740 * 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
741 * 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
742 *
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
743 * @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
744 */
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
745 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
746 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
747 }
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
748
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
749
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
750 /**
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
751 * 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
752 *
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
753 * @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
754 */
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
755 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
756 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
757 }
f364410c7bc9 Refactored (state access) to ease future development of more trivial artifacts.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1059
diff changeset
758
f364410c7bc9 Refactored (state access) to ease future development of more trivial artifacts.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1059
diff changeset
759
f364410c7bc9 Refactored (state access) to ease future development of more trivial artifacts.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1059
diff changeset
760 /**
f364410c7bc9 Refactored (state access) to ease future development of more trivial artifacts.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1059
diff changeset
761 * 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
762 * @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
763 * @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
764 */
f364410c7bc9 Refactored (state access) to ease future development of more trivial artifacts.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1059
diff changeset
765 protected List<State> getStates(Object context) {
5866
9a6741ccf6d4 FLYS artifacts: Renamed FLYSContext(Factory) to RiverContext(Factory).
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5865
diff changeset
766 RiverContext flysContext = RiverUtils.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
767 StateEngine engine = (StateEngine) flysContext.get(
5866
9a6741ccf6d4 FLYS artifacts: Renamed FLYSContext(Factory) to RiverContext(Factory).
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5865
diff changeset
768 RiverContext.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
769 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
770 }
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
771
1067
f364410c7bc9 Refactored (state access) to ease future development of more trivial artifacts.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1059
diff changeset
772
f364410c7bc9 Refactored (state access) to ease future development of more trivial artifacts.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1059
diff changeset
773 /**
f364410c7bc9 Refactored (state access) to ease future development of more trivial artifacts.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1059
diff changeset
774 * 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
775 * @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
776 * @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
777 * @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
778 */
722
4800230fba8a Improved situtation on rendering "Abflusskurve am Pegel". Not fully working, yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 708
diff changeset
779 protected State getState(Object context, String stateID) {
5866
9a6741ccf6d4 FLYS artifacts: Renamed FLYSContext(Factory) to RiverContext(Factory).
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5865
diff changeset
780 RiverContext flysContext = RiverUtils.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
781 StateEngine engine = (StateEngine) flysContext.get(
5866
9a6741ccf6d4 FLYS artifacts: Renamed FLYSContext(Factory) to RiverContext(Factory).
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5865
diff changeset
782 RiverContext.STATE_ENGINE_KEY);
722
4800230fba8a Improved situtation on rendering "Abflusskurve am Pegel". Not fully working, yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 708
diff changeset
783 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
784 }
4800230fba8a Improved situtation on rendering "Abflusskurve am Pegel". Not fully working, yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 708
diff changeset
785
119
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
786
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
787 /**
122
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
788 * 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
789 *
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
790 * @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
791 */
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
792 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
793 return previousStateIds;
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
794 }
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
795
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
796
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
797 /**
1783
376c81aa7d55 Added method to FLYSArtifact to access ids of states.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1777
diff changeset
798 * 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
799 * @return #getPreviousStateIds() + #getCurrentStateId()
376c81aa7d55 Added method to FLYSArtifact to access ids of states.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1777
diff changeset
800 */
376c81aa7d55 Added method to FLYSArtifact to access ids of states.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1777
diff changeset
801 public List<String> getStateHistoryIds() {
2606
619f6dfec901 #460 Fixed duplicated Outputs in DESCRIBE documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2205
diff changeset
802 ArrayList<String> prevIds = (ArrayList) getPreviousStateIds();
619f6dfec901 #460 Fixed duplicated Outputs in DESCRIBE documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2205
diff changeset
803 ArrayList<String> allIds = (ArrayList) prevIds.clone();
619f6dfec901 #460 Fixed duplicated Outputs in DESCRIBE documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2205
diff changeset
804
1783
376c81aa7d55 Added method to FLYSArtifact to access ids of states.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1777
diff changeset
805 allIds.add(getCurrentStateId());
376c81aa7d55 Added method to FLYSArtifact to access ids of states.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1777
diff changeset
806 return allIds;
376c81aa7d55 Added method to FLYSArtifact to access ids of states.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1777
diff changeset
807 }
376c81aa7d55 Added method to FLYSArtifact to access ids of states.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1777
diff changeset
808
376c81aa7d55 Added method to FLYSArtifact to access ids of states.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1777
diff changeset
809
376c81aa7d55 Added method to FLYSArtifact to access ids of states.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1777
diff changeset
810 /**
121
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
811 * 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
812 *
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
813 * @param name the name of the data object.
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
814 * @param data the data object itself.
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
815 */
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
816 protected void addData(String name, StateData data) {
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
817 this.data.put(name, data);
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
818 }
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
819
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
820
4206
6b0683f5c530 Documentation added, cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4147
diff changeset
821 /** Remove and return statedata associated to name. */
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
822 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
823 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
824 }
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
825
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
826
121
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
827 /**
122
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
828 * 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
829 * 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
830 *
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
831 * @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
832 *
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
833 * @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
834 */
298
fc694a43a7e5 Changed the visibility of getData() method of FLYSArtifacts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 140
diff changeset
835 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
836 return data.get(name);
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
837 }
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
838
4206
6b0683f5c530 Documentation added, cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4147
diff changeset
839
3920
8483d190b2e7 Convert FKYSArtifact data member to a private variable
Bjoern Ricks <bjoern.ricks@intevation.de>
parents: 3883
diff changeset
840 /**
8483d190b2e7 Convert FKYSArtifact data member to a private variable
Bjoern Ricks <bjoern.ricks@intevation.de>
parents: 3883
diff changeset
841 * A derived Artifact class can use this method to set the data
8483d190b2e7 Convert FKYSArtifact data member to a private variable
Bjoern Ricks <bjoern.ricks@intevation.de>
parents: 3883
diff changeset
842 */
8483d190b2e7 Convert FKYSArtifact data member to a private variable
Bjoern Ricks <bjoern.ricks@intevation.de>
parents: 3883
diff changeset
843 protected void setData(Map<String, StateData> data) {
8483d190b2e7 Convert FKYSArtifact data member to a private variable
Bjoern Ricks <bjoern.ricks@intevation.de>
parents: 3883
diff changeset
844 this.data = data;
8483d190b2e7 Convert FKYSArtifact data member to a private variable
Bjoern Ricks <bjoern.ricks@intevation.de>
parents: 3883
diff changeset
845 }
122
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
846
4206
6b0683f5c530 Documentation added, cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4147
diff changeset
847
2169
b817e680cf18 Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2141
diff changeset
848 /** Return named data item, null if not found. */
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
849 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
850 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
851 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
852 }
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
853
1763
0e748e8972b5 Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1724
diff changeset
854
0e748e8972b5 Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1724
diff changeset
855 /**
2013
9d5f339d83a3 #380 Validate the user selected DEM in the server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1895
diff changeset
856 * 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
857 * 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
858 *
9d5f339d83a3 #380 Validate the user selected DEM in the server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1895
diff changeset
859 * @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
860 *
9d5f339d83a3 #380 Validate the user selected DEM in the server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1895
diff changeset
861 * @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
862 * 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
863 *
9d5f339d83a3 #380 Validate the user selected DEM in the server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1895
diff changeset
864 * @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
865 * 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
866 */
9d5f339d83a3 #380 Validate the user selected DEM in the server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1895
diff changeset
867 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
868 throws NumberFormatException
9d5f339d83a3 #380 Validate the user selected DEM in the server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1895
diff changeset
869 {
9d5f339d83a3 #380 Validate the user selected DEM in the server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1895
diff changeset
870 String value = getDataAsString(name);
9d5f339d83a3 #380 Validate the user selected DEM in the server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1895
diff changeset
871
9d5f339d83a3 #380 Validate the user selected DEM in the server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1895
diff changeset
872 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
873 return Integer.parseInt(value);
9d5f339d83a3 #380 Validate the user selected DEM in the server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1895
diff changeset
874 }
9d5f339d83a3 #380 Validate the user selected DEM in the server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1895
diff changeset
875
9d5f339d83a3 #380 Validate the user selected DEM in the server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1895
diff changeset
876 return null;
9d5f339d83a3 #380 Validate the user selected DEM in the server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1895
diff changeset
877 }
9d5f339d83a3 #380 Validate the user selected DEM in the server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1895
diff changeset
878
9d5f339d83a3 #380 Validate the user selected DEM in the server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1895
diff changeset
879
9d5f339d83a3 #380 Validate the user selected DEM in the server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1895
diff changeset
880 /**
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
881 * This method returns the value of a StateData object stored in the data
2701
c553d4fa3957 Moved the implementation of getDataAsDouble() from concrete Artifacts into FLYSArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2606
diff changeset
882 * pool of this Artifact as Double.
c553d4fa3957 Moved the implementation of getDataAsDouble() from concrete Artifacts into FLYSArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2606
diff changeset
883 *
c553d4fa3957 Moved the implementation of getDataAsDouble() from concrete Artifacts into FLYSArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2606
diff changeset
884 * @param name The name of the StateData object.
c553d4fa3957 Moved the implementation of getDataAsDouble() from concrete Artifacts into FLYSArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2606
diff changeset
885 *
c553d4fa3957 Moved the implementation of getDataAsDouble() from concrete Artifacts into FLYSArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2606
diff changeset
886 * @return an Double representing the value of the data object or null if
c553d4fa3957 Moved the implementation of getDataAsDouble() from concrete Artifacts into FLYSArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2606
diff changeset
887 * no object was found for <i>name</i>.
c553d4fa3957 Moved the implementation of getDataAsDouble() from concrete Artifacts into FLYSArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2606
diff changeset
888 *
c553d4fa3957 Moved the implementation of getDataAsDouble() from concrete Artifacts into FLYSArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2606
diff changeset
889 * @throws NumberFormatException if the value of the data object could not
c553d4fa3957 Moved the implementation of getDataAsDouble() from concrete Artifacts into FLYSArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2606
diff changeset
890 * be transformed into a Double.
c553d4fa3957 Moved the implementation of getDataAsDouble() from concrete Artifacts into FLYSArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2606
diff changeset
891 */
c553d4fa3957 Moved the implementation of getDataAsDouble() from concrete Artifacts into FLYSArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2606
diff changeset
892 public Double getDataAsDouble(String name)
c553d4fa3957 Moved the implementation of getDataAsDouble() from concrete Artifacts into FLYSArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2606
diff changeset
893 throws NumberFormatException
c553d4fa3957 Moved the implementation of getDataAsDouble() from concrete Artifacts into FLYSArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2606
diff changeset
894 {
c553d4fa3957 Moved the implementation of getDataAsDouble() from concrete Artifacts into FLYSArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2606
diff changeset
895 String value = getDataAsString(name);
c553d4fa3957 Moved the implementation of getDataAsDouble() from concrete Artifacts into FLYSArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2606
diff changeset
896
c553d4fa3957 Moved the implementation of getDataAsDouble() from concrete Artifacts into FLYSArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2606
diff changeset
897 if (value != null && value.length() > 0) {
c553d4fa3957 Moved the implementation of getDataAsDouble() from concrete Artifacts into FLYSArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2606
diff changeset
898 return Double.parseDouble(value);
c553d4fa3957 Moved the implementation of getDataAsDouble() from concrete Artifacts into FLYSArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2606
diff changeset
899 }
c553d4fa3957 Moved the implementation of getDataAsDouble() from concrete Artifacts into FLYSArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2606
diff changeset
900
c553d4fa3957 Moved the implementation of getDataAsDouble() from concrete Artifacts into FLYSArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2606
diff changeset
901 return null;
c553d4fa3957 Moved the implementation of getDataAsDouble() from concrete Artifacts into FLYSArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2606
diff changeset
902 }
c553d4fa3957 Moved the implementation of getDataAsDouble() from concrete Artifacts into FLYSArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2606
diff changeset
903
c553d4fa3957 Moved the implementation of getDataAsDouble() from concrete Artifacts into FLYSArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2606
diff changeset
904
c553d4fa3957 Moved the implementation of getDataAsDouble() from concrete Artifacts into FLYSArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2606
diff changeset
905 /**
c553d4fa3957 Moved the implementation of getDataAsDouble() from concrete Artifacts into FLYSArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2606
diff changeset
906 * This method returns the value of a StateData object stored in the data
2128
bf67eb014443 Added convinience functions to FLYSArtifact and FLYSUtils.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2111
diff changeset
907 * pool of this Artifact as Long.
bf67eb014443 Added convinience functions to FLYSArtifact and FLYSUtils.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2111
diff changeset
908 *
bf67eb014443 Added convinience functions to FLYSArtifact and FLYSUtils.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2111
diff changeset
909 * @param name The name of the StateData object.
bf67eb014443 Added convinience functions to FLYSArtifact and FLYSUtils.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2111
diff changeset
910 *
bf67eb014443 Added convinience functions to FLYSArtifact and FLYSUtils.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2111
diff changeset
911 * @return a Long representing the value of the data object or null if
bf67eb014443 Added convinience functions to FLYSArtifact and FLYSUtils.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2111
diff changeset
912 * no object was found for <i>name</i>.
bf67eb014443 Added convinience functions to FLYSArtifact and FLYSUtils.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2111
diff changeset
913 *
bf67eb014443 Added convinience functions to FLYSArtifact and FLYSUtils.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2111
diff changeset
914 * @throws NumberFormatException if the value of the data object could not
bf67eb014443 Added convinience functions to FLYSArtifact and FLYSUtils.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2111
diff changeset
915 * be transformed into a Long.
bf67eb014443 Added convinience functions to FLYSArtifact and FLYSUtils.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2111
diff changeset
916 */
bf67eb014443 Added convinience functions to FLYSArtifact and FLYSUtils.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2111
diff changeset
917 public Long getDataAsLong(String name)
bf67eb014443 Added convinience functions to FLYSArtifact and FLYSUtils.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2111
diff changeset
918 throws NumberFormatException
bf67eb014443 Added convinience functions to FLYSArtifact and FLYSUtils.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2111
diff changeset
919 {
bf67eb014443 Added convinience functions to FLYSArtifact and FLYSUtils.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2111
diff changeset
920 String value = getDataAsString(name);
bf67eb014443 Added convinience functions to FLYSArtifact and FLYSUtils.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2111
diff changeset
921
bf67eb014443 Added convinience functions to FLYSArtifact and FLYSUtils.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2111
diff changeset
922 if (value != null && value.length() > 0) {
bf67eb014443 Added convinience functions to FLYSArtifact and FLYSUtils.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2111
diff changeset
923 return Long.parseLong(value);
bf67eb014443 Added convinience functions to FLYSArtifact and FLYSUtils.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2111
diff changeset
924 }
bf67eb014443 Added convinience functions to FLYSArtifact and FLYSUtils.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2111
diff changeset
925
bf67eb014443 Added convinience functions to FLYSArtifact and FLYSUtils.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2111
diff changeset
926 return null;
bf67eb014443 Added convinience functions to FLYSArtifact and FLYSUtils.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2111
diff changeset
927 }
bf67eb014443 Added convinience functions to FLYSArtifact and FLYSUtils.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2111
diff changeset
928
bf67eb014443 Added convinience functions to FLYSArtifact and FLYSUtils.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2111
diff changeset
929
bf67eb014443 Added convinience functions to FLYSArtifact and FLYSUtils.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2111
diff changeset
930 /**
bf67eb014443 Added convinience functions to FLYSArtifact and FLYSUtils.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2111
diff changeset
931 * This method returns the value of a StateData object stored in the data
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
932 * 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
933 *
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
934 * @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
935 *
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
936 * @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
937 * 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
938 */
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
939 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
940 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
941
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
942 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
943 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
944 }
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
945
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
946 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
947 }
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
948
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
949
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
950 /**
1763
0e748e8972b5 Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1724
diff changeset
951 * Add StateData containing a given string.
0e748e8972b5 Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1724
diff changeset
952 * @param name Name of the data object.
0e748e8972b5 Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1724
diff changeset
953 * @param value String to store.
0e748e8972b5 Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1724
diff changeset
954 */
1724
0349dd524f9c Add convenience method to add default data as string.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1709
diff changeset
955 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
956 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
957 }
0349dd524f9c Add convenience method to add default data as string.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1709
diff changeset
958
3920
8483d190b2e7 Convert FKYSArtifact data member to a private variable
Bjoern Ricks <bjoern.ricks@intevation.de>
parents: 3883
diff changeset
959 /**
8483d190b2e7 Convert FKYSArtifact data member to a private variable
Bjoern Ricks <bjoern.ricks@intevation.de>
parents: 3883
diff changeset
960 * This method returns all stored StateData in this artifact as a Collection
8483d190b2e7 Convert FKYSArtifact data member to a private variable
Bjoern Ricks <bjoern.ricks@intevation.de>
parents: 3883
diff changeset
961 * @return a Collection of all StateData objects in this artifact
8483d190b2e7 Convert FKYSArtifact data member to a private variable
Bjoern Ricks <bjoern.ricks@intevation.de>
parents: 3883
diff changeset
962 */
960
92027887775a DataCage: Added a recommend() method to generate recommendations for
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 958
diff changeset
963 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
964 return data.values();
92027887775a DataCage: Added a recommend() method to generate recommendations for
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 958
diff changeset
965 }
92027887775a DataCage: Added a recommend() method to generate recommendations for
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 958
diff changeset
966
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
967
4206
6b0683f5c530 Documentation added, cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4147
diff changeset
968 /** Return all produced facets. */
2095
8cb679d4ec49 Implemented initialize() in FloodMapState to enable cloning floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2093
diff changeset
969 public List<Facet> getFacets() {
8cb679d4ec49 Implemented initialize() in FloodMapState to enable cloning floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2093
diff changeset
970 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
971
4206
6b0683f5c530 Documentation added, cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4147
diff changeset
972 // Iterate over facets of each state.
3553
5da58c5c1517 FLYSArtifact: Some code simplifications.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3436
diff changeset
973 for (List<Facet> fs: facets.values()) {
5da58c5c1517 FLYSArtifact: Some code simplifications.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3436
diff changeset
974 all.addAll(fs);
2095
8cb679d4ec49 Implemented initialize() in FloodMapState to enable cloning floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2093
diff changeset
975 }
8cb679d4ec49 Implemented initialize() in FloodMapState to enable cloning floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2093
diff changeset
976
8cb679d4ec49 Implemented initialize() in FloodMapState to enable cloning floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2093
diff changeset
977 return all;
8cb679d4ec49 Implemented initialize() in FloodMapState to enable cloning floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2093
diff changeset
978 }
8cb679d4ec49 Implemented initialize() in FloodMapState to enable cloning floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2093
diff changeset
979
8cb679d4ec49 Implemented initialize() in FloodMapState to enable cloning floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2093
diff changeset
980
1771
c62ff9e72cea Restore mapping of state id to facets (revert, rev 3083 and 3088).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1765
diff changeset
981 /**
c62ff9e72cea Restore mapping of state id to facets (revert, rev 3083 and 3088).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1765
diff changeset
982 * 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
983 * facet.
c62ff9e72cea Restore mapping of state id to facets (revert, rev 3083 and 3088).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1765
diff changeset
984 * @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
985 * @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
986 */
6140
60b94dec104b Add handling of bound artifacts.
Andre Heinecke <aheinecke@intevation.de>
parents: 5994
diff changeset
987 public Facet getNativeFacet(Facet facet, String outName) {
696
708b270dfd30 OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 693
diff changeset
988 String name = facet.getName();
708b270dfd30 OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 693
diff changeset
989 int index = facet.getIndex();
6140
60b94dec104b Add handling of bound artifacts.
Andre Heinecke <aheinecke@intevation.de>
parents: 5994
diff changeset
990 if (getBoundToOut() != null && !getBoundToOut().isEmpty() &&
60b94dec104b Add handling of bound artifacts.
Andre Heinecke <aheinecke@intevation.de>
parents: 5994
diff changeset
991 !getBoundToOut().equals(outName)) {
60b94dec104b Add handling of bound artifacts.
Andre Heinecke <aheinecke@intevation.de>
parents: 5994
diff changeset
992 log.debug(name + ": not returning facets for " + outName +
60b94dec104b Add handling of bound artifacts.
Andre Heinecke <aheinecke@intevation.de>
parents: 5994
diff changeset
993 " because bound to " + getBoundToOut());
60b94dec104b Add handling of bound artifacts.
Andre Heinecke <aheinecke@intevation.de>
parents: 5994
diff changeset
994 return null;
60b94dec104b Add handling of bound artifacts.
Andre Heinecke <aheinecke@intevation.de>
parents: 5994
diff changeset
995 }
60b94dec104b Add handling of bound artifacts.
Andre Heinecke <aheinecke@intevation.de>
parents: 5994
diff changeset
996 log.debug("Facet: " + facet.getName());
60b94dec104b Add handling of bound artifacts.
Andre Heinecke <aheinecke@intevation.de>
parents: 5994
diff changeset
997 log.debug("Bound to out: " + getBoundToOut());
60b94dec104b Add handling of bound artifacts.
Andre Heinecke <aheinecke@intevation.de>
parents: 5994
diff changeset
998 log.debug("OutName: " + outName);
696
708b270dfd30 OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 693
diff changeset
999
3553
5da58c5c1517 FLYSArtifact: Some code simplifications.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3436
diff changeset
1000 for (List<Facet> fs: facets.values()) {
5da58c5c1517 FLYSArtifact: Some code simplifications.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3436
diff changeset
1001 for (Facet f: fs) {
1771
c62ff9e72cea Restore mapping of state id to facets (revert, rev 3083 and 3088).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1765
diff changeset
1002 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
1003 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
1004 }
696
708b270dfd30 OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 693
diff changeset
1005 }
708b270dfd30 OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 693
diff changeset
1006 }
708b270dfd30 OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 693
diff changeset
1007
3554
9b356ed24411 FLYSArtifact: Lowered logging output level from info to debug. Made some more debug outputs conditional.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3553
diff changeset
1008 log.warn("Could not find facet: " + name + " at " + index);
4495
c095eb67c975 Improve loggin in FLYSArtifact
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4433
diff changeset
1009 log.warn("Available facets for : " + getName() + " " + identifier() +
c095eb67c975 Improve loggin in FLYSArtifact
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4433
diff changeset
1010 ": " + facets.values());
696
708b270dfd30 OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 693
diff changeset
1011 return null;
708b270dfd30 OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 693
diff changeset
1012 }
708b270dfd30 OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 693
diff changeset
1013
708b270dfd30 OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 693
diff changeset
1014
122
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
1015 /**
121
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
1016 * 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
1017 *
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
1018 * @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
1019 * @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
1020 */
3553
5da58c5c1517 FLYSArtifact: Some code simplifications.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3436
diff changeset
1021 public void saveData(Document feed, CallContext context)
121
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
1022 throws IllegalArgumentException
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
1023 {
3553
5da58c5c1517 FLYSArtifact: Some code simplifications.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3436
diff changeset
1024 if (feed == null) {
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
1025 throw new IllegalArgumentException("error_feed_no_data");
121
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
1026 }
119
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
1027
121
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
1028 NodeList nodes = (NodeList) XMLUtils.xpath(
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
1029 feed,
3553
5da58c5c1517 FLYSArtifact: Some code simplifications.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3436
diff changeset
1030 XPATH_FEED_INPUT,
121
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
1031 XPathConstants.NODESET,
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
1032 ArtifactNamespaceContext.INSTANCE);
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
1033
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
1034 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
1035 throw new IllegalArgumentException("error_feed_no_data");
121
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
1036 }
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
1037
3554
9b356ed24411 FLYSArtifact: Lowered logging output level from info to debug. Made some more debug outputs conditional.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3553
diff changeset
1038 boolean debug = log.isDebugEnabled();
9b356ed24411 FLYSArtifact: Lowered logging output level from info to debug. Made some more debug outputs conditional.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3553
diff changeset
1039
121
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
1040 int count = nodes.getLength();
3554
9b356ed24411 FLYSArtifact: Lowered logging output level from info to debug. Made some more debug outputs conditional.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3553
diff changeset
1041
9b356ed24411 FLYSArtifact: Lowered logging output level from info to debug. Made some more debug outputs conditional.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3553
diff changeset
1042 if (debug) {
9b356ed24411 FLYSArtifact: Lowered logging output level from info to debug. Made some more debug outputs conditional.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3553
diff changeset
1043 log.debug("Try to save " + count + " data items.");
9b356ed24411 FLYSArtifact: Lowered logging output level from info to debug. Made some more debug outputs conditional.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3553
diff changeset
1044 }
121
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
1045
708
757ff56b43b3 Added calculation "am Pegel" version to the "Wasserspiegellage" calculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 707
diff changeset
1046 String uri = ArtifactNamespaceContext.NAMESPACE_URI;
121
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
1047
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
1048 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
1049
5866
9a6741ccf6d4 FLYS artifacts: Renamed FLYSContext(Factory) to RiverContext(Factory).
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5865
diff changeset
1050 RiverContext flysContext = RiverUtils.getFlysContext(context);
2205
a22e0cb6eace Format the timerange (static ui) inserted in the 'historical discharge curves' calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2169
diff changeset
1051 StateEngine engine = (StateEngine) flysContext.get(
5866
9a6741ccf6d4 FLYS artifacts: Renamed FLYSContext(Factory) to RiverContext(Factory).
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5865
diff changeset
1052 RiverContext.STATE_ENGINE_KEY);
2205
a22e0cb6eace Format the timerange (static ui) inserted in the 'historical discharge curves' calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2169
diff changeset
1053
708
757ff56b43b3 Added calculation "am Pegel" version to the "Wasserspiegellage" calculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 707
diff changeset
1054 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
1055 Element node = (Element)nodes.item(i);
121
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
1056
708
757ff56b43b3 Added calculation "am Pegel" version to the "Wasserspiegellage" calculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 707
diff changeset
1057 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
1058 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
1059
757ff56b43b3 Added calculation "am Pegel" version to the "Wasserspiegellage" calculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 707
diff changeset
1060 if (name.length() > 0 && value.length() > 0) {
3554
9b356ed24411 FLYSArtifact: Lowered logging output level from info to debug. Made some more debug outputs conditional.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3553
diff changeset
1061 if (debug) {
9b356ed24411 FLYSArtifact: Lowered logging output level from info to debug. Made some more debug outputs conditional.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3553
diff changeset
1062 log.debug("Save data item for '" + name + "' : " + value);
9b356ed24411 FLYSArtifact: Lowered logging output level from info to debug. Made some more debug outputs conditional.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3553
diff changeset
1063 }
121
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
1064
2205
a22e0cb6eace Format the timerange (static ui) inserted in the 'historical discharge curves' calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2169
diff changeset
1065 StateData model = engine.getStateData(getName(), name);
a22e0cb6eace Format the timerange (static ui) inserted in the 'historical discharge curves' calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2169
diff changeset
1066
a22e0cb6eace Format the timerange (static ui) inserted in the 'historical discharge curves' calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2169
diff changeset
1067 StateData sd = model != null
a22e0cb6eace Format the timerange (static ui) inserted in the 'historical discharge curves' calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2169
diff changeset
1068 ? model.deepCopy()
a22e0cb6eace Format the timerange (static ui) inserted in the 'historical discharge curves' calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2169
diff changeset
1069 : new DefaultStateData(name, null, null, value);
a22e0cb6eace Format the timerange (static ui) inserted in the 'historical discharge curves' calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2169
diff changeset
1070
a22e0cb6eace Format the timerange (static ui) inserted in the 'historical discharge curves' calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2169
diff changeset
1071 addData(
a22e0cb6eace Format the timerange (static ui) inserted in the 'historical discharge curves' calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2169
diff changeset
1072 name, current.transform(this, context, sd, name, value));
121
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
1073 }
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
1074 else if (name.length() > 0 && value.length() == 0) {
3554
9b356ed24411 FLYSArtifact: Lowered logging output level from info to debug. Made some more debug outputs conditional.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3553
diff changeset
1075 if (removeData(name) != null && debug) {
9b356ed24411 FLYSArtifact: Lowered logging output level from info to debug. Made some more debug outputs conditional.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3553
diff changeset
1076 log.debug("Removed data '" + name + "' successfully.");
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
1077 }
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
1078 }
121
e0ded17a4846 Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 119
diff changeset
1079 }
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
1080
1050
eccf966fb677 State engine: Removed CallContext from state validation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 981
diff changeset
1081 current.validate(this);
122
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
1082 }
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
1083
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
1084
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
1085 /**
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
1086 * 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
1087 * 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
1088 * TransitionEngine.
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
1089 *
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
1090 * @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
1091 * @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
1092 *
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
1093 * @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
1094 * otherwise false.
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
1095 */
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
1096 protected boolean isStateReachable(String stateId, Object context) {
3554
9b356ed24411 FLYSArtifact: Lowered logging output level from info to debug. Made some more debug outputs conditional.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3553
diff changeset
1097
9b356ed24411 FLYSArtifact: Lowered logging output level from info to debug. Made some more debug outputs conditional.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3553
diff changeset
1098 if (log.isDebugEnabled()) {
9b356ed24411 FLYSArtifact: Lowered logging output level from info to debug. Made some more debug outputs conditional.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3553
diff changeset
1099 log.debug("Determine if the state '" + stateId + "' is reachable.");
9b356ed24411 FLYSArtifact: Lowered logging output level from info to debug. Made some more debug outputs conditional.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3553
diff changeset
1100 }
122
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
1101
5866
9a6741ccf6d4 FLYS artifacts: Renamed FLYSContext(Factory) to RiverContext(Factory).
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5865
diff changeset
1102 RiverContext flysContext = RiverUtils.getFlysContext(context);
122
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
1103
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
1104 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
1105 StateEngine sEngine = (StateEngine) flysContext.get(
5866
9a6741ccf6d4 FLYS artifacts: Renamed FLYSContext(Factory) to RiverContext(Factory).
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5865
diff changeset
1106 RiverContext.STATE_ENGINE_KEY);
122
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
1107
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
1108 TransitionEngine tEngine = (TransitionEngine) flysContext.get(
5866
9a6741ccf6d4 FLYS artifacts: Renamed FLYSContext(Factory) to RiverContext(Factory).
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5865
diff changeset
1109 RiverContext.TRANSITION_ENGINE_KEY);
122
d3b8b0b1d010 Implemented the step-forward part of the advance operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 121
diff changeset
1110
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
1111 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
1112 }
140
43f03f6047b9 Implemented the step-back part of the advance() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 123
diff changeset
1113
43f03f6047b9 Implemented the step-back part of the advance() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 123
diff changeset
1114
43f03f6047b9 Implemented the step-back part of the advance() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 123
diff changeset
1115 /**
43f03f6047b9 Implemented the step-back part of the advance() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 123
diff changeset
1116 * 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
1117 * 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
1118 *
43f03f6047b9 Implemented the step-back part of the advance() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 123
diff changeset
1119 * @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
1120 * @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
1121 */
43f03f6047b9 Implemented the step-back part of the advance() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 123
diff changeset
1122 protected boolean isPreviousState(String stateId, Object context) {
3554
9b356ed24411 FLYSArtifact: Lowered logging output level from info to debug. Made some more debug outputs conditional.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3553
diff changeset
1123 if (log.isDebugEnabled()) {
9b356ed24411 FLYSArtifact: Lowered logging output level from info to debug. Made some more debug outputs conditional.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3553
diff changeset
1124 log.debug("Determine if the state '" + stateId + "' is old.");
9b356ed24411 FLYSArtifact: Lowered logging output level from info to debug. Made some more debug outputs conditional.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3553
diff changeset
1125 }
140
43f03f6047b9 Implemented the step-back part of the advance() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 123
diff changeset
1126
3553
5da58c5c1517 FLYSArtifact: Some code simplifications.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3436
diff changeset
1127 return getPreviousStateIds().contains(stateId);
140
43f03f6047b9 Implemented the step-back part of the advance() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 123
diff changeset
1128 }
317
8f40a57229c3 FLYSArtifact provides methods to retrieve the real River, Gauge objects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 298
diff changeset
1129
8f40a57229c3 FLYSArtifact provides methods to retrieve the real River, Gauge objects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 298
diff changeset
1130
8f40a57229c3 FLYSArtifact provides methods to retrieve the real River, Gauge objects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 298
diff changeset
1131 /**
686
3dc61e00385e Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 661
diff changeset
1132 * 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
1133 *
3dc61e00385e Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 661
diff changeset
1134 * @return a hash code.
3dc61e00385e Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 661
diff changeset
1135 */
3dc61e00385e Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 661
diff changeset
1136 @Override
3dc61e00385e Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 661
diff changeset
1137 public String hash() {
3dc61e00385e Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 661
diff changeset
1138
705
853dceead0f4 Only generate facets when needed.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 704
diff changeset
1139 long hash = 0L;
853dceead0f4 Only generate facets when needed.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 704
diff changeset
1140 int shift = 3;
686
3dc61e00385e Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 661
diff changeset
1141
4050
975f608dd254 Cleaned up iterating over maps. Removed some dead code.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 3934
diff changeset
1142 for (Map.Entry<String, StateData> entry: data.entrySet()) {
686
3dc61e00385e Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 661
diff changeset
1143 String key = entry.getKey();
3dc61e00385e Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 661
diff changeset
1144 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
1145
742
c09c9e05ecfa Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 741
diff changeset
1146 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
1147 | ((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
1148 shift += 2;
3dc61e00385e Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 661
diff changeset
1149 }
3dc61e00385e Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 661
diff changeset
1150
3dc61e00385e Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 661
diff changeset
1151 return getCurrentStateId() + hash;
3dc61e00385e Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 661
diff changeset
1152 }
3dc61e00385e Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 661
diff changeset
1153
1628
16c74ca3586e Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1187
diff changeset
1154
16c74ca3586e Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1187
diff changeset
1155 /**
1763
0e748e8972b5 Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1724
diff changeset
1156 * Return List of outputs, where combinations of outputname and filtername
0e748e8972b5 Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1724
diff changeset
1157 * that match content in filterFacets is left out.
0e748e8972b5 Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1724
diff changeset
1158 * @return filtered Outputlist.
1628
16c74ca3586e Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1187
diff changeset
1159 */
1056
bd1b751deab3 Added optional positive filter for outs and facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1055
diff changeset
1160 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
1161 if (filterFacets == null || filterFacets.isEmpty()) {
3554
9b356ed24411 FLYSArtifact: Lowered logging output level from info to debug. Made some more debug outputs conditional.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3553
diff changeset
1162 log.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
1163 return outs;
bd1b751deab3 Added optional positive filter for outs and facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1055
diff changeset
1164 }
bd1b751deab3 Added optional positive filter for outs and facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1055
diff changeset
1165
3554
9b356ed24411 FLYSArtifact: Lowered logging output level from info to debug. Made some more debug outputs conditional.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3553
diff changeset
1166 boolean debug = log.isDebugEnabled();
3436
0d63581c5df1 FLYSArtifact: Prevent NPE in getOutputForState(). Why does this happen?
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3306
diff changeset
1167
0d63581c5df1 FLYSArtifact: Prevent NPE in getOutputForState(). Why does this happen?
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3306
diff changeset
1168 if (debug) {
3554
9b356ed24411 FLYSArtifact: Lowered logging output level from info to debug. Made some more debug outputs conditional.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3553
diff changeset
1169 log.debug(
3436
0d63581c5df1 FLYSArtifact: Prevent NPE in getOutputForState(). Why does this happen?
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3306
diff changeset
1170 "Filter Facets with " + filterFacets.size() + " filters.");
0d63581c5df1 FLYSArtifact: Prevent NPE in getOutputForState(). Why does this happen?
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3306
diff changeset
1171 }
2095
8cb679d4ec49 Implemented initialize() in FloodMapState to enable cloning floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2093
diff changeset
1172
1056
bd1b751deab3 Added optional positive filter for outs and facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1055
diff changeset
1173 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
1174
bd1b751deab3 Added optional positive filter for outs and facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1055
diff changeset
1175 for (Output out: outs) {
2095
8cb679d4ec49 Implemented initialize() in FloodMapState to enable cloning floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2093
diff changeset
1176 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
1177
3436
0d63581c5df1 FLYSArtifact: Prevent NPE in getOutputForState(). Why does this happen?
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3306
diff changeset
1178 if (debug) {
3554
9b356ed24411 FLYSArtifact: Lowered logging output level from info to debug. Made some more debug outputs conditional.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3553
diff changeset
1179 log.debug(" filter Facets for Output: " + outName);
3436
0d63581c5df1 FLYSArtifact: Prevent NPE in getOutputForState(). Why does this happen?
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3306
diff changeset
1180 }
2095
8cb679d4ec49 Implemented initialize() in FloodMapState to enable cloning floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2093
diff changeset
1181
8cb679d4ec49 Implemented initialize() in FloodMapState to enable cloning floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2093
diff changeset
1182 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
1183 if (fFacets != null) {
3436
0d63581c5df1 FLYSArtifact: Prevent NPE in getOutputForState(). Why does this happen?
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3306
diff changeset
1184 if (debug) {
3554
9b356ed24411 FLYSArtifact: Lowered logging output level from info to debug. Made some more debug outputs conditional.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3553
diff changeset
1185 log.debug("" + fFacets.size() + " filters for: " + outName);
2095
8cb679d4ec49 Implemented initialize() in FloodMapState to enable cloning floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2093
diff changeset
1186 for (Facet tmp: fFacets) {
3554
9b356ed24411 FLYSArtifact: Lowered logging output level from info to debug. Made some more debug outputs conditional.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3553
diff changeset
1187 log.debug(" filter = '" + tmp.getName() + "'");
2095
8cb679d4ec49 Implemented initialize() in FloodMapState to enable cloning floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2093
diff changeset
1188 }
8cb679d4ec49 Implemented initialize() in FloodMapState to enable cloning floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2093
diff changeset
1189 }
1056
bd1b751deab3 Added optional positive filter for outs and facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1055
diff changeset
1190
bd1b751deab3 Added optional positive filter for outs and facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1055
diff changeset
1191 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
1192
bd1b751deab3 Added optional positive filter for outs and facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1055
diff changeset
1193 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
1194 for (Facet fFacet: fFacets) {
bd1b751deab3 Added optional positive filter for outs and facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1055
diff changeset
1195 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
1196 && 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
1197 resultFacets.add(facet);
bd1b751deab3 Added optional positive filter for outs and facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1055
diff changeset
1198 break;
bd1b751deab3 Added optional positive filter for outs and facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1055
diff changeset
1199 }
bd1b751deab3 Added optional positive filter for outs and facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1055
diff changeset
1200 }
bd1b751deab3 Added optional positive filter for outs and facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1055
diff changeset
1201 }
bd1b751deab3 Added optional positive filter for outs and facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1055
diff changeset
1202
3436
0d63581c5df1 FLYSArtifact: Prevent NPE in getOutputForState(). Why does this happen?
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3306
diff changeset
1203 if (debug) {
3554
9b356ed24411 FLYSArtifact: Lowered logging output level from info to debug. Made some more debug outputs conditional.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3553
diff changeset
1204 log.debug(
3436
0d63581c5df1 FLYSArtifact: Prevent NPE in getOutputForState(). Why does this happen?
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3306
diff changeset
1205 "Facets after filtering = " + resultFacets.size());
0d63581c5df1 FLYSArtifact: Prevent NPE in getOutputForState(). Why does this happen?
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3306
diff changeset
1206 }
2095
8cb679d4ec49 Implemented initialize() in FloodMapState to enable cloning floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2093
diff changeset
1207
1056
bd1b751deab3 Added optional positive filter for outs and facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1055
diff changeset
1208 if (!resultFacets.isEmpty()) {
bd1b751deab3 Added optional positive filter for outs and facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1055
diff changeset
1209 DefaultOutput nout = new DefaultOutput(
bd1b751deab3 Added optional positive filter for outs and facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1055
diff changeset
1210 out.getName(),
bd1b751deab3 Added optional positive filter for outs and facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1055
diff changeset
1211 out.getDescription(),
bd1b751deab3 Added optional positive filter for outs and facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1055
diff changeset
1212 out.getMimeType(),
bd1b751deab3 Added optional positive filter for outs and facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1055
diff changeset
1213 resultFacets);
bd1b751deab3 Added optional positive filter for outs and facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1055
diff changeset
1214 filtered.add(nout);
bd1b751deab3 Added optional positive filter for outs and facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1055
diff changeset
1215 }
bd1b751deab3 Added optional positive filter for outs and facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1055
diff changeset
1216 }
4403
d4f88fda6ed3 Improve debugging inf FLYSArtifact
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4206
diff changeset
1217 else if (debug) {
d4f88fda6ed3 Improve debugging inf FLYSArtifact
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4206
diff changeset
1218 log.debug("No filter Factes for Output: " + outName);
d4f88fda6ed3 Improve debugging inf FLYSArtifact
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4206
diff changeset
1219 }
1056
bd1b751deab3 Added optional positive filter for outs and facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1055
diff changeset
1220 }
bd1b751deab3 Added optional positive filter for outs and facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1055
diff changeset
1221
3436
0d63581c5df1 FLYSArtifact: Prevent NPE in getOutputForState(). Why does this happen?
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3306
diff changeset
1222 if (debug) {
4403
d4f88fda6ed3 Improve debugging inf FLYSArtifact
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4206
diff changeset
1223 log.debug("Number of outs after filtering = " + filtered.size());
3436
0d63581c5df1 FLYSArtifact: Prevent NPE in getOutputForState(). Why does this happen?
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3306
diff changeset
1224 }
2095
8cb679d4ec49 Implemented initialize() in FloodMapState to enable cloning floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2093
diff changeset
1225
1056
bd1b751deab3 Added optional positive filter for outs and facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1055
diff changeset
1226 return filtered;
bd1b751deab3 Added optional positive filter for outs and facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1055
diff changeset
1227 }
bd1b751deab3 Added optional positive filter for outs and facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1055
diff changeset
1228
686
3dc61e00385e Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 661
diff changeset
1229
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
1230 /**
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
1231 * 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
1232 * 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
1233 *
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
1234 * @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
1235 */
1050
eccf966fb677 State engine: Removed CallContext from state validation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 981
diff changeset
1236 public List<Output> getOutputs(Object context) {
3554
9b356ed24411 FLYSArtifact: Lowered logging output level from info to debug. Made some more debug outputs conditional.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3553
diff changeset
1237 if (log.isDebugEnabled()) {
9b356ed24411 FLYSArtifact: Lowered logging output level from info to debug. Made some more debug outputs conditional.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3553
diff changeset
1238 log.debug("##### Get Outputs for: " + identifier() + " #####");
9b356ed24411 FLYSArtifact: Lowered logging output level from info to debug. Made some more debug outputs conditional.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3553
diff changeset
1239 dumpArtifact();
3436
0d63581c5df1 FLYSArtifact: Prevent NPE in getOutputForState(). Why does this happen?
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3306
diff changeset
1240 }
2095
8cb679d4ec49 Implemented initialize() in FloodMapState to enable cloning floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2093
diff changeset
1241
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
1242 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
1243 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
1244
c256061287d7 Simplified the code to read all provided Outputs of an Artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 942
diff changeset
1245 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
1246 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
1247 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
1248 }
c256061287d7 Simplified the code to read all provided Outputs of an Artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 942
diff changeset
1249
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
1250 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
1251
1056
bd1b751deab3 Added optional positive filter for outs and facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1055
diff changeset
1252 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
1253 }
c256061287d7 Simplified the code to read all provided Outputs of an Artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 942
diff changeset
1254
c256061287d7 Simplified the code to read all provided Outputs of an Artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 942
diff changeset
1255
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
1256 /**
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
1257 * 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
1258 * @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
1259 */
1050
eccf966fb677 State engine: Removed CallContext from state validation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 981
diff changeset
1260 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
1261 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
1262
79251b1d47da Modified the CollectionMonitor to recommend artifacts for the current state's outputs only.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 960
diff changeset
1263 try {
1050
eccf966fb677 State engine: Removed CallContext from state validation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 981
diff changeset
1264 if (cur.validate(this)) {
981
799c7108ea6d datacage: prepared access to outs of artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 965
diff changeset
1265 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
1266 }
79251b1d47da Modified the CollectionMonitor to recommend artifacts for the current state's outputs only.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 960
diff changeset
1267 }
79251b1d47da Modified the CollectionMonitor to recommend artifacts for the current state's outputs only.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 960
diff changeset
1268 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
1269
79251b1d47da Modified the CollectionMonitor to recommend artifacts for the current state's outputs only.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 960
diff changeset
1270 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
1271 }
79251b1d47da Modified the CollectionMonitor to recommend artifacts for the current state's outputs only.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 960
diff changeset
1272
1137
073c36bb94ed Minor cosmetics
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1117
diff changeset
1273
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
1274 /**
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
1275 * 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
1276 * @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
1277 * @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
1278 */
981
799c7108ea6d datacage: prepared access to outs of artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 965
diff changeset
1279 protected List<Output> getOutputForState(DefaultState state) {
3436
0d63581c5df1 FLYSArtifact: Prevent NPE in getOutputForState(). Why does this happen?
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3306
diff changeset
1280
0d63581c5df1 FLYSArtifact: Prevent NPE in getOutputForState(). Why does this happen?
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3306
diff changeset
1281 if (state == null) {
3554
9b356ed24411 FLYSArtifact: Lowered logging output level from info to debug. Made some more debug outputs conditional.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3553
diff changeset
1282 log.error("state == null: This should not happen!");
3436
0d63581c5df1 FLYSArtifact: Prevent NPE in getOutputForState(). Why does this happen?
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3306
diff changeset
1283 return new ArrayList<Output>();
0d63581c5df1 FLYSArtifact: Prevent NPE in getOutputForState(). Why does this happen?
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3306
diff changeset
1284 }
0d63581c5df1 FLYSArtifact: Prevent NPE in getOutputForState(). Why does this happen?
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3306
diff changeset
1285
3554
9b356ed24411 FLYSArtifact: Lowered logging output level from info to debug. Made some more debug outputs conditional.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3553
diff changeset
1286 boolean debug = log.isDebugEnabled();
3436
0d63581c5df1 FLYSArtifact: Prevent NPE in getOutputForState(). Why does this happen?
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3306
diff changeset
1287
0d63581c5df1 FLYSArtifact: Prevent NPE in getOutputForState(). Why does this happen?
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3306
diff changeset
1288 if (debug) {
3554
9b356ed24411 FLYSArtifact: Lowered logging output level from info to debug. Made some more debug outputs conditional.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3553
diff changeset
1289 log.debug("Find Outputs for State: " + state.getID());
3436
0d63581c5df1 FLYSArtifact: Prevent NPE in getOutputForState(). Why does this happen?
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3306
diff changeset
1290 }
2095
8cb679d4ec49 Implemented initialize() in FloodMapState to enable cloning floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2093
diff changeset
1291
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
1292 List<Output> list = state.getOutputs();
3555
b1912514e0f5 s/container.size() == 0/container.isEmpty()/
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3554
diff changeset
1293 if (list == null || list.isEmpty()) {
3436
0d63581c5df1 FLYSArtifact: Prevent NPE in getOutputForState(). Why does this happen?
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3306
diff changeset
1294 if (debug) {
3554
9b356ed24411 FLYSArtifact: Lowered logging output level from info to debug. Made some more debug outputs conditional.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3553
diff changeset
1295 log.debug("-> No output modes for this state.");
3436
0d63581c5df1 FLYSArtifact: Prevent NPE in getOutputForState(). Why does this happen?
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3306
diff changeset
1296 }
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
1297 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
1298 }
79251b1d47da Modified the CollectionMonitor to recommend artifacts for the current state's outputs only.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 960
diff changeset
1299
2095
8cb679d4ec49 Implemented initialize() in FloodMapState to enable cloning floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2093
diff changeset
1300 String stateId = state.getID();
8cb679d4ec49 Implemented initialize() in FloodMapState to enable cloning floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2093
diff changeset
1301
4497
a2735a4bf75e Change facets member variable to private
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4496
diff changeset
1302 List<Facet> fs = getFacets(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
1303
3555
b1912514e0f5 s/container.size() == 0/container.isEmpty()/
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3554
diff changeset
1304 if (fs == null || fs.isEmpty()) {
3436
0d63581c5df1 FLYSArtifact: Prevent NPE in getOutputForState(). Why does this happen?
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3306
diff changeset
1305 if (debug) {
3554
9b356ed24411 FLYSArtifact: Lowered logging output level from info to debug. Made some more debug outputs conditional.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3553
diff changeset
1306 log.debug("No facets found.");
3436
0d63581c5df1 FLYSArtifact: Prevent NPE in getOutputForState(). Why does this happen?
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3306
diff changeset
1307 }
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
1308 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
1309 }
4495
c095eb67c975 Improve loggin in FLYSArtifact
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4433
diff changeset
1310 if (debug) {
c095eb67c975 Improve loggin in FLYSArtifact
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4433
diff changeset
1311 log.debug("State '" + stateId + "' has facets " + fs);
c095eb67c975 Improve loggin in FLYSArtifact
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4433
diff changeset
1312 }
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
1313
7593
60a5fc522ec4 Rename the Global Facet filter to reduce ambiguity with the old facet filter
Andre Heinecke <aheinecke@intevation.de>
parents: 7245
diff changeset
1314 List<Output> gen = generateOutputs(list, applyGlobalFilterFacets(fs));
2095
8cb679d4ec49 Implemented initialize() in FloodMapState to enable cloning floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2093
diff changeset
1315
3436
0d63581c5df1 FLYSArtifact: Prevent NPE in getOutputForState(). Why does this happen?
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3306
diff changeset
1316 if (debug) {
3554
9b356ed24411 FLYSArtifact: Lowered logging output level from info to debug. Made some more debug outputs conditional.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3553
diff changeset
1317 log.debug("State '" + stateId + "' has " + gen.size() + " outs");
3436
0d63581c5df1 FLYSArtifact: Prevent NPE in getOutputForState(). Why does this happen?
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3306
diff changeset
1318 }
2095
8cb679d4ec49 Implemented initialize() in FloodMapState to enable cloning floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2093
diff changeset
1319
8cb679d4ec49 Implemented initialize() in FloodMapState to enable cloning floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2093
diff changeset
1320 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
1321 }
79251b1d47da Modified the CollectionMonitor to recommend artifacts for the current state's outputs only.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 960
diff changeset
1322
7244
737dd43e32d6 Remove boundToOut facet pass. This is now only done if we filtered before.
Andre Heinecke <aheinecke@intevation.de>
parents: 7227
diff changeset
1323 /** If we use a facet filter that bases the list of compatible facets
7676
da412a6c4f39 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7593
diff changeset
1324 * on the output this artifact is bound to then return true. */
7593
60a5fc522ec4 Rename the Global Facet filter to reduce ambiguity with the old facet filter
Andre Heinecke <aheinecke@intevation.de>
parents: 7245
diff changeset
1325 public boolean usesOutputGlobalFacetFilter() {
7244
737dd43e32d6 Remove boundToOut facet pass. This is now only done if we filtered before.
Andre Heinecke <aheinecke@intevation.de>
parents: 7227
diff changeset
1326 if (boundToOut == null || boundToOut.isEmpty()) {
737dd43e32d6 Remove boundToOut facet pass. This is now only done if we filtered before.
Andre Heinecke <aheinecke@intevation.de>
parents: 7227
diff changeset
1327 return false;
737dd43e32d6 Remove boundToOut facet pass. This is now only done if we filtered before.
Andre Heinecke <aheinecke@intevation.de>
parents: 7227
diff changeset
1328 }
737dd43e32d6 Remove boundToOut facet pass. This is now only done if we filtered before.
Andre Heinecke <aheinecke@intevation.de>
parents: 7227
diff changeset
1329
737dd43e32d6 Remove boundToOut facet pass. This is now only done if we filtered before.
Andre Heinecke <aheinecke@intevation.de>
parents: 7227
diff changeset
1330 FacetFilter facetFilter =
737dd43e32d6 Remove boundToOut facet pass. This is now only done if we filtered before.
Andre Heinecke <aheinecke@intevation.de>
parents: 7227
diff changeset
1331 (FacetFilter)RiverContextFactory.getGlobalContext()
737dd43e32d6 Remove boundToOut facet pass. This is now only done if we filtered before.
Andre Heinecke <aheinecke@intevation.de>
parents: 7227
diff changeset
1332 .get(RiverContext.FACETFILTER_KEY);
737dd43e32d6 Remove boundToOut facet pass. This is now only done if we filtered before.
Andre Heinecke <aheinecke@intevation.de>
parents: 7227
diff changeset
1333
7245
965dbf2d4c44 Code simplification + moved code out of inner loop.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7244
diff changeset
1334 return facetFilter != null;
7244
737dd43e32d6 Remove boundToOut facet pass. This is now only done if we filtered before.
Andre Heinecke <aheinecke@intevation.de>
parents: 7227
diff changeset
1335 }
737dd43e32d6 Remove boundToOut facet pass. This is now only done if we filtered before.
Andre Heinecke <aheinecke@intevation.de>
parents: 7227
diff changeset
1336
7676
da412a6c4f39 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7593
diff changeset
1337 /**
da412a6c4f39 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7593
diff changeset
1338 * If a global facet filter and a bounded out are defined
da412a6c4f39 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7593
diff changeset
1339 * use them to eliminate unwished facets.
7227
744df5a03337 Use diagram configuration and there processors to define compatible facets in loaded data.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7178
diff changeset
1340 */
7593
60a5fc522ec4 Rename the Global Facet filter to reduce ambiguity with the old facet filter
Andre Heinecke <aheinecke@intevation.de>
parents: 7245
diff changeset
1341 protected List<Facet> applyGlobalFilterFacets(List<Facet> facets) {
60a5fc522ec4 Rename the Global Facet filter to reduce ambiguity with the old facet filter
Andre Heinecke <aheinecke@intevation.de>
parents: 7245
diff changeset
1342 if (!usesOutputGlobalFacetFilter()) {
7227
744df5a03337 Use diagram configuration and there processors to define compatible facets in loaded data.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7178
diff changeset
1343 return facets;
744df5a03337 Use diagram configuration and there processors to define compatible facets in loaded data.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7178
diff changeset
1344 }
744df5a03337 Use diagram configuration and there processors to define compatible facets in loaded data.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7178
diff changeset
1345
744df5a03337 Use diagram configuration and there processors to define compatible facets in loaded data.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7178
diff changeset
1346 FacetFilter facetFilter =
744df5a03337 Use diagram configuration and there processors to define compatible facets in loaded data.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7178
diff changeset
1347 (FacetFilter)RiverContextFactory.getGlobalContext()
744df5a03337 Use diagram configuration and there processors to define compatible facets in loaded data.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7178
diff changeset
1348 .get(RiverContext.FACETFILTER_KEY);
744df5a03337 Use diagram configuration and there processors to define compatible facets in loaded data.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7178
diff changeset
1349
744df5a03337 Use diagram configuration and there processors to define compatible facets in loaded data.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7178
diff changeset
1350 List<Facet> result = new ArrayList<Facet>(facets.size());
744df5a03337 Use diagram configuration and there processors to define compatible facets in loaded data.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7178
diff changeset
1351 for (Facet facet: facets) {
744df5a03337 Use diagram configuration and there processors to define compatible facets in loaded data.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7178
diff changeset
1352 if (facetFilter.accept(boundToOut, facet.getName())) {
744df5a03337 Use diagram configuration and there processors to define compatible facets in loaded data.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7178
diff changeset
1353 result.add(facet);
744df5a03337 Use diagram configuration and there processors to define compatible facets in loaded data.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7178
diff changeset
1354 }
744df5a03337 Use diagram configuration and there processors to define compatible facets in loaded data.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7178
diff changeset
1355 }
744df5a03337 Use diagram configuration and there processors to define compatible facets in loaded data.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7178
diff changeset
1356 return result;
744df5a03337 Use diagram configuration and there processors to define compatible facets in loaded data.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7178
diff changeset
1357 }
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
1358
1763
0e748e8972b5 Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1724
diff changeset
1359 /**
0e748e8972b5 Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1724
diff changeset
1360 * 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
1361 * of output.
0e748e8972b5 Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1724
diff changeset
1362 *
0e748e8972b5 Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1724
diff changeset
1363 * @param list List of outputs
0e748e8972b5 Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1724
diff changeset
1364 * @param fs List of facets
0e748e8972b5 Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1724
diff changeset
1365 */
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
1366 protected List<Output> generateOutputs(List<Output> list, List<Facet> fs) {
3554
9b356ed24411 FLYSArtifact: Lowered logging output level from info to debug. Made some more debug outputs conditional.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3553
diff changeset
1367 boolean debug = log.isDebugEnabled();
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
1368
7245
965dbf2d4c44 Code simplification + moved code out of inner loop.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7244
diff changeset
1369 List<Output> generated = new ArrayList<Output>();
965dbf2d4c44 Code simplification + moved code out of inner loop.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7244
diff changeset
1370
965dbf2d4c44 Code simplification + moved code out of inner loop.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7244
diff changeset
1371 if (debug) {
965dbf2d4c44 Code simplification + moved code out of inner loop.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7244
diff changeset
1372 log.debug("generateOutputs for Artifact " + getName() + " "
965dbf2d4c44 Code simplification + moved code out of inner loop.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7244
diff changeset
1373 + identifier());
965dbf2d4c44 Code simplification + moved code out of inner loop.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7244
diff changeset
1374 }
965dbf2d4c44 Code simplification + moved code out of inner loop.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7244
diff changeset
1375
7593
60a5fc522ec4 Rename the Global Facet filter to reduce ambiguity with the old facet filter
Andre Heinecke <aheinecke@intevation.de>
parents: 7245
diff changeset
1376 boolean useFacetFilter = usesOutputGlobalFacetFilter();
7245
965dbf2d4c44 Code simplification + moved code out of inner loop.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7244
diff changeset
1377
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
1378 for (Output out: list) {
7245
965dbf2d4c44 Code simplification + moved code out of inner loop.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7244
diff changeset
1379 if (debug) {
965dbf2d4c44 Code simplification + moved code out of inner loop.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7244
diff changeset
1380 log.debug("check facets for output: " + out.getName());
965dbf2d4c44 Code simplification + moved code out of inner loop.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7244
diff changeset
1381 }
7178
12248d9eb326 Only filter the facets for unbound outs
Andre Heinecke <aheinecke@intevation.de>
parents: 6856
diff changeset
1382 String outName = out.getName();
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
1383 Output o = new DefaultOutput(
7178
12248d9eb326 Only filter the facets for unbound outs
Andre Heinecke <aheinecke@intevation.de>
parents: 6856
diff changeset
1384 outName,
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
1385 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
1386 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
1387 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
1388
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
1389 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
1390
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
1391 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
1392 if (outTypes.add(f.getName()) && debug) {
3554
9b356ed24411 FLYSArtifact: Lowered logging output level from info to debug. Made some more debug outputs conditional.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3553
diff changeset
1393 log.debug("configured facet " + f);
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
1394 }
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
1395 }
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
1396
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
1397 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
1398 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
1399 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
1400
7178
12248d9eb326 Only filter the facets for unbound outs
Andre Heinecke <aheinecke@intevation.de>
parents: 6856
diff changeset
1401 /* Match the facets to the output configuration.
7244
737dd43e32d6 Remove boundToOut facet pass. This is now only done if we filtered before.
Andre Heinecke <aheinecke@intevation.de>
parents: 7227
diff changeset
1402 * This is only done when we are not using the Output
737dd43e32d6 Remove boundToOut facet pass. This is now only done if we filtered before.
Andre Heinecke <aheinecke@intevation.de>
parents: 7227
diff changeset
1403 * we are bound to to determine the compatible facets. */
7245
965dbf2d4c44 Code simplification + moved code out of inner loop.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7244
diff changeset
1404 if (useFacetFilter || outTypes.contains(type)) {
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
1405 if (debug) {
3554
9b356ed24411 FLYSArtifact: Lowered logging output level from info to debug. Made some more debug outputs conditional.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3553
diff changeset
1406 log.debug("Add facet " + f);
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
1407 }
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
1408 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
1409 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
1410 }
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
1411 }
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
1412
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
1413 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
1414 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
1415 }
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
1416 }
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
1417
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
1418 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
1419 }
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
1420
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
1421
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
1422 /**
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
1423 * 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
1424 * 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
1425 * 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
1426 *
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
1427 * @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
1428 */
705
853dceead0f4 Only generate facets when needed.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 704
diff changeset
1429 public Object compute(
742
c09c9e05ecfa Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 741
diff changeset
1430 CallContext context,
c09c9e05ecfa Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 741
diff changeset
1431 ComputeType type,
705
853dceead0f4 Only generate facets when needed.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 704
diff changeset
1432 boolean generateFacets
853dceead0f4 Only generate facets when needed.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 704
diff changeset
1433 ) {
853dceead0f4 Only generate facets when needed.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 704
diff changeset
1434 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
1435 }
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
1436
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
1437
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
1438 /**
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
1439 * Dispatches computation requests to the current state which needs to
5867
59ff03ff48f1 River artifacts: Renamed FLYSArtifact(Collection) to D4EArtifact(Collection).
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5866
diff changeset
1440 * implement a createComputeCallback(String hash, D4EArtifact artifact)
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
1441 * 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
1442 *
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
1443 * @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
1444 * @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
1445 * 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
1446 *
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
1447 * @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
1448 */
705
853dceead0f4 Only generate facets when needed.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 704
diff changeset
1449 public Object compute(
853dceead0f4 Only generate facets when needed.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 704
diff changeset
1450 CallContext context,
853dceead0f4 Only generate facets when needed.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 704
diff changeset
1451 String hash,
742
c09c9e05ecfa Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 741
diff changeset
1452 ComputeType type,
705
853dceead0f4 Only generate facets when needed.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 704
diff changeset
1453 boolean generateFacets
853dceead0f4 Only generate facets when needed.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 704
diff changeset
1454 ) {
693
af393c5eb2c8 Write computed facets into artifacts describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 692
diff changeset
1455 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
1456 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
1457 }
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
1458
1704
e8627d1e2db6 Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1656
diff changeset
1459
e8627d1e2db6 Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1656
diff changeset
1460 /**
7676
da412a6c4f39 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7593
diff changeset
1461 * Like compute, but identify State by its id (string).
1704
e8627d1e2db6 Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1656
diff changeset
1462 */
722
4800230fba8a Improved situtation on rendering "Abflusskurve am Pegel". Not fully working, yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 708
diff changeset
1463 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
1464 CallContext context,
1117
ea80e652f033 Reordered some parameters in a FLYSArtifact method.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1094
diff changeset
1465 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
1466 String stateID,
742
c09c9e05ecfa Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 741
diff changeset
1467 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
1468 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
1469 ) {
2141
79a94c4171cb Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2128
diff changeset
1470 DefaultState current =
79a94c4171cb Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2128
diff changeset
1471 (stateID == null)
722
4800230fba8a Improved situtation on rendering "Abflusskurve am Pegel". Not fully working, yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 708
diff changeset
1472 ? (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
1473 : (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
1474
4800230fba8a Improved situtation on rendering "Abflusskurve am Pegel". Not fully working, yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 708
diff changeset
1475 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
1476 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
1477 }
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
1478
705
853dceead0f4 Only generate facets when needed.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 704
diff changeset
1479 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
1480 }
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
1481
1137
073c36bb94ed Minor cosmetics
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1117
diff changeset
1482
073c36bb94ed Minor cosmetics
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1117
diff changeset
1483 /**
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
1484 * 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
1485 *
1137
073c36bb94ed Minor cosmetics
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1117
diff changeset
1486 * @param key key of state
073c36bb94ed Minor cosmetics
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1117
diff changeset
1487 * @param state state
073c36bb94ed Minor cosmetics
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1117
diff changeset
1488 * @param type Type of compute
073c36bb94ed Minor cosmetics
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1117
diff changeset
1489 * @param generateFacets Whether new facets shall be generated.
073c36bb94ed Minor cosmetics
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1117
diff changeset
1490 */
690
3481cd37e609 Use enums to dispatch computeFeed() and computeAdvance().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 689
diff changeset
1491 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
1492 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
1493 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
1494 DefaultState state,
705
853dceead0f4 Only generate facets when needed.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 704
diff changeset
1495 ComputeType type,
853dceead0f4 Only generate facets when needed.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 704
diff changeset
1496 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
1497 ) {
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
1498 String stateID = state.getID();
691
2600aa2c7319 Store facets for each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 690
diff changeset
1499
1137
073c36bb94ed Minor cosmetics
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1117
diff changeset
1500 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
1501
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
1502 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
1503 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
1504
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
1505 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
1506
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
1507 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
1508 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
1509 if (element != null) {
3554
9b356ed24411 FLYSArtifact: Lowered logging output level from info to debug. Made some more debug outputs conditional.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3553
diff changeset
1510 log.debug("Got computation result from cache.");
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
1511 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
1512 }
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
1513 }
3203
1b9f791937c3 Moved FixationArtifactAccess to new access package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3193
diff changeset
1514 else {
3554
9b356ed24411 FLYSArtifact: Lowered logging output level from info to debug. Made some more debug outputs conditional.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3553
diff changeset
1515 log.debug("cache not configured.");
3203
1b9f791937c3 Moved FixationArtifactAccess to new access package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3193
diff changeset
1516 }
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
1517
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
1518 Object res;
690
3481cd37e609 Use enums to dispatch computeFeed() and computeAdvance().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 689
diff changeset
1519 switch (type) {
3481cd37e609 Use enums to dispatch computeFeed() and computeAdvance().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 689
diff changeset
1520 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
1521 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
1522 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
1523 case ADVANCE:
700
94f0f91be11c call computeAdvance() if we want to advance.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 699
diff changeset
1524 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
1525 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
1526 case INIT:
958
ae198bef4ba0 Added configurations for river WMSe (currently for Saar, Mosel, Elbe).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 952
diff changeset
1527 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
1528 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
1529 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
1530 }
690
3481cd37e609 Use enums to dispatch computeFeed() and computeAdvance().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 689
diff changeset
1531
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
1532 if (cache != null && old != res && res != null) {
3554
9b356ed24411 FLYSArtifact: Lowered logging output level from info to debug. Made some more debug outputs conditional.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3553
diff changeset
1533 log.debug("Store computation result to cache.");
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
1534 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
1535 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
1536 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
1537 }
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
1538
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
1539 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
1540 }
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
1541 finally {
705
853dceead0f4 Only generate facets when needed.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 704
diff changeset
1542 if (generateFacets) {
853dceead0f4 Only generate facets when needed.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 704
diff changeset
1543 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
1544 facets.remove(stateID);
705
853dceead0f4 Only generate facets when needed.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 704
diff changeset
1545 }
853dceead0f4 Only generate facets when needed.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 704
diff changeset
1546 else {
3934
33fcc786f246 Add FLYSArtifact addFacets method
Bjoern Ricks <bjoern.ricks@intevation.de>
parents: 3920
diff changeset
1547 addFacets(stateID, fs);
705
853dceead0f4 Only generate facets when needed.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 704
diff changeset
1548 }
690
3481cd37e609 Use enums to dispatch computeFeed() and computeAdvance().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 689
diff changeset
1549 }
686
3dc61e00385e Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 661
diff changeset
1550 }
3dc61e00385e Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 661
diff changeset
1551 }
3dc61e00385e Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 661
diff changeset
1552
3934
33fcc786f246 Add FLYSArtifact addFacets method
Bjoern Ricks <bjoern.ricks@intevation.de>
parents: 3920
diff changeset
1553 /**
7676
da412a6c4f39 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7593
diff changeset
1554 * Sets the facets for an ID, which is normally a state ID.
3934
33fcc786f246 Add FLYSArtifact addFacets method
Bjoern Ricks <bjoern.ricks@intevation.de>
parents: 3920
diff changeset
1555 *
33fcc786f246 Add FLYSArtifact addFacets method
Bjoern Ricks <bjoern.ricks@intevation.de>
parents: 3920
diff changeset
1556 * @param id ID to map the facets to
33fcc786f246 Add FLYSArtifact addFacets method
Bjoern Ricks <bjoern.ricks@intevation.de>
parents: 3920
diff changeset
1557 * @param facets List of facets to be stored
33fcc786f246 Add FLYSArtifact addFacets method
Bjoern Ricks <bjoern.ricks@intevation.de>
parents: 3920
diff changeset
1558 */
33fcc786f246 Add FLYSArtifact addFacets method
Bjoern Ricks <bjoern.ricks@intevation.de>
parents: 3920
diff changeset
1559 protected void addFacets(String id, List<Facet> facets) {
6140
60b94dec104b Add handling of bound artifacts.
Andre Heinecke <aheinecke@intevation.de>
parents: 5994
diff changeset
1560 for (Facet fac : facets) {
60b94dec104b Add handling of bound artifacts.
Andre Heinecke <aheinecke@intevation.de>
parents: 5994
diff changeset
1561 fac.setBoundToOut(getBoundToOut());
60b94dec104b Add handling of bound artifacts.
Andre Heinecke <aheinecke@intevation.de>
parents: 5994
diff changeset
1562 }
3934
33fcc786f246 Add FLYSArtifact addFacets method
Bjoern Ricks <bjoern.ricks@intevation.de>
parents: 3920
diff changeset
1563 this.facets.put(id, facets);
33fcc786f246 Add FLYSArtifact addFacets method
Bjoern Ricks <bjoern.ricks@intevation.de>
parents: 3920
diff changeset
1564 }
33fcc786f246 Add FLYSArtifact addFacets method
Bjoern Ricks <bjoern.ricks@intevation.de>
parents: 3920
diff changeset
1565
686
3dc61e00385e Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 661
diff changeset
1566
623
aa64fe4df8ab Added a method to dump the artifacts state/data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 459
diff changeset
1567 /**
aa64fe4df8ab Added a method to dump the artifacts state/data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 459
diff changeset
1568 * 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
1569 */
6856
fbbba09ac6a8 Make debug functions of D4EArtifact public
Andre Heinecke <aheinecke@intevation.de>
parents: 6144
diff changeset
1570 public void dumpArtifact() {
3554
9b356ed24411 FLYSArtifact: Lowered logging output level from info to debug. Made some more debug outputs conditional.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3553
diff changeset
1571 log.debug("++++++++++++++ DUMP ARTIFACT DATA +++++++++++++++++");
9b356ed24411 FLYSArtifact: Lowered logging output level from info to debug. Made some more debug outputs conditional.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3553
diff changeset
1572 // Include uuid, type, name
4495
c095eb67c975 Improve loggin in FLYSArtifact
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4433
diff changeset
1573 log.debug(" - Name: " + getName());
c095eb67c975 Improve loggin in FLYSArtifact
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4433
diff changeset
1574 log.debug(" - UUID: " + identifier());
6140
60b94dec104b Add handling of bound artifacts.
Andre Heinecke <aheinecke@intevation.de>
parents: 5994
diff changeset
1575 log.debug(" - Class: " + getClass().getName());
60b94dec104b Add handling of bound artifacts.
Andre Heinecke <aheinecke@intevation.de>
parents: 5994
diff changeset
1576 log.debug(" - BoundToOut: " + getBoundToOut());
623
aa64fe4df8ab Added a method to dump the artifacts state/data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 459
diff changeset
1577
3554
9b356ed24411 FLYSArtifact: Lowered logging output level from info to debug. Made some more debug outputs conditional.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3553
diff changeset
1578 log.debug("------ DUMP DATA ------");
9b356ed24411 FLYSArtifact: Lowered logging output level from info to debug. Made some more debug outputs conditional.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3553
diff changeset
1579 Collection<StateData> allData = data.values();
623
aa64fe4df8ab Added a method to dump the artifacts state/data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 459
diff changeset
1580
3554
9b356ed24411 FLYSArtifact: Lowered logging output level from info to debug. Made some more debug outputs conditional.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3553
diff changeset
1581 for (StateData d: allData) {
9b356ed24411 FLYSArtifact: Lowered logging output level from info to debug. Made some more debug outputs conditional.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3553
diff changeset
1582 String name = d.getName();
9b356ed24411 FLYSArtifact: Lowered logging output level from info to debug. Made some more debug outputs conditional.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3553
diff changeset
1583 String value = (String) d.getValue();
623
aa64fe4df8ab Added a method to dump the artifacts state/data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 459
diff changeset
1584
3554
9b356ed24411 FLYSArtifact: Lowered logging output level from info to debug. Made some more debug outputs conditional.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3553
diff changeset
1585 log.debug("- " + name + ": " + value);
9b356ed24411 FLYSArtifact: Lowered logging output level from info to debug. Made some more debug outputs conditional.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3553
diff changeset
1586 }
2095
8cb679d4ec49 Implemented initialize() in FloodMapState to enable cloning floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2093
diff changeset
1587
3554
9b356ed24411 FLYSArtifact: Lowered logging output level from info to debug. Made some more debug outputs conditional.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3553
diff changeset
1588 log.debug("------ DUMP PREVIOUS STATES ------");
9b356ed24411 FLYSArtifact: Lowered logging output level from info to debug. Made some more debug outputs conditional.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3553
diff changeset
1589 List<String> stateIds = getPreviousStateIds();
9b356ed24411 FLYSArtifact: Lowered logging output level from info to debug. Made some more debug outputs conditional.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3553
diff changeset
1590
9b356ed24411 FLYSArtifact: Lowered logging output level from info to debug. Made some more debug outputs conditional.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3553
diff changeset
1591 for (String id: stateIds) {
9b356ed24411 FLYSArtifact: Lowered logging output level from info to debug. Made some more debug outputs conditional.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3553
diff changeset
1592 log.debug("- State: " + id);
623
aa64fe4df8ab Added a method to dump the artifacts state/data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 459
diff changeset
1593 }
3554
9b356ed24411 FLYSArtifact: Lowered logging output level from info to debug. Made some more debug outputs conditional.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3553
diff changeset
1594
9b356ed24411 FLYSArtifact: Lowered logging output level from info to debug. Made some more debug outputs conditional.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3553
diff changeset
1595 log.debug("CURRENT STATE: " + getCurrentStateId());
9b356ed24411 FLYSArtifact: Lowered logging output level from info to debug. Made some more debug outputs conditional.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3553
diff changeset
1596
9b356ed24411 FLYSArtifact: Lowered logging output level from info to debug. Made some more debug outputs conditional.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3553
diff changeset
1597 debugFacets();
9b356ed24411 FLYSArtifact: Lowered logging output level from info to debug. Made some more debug outputs conditional.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3553
diff changeset
1598 dumpFilterFacets();
9b356ed24411 FLYSArtifact: Lowered logging output level from info to debug. Made some more debug outputs conditional.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3553
diff changeset
1599
9b356ed24411 FLYSArtifact: Lowered logging output level from info to debug. Made some more debug outputs conditional.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3553
diff changeset
1600 log.debug("++++++++++++++ END ARTIFACT DUMP +++++++++++++++++");
623
aa64fe4df8ab Added a method to dump the artifacts state/data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 459
diff changeset
1601 }
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
1602
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
1603
6856
fbbba09ac6a8 Make debug functions of D4EArtifact public
Andre Heinecke <aheinecke@intevation.de>
parents: 6144
diff changeset
1604 public void debugFacets() {
3554
9b356ed24411 FLYSArtifact: Lowered logging output level from info to debug. Made some more debug outputs conditional.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3553
diff changeset
1605 log.debug("######### FACETS #########");
2095
8cb679d4ec49 Implemented initialize() in FloodMapState to enable cloning floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2093
diff changeset
1606
4050
975f608dd254 Cleaned up iterating over maps. Removed some dead code.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 3934
diff changeset
1607 for (Map.Entry<String, List<Facet>> entry: facets.entrySet()) {
2095
8cb679d4ec49 Implemented initialize() in FloodMapState to enable cloning floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2093
diff changeset
1608 String out = entry.getKey();
8cb679d4ec49 Implemented initialize() in FloodMapState to enable cloning floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2093
diff changeset
1609 List<Facet> fs = entry.getValue();
8cb679d4ec49 Implemented initialize() in FloodMapState to enable cloning floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2093
diff changeset
1610 for (Facet f: fs) {
3554
9b356ed24411 FLYSArtifact: Lowered logging output level from info to debug. Made some more debug outputs conditional.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3553
diff changeset
1611 log.debug(" # " + out + " : " + f.getName());
6140
60b94dec104b Add handling of bound artifacts.
Andre Heinecke <aheinecke@intevation.de>
parents: 5994
diff changeset
1612 log.debug(" # boundToOut : " + f.getBoundToOut());
2095
8cb679d4ec49 Implemented initialize() in FloodMapState to enable cloning floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2093
diff changeset
1613 }
8cb679d4ec49 Implemented initialize() in FloodMapState to enable cloning floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2093
diff changeset
1614 }
8cb679d4ec49 Implemented initialize() in FloodMapState to enable cloning floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2093
diff changeset
1615
3554
9b356ed24411 FLYSArtifact: Lowered logging output level from info to debug. Made some more debug outputs conditional.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3553
diff changeset
1616 log.debug("######## FACETS END ########");
2095
8cb679d4ec49 Implemented initialize() in FloodMapState to enable cloning floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2093
diff changeset
1617 }
8cb679d4ec49 Implemented initialize() in FloodMapState to enable cloning floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2093
diff changeset
1618
8cb679d4ec49 Implemented initialize() in FloodMapState to enable cloning floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2093
diff changeset
1619
6856
fbbba09ac6a8 Make debug functions of D4EArtifact public
Andre Heinecke <aheinecke@intevation.de>
parents: 6144
diff changeset
1620 public void dumpFilterFacets() {
3554
9b356ed24411 FLYSArtifact: Lowered logging output level from info to debug. Made some more debug outputs conditional.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3553
diff changeset
1621 log.debug("######## FILTER FACETS ########");
2095
8cb679d4ec49 Implemented initialize() in FloodMapState to enable cloning floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2093
diff changeset
1622
8cb679d4ec49 Implemented initialize() in FloodMapState to enable cloning floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2093
diff changeset
1623 if (filterFacets == null || filterFacets.isEmpty()) {
3554
9b356ed24411 FLYSArtifact: Lowered logging output level from info to debug. Made some more debug outputs conditional.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3553
diff changeset
1624 log.debug("No Filter Facets defined.");
2095
8cb679d4ec49 Implemented initialize() in FloodMapState to enable cloning floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2093
diff changeset
1625 return;
8cb679d4ec49 Implemented initialize() in FloodMapState to enable cloning floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2093
diff changeset
1626 }
8cb679d4ec49 Implemented initialize() in FloodMapState to enable cloning floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2093
diff changeset
1627
4050
975f608dd254 Cleaned up iterating over maps. Removed some dead code.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 3934
diff changeset
1628 for (Map.Entry<String, List<Facet>> entry: filterFacets.entrySet()) {
2095
8cb679d4ec49 Implemented initialize() in FloodMapState to enable cloning floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2093
diff changeset
1629 String out = entry.getKey();
8cb679d4ec49 Implemented initialize() in FloodMapState to enable cloning floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2093
diff changeset
1630 List<Facet> filters = entry.getValue();
8cb679d4ec49 Implemented initialize() in FloodMapState to enable cloning floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2093
diff changeset
1631
7746
56001dce01dd Upcoming issue1532: Extracted method where 'cloning/initialize' takes place.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7676
diff changeset
1632 log.debug("There are " + filters.size() + " filters for: " + out);
2095
8cb679d4ec49 Implemented initialize() in FloodMapState to enable cloning floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2093
diff changeset
1633
8cb679d4ec49 Implemented initialize() in FloodMapState to enable cloning floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2093
diff changeset
1634 for (Facet filter: filters) {
3554
9b356ed24411 FLYSArtifact: Lowered logging output level from info to debug. Made some more debug outputs conditional.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3553
diff changeset
1635 log.debug(" filter: " + filter.getName());
2095
8cb679d4ec49 Implemented initialize() in FloodMapState to enable cloning floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2093
diff changeset
1636 }
8cb679d4ec49 Implemented initialize() in FloodMapState to enable cloning floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2093
diff changeset
1637 }
8cb679d4ec49 Implemented initialize() in FloodMapState to enable cloning floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2093
diff changeset
1638
3554
9b356ed24411 FLYSArtifact: Lowered logging output level from info to debug. Made some more debug outputs conditional.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3553
diff changeset
1639 log.debug("######## FILTER FACETS END ########");
2095
8cb679d4ec49 Implemented initialize() in FloodMapState to enable cloning floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2093
diff changeset
1640 }
8cb679d4ec49 Implemented initialize() in FloodMapState to enable cloning floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2093
diff changeset
1641
8cb679d4ec49 Implemented initialize() in FloodMapState to enable cloning floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2093
diff changeset
1642
4206
6b0683f5c530 Documentation added, cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4147
diff changeset
1643 /** Destroy and clean up state with given id. */
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
1644 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
1645 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
1646 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
1647 }
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
1648
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
1649
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
1650 /**
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
1651 * 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
1652 *
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
1653 * @param ids The State IDs that should be destroyed.
5866
9a6741ccf6d4 FLYS artifacts: Renamed FLYSContext(Factory) to RiverContext(Factory).
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5865
diff changeset
1654 * @param context The RiverContext.
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
1655 */
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
1656 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
1657 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
1658 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
1659 }
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
1660 }
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
1661
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
1662
1763
0e748e8972b5 Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1724
diff changeset
1663 /**
0e748e8972b5 Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1724
diff changeset
1664 * Destroy the states.
0e748e8972b5 Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1724
diff changeset
1665 */
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
1666 @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
1667 public void endOfLife(Object context) {
3554
9b356ed24411 FLYSArtifact: Lowered logging output level from info to debug. Made some more debug outputs conditional.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3553
diff changeset
1668 if (log.isDebugEnabled()) {
5867
59ff03ff48f1 River artifacts: Renamed FLYSArtifact(Collection) to D4EArtifact(Collection).
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5866
diff changeset
1669 log.debug("D4EArtifact.endOfLife: " + identifier());
3436
0d63581c5df1 FLYSArtifact: Prevent NPE in getOutputForState(). Why does this happen?
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3306
diff changeset
1670 }
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
1671
2606
619f6dfec901 #460 Fixed duplicated Outputs in DESCRIBE documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2205
diff changeset
1672 ArrayList<String> ids = (ArrayList<String>) getPreviousStateIds();
619f6dfec901 #460 Fixed duplicated Outputs in DESCRIBE documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2205
diff changeset
1673 ArrayList<String> toDestroy = (ArrayList<String>) ids.clone();
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
1674
2606
619f6dfec901 #460 Fixed duplicated Outputs in DESCRIBE documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2205
diff changeset
1675 toDestroy.add(getCurrentStateId());
619f6dfec901 #460 Fixed duplicated Outputs in DESCRIBE documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2205
diff changeset
1676
619f6dfec901 #460 Fixed duplicated Outputs in DESCRIBE documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2205
diff changeset
1677 destroyStates(toDestroy, 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
1678 }
4496
d8992459b408 Add method to return the facets of an artifact
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4495
diff changeset
1679
d8992459b408 Add method to return the facets of an artifact
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4495
diff changeset
1680 /**
7676
da412a6c4f39 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7593
diff changeset
1681 * Return the Facets which a state provides.
4496
d8992459b408 Add method to return the facets of an artifact
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4495
diff changeset
1682 * @param stateid String that identifies the state
d8992459b408 Add method to return the facets of an artifact
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4495
diff changeset
1683 * @return List of Facets belonging to the state identifier
d8992459b408 Add method to return the facets of an artifact
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4495
diff changeset
1684 */
d8992459b408 Add method to return the facets of an artifact
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4495
diff changeset
1685 protected List<Facet> getFacets(String stateid) {
6140
60b94dec104b Add handling of bound artifacts.
Andre Heinecke <aheinecke@intevation.de>
parents: 5994
diff changeset
1686 return facets.get(stateid);
4496
d8992459b408 Add method to return the facets of an artifact
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4495
diff changeset
1687 }
5975
95b9e40bbad0 Add handling for OUT id's parameter to D4EArtifact
Andre Heinecke <aheinecke@intevation.de>
parents: 5867
diff changeset
1688
95b9e40bbad0 Add handling for OUT id's parameter to D4EArtifact
Andre Heinecke <aheinecke@intevation.de>
parents: 5867
diff changeset
1689 public String getBoundToOut() {
95b9e40bbad0 Add handling for OUT id's parameter to D4EArtifact
Andre Heinecke <aheinecke@intevation.de>
parents: 5867
diff changeset
1690 return boundToOut;
95b9e40bbad0 Add handling for OUT id's parameter to D4EArtifact
Andre Heinecke <aheinecke@intevation.de>
parents: 5867
diff changeset
1691 }
6140
60b94dec104b Add handling of bound artifacts.
Andre Heinecke <aheinecke@intevation.de>
parents: 5994
diff changeset
1692
60b94dec104b Add handling of bound artifacts.
Andre Heinecke <aheinecke@intevation.de>
parents: 5994
diff changeset
1693 /**
7676
da412a6c4f39 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7593
diff changeset
1694 * Binds this artifact and all its facet to an out.
6140
60b94dec104b Add handling of bound artifacts.
Andre Heinecke <aheinecke@intevation.de>
parents: 5994
diff changeset
1695 */
60b94dec104b Add handling of bound artifacts.
Andre Heinecke <aheinecke@intevation.de>
parents: 5994
diff changeset
1696 public void setBoundToOut(String out) {
60b94dec104b Add handling of bound artifacts.
Andre Heinecke <aheinecke@intevation.de>
parents: 5994
diff changeset
1697 boundToOut = out;
60b94dec104b Add handling of bound artifacts.
Andre Heinecke <aheinecke@intevation.de>
parents: 5994
diff changeset
1698 for (List<Facet> stateFacets: facets.values()) {
60b94dec104b Add handling of bound artifacts.
Andre Heinecke <aheinecke@intevation.de>
parents: 5994
diff changeset
1699 for (Facet fac: stateFacets) {
60b94dec104b Add handling of bound artifacts.
Andre Heinecke <aheinecke@intevation.de>
parents: 5994
diff changeset
1700 fac.setBoundToOut(out);
60b94dec104b Add handling of bound artifacts.
Andre Heinecke <aheinecke@intevation.de>
parents: 5994
diff changeset
1701 }
60b94dec104b Add handling of bound artifacts.
Andre Heinecke <aheinecke@intevation.de>
parents: 5994
diff changeset
1702 }
60b94dec104b Add handling of bound artifacts.
Andre Heinecke <aheinecke@intevation.de>
parents: 5994
diff changeset
1703 }
119
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
1704 }
84c0b151203e Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
1705 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org