Mercurial > dive4elements > river
annotate artifacts/src/main/java/org/dive4elements/river/artifacts/context/RiverContextFactory.java @ 9555:ef5754ba5573
Implemented legend aggregation based on type of themes.
Added theme-editor style configuration for aggregated legend entries.
Only configured themes get aggregated.
author | gernotbelger |
---|---|
date | Tue, 23 Oct 2018 16:26:48 +0200 |
parents | c26fb37899ca |
children |
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:
5867
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:
5867
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:
5152
diff
changeset
|
9 package org.dive4elements.river.artifacts.context; |
106
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
10 |
7099
24f153ad1f40
Use pre-converted diagram attributes now.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7074
diff
changeset
|
11 import java.io.File; |
106
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
12 import java.util.ArrayList; |
9555
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
13 import java.util.Collections; |
295
53c155bfde07
Added code to parse the configured OutGenerators in the global configuration and to save a map of such in the FLYSContext.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
130
diff
changeset
|
14 import java.util.HashMap; |
106
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
15 import java.util.List; |
295
53c155bfde07
Added code to parse the configured OutGenerators in the global configuration and to save a map of such in the FLYSContext.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
130
diff
changeset
|
16 import java.util.Map; |
106
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
17 |
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
18 import javax.xml.xpath.XPathConstants; |
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
19 |
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
20 import org.apache.log4j.Logger; |
7099
24f153ad1f40
Use pre-converted diagram attributes now.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7074
diff
changeset
|
21 import org.dive4elements.artifactdatabase.state.State; |
24f153ad1f40
Use pre-converted diagram attributes now.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7074
diff
changeset
|
22 import org.dive4elements.artifactdatabase.state.StateEngine; |
24f153ad1f40
Use pre-converted diagram attributes now.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7074
diff
changeset
|
23 import org.dive4elements.artifactdatabase.transition.Transition; |
24f153ad1f40
Use pre-converted diagram attributes now.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7074
diff
changeset
|
24 import org.dive4elements.artifactdatabase.transition.TransitionEngine; |
24f153ad1f40
Use pre-converted diagram attributes now.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7074
diff
changeset
|
25 import org.dive4elements.artifacts.ArtifactContextFactory; |
9555
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
26 import org.dive4elements.artifacts.ContextInjector; |
7099
24f153ad1f40
Use pre-converted diagram attributes now.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7074
diff
changeset
|
27 import org.dive4elements.artifacts.GlobalContext; |
24f153ad1f40
Use pre-converted diagram attributes now.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7074
diff
changeset
|
28 import org.dive4elements.artifacts.common.utils.Config; |
24f153ad1f40
Use pre-converted diagram attributes now.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7074
diff
changeset
|
29 import org.dive4elements.artifacts.common.utils.ElementConverter; |
24f153ad1f40
Use pre-converted diagram attributes now.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7074
diff
changeset
|
30 import org.dive4elements.artifacts.common.utils.XMLUtils; |
24f153ad1f40
Use pre-converted diagram attributes now.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7074
diff
changeset
|
31 import org.dive4elements.river.artifacts.model.Module; |
7756
cd04a7389389
Read rivers supported by a module from config file.
Raimund Renkert <rrenkert@intevation.de>
parents:
7227
diff
changeset
|
32 import org.dive4elements.river.artifacts.model.RiverFactory; |
7099
24f153ad1f40
Use pre-converted diagram attributes now.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7074
diff
changeset
|
33 import org.dive4elements.river.artifacts.model.ZoomScale; |
24f153ad1f40
Use pre-converted diagram attributes now.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7074
diff
changeset
|
34 import org.dive4elements.river.artifacts.states.StateFactory; |
24f153ad1f40
Use pre-converted diagram attributes now.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7074
diff
changeset
|
35 import org.dive4elements.river.artifacts.transitions.TransitionFactory; |
7226
8ab618dda850
Made lookup for generators a class of its own. First step to use it as a compat filter for facets, too.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7099
diff
changeset
|
36 import org.dive4elements.river.exports.GeneratorLookup; |
7099
24f153ad1f40
Use pre-converted diagram attributes now.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7074
diff
changeset
|
37 import org.dive4elements.river.exports.OutGenerator; |
7756
cd04a7389389
Read rivers supported by a module from config file.
Raimund Renkert <rrenkert@intevation.de>
parents:
7227
diff
changeset
|
38 import org.dive4elements.river.model.River; |
7099
24f153ad1f40
Use pre-converted diagram attributes now.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7074
diff
changeset
|
39 import org.dive4elements.river.themes.Theme; |
24f153ad1f40
Use pre-converted diagram attributes now.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7074
diff
changeset
|
40 import org.dive4elements.river.themes.ThemeFactory; |
24f153ad1f40
Use pre-converted diagram attributes now.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7074
diff
changeset
|
41 import org.dive4elements.river.themes.ThemeGroup; |
24f153ad1f40
Use pre-converted diagram attributes now.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7074
diff
changeset
|
42 import org.dive4elements.river.themes.ThemeMapping; |
106
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
43 import org.w3c.dom.Document; |
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
44 import org.w3c.dom.Element; |
295
53c155bfde07
Added code to parse the configured OutGenerators in the global configuration and to save a map of such in the FLYSContext.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
130
diff
changeset
|
45 import org.w3c.dom.Node; |
106
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
46 import org.w3c.dom.NodeList; |
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
47 |
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
48 /** |
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
49 * The ArtifactContextFactory is used to initialize basic components and put |
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
50 * them into the global context of the application. |
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
51 * |
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
52 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> |
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
53 */ |
5866
9a6741ccf6d4
FLYS artifacts: Renamed FLYSContext(Factory) to RiverContext(Factory).
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
54 public class RiverContextFactory implements ArtifactContextFactory { |
106
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
55 |
8202
e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents:
8157
diff
changeset
|
56 /** The log that is used in this class. */ |
e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents:
8157
diff
changeset
|
57 private static Logger log = Logger.getLogger(RiverContextFactory.class); |
106
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
58 |
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
59 /** The XPath to the artifacts configured in the configuration. */ |
9555
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
60 private static final String XPATH_ARTIFACTS = "/artifact-database/artifacts/artifact"; |
106
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
61 |
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
62 /** The XPath to the name of the artifact. */ |
9555
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
63 private static final String XPATH_ARTIFACT_NAME = "/artifact/@name"; |
106
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
64 |
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
65 /** The XPath to the xlink ref in an artifact configuration. */ |
9555
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
66 private static final String XPATH_XLINK = "xlink:href"; |
106
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
67 |
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
68 /** The XPath to the transitions configured in the artifact config. */ |
9555
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
69 private static final String XPATH_TRANSITIONS = "/artifact/states/transition"; |
106
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
70 |
107
a228b39494a9
Improved the bootstrap process - the states are initialized.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
106
diff
changeset
|
71 /** The XPath to the states configured in the artifact config. */ |
9555
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
72 private static final String XPATH_STATES = "/artifact/states/state"; |
2737
83b22ccf48da
Introduced theme groups and added new service to get themes filtered by name.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2141
diff
changeset
|
73 |
9555
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
74 private static final String XPATH_OUTPUT_GENERATORS = "/artifact-database/output-generators//output-generator"; |
345
88a669785863
Initialized the facet2theme mappings configured in themes.xml and added a function to the ThemeFactory that retrieves a theme from FLYSContext based on its name.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
341
diff
changeset
|
75 |
9555
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
76 private static final String XPATH_THEME_CONFIG = "/artifact-database/flys/themes/configuration/text()"; |
958
ae198bef4ba0
Added configurations for river WMSe (currently for Saar, Mosel, Elbe).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
939
diff
changeset
|
77 |
9555
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
78 private static final String XPATH_THEMES = "theme"; |
3630
28be160b5870
Add a module service. It's now possible to configure the modules which are
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
3256
diff
changeset
|
79 |
9555
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
80 private static final String XPATH_LEGEND_GROUP = "/themes/legendgroup"; |
4619
05c9902c761d
Added example config for river 'Elbe' and read the config in context factory.
Raimund Renkert <rrenkert@intevation.de>
parents:
4051
diff
changeset
|
81 |
9555
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
82 private static final String XPATH_THEME_GROUPS = "/themes/themegroup"; |
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
83 |
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
84 private static final String XPATH_THEME_MAPPINGS = "/themes/mappings/mapping"; |
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
85 |
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
86 private static final String XPATH_RIVER_WMS = "/artifact-database/floodmap/river"; |
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
87 |
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
88 private static final String XPATH_MODULES = "/artifact-database/modules/module"; |
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
89 |
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
90 private static final String XPATH_ZOOM_SCALES = "/artifact-database/options/zoom-scales/zoom-scale"; |
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
91 |
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
92 private static final String XPATH_DGM_PATH = "/artifact-database/options/dgm-path/text()"; |
5152
b26465581abf
Add a configurable path prefix to relative DGM path to allways have an absolute path.
Raimund Renkert <rrenkert@intevation.de>
parents:
4656
diff
changeset
|
93 |
6933
468d9ebda4ce
Datacage: Add dc:all-state-successors() to enable predicates like dc:contains(dc:all-state-successors($artifact-name, $current-state-id), 'state.winfo.calculation_mode') which recursively collects all successor state ids an check for containment.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5994
diff
changeset
|
94 private static GlobalContext GLOBAL_CONTEXT_INSTANCE; |
468d9ebda4ce
Datacage: Add dc:all-state-successors() to enable predicates like dc:contains(dc:all-state-successors($artifact-name, $current-state-id), 'state.winfo.calculation_mode') which recursively collects all successor state ids an check for containment.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5994
diff
changeset
|
95 |
106
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
96 /** |
5867
59ff03ff48f1
River artifacts: Renamed FLYSArtifact(Collection) to D4EArtifact(Collection).
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5866
diff
changeset
|
97 * Creates a new D4EArtifactContext object and initialize all |
106
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
98 * components required by the application. |
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
99 * |
9555
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
100 * @param config |
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
101 * The artifact server configuration. |
5867
59ff03ff48f1
River artifacts: Renamed FLYSArtifact(Collection) to D4EArtifact(Collection).
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5866
diff
changeset
|
102 * @return a D4EArtifactContext. |
106
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
103 */ |
4656
442fbb290fa8
Introduce river mapfile generation (WARNING: Changes in config xml files required!).
Christian Lins <christian.lins@intevation.de>
parents:
4629
diff
changeset
|
104 @Override |
9555
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
105 public GlobalContext createArtifactContext(final Document config) { |
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
106 final RiverContext context = new RiverContext(config); |
106
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
107 |
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
108 configureTransitions(config, context); |
107
a228b39494a9
Improved the bootstrap process - the states are initialized.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
106
diff
changeset
|
109 configureStates(config, context); |
295
53c155bfde07
Added code to parse the configured OutGenerators in the global configuration and to save a map of such in the FLYSContext.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
130
diff
changeset
|
110 configureOutGenerators(config, context); |
341
eca7892bf8ff
Added a first small theme configuration and code to read it.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
295
diff
changeset
|
111 configureThemes(config, context); |
345
88a669785863
Initialized the facet2theme mappings configured in themes.xml and added a function to the ThemeFactory that retrieves a theme from FLYSContext based on its name.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
341
diff
changeset
|
112 configureThemesMappings(config, context); |
9555
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
113 configureLegend(config, context); |
4656
442fbb290fa8
Introduce river mapfile generation (WARNING: Changes in config xml files required!).
Christian Lins <christian.lins@intevation.de>
parents:
4629
diff
changeset
|
114 configureFloodmapWMS(config, context); |
3630
28be160b5870
Add a module service. It's now possible to configure the modules which are
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
3256
diff
changeset
|
115 configureModules(config, context); |
4619
05c9902c761d
Added example config for river 'Elbe' and read the config in context factory.
Raimund Renkert <rrenkert@intevation.de>
parents:
4051
diff
changeset
|
116 configureZoomScales(config, context); |
5152
b26465581abf
Add a configurable path prefix to relative DGM path to allways have an absolute path.
Raimund Renkert <rrenkert@intevation.de>
parents:
4656
diff
changeset
|
117 configureDGMPath(config, context); |
106
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
118 |
6933
468d9ebda4ce
Datacage: Add dc:all-state-successors() to enable predicates like dc:contains(dc:all-state-successors($artifact-name, $current-state-id), 'state.winfo.calculation_mode') which recursively collects all successor state ids an check for containment.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5994
diff
changeset
|
119 synchronized (RiverContextFactory.class) { |
468d9ebda4ce
Datacage: Add dc:all-state-successors() to enable predicates like dc:contains(dc:all-state-successors($artifact-name, $current-state-id), 'state.winfo.calculation_mode') which recursively collects all successor state ids an check for containment.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5994
diff
changeset
|
120 GLOBAL_CONTEXT_INSTANCE = context; |
468d9ebda4ce
Datacage: Add dc:all-state-successors() to enable predicates like dc:contains(dc:all-state-successors($artifact-name, $current-state-id), 'state.winfo.calculation_mode') which recursively collects all successor state ids an check for containment.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5994
diff
changeset
|
121 } |
468d9ebda4ce
Datacage: Add dc:all-state-successors() to enable predicates like dc:contains(dc:all-state-successors($artifact-name, $current-state-id), 'state.winfo.calculation_mode') which recursively collects all successor state ids an check for containment.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5994
diff
changeset
|
122 |
106
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
123 return context; |
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
124 } |
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
125 |
6933
468d9ebda4ce
Datacage: Add dc:all-state-successors() to enable predicates like dc:contains(dc:all-state-successors($artifact-name, $current-state-id), 'state.winfo.calculation_mode') which recursively collects all successor state ids an check for containment.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5994
diff
changeset
|
126 public static synchronized GlobalContext getGlobalContext() { |
468d9ebda4ce
Datacage: Add dc:all-state-successors() to enable predicates like dc:contains(dc:all-state-successors($artifact-name, $current-state-id), 'state.winfo.calculation_mode') which recursively collects all successor state ids an check for containment.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5994
diff
changeset
|
127 return GLOBAL_CONTEXT_INSTANCE; |
468d9ebda4ce
Datacage: Add dc:all-state-successors() to enable predicates like dc:contains(dc:all-state-successors($artifact-name, $current-state-id), 'state.winfo.calculation_mode') which recursively collects all successor state ids an check for containment.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5994
diff
changeset
|
128 } |
468d9ebda4ce
Datacage: Add dc:all-state-successors() to enable predicates like dc:contains(dc:all-state-successors($artifact-name, $current-state-id), 'state.winfo.calculation_mode') which recursively collects all successor state ids an check for containment.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5994
diff
changeset
|
129 |
9555
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
130 private void configureDGMPath(final Document config, final RiverContext context) { |
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
131 final String dgmPath = (String) XMLUtils.xpath(config, XPATH_DGM_PATH, XPathConstants.STRING); |
5152
b26465581abf
Add a configurable path prefix to relative DGM path to allways have an absolute path.
Raimund Renkert <rrenkert@intevation.de>
parents:
4656
diff
changeset
|
132 |
b26465581abf
Add a configurable path prefix to relative DGM path to allways have an absolute path.
Raimund Renkert <rrenkert@intevation.de>
parents:
4656
diff
changeset
|
133 context.put("dgm-path", dgmPath); |
b26465581abf
Add a configurable path prefix to relative DGM path to allways have an absolute path.
Raimund Renkert <rrenkert@intevation.de>
parents:
4656
diff
changeset
|
134 } |
b26465581abf
Add a configurable path prefix to relative DGM path to allways have an absolute path.
Raimund Renkert <rrenkert@intevation.de>
parents:
4656
diff
changeset
|
135 |
9555
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
136 private void configureZoomScales(final Document config, final RiverContext context) { |
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
137 final NodeList list = (NodeList) XMLUtils.xpath(config, XPATH_ZOOM_SCALES, XPathConstants.NODESET); |
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
138 final ZoomScale scale = new ZoomScale(); |
4619
05c9902c761d
Added example config for river 'Elbe' and read the config in context factory.
Raimund Renkert <rrenkert@intevation.de>
parents:
4051
diff
changeset
|
139 for (int i = 0; i < list.getLength(); i++) { |
9555
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
140 final Element element = (Element) list.item(i); |
4619
05c9902c761d
Added example config for river 'Elbe' and read the config in context factory.
Raimund Renkert <rrenkert@intevation.de>
parents:
4051
diff
changeset
|
141 String river = "default"; |
05c9902c761d
Added example config for river 'Elbe' and read the config in context factory.
Raimund Renkert <rrenkert@intevation.de>
parents:
4051
diff
changeset
|
142 double range = 0d; |
05c9902c761d
Added example config for river 'Elbe' and read the config in context factory.
Raimund Renkert <rrenkert@intevation.de>
parents:
4051
diff
changeset
|
143 double radius = 10d; |
05c9902c761d
Added example config for river 'Elbe' and read the config in context factory.
Raimund Renkert <rrenkert@intevation.de>
parents:
4051
diff
changeset
|
144 if (element.hasAttribute("river")) { |
05c9902c761d
Added example config for river 'Elbe' and read the config in context factory.
Raimund Renkert <rrenkert@intevation.de>
parents:
4051
diff
changeset
|
145 river = element.getAttribute("river"); |
05c9902c761d
Added example config for river 'Elbe' and read the config in context factory.
Raimund Renkert <rrenkert@intevation.de>
parents:
4051
diff
changeset
|
146 } |
05c9902c761d
Added example config for river 'Elbe' and read the config in context factory.
Raimund Renkert <rrenkert@intevation.de>
parents:
4051
diff
changeset
|
147 if (!element.hasAttribute("range")) { |
05c9902c761d
Added example config for river 'Elbe' and read the config in context factory.
Raimund Renkert <rrenkert@intevation.de>
parents:
4051
diff
changeset
|
148 continue; |
9555
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
149 } else { |
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
150 final String r = element.getAttribute("range"); |
4619
05c9902c761d
Added example config for river 'Elbe' and read the config in context factory.
Raimund Renkert <rrenkert@intevation.de>
parents:
4051
diff
changeset
|
151 try { |
05c9902c761d
Added example config for river 'Elbe' and read the config in context factory.
Raimund Renkert <rrenkert@intevation.de>
parents:
4051
diff
changeset
|
152 range = Double.parseDouble(r); |
05c9902c761d
Added example config for river 'Elbe' and read the config in context factory.
Raimund Renkert <rrenkert@intevation.de>
parents:
4051
diff
changeset
|
153 } |
9555
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
154 catch (final NumberFormatException nfe) { |
4619
05c9902c761d
Added example config for river 'Elbe' and read the config in context factory.
Raimund Renkert <rrenkert@intevation.de>
parents:
4051
diff
changeset
|
155 continue; |
05c9902c761d
Added example config for river 'Elbe' and read the config in context factory.
Raimund Renkert <rrenkert@intevation.de>
parents:
4051
diff
changeset
|
156 } |
05c9902c761d
Added example config for river 'Elbe' and read the config in context factory.
Raimund Renkert <rrenkert@intevation.de>
parents:
4051
diff
changeset
|
157 } |
05c9902c761d
Added example config for river 'Elbe' and read the config in context factory.
Raimund Renkert <rrenkert@intevation.de>
parents:
4051
diff
changeset
|
158 if (!element.hasAttribute("radius")) { |
05c9902c761d
Added example config for river 'Elbe' and read the config in context factory.
Raimund Renkert <rrenkert@intevation.de>
parents:
4051
diff
changeset
|
159 continue; |
9555
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
160 } else { |
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
161 final String r = element.getAttribute("radius"); |
4619
05c9902c761d
Added example config for river 'Elbe' and read the config in context factory.
Raimund Renkert <rrenkert@intevation.de>
parents:
4051
diff
changeset
|
162 try { |
05c9902c761d
Added example config for river 'Elbe' and read the config in context factory.
Raimund Renkert <rrenkert@intevation.de>
parents:
4051
diff
changeset
|
163 radius = Double.parseDouble(r); |
05c9902c761d
Added example config for river 'Elbe' and read the config in context factory.
Raimund Renkert <rrenkert@intevation.de>
parents:
4051
diff
changeset
|
164 } |
9555
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
165 catch (final NumberFormatException nfe) { |
4619
05c9902c761d
Added example config for river 'Elbe' and read the config in context factory.
Raimund Renkert <rrenkert@intevation.de>
parents:
4051
diff
changeset
|
166 continue; |
05c9902c761d
Added example config for river 'Elbe' and read the config in context factory.
Raimund Renkert <rrenkert@intevation.de>
parents:
4051
diff
changeset
|
167 } |
05c9902c761d
Added example config for river 'Elbe' and read the config in context factory.
Raimund Renkert <rrenkert@intevation.de>
parents:
4051
diff
changeset
|
168 } |
05c9902c761d
Added example config for river 'Elbe' and read the config in context factory.
Raimund Renkert <rrenkert@intevation.de>
parents:
4051
diff
changeset
|
169 scale.addRange(river, range, radius); |
9555
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
170 } |
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
171 context.put("zoomscale", scale); |
4619
05c9902c761d
Added example config for river 'Elbe' and read the config in context factory.
Raimund Renkert <rrenkert@intevation.de>
parents:
4051
diff
changeset
|
172 } |
05c9902c761d
Added example config for river 'Elbe' and read the config in context factory.
Raimund Renkert <rrenkert@intevation.de>
parents:
4051
diff
changeset
|
173 |
106
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
174 /** |
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
175 * This method initializes the transition configuration. |
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
176 * |
9555
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
177 * @param config |
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
178 * the config document. |
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
179 * @param context |
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
180 * the RiverContext. |
106
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
181 */ |
9555
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
182 private void configureTransitions(final Document config, final RiverContext context) { |
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
183 final TransitionEngine engine = new TransitionEngine(); |
106
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
184 |
9555
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
185 final List<Document> artifacts = getArtifactConfigurations(config); |
8202
e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents:
8157
diff
changeset
|
186 log.info("Found " + artifacts.size() + " artifacts in the config."); |
106
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
187 |
9555
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
188 for (final Document doc : artifacts) { |
106
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
189 |
9555
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
190 final String artName = (String) XMLUtils.xpath(doc, XPATH_ARTIFACT_NAME, XPathConstants.STRING); |
106
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
191 |
9555
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
192 final NodeList list = (NodeList) XMLUtils.xpath(doc, XPATH_TRANSITIONS, XPathConstants.NODESET); |
106
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
193 |
111
7222d8fb53ea
Changed the way of storing transitions in the TransitionEngine.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
107
diff
changeset
|
194 if (list == null) { |
9555
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
195 log.warn("The artifact " + artName + " has no transitions configured."); |
107
a228b39494a9
Improved the bootstrap process - the states are initialized.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
106
diff
changeset
|
196 continue; |
106
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
197 } |
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
198 |
9555
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
199 final int trans = list.getLength(); |
106
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
200 |
9555
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
201 log.info("Artifact '" + artName + "' has " + trans + " transitions."); |
106
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
202 |
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
203 for (int i = 0; i < trans; i++) { |
9555
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
204 final Transition t = TransitionFactory.createTransition(list.item(i)); |
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
205 final String s = t.getFrom(); |
111
7222d8fb53ea
Changed the way of storing transitions in the TransitionEngine.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
107
diff
changeset
|
206 engine.addTransition(s, t); |
106
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
207 } |
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
208 } |
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
209 |
5866
9a6741ccf6d4
FLYS artifacts: Renamed FLYSContext(Factory) to RiverContext(Factory).
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
210 context.put(RiverContext.TRANSITION_ENGINE_KEY, engine); |
106
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
211 } |
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
212 |
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
213 /** |
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
214 * This method returns all artifact documents defined in |
9555
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
215 * <code>config</code>. <br> |
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
216 * NOTE: The artifact configurations need to be |
106
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
217 * stored in own files referenced by an xlink. |
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
218 * |
9555
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
219 * @param config |
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
220 * The global configuration. |
106
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
221 * |
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
222 * @return an array of Artifact configurations. |
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
223 */ |
9555
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
224 private List<Document> getArtifactConfigurations(final Document config) { |
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
225 final NodeList artifacts = (NodeList) XMLUtils.xpath(config, XPATH_ARTIFACTS, XPathConstants.NODESET); |
106
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
226 |
9555
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
227 final int count = artifacts.getLength(); |
106
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
228 |
9555
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
229 final ArrayList<Document> docs = new ArrayList<>(count); |
106
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
230 |
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
231 for (int i = 0; i < count; i++) { |
9555
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
232 final Element tmp = (Element) artifacts.item(i); |
106
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
233 |
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
234 String xlink = tmp.getAttribute(XPATH_XLINK); |
9555
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
235 xlink = Config.replaceConfigDir(xlink); |
106
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
236 |
8272
c57b0400ac98
Adopt configuation of artifacts into new xml documents to make them configurable inline.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
8254
diff
changeset
|
237 if (!xlink.isEmpty()) { |
9555
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
238 final File file = new File(xlink); |
8272
c57b0400ac98
Adopt configuation of artifacts into new xml documents to make them configurable inline.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
8254
diff
changeset
|
239 if (!file.isFile() || !file.canRead()) { |
9555
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
240 log.warn("Artifact configuration '" + file + "' not found."); |
8272
c57b0400ac98
Adopt configuation of artifacts into new xml documents to make them configurable inline.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
8254
diff
changeset
|
241 } else { |
9555
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
242 final Document doc = XMLUtils.parseDocument(file); |
8272
c57b0400ac98
Adopt configuation of artifacts into new xml documents to make them configurable inline.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
8254
diff
changeset
|
243 if (doc != null) { |
c57b0400ac98
Adopt configuation of artifacts into new xml documents to make them configurable inline.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
8254
diff
changeset
|
244 docs.add(doc); |
c57b0400ac98
Adopt configuation of artifacts into new xml documents to make them configurable inline.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
8254
diff
changeset
|
245 } |
c57b0400ac98
Adopt configuation of artifacts into new xml documents to make them configurable inline.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
8254
diff
changeset
|
246 } |
8086
7ede7904c8a5
Be more tolerant with not existing artifact configurations.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7756
diff
changeset
|
247 continue; |
7ede7904c8a5
Be more tolerant with not existing artifact configurations.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7756
diff
changeset
|
248 } |
9555
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
249 final Document doc = XMLUtils.newDocument(); |
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
250 final Node copy = doc.adoptNode(tmp.cloneNode(true)); |
8272
c57b0400ac98
Adopt configuation of artifacts into new xml documents to make them configurable inline.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
8254
diff
changeset
|
251 doc.appendChild(copy); |
c57b0400ac98
Adopt configuation of artifacts into new xml documents to make them configurable inline.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
8254
diff
changeset
|
252 docs.add(doc); |
106
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
253 } |
8086
7ede7904c8a5
Be more tolerant with not existing artifact configurations.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7756
diff
changeset
|
254 return docs; |
106
5864c41219db
Initializes a TransitionEngine storing all transitions for each artifact at the application start.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
255 } |
107
a228b39494a9
Improved the bootstrap process - the states are initialized.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
106
diff
changeset
|
256 |
a228b39494a9
Improved the bootstrap process - the states are initialized.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
106
diff
changeset
|
257 /** |
a228b39494a9
Improved the bootstrap process - the states are initialized.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
106
diff
changeset
|
258 * This method initializes the transition configuration. |
a228b39494a9
Improved the bootstrap process - the states are initialized.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
106
diff
changeset
|
259 * |
9555
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
260 * @param config |
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
261 * the config document. |
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
262 * @param context |
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
263 * the RiverContext. |
107
a228b39494a9
Improved the bootstrap process - the states are initialized.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
106
diff
changeset
|
264 */ |
9555
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
265 private void configureStates(final Document config, final RiverContext context) { |
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
266 final StateEngine engine = new StateEngine(); |
107
a228b39494a9
Improved the bootstrap process - the states are initialized.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
106
diff
changeset
|
267 |
9555
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
268 final List<Document> artifacts = getArtifactConfigurations(config); |
8202
e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents:
8157
diff
changeset
|
269 log.info("Found " + artifacts.size() + " artifacts in the config."); |
107
a228b39494a9
Improved the bootstrap process - the states are initialized.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
106
diff
changeset
|
270 |
9555
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
271 for (final Document doc : artifacts) { |
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
272 final List<State> states = new ArrayList<>(); |
107
a228b39494a9
Improved the bootstrap process - the states are initialized.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
106
diff
changeset
|
273 |
9555
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
274 final String artName = (String) XMLUtils.xpath(doc, XPATH_ARTIFACT_NAME, XPathConstants.STRING); |
107
a228b39494a9
Improved the bootstrap process - the states are initialized.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
106
diff
changeset
|
275 |
9555
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
276 final NodeList stateList = (NodeList) XMLUtils.xpath(doc, XPATH_STATES, XPathConstants.NODESET); |
107
a228b39494a9
Improved the bootstrap process - the states are initialized.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
106
diff
changeset
|
277 |
a228b39494a9
Improved the bootstrap process - the states are initialized.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
106
diff
changeset
|
278 if (stateList == null) { |
9555
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
279 log.warn("The artifact " + artName + " has no states configured."); |
107
a228b39494a9
Improved the bootstrap process - the states are initialized.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
106
diff
changeset
|
280 continue; |
a228b39494a9
Improved the bootstrap process - the states are initialized.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
106
diff
changeset
|
281 } |
a228b39494a9
Improved the bootstrap process - the states are initialized.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
106
diff
changeset
|
282 |
9555
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
283 final int count = stateList.getLength(); |
107
a228b39494a9
Improved the bootstrap process - the states are initialized.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
106
diff
changeset
|
284 |
9555
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
285 log.info("Artifact '" + artName + "' has " + count + " states."); |
107
a228b39494a9
Improved the bootstrap process - the states are initialized.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
106
diff
changeset
|
286 |
a228b39494a9
Improved the bootstrap process - the states are initialized.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
106
diff
changeset
|
287 for (int i = 0; i < count; i++) { |
9555
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
288 states.add(StateFactory.createState(stateList.item(i))); |
107
a228b39494a9
Improved the bootstrap process - the states are initialized.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
106
diff
changeset
|
289 } |
a228b39494a9
Improved the bootstrap process - the states are initialized.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
106
diff
changeset
|
290 |
a228b39494a9
Improved the bootstrap process - the states are initialized.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
106
diff
changeset
|
291 engine.addStates(artName, states); |
a228b39494a9
Improved the bootstrap process - the states are initialized.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
106
diff
changeset
|
292 } |
a228b39494a9
Improved the bootstrap process - the states are initialized.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
106
diff
changeset
|
293 |
5866
9a6741ccf6d4
FLYS artifacts: Renamed FLYSContext(Factory) to RiverContext(Factory).
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
294 context.put(RiverContext.STATE_ENGINE_KEY, engine); |
107
a228b39494a9
Improved the bootstrap process - the states are initialized.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
106
diff
changeset
|
295 } |
295
53c155bfde07
Added code to parse the configured OutGenerators in the global configuration and to save a map of such in the FLYSContext.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
130
diff
changeset
|
296 |
53c155bfde07
Added code to parse the configured OutGenerators in the global configuration and to save a map of such in the FLYSContext.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
130
diff
changeset
|
297 /** |
53c155bfde07
Added code to parse the configured OutGenerators in the global configuration and to save a map of such in the FLYSContext.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
130
diff
changeset
|
298 * This method intializes the provided output generators. |
53c155bfde07
Added code to parse the configured OutGenerators in the global configuration and to save a map of such in the FLYSContext.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
130
diff
changeset
|
299 * |
9555
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
300 * @param config |
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
301 * the config document. |
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
302 * @param context |
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
303 * the RiverContext. |
295
53c155bfde07
Added code to parse the configured OutGenerators in the global configuration and to save a map of such in the FLYSContext.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
130
diff
changeset
|
304 */ |
9555
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
305 private void configureOutGenerators(final Document config, final RiverContext context) { |
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
306 final NodeList outGenerators = (NodeList) XMLUtils.xpath(config, XPATH_OUTPUT_GENERATORS, XPathConstants.NODESET); |
295
53c155bfde07
Added code to parse the configured OutGenerators in the global configuration and to save a map of such in the FLYSContext.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
130
diff
changeset
|
307 |
9555
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
308 final int num = outGenerators == null ? 0 : outGenerators.getLength(); |
295
53c155bfde07
Added code to parse the configured OutGenerators in the global configuration and to save a map of such in the FLYSContext.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
130
diff
changeset
|
309 |
53c155bfde07
Added code to parse the configured OutGenerators in the global configuration and to save a map of such in the FLYSContext.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
130
diff
changeset
|
310 if (num == 0) { |
8202
e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents:
8157
diff
changeset
|
311 log.warn("No output generators configured in this application."); |
295
53c155bfde07
Added code to parse the configured OutGenerators in the global configuration and to save a map of such in the FLYSContext.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
130
diff
changeset
|
312 return; |
53c155bfde07
Added code to parse the configured OutGenerators in the global configuration and to save a map of such in the FLYSContext.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
130
diff
changeset
|
313 } |
53c155bfde07
Added code to parse the configured OutGenerators in the global configuration and to save a map of such in the FLYSContext.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
130
diff
changeset
|
314 |
8202
e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents:
8157
diff
changeset
|
315 log.info("Found " + num + " configured output generators."); |
295
53c155bfde07
Added code to parse the configured OutGenerators in the global configuration and to save a map of such in the FLYSContext.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
130
diff
changeset
|
316 |
9555
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
317 final GeneratorLookup generators = new GeneratorLookup(); |
7037
5c6fd2c010dd
Add setup(Element config) method to Generator interface to be initialized from configuration.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6933
diff
changeset
|
318 |
295
53c155bfde07
Added code to parse the configured OutGenerators in the global configuration and to save a map of such in the FLYSContext.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
130
diff
changeset
|
319 int idx = 0; |
53c155bfde07
Added code to parse the configured OutGenerators in the global configuration and to save a map of such in the FLYSContext.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
130
diff
changeset
|
320 |
53c155bfde07
Added code to parse the configured OutGenerators in the global configuration and to save a map of such in the FLYSContext.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
130
diff
changeset
|
321 for (int i = 0; i < num; i++) { |
9555
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
322 final Element item = (Element) outGenerators.item(i); |
295
53c155bfde07
Added code to parse the configured OutGenerators in the global configuration and to save a map of such in the FLYSContext.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
130
diff
changeset
|
323 |
9555
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
324 final String names = item.getAttribute("names").trim(); |
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
325 final String clazz = item.getAttribute("class").trim(); |
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
326 final String converter = item.getAttribute("converter").trim(); |
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
327 final String injectors = item.getAttribute("injectors").trim(); |
295
53c155bfde07
Added code to parse the configured OutGenerators in the global configuration and to save a map of such in the FLYSContext.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
130
diff
changeset
|
328 |
7074
a2abd87c0d3b
Trim "names" and "class" attribute of out generators before using.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7073
diff
changeset
|
329 if (names.isEmpty() || clazz.isEmpty()) { |
295
53c155bfde07
Added code to parse the configured OutGenerators in the global configuration and to save a map of such in the FLYSContext.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
130
diff
changeset
|
330 continue; |
53c155bfde07
Added code to parse the configured OutGenerators in the global configuration and to save a map of such in the FLYSContext.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
130
diff
changeset
|
331 } |
53c155bfde07
Added code to parse the configured OutGenerators in the global configuration and to save a map of such in the FLYSContext.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
130
diff
changeset
|
332 |
7073
beb9e94f04d3
Allow comma separated names in "names" attribute in out generators to allow registering for more than one name. Old "name" attribute is removed.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7072
diff
changeset
|
333 Class<OutGenerator> generatorClass = null; |
beb9e94f04d3
Allow comma separated names in "names" attribute in out generators to allow registering for more than one name. Old "name" attribute is removed.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7072
diff
changeset
|
334 |
295
53c155bfde07
Added code to parse the configured OutGenerators in the global configuration and to save a map of such in the FLYSContext.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
130
diff
changeset
|
335 try { |
9555
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
336 generatorClass = (Class<OutGenerator>) Class.forName(clazz); |
295
53c155bfde07
Added code to parse the configured OutGenerators in the global configuration and to save a map of such in the FLYSContext.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
130
diff
changeset
|
337 } |
9555
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
338 catch (final ClassNotFoundException cnfe) { |
8202
e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents:
8157
diff
changeset
|
339 log.error(cnfe, cnfe); |
7073
beb9e94f04d3
Allow comma separated names in "names" attribute in out generators to allow registering for more than one name. Old "name" attribute is removed.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7072
diff
changeset
|
340 continue; |
beb9e94f04d3
Allow comma separated names in "names" attribute in out generators to allow registering for more than one name. Old "name" attribute is removed.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7072
diff
changeset
|
341 } |
beb9e94f04d3
Allow comma separated names in "names" attribute in out generators to allow registering for more than one name. Old "name" attribute is removed.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7072
diff
changeset
|
342 |
7099
24f153ad1f40
Use pre-converted diagram attributes now.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7074
diff
changeset
|
343 Object cfg = null; |
24f153ad1f40
Use pre-converted diagram attributes now.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7074
diff
changeset
|
344 |
24f153ad1f40
Use pre-converted diagram attributes now.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7074
diff
changeset
|
345 if (!converter.isEmpty()) { |
24f153ad1f40
Use pre-converted diagram attributes now.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7074
diff
changeset
|
346 try { |
9555
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
347 final ElementConverter ec = (ElementConverter) Class.forName(converter).newInstance(); |
7099
24f153ad1f40
Use pre-converted diagram attributes now.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7074
diff
changeset
|
348 cfg = ec.convert(item); |
24f153ad1f40
Use pre-converted diagram attributes now.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7074
diff
changeset
|
349 } |
9555
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
350 catch (final ClassNotFoundException cnfe) { |
8202
e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents:
8157
diff
changeset
|
351 log.error(cnfe, cnfe); |
7099
24f153ad1f40
Use pre-converted diagram attributes now.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7074
diff
changeset
|
352 } |
9555
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
353 catch (final InstantiationException ie) { |
8202
e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents:
8157
diff
changeset
|
354 log.error(ie); |
7099
24f153ad1f40
Use pre-converted diagram attributes now.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7074
diff
changeset
|
355 } |
9555
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
356 catch (final IllegalAccessException iae) { |
8202
e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents:
8157
diff
changeset
|
357 log.error(iae); |
7099
24f153ad1f40
Use pre-converted diagram attributes now.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7074
diff
changeset
|
358 } |
24f153ad1f40
Use pre-converted diagram attributes now.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7074
diff
changeset
|
359 } |
24f153ad1f40
Use pre-converted diagram attributes now.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7074
diff
changeset
|
360 |
8254
c87c87544cc6
Made call context injectors a list of comma separated classes.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
8219
diff
changeset
|
361 List<ContextInjector> cis = null; |
8219
9667900536b6
Added context injector to generators.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
8202
diff
changeset
|
362 |
8254
c87c87544cc6
Made call context injectors a list of comma separated classes.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
8219
diff
changeset
|
363 if (!injectors.isEmpty()) { |
9555
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
364 cis = new ArrayList<>(); |
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
365 for (final String injector : injectors.split("[\\s,]+")) { |
8254
c87c87544cc6
Made call context injectors a list of comma separated classes.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
8219
diff
changeset
|
366 try { |
9555
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
367 final ContextInjector ci = (ContextInjector) Class.forName(injector).newInstance(); |
8254
c87c87544cc6
Made call context injectors a list of comma separated classes.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
8219
diff
changeset
|
368 ci.setup(item); |
c87c87544cc6
Made call context injectors a list of comma separated classes.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
8219
diff
changeset
|
369 cis.add(ci); |
c87c87544cc6
Made call context injectors a list of comma separated classes.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
8219
diff
changeset
|
370 } |
9555
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
371 catch (final ClassNotFoundException cnfe) { |
8254
c87c87544cc6
Made call context injectors a list of comma separated classes.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
8219
diff
changeset
|
372 log.error(cnfe, cnfe); |
c87c87544cc6
Made call context injectors a list of comma separated classes.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
8219
diff
changeset
|
373 } |
9555
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
374 catch (final InstantiationException ie) { |
8254
c87c87544cc6
Made call context injectors a list of comma separated classes.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
8219
diff
changeset
|
375 log.error(ie); |
c87c87544cc6
Made call context injectors a list of comma separated classes.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
8219
diff
changeset
|
376 } |
9555
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
377 catch (final IllegalAccessException iae) { |
8254
c87c87544cc6
Made call context injectors a list of comma separated classes.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
8219
diff
changeset
|
378 log.error(iae); |
c87c87544cc6
Made call context injectors a list of comma separated classes.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
8219
diff
changeset
|
379 } |
8219
9667900536b6
Added context injector to generators.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
8202
diff
changeset
|
380 } |
9667900536b6
Added context injector to generators.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
8202
diff
changeset
|
381 } |
9667900536b6
Added context injector to generators.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
8202
diff
changeset
|
382 |
9555
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
383 for (String key : names.split("[\\s,]+")) { |
7073
beb9e94f04d3
Allow comma separated names in "names" attribute in out generators to allow registering for more than one name. Old "name" attribute is removed.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7072
diff
changeset
|
384 if (!(key = key.trim()).isEmpty()) { |
8254
c87c87544cc6
Made call context injectors a list of comma separated classes.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
8219
diff
changeset
|
385 generators.putGenerator(key, generatorClass, cfg, cis); |
7073
beb9e94f04d3
Allow comma separated names in "names" attribute in out generators to allow registering for more than one name. Old "name" attribute is removed.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7072
diff
changeset
|
386 idx++; |
beb9e94f04d3
Allow comma separated names in "names" attribute in out generators to allow registering for more than one name. Old "name" attribute is removed.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7072
diff
changeset
|
387 } |
295
53c155bfde07
Added code to parse the configured OutGenerators in the global configuration and to save a map of such in the FLYSContext.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
130
diff
changeset
|
388 } |
53c155bfde07
Added code to parse the configured OutGenerators in the global configuration and to save a map of such in the FLYSContext.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
130
diff
changeset
|
389 } |
53c155bfde07
Added code to parse the configured OutGenerators in the global configuration and to save a map of such in the FLYSContext.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
130
diff
changeset
|
390 |
8202
e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents:
8157
diff
changeset
|
391 log.info("Successfully loaded " + idx + " output generators."); |
5866
9a6741ccf6d4
FLYS artifacts: Renamed FLYSContext(Factory) to RiverContext(Factory).
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
392 context.put(RiverContext.OUTGENERATORS_KEY, generators); |
7227
744df5a03337
Use diagram configuration and there processors to define compatible facets in loaded data.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7226
diff
changeset
|
393 context.put(RiverContext.FACETFILTER_KEY, generators); |
295
53c155bfde07
Added code to parse the configured OutGenerators in the global configuration and to save a map of such in the FLYSContext.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
130
diff
changeset
|
394 } |
341
eca7892bf8ff
Added a first small theme configuration and code to read it.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
295
diff
changeset
|
395 |
eca7892bf8ff
Added a first small theme configuration and code to read it.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
295
diff
changeset
|
396 /** |
eca7892bf8ff
Added a first small theme configuration and code to read it.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
295
diff
changeset
|
397 * This methods reads the configured themes and puts them into the |
5866
9a6741ccf6d4
FLYS artifacts: Renamed FLYSContext(Factory) to RiverContext(Factory).
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
398 * RiverContext. |
341
eca7892bf8ff
Added a first small theme configuration and code to read it.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
295
diff
changeset
|
399 * |
9555
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
400 * @param config |
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
401 * The global configuration. |
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
402 * @param context |
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
403 * The RiverContext. |
341
eca7892bf8ff
Added a first small theme configuration and code to read it.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
295
diff
changeset
|
404 */ |
9555
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
405 private void configureThemes(final Document config, final RiverContext context) { |
8202
e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents:
8157
diff
changeset
|
406 log.debug("RiverContextFactory.configureThemes"); |
341
eca7892bf8ff
Added a first small theme configuration and code to read it.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
295
diff
changeset
|
407 |
9555
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
408 final Document cfg = getThemeConfig(config); |
341
eca7892bf8ff
Added a first small theme configuration and code to read it.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
295
diff
changeset
|
409 |
9555
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
410 final NodeList themeGroups = (NodeList) XMLUtils.xpath(cfg, XPATH_THEME_GROUPS, XPathConstants.NODESET); |
341
eca7892bf8ff
Added a first small theme configuration and code to read it.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
295
diff
changeset
|
411 |
9555
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
412 final int groupNum = themeGroups != null ? themeGroups.getLength() : 0; |
341
eca7892bf8ff
Added a first small theme configuration and code to read it.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
295
diff
changeset
|
413 |
2737
83b22ccf48da
Introduced theme groups and added new service to get themes filtered by name.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2141
diff
changeset
|
414 if (groupNum == 0) { |
8202
e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents:
8157
diff
changeset
|
415 log.warn("There are no theme groups configured!"); |
341
eca7892bf8ff
Added a first small theme configuration and code to read it.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
295
diff
changeset
|
416 } |
3256
17ca0a43027a
Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3239
diff
changeset
|
417 |
8202
e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents:
8157
diff
changeset
|
418 log.info("Found " + groupNum + " theme groups in configuration"); |
341
eca7892bf8ff
Added a first small theme configuration and code to read it.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
295
diff
changeset
|
419 |
9555
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
420 final List<ThemeGroup> groups = new ArrayList<>(); |
341
eca7892bf8ff
Added a first small theme configuration and code to read it.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
295
diff
changeset
|
421 |
2737
83b22ccf48da
Introduced theme groups and added new service to get themes filtered by name.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2141
diff
changeset
|
422 for (int g = 0; g < groupNum; g++) { |
9555
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
423 final Element themeGroup = (Element) themeGroups.item(g); |
341
eca7892bf8ff
Added a first small theme configuration and code to read it.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
295
diff
changeset
|
424 |
9555
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
425 final Map<String, Theme> theThemes = readThemes(cfg, themeGroup); |
341
eca7892bf8ff
Added a first small theme configuration and code to read it.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
295
diff
changeset
|
426 |
9555
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
427 if (theThemes.size() == 0) { |
8202
e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents:
8157
diff
changeset
|
428 log.warn("There are no themes configured!"); |
2737
83b22ccf48da
Introduced theme groups and added new service to get themes filtered by name.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2141
diff
changeset
|
429 return; |
83b22ccf48da
Introduced theme groups and added new service to get themes filtered by name.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2141
diff
changeset
|
430 } |
83b22ccf48da
Introduced theme groups and added new service to get themes filtered by name.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2141
diff
changeset
|
431 |
9555
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
432 final String gName = themeGroup.getAttribute("name"); |
2737
83b22ccf48da
Introduced theme groups and added new service to get themes filtered by name.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2141
diff
changeset
|
433 groups.add(new ThemeGroup(gName, theThemes)); |
3256
17ca0a43027a
Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3239
diff
changeset
|
434 |
9555
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
435 log.info("Initialized " + theThemes.size() + "/" + theThemes.size() + " themes " + "of theme-group '" + gName + "'"); |
2737
83b22ccf48da
Introduced theme groups and added new service to get themes filtered by name.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2141
diff
changeset
|
436 } |
5866
9a6741ccf6d4
FLYS artifacts: Renamed FLYSContext(Factory) to RiverContext(Factory).
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
437 context.put(RiverContext.THEMES, groups); |
341
eca7892bf8ff
Added a first small theme configuration and code to read it.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
295
diff
changeset
|
438 } |
eca7892bf8ff
Added a first small theme configuration and code to read it.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
295
diff
changeset
|
439 |
eca7892bf8ff
Added a first small theme configuration and code to read it.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
295
diff
changeset
|
440 /** |
9555
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
441 * This methods reads the configured themes and puts them into the |
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
442 * RiverContext. |
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
443 * |
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
444 * @param config |
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
445 * The global configuration. |
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
446 * @param context |
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
447 * The RiverContext. |
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
448 */ |
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
449 private void configureLegend(final Document config, final RiverContext context) { |
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
450 log.debug("RiverContextFactory.configureLegend"); |
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
451 |
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
452 final Map<String, Theme> legendGroup = readLegend(config); |
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
453 context.put(RiverContext.LEGEND, legendGroup); |
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
454 } |
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
455 |
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
456 private Map<String, Theme> readLegend(final Document config) { |
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
457 |
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
458 final Document cfg = getThemeConfig(config); |
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
459 |
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
460 final Node legendGroup = (Node) XMLUtils.xpath(cfg, XPATH_LEGEND_GROUP, XPathConstants.NODE); |
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
461 if (legendGroup == null) { |
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
462 log.warn("There is no legend group configured"); |
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
463 return Collections.emptyMap(); |
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
464 } |
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
465 |
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
466 return readThemes(cfg, legendGroup); |
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
467 } |
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
468 |
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
469 private Map<String, Theme> readThemes(final Document cfg, final Node themeGroup) { |
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
470 final NodeList themes = (NodeList) XMLUtils.xpath(themeGroup, XPATH_THEMES, XPathConstants.NODESET); |
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
471 if (themes == null) |
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
472 return Collections.emptyMap(); |
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
473 |
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
474 final int num = themes.getLength(); |
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
475 log.info("Theme group has " + num + " themes."); |
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
476 final Map<String, Theme> theThemes = new HashMap<>(); |
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
477 |
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
478 for (int i = 0; i < num; i++) { |
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
479 final Node theme = themes.item(i); |
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
480 |
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
481 final Theme theTheme = ThemeFactory.createTheme(cfg, theme); |
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
482 theThemes.put(theTheme.getName(), theTheme); |
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
483 } |
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
484 |
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
485 return theThemes; |
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
486 } |
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
487 |
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
488 /** |
341
eca7892bf8ff
Added a first small theme configuration and code to read it.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
295
diff
changeset
|
489 * This method is used to retrieve the theme configuration document. |
eca7892bf8ff
Added a first small theme configuration and code to read it.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
295
diff
changeset
|
490 * |
9555
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
491 * @param config |
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
492 * The global configuration. |
341
eca7892bf8ff
Added a first small theme configuration and code to read it.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
295
diff
changeset
|
493 * |
eca7892bf8ff
Added a first small theme configuration and code to read it.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
295
diff
changeset
|
494 * @return the theme configuration. |
eca7892bf8ff
Added a first small theme configuration and code to read it.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
295
diff
changeset
|
495 */ |
9555
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
496 private Document getThemeConfig(final Document config) { |
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
497 String themeConfig = (String) XMLUtils.xpath(config, XPATH_THEME_CONFIG, XPathConstants.STRING); |
341
eca7892bf8ff
Added a first small theme configuration and code to read it.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
295
diff
changeset
|
498 |
eca7892bf8ff
Added a first small theme configuration and code to read it.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
295
diff
changeset
|
499 themeConfig = Config.replaceConfigDir(themeConfig); |
eca7892bf8ff
Added a first small theme configuration and code to read it.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
295
diff
changeset
|
500 |
8202
e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents:
8157
diff
changeset
|
501 log.debug("Parse theme cfg: " + themeConfig); |
341
eca7892bf8ff
Added a first small theme configuration and code to read it.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
295
diff
changeset
|
502 |
9555
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
503 return XMLUtils.parseDocument(new File(themeConfig), true, XMLUtils.CONF_RESOLVER); |
341
eca7892bf8ff
Added a first small theme configuration and code to read it.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
295
diff
changeset
|
504 } |
345
88a669785863
Initialized the facet2theme mappings configured in themes.xml and added a function to the ThemeFactory that retrieves a theme from FLYSContext based on its name.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
341
diff
changeset
|
505 |
9555
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
506 private void configureThemesMappings(final Document cfg, final RiverContext context) { |
8202
e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents:
8157
diff
changeset
|
507 log.debug("RiverContextFactory.configureThemesMappings"); |
345
88a669785863
Initialized the facet2theme mappings configured in themes.xml and added a function to the ThemeFactory that retrieves a theme from FLYSContext based on its name.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
341
diff
changeset
|
508 |
9555
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
509 final Document config = getThemeConfig(cfg); |
345
88a669785863
Initialized the facet2theme mappings configured in themes.xml and added a function to the ThemeFactory that retrieves a theme from FLYSContext based on its name.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
341
diff
changeset
|
510 |
9555
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
511 final NodeList mappings = (NodeList) XMLUtils.xpath(config, XPATH_THEME_MAPPINGS, XPathConstants.NODESET); |
345
88a669785863
Initialized the facet2theme mappings configured in themes.xml and added a function to the ThemeFactory that retrieves a theme from FLYSContext based on its name.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
341
diff
changeset
|
512 |
9555
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
513 final int num = mappings != null ? mappings.getLength() : 0; |
345
88a669785863
Initialized the facet2theme mappings configured in themes.xml and added a function to the ThemeFactory that retrieves a theme from FLYSContext based on its name.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
341
diff
changeset
|
514 |
88a669785863
Initialized the facet2theme mappings configured in themes.xml and added a function to the ThemeFactory that retrieves a theme from FLYSContext based on its name.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
341
diff
changeset
|
515 if (num == 0) { |
8202
e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents:
8157
diff
changeset
|
516 log.warn("No theme <--> facet mappins found!"); |
345
88a669785863
Initialized the facet2theme mappings configured in themes.xml and added a function to the ThemeFactory that retrieves a theme from FLYSContext based on its name.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
341
diff
changeset
|
517 return; |
88a669785863
Initialized the facet2theme mappings configured in themes.xml and added a function to the ThemeFactory that retrieves a theme from FLYSContext based on its name.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
341
diff
changeset
|
518 } |
88a669785863
Initialized the facet2theme mappings configured in themes.xml and added a function to the ThemeFactory that retrieves a theme from FLYSContext based on its name.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
341
diff
changeset
|
519 |
9555
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
520 final Map<String, List<ThemeMapping>> mapping = new HashMap<>(); |
345
88a669785863
Initialized the facet2theme mappings configured in themes.xml and added a function to the ThemeFactory that retrieves a theme from FLYSContext based on its name.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
341
diff
changeset
|
521 |
88a669785863
Initialized the facet2theme mappings configured in themes.xml and added a function to the ThemeFactory that retrieves a theme from FLYSContext based on its name.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
341
diff
changeset
|
522 for (int i = 0; i < num; i++) { |
9555
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
523 final Element node = (Element) mappings.item(i); |
345
88a669785863
Initialized the facet2theme mappings configured in themes.xml and added a function to the ThemeFactory that retrieves a theme from FLYSContext based on its name.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
341
diff
changeset
|
524 |
9555
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
525 final String from = node.getAttribute("from"); |
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
526 final String to = node.getAttribute("to"); |
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
527 final String pattern = node.getAttribute("pattern"); |
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
528 final String masterAttrPattern = node.getAttribute("masterAttr"); |
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
529 final String outputPattern = node.getAttribute("output"); |
1747
d2a17e990c70
Improved the Themes: we now support special themes for facets which need to match a given pattern string.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1062
diff
changeset
|
530 |
2742
faf73245ec73
Improved startup performance.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2737
diff
changeset
|
531 if (from.length() > 0 && to.length() > 0) { |
1747
d2a17e990c70
Improved the Themes: we now support special themes for facets which need to match a given pattern string.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1062
diff
changeset
|
532 List<ThemeMapping> tm = mapping.get(from); |
d2a17e990c70
Improved the Themes: we now support special themes for facets which need to match a given pattern string.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1062
diff
changeset
|
533 |
d2a17e990c70
Improved the Themes: we now support special themes for facets which need to match a given pattern string.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1062
diff
changeset
|
534 if (tm == null) { |
9555
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
535 tm = new ArrayList<>(); |
1747
d2a17e990c70
Improved the Themes: we now support special themes for facets which need to match a given pattern string.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1062
diff
changeset
|
536 mapping.put(from, tm); |
d2a17e990c70
Improved the Themes: we now support special themes for facets which need to match a given pattern string.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1062
diff
changeset
|
537 } |
d2a17e990c70
Improved the Themes: we now support special themes for facets which need to match a given pattern string.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1062
diff
changeset
|
538 |
9555
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
539 tm.add(new ThemeMapping(from, to, pattern, masterAttrPattern, outputPattern)); |
345
88a669785863
Initialized the facet2theme mappings configured in themes.xml and added a function to the ThemeFactory that retrieves a theme from FLYSContext based on its name.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
341
diff
changeset
|
540 } |
88a669785863
Initialized the facet2theme mappings configured in themes.xml and added a function to the ThemeFactory that retrieves a theme from FLYSContext based on its name.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
341
diff
changeset
|
541 } |
88a669785863
Initialized the facet2theme mappings configured in themes.xml and added a function to the ThemeFactory that retrieves a theme from FLYSContext based on its name.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
341
diff
changeset
|
542 |
8202
e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents:
8157
diff
changeset
|
543 log.debug("Found " + mapping.size() + " theme mappings."); |
345
88a669785863
Initialized the facet2theme mappings configured in themes.xml and added a function to the ThemeFactory that retrieves a theme from FLYSContext based on its name.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
341
diff
changeset
|
544 |
5866
9a6741ccf6d4
FLYS artifacts: Renamed FLYSContext(Factory) to RiverContext(Factory).
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
545 context.put(RiverContext.THEME_MAPPING, mapping); |
345
88a669785863
Initialized the facet2theme mappings configured in themes.xml and added a function to the ThemeFactory that retrieves a theme from FLYSContext based on its name.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
341
diff
changeset
|
546 } |
958
ae198bef4ba0
Added configurations for river WMSe (currently for Saar, Mosel, Elbe).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
939
diff
changeset
|
547 |
4656
442fbb290fa8
Introduce river mapfile generation (WARNING: Changes in config xml files required!).
Christian Lins <christian.lins@intevation.de>
parents:
4629
diff
changeset
|
548 /** |
442fbb290fa8
Introduce river mapfile generation (WARNING: Changes in config xml files required!).
Christian Lins <christian.lins@intevation.de>
parents:
4629
diff
changeset
|
549 * Reads configured floodmap river WMSs from floodmap.xml and |
5866
9a6741ccf6d4
FLYS artifacts: Renamed FLYSContext(Factory) to RiverContext(Factory).
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
550 * loads them into the given RiverContext. |
9555
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
551 * |
4656
442fbb290fa8
Introduce river mapfile generation (WARNING: Changes in config xml files required!).
Christian Lins <christian.lins@intevation.de>
parents:
4629
diff
changeset
|
552 * @param cfg |
442fbb290fa8
Introduce river mapfile generation (WARNING: Changes in config xml files required!).
Christian Lins <christian.lins@intevation.de>
parents:
4629
diff
changeset
|
553 * @param context |
442fbb290fa8
Introduce river mapfile generation (WARNING: Changes in config xml files required!).
Christian Lins <christian.lins@intevation.de>
parents:
4629
diff
changeset
|
554 */ |
9555
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
555 private void configureFloodmapWMS(final Document cfg, final RiverContext context) { |
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
556 final Map<String, String> riverWMS = new HashMap<>(); |
958
ae198bef4ba0
Added configurations for river WMSe (currently for Saar, Mosel, Elbe).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
939
diff
changeset
|
557 |
9555
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
558 final NodeList rivers = (NodeList) XMLUtils.xpath(cfg, XPATH_RIVER_WMS, XPathConstants.NODESET); |
958
ae198bef4ba0
Added configurations for river WMSe (currently for Saar, Mosel, Elbe).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
939
diff
changeset
|
559 |
9555
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
560 final int num = rivers != null ? rivers.getLength() : 0; |
958
ae198bef4ba0
Added configurations for river WMSe (currently for Saar, Mosel, Elbe).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
939
diff
changeset
|
561 |
ae198bef4ba0
Added configurations for river WMSe (currently for Saar, Mosel, Elbe).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
939
diff
changeset
|
562 for (int i = 0; i < num; i++) { |
9555
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
563 final Element e = (Element) rivers.item(i); |
958
ae198bef4ba0
Added configurations for river WMSe (currently for Saar, Mosel, Elbe).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
939
diff
changeset
|
564 |
9555
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
565 final String river = e.getAttribute("name"); |
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
566 final String url = XMLUtils.xpathString(e, "river-wms/@url", null); |
958
ae198bef4ba0
Added configurations for river WMSe (currently for Saar, Mosel, Elbe).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
939
diff
changeset
|
567 |
ae198bef4ba0
Added configurations for river WMSe (currently for Saar, Mosel, Elbe).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
939
diff
changeset
|
568 if (river != null && url != null) { |
ae198bef4ba0
Added configurations for river WMSe (currently for Saar, Mosel, Elbe).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
939
diff
changeset
|
569 riverWMS.put(river, url); |
ae198bef4ba0
Added configurations for river WMSe (currently for Saar, Mosel, Elbe).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
939
diff
changeset
|
570 } |
ae198bef4ba0
Added configurations for river WMSe (currently for Saar, Mosel, Elbe).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
939
diff
changeset
|
571 } |
ae198bef4ba0
Added configurations for river WMSe (currently for Saar, Mosel, Elbe).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
939
diff
changeset
|
572 |
8202
e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents:
8157
diff
changeset
|
573 log.debug("Found " + riverWMS.size() + " river WMS."); |
958
ae198bef4ba0
Added configurations for river WMSe (currently for Saar, Mosel, Elbe).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
939
diff
changeset
|
574 |
5866
9a6741ccf6d4
FLYS artifacts: Renamed FLYSContext(Factory) to RiverContext(Factory).
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
575 context.put(RiverContext.RIVER_WMS, riverWMS); |
958
ae198bef4ba0
Added configurations for river WMSe (currently for Saar, Mosel, Elbe).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
939
diff
changeset
|
576 } |
3630
28be160b5870
Add a module service. It's now possible to configure the modules which are
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
3256
diff
changeset
|
577 |
28be160b5870
Add a module service. It's now possible to configure the modules which are
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
3256
diff
changeset
|
578 /** |
28be160b5870
Add a module service. It's now possible to configure the modules which are
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
3256
diff
changeset
|
579 * This method initializes the modules configuration. |
28be160b5870
Add a module service. It's now possible to configure the modules which are
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
3256
diff
changeset
|
580 * |
9555
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
581 * @param config |
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
582 * the config document. |
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
583 * @param context |
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
584 * the RiverContext. |
3630
28be160b5870
Add a module service. It's now possible to configure the modules which are
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
3256
diff
changeset
|
585 */ |
9555
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
586 private void configureModules(final Document cfg, final RiverContext context) { |
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
587 final NodeList modulenodes = (NodeList) XMLUtils.xpath(cfg, XPATH_MODULES, XPathConstants.NODESET); |
3630
28be160b5870
Add a module service. It's now possible to configure the modules which are
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
3256
diff
changeset
|
588 |
8870
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
589 final int num = modulenodes != null ? modulenodes.getLength() : 0; |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
590 |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
591 final List<Module> modules = new ArrayList<>(num); |
3630
28be160b5870
Add a module service. It's now possible to configure the modules which are
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
3256
diff
changeset
|
592 |
28be160b5870
Add a module service. It's now possible to configure the modules which are
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
3256
diff
changeset
|
593 for (int i = 0; i < num; i++) { |
8870
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
594 final Element e = (Element) modulenodes.item(i); |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
595 final String modulename = e.getAttribute("name"); |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
596 final String attrselected = e.getAttribute("selected"); |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
597 final boolean selected = Boolean.parseBoolean(attrselected); |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
598 final String group = e.getAttribute("group"); |
9555
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
599 |
8202
e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents:
8157
diff
changeset
|
600 log.debug("Loaded module " + modulename); |
9555
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
601 |
8870
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
602 final NodeList children = e.getChildNodes(); |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
603 final List<String> rivers = new ArrayList<>(children.getLength()); |
7756
cd04a7389389
Read rivers supported by a module from config file.
Raimund Renkert <rrenkert@intevation.de>
parents:
7227
diff
changeset
|
604 for (int j = 0; j < children.getLength(); j++) { |
cd04a7389389
Read rivers supported by a module from config file.
Raimund Renkert <rrenkert@intevation.de>
parents:
7227
diff
changeset
|
605 if (children.item(j).getNodeType() != Node.ELEMENT_NODE) { |
cd04a7389389
Read rivers supported by a module from config file.
Raimund Renkert <rrenkert@intevation.de>
parents:
7227
diff
changeset
|
606 continue; |
cd04a7389389
Read rivers supported by a module from config file.
Raimund Renkert <rrenkert@intevation.de>
parents:
7227
diff
changeset
|
607 } |
9555
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
608 |
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
609 final Element ce = (Element) children.item(j); |
7756
cd04a7389389
Read rivers supported by a module from config file.
Raimund Renkert <rrenkert@intevation.de>
parents:
7227
diff
changeset
|
610 if (ce.hasAttribute("uuid")) { |
cd04a7389389
Read rivers supported by a module from config file.
Raimund Renkert <rrenkert@intevation.de>
parents:
7227
diff
changeset
|
611 rivers.add(ce.getAttribute("uuid")); |
9555
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
612 } else if (ce.hasAttribute("name")) { |
8870
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
613 final List<River> allRivers = RiverFactory.getRivers(); |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
614 final String name = ce.getAttribute("name"); |
9555
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
615 for (final River r : allRivers) { |
7756
cd04a7389389
Read rivers supported by a module from config file.
Raimund Renkert <rrenkert@intevation.de>
parents:
7227
diff
changeset
|
616 if (name.equals(r.getName())) { |
cd04a7389389
Read rivers supported by a module from config file.
Raimund Renkert <rrenkert@intevation.de>
parents:
7227
diff
changeset
|
617 rivers.add(r.getModelUuid()); |
cd04a7389389
Read rivers supported by a module from config file.
Raimund Renkert <rrenkert@intevation.de>
parents:
7227
diff
changeset
|
618 break; |
cd04a7389389
Read rivers supported by a module from config file.
Raimund Renkert <rrenkert@intevation.de>
parents:
7227
diff
changeset
|
619 } |
cd04a7389389
Read rivers supported by a module from config file.
Raimund Renkert <rrenkert@intevation.de>
parents:
7227
diff
changeset
|
620 } |
cd04a7389389
Read rivers supported by a module from config file.
Raimund Renkert <rrenkert@intevation.de>
parents:
7227
diff
changeset
|
621 } |
cd04a7389389
Read rivers supported by a module from config file.
Raimund Renkert <rrenkert@intevation.de>
parents:
7227
diff
changeset
|
622 } |
8870
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
623 modules.add(new Module(modulename, selected, group, rivers)); |
3630
28be160b5870
Add a module service. It's now possible to configure the modules which are
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
3256
diff
changeset
|
624 } |
5866
9a6741ccf6d4
FLYS artifacts: Renamed FLYSContext(Factory) to RiverContext(Factory).
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
625 context.put(RiverContext.MODULES, modules); |
3630
28be160b5870
Add a module service. It's now possible to configure the modules which are
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
3256
diff
changeset
|
626 } |
9555
ef5754ba5573
Implemented legend aggregation based on type of themes.
gernotbelger
parents:
8870
diff
changeset
|
627 } |