Mercurial > dive4elements > river
annotate flys-artifacts/src/main/java/de/intevation/flys/themes/ThemeMapping.java @ 2315:c0dfa36add96
Some bugfixes and improvements in the calculation of historical discharge curves.
flys-artifacts/trunk@3996 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Thu, 09 Feb 2012 11:47:25 +0000 |
parents | 9562ca537143 |
children | e74e707ff650 |
rev | line source |
---|---|
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:
diff
changeset
|
1 package de.intevation.flys.themes; |
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:
diff
changeset
|
2 |
1822
6ed439ff61bf
Changed theme-mapping mechanism to include further condition (on master-artifacts attributes), added point themes for longitudinal.ws for calculations at locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1747
diff
changeset
|
3 import org.apache.log4j.Logger; |
6ed439ff61bf
Changed theme-mapping mechanism to include further condition (on master-artifacts attributes), added point themes for longitudinal.ws for calculations at locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1747
diff
changeset
|
4 |
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:
diff
changeset
|
5 import java.io.Serializable; |
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:
diff
changeset
|
6 import java.util.regex.Matcher; |
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:
diff
changeset
|
7 import java.util.regex.Pattern; |
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:
diff
changeset
|
8 |
1822
6ed439ff61bf
Changed theme-mapping mechanism to include further condition (on master-artifacts attributes), added point themes for longitudinal.ws for calculations at locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1747
diff
changeset
|
9 import de.intevation.flys.artifacts.FLYSArtifact; |
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:
diff
changeset
|
10 |
1822
6ed439ff61bf
Changed theme-mapping mechanism to include further condition (on master-artifacts attributes), added point themes for longitudinal.ws for calculations at locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1747
diff
changeset
|
11 /** |
6ed439ff61bf
Changed theme-mapping mechanism to include further condition (on master-artifacts attributes), added point themes for longitudinal.ws for calculations at locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1747
diff
changeset
|
12 * Represents mapping to a theme (including conditions). |
6ed439ff61bf
Changed theme-mapping mechanism to include further condition (on master-artifacts attributes), added point themes for longitudinal.ws for calculations at locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1747
diff
changeset
|
13 */ |
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:
diff
changeset
|
14 public class ThemeMapping implements Serializable { |
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:
diff
changeset
|
15 |
1822
6ed439ff61bf
Changed theme-mapping mechanism to include further condition (on master-artifacts attributes), added point themes for longitudinal.ws for calculations at locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1747
diff
changeset
|
16 /** The logger that is used in this class */ |
6ed439ff61bf
Changed theme-mapping mechanism to include further condition (on master-artifacts attributes), added point themes for longitudinal.ws for calculations at locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1747
diff
changeset
|
17 private static Logger logger = Logger.getLogger(ThemeMapping.class); |
6ed439ff61bf
Changed theme-mapping mechanism to include further condition (on master-artifacts attributes), added point themes for longitudinal.ws for calculations at locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1747
diff
changeset
|
18 |
6ed439ff61bf
Changed theme-mapping mechanism to include further condition (on master-artifacts attributes), added point themes for longitudinal.ws for calculations at locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1747
diff
changeset
|
19 /** Name from which to map. */ |
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:
diff
changeset
|
20 protected String from; |
1822
6ed439ff61bf
Changed theme-mapping mechanism to include further condition (on master-artifacts attributes), added point themes for longitudinal.ws for calculations at locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1747
diff
changeset
|
21 |
6ed439ff61bf
Changed theme-mapping mechanism to include further condition (on master-artifacts attributes), added point themes for longitudinal.ws for calculations at locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1747
diff
changeset
|
22 /** Name to which to map. */ |
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:
diff
changeset
|
23 protected String to; |
1822
6ed439ff61bf
Changed theme-mapping mechanism to include further condition (on master-artifacts attributes), added point themes for longitudinal.ws for calculations at locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1747
diff
changeset
|
24 |
6ed439ff61bf
Changed theme-mapping mechanism to include further condition (on master-artifacts attributes), added point themes for longitudinal.ws for calculations at locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1747
diff
changeset
|
25 /** Given pattern (held against facet description). */ |
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:
diff
changeset
|
26 protected String patternStr; |
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:
diff
changeset
|
27 |
1822
6ed439ff61bf
Changed theme-mapping mechanism to include further condition (on master-artifacts attributes), added point themes for longitudinal.ws for calculations at locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1747
diff
changeset
|
28 /** Given masterAttr pattern (held against masterartifacts attributes). */ |
6ed439ff61bf
Changed theme-mapping mechanism to include further condition (on master-artifacts attributes), added point themes for longitudinal.ws for calculations at locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1747
diff
changeset
|
29 protected String masterAttr; |
6ed439ff61bf
Changed theme-mapping mechanism to include further condition (on master-artifacts attributes), added point themes for longitudinal.ws for calculations at locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1747
diff
changeset
|
30 |
1828
9562ca537143
Added new optional condition for theme-mappings: the output name.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1822
diff
changeset
|
31 /** Given output for which mapping is valid. */ |
9562ca537143
Added new optional condition for theme-mappings: the output name.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1822
diff
changeset
|
32 protected String output; |
9562ca537143
Added new optional condition for theme-mappings: the output name.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1822
diff
changeset
|
33 |
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:
diff
changeset
|
34 protected Pattern pattern; |
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:
diff
changeset
|
35 |
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:
diff
changeset
|
36 |
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:
diff
changeset
|
37 public ThemeMapping(String from, String to) { |
1828
9562ca537143
Added new optional condition for theme-mappings: the output name.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1822
diff
changeset
|
38 this(from, to, null, null, null); |
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:
diff
changeset
|
39 } |
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:
diff
changeset
|
40 |
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:
diff
changeset
|
41 |
1822
6ed439ff61bf
Changed theme-mapping mechanism to include further condition (on master-artifacts attributes), added point themes for longitudinal.ws for calculations at locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1747
diff
changeset
|
42 public ThemeMapping( |
6ed439ff61bf
Changed theme-mapping mechanism to include further condition (on master-artifacts attributes), added point themes for longitudinal.ws for calculations at locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1747
diff
changeset
|
43 String from, |
6ed439ff61bf
Changed theme-mapping mechanism to include further condition (on master-artifacts attributes), added point themes for longitudinal.ws for calculations at locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1747
diff
changeset
|
44 String to, |
6ed439ff61bf
Changed theme-mapping mechanism to include further condition (on master-artifacts attributes), added point themes for longitudinal.ws for calculations at locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1747
diff
changeset
|
45 String patternStr, |
1828
9562ca537143
Added new optional condition for theme-mappings: the output name.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1822
diff
changeset
|
46 String masterAttr, |
9562ca537143
Added new optional condition for theme-mappings: the output name.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1822
diff
changeset
|
47 String output) |
1822
6ed439ff61bf
Changed theme-mapping mechanism to include further condition (on master-artifacts attributes), added point themes for longitudinal.ws for calculations at locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1747
diff
changeset
|
48 { |
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:
diff
changeset
|
49 this.from = 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:
diff
changeset
|
50 this.to = to; |
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:
diff
changeset
|
51 this.patternStr = patternStr; |
1822
6ed439ff61bf
Changed theme-mapping mechanism to include further condition (on master-artifacts attributes), added point themes for longitudinal.ws for calculations at locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1747
diff
changeset
|
52 this.masterAttr = masterAttr; |
1828
9562ca537143
Added new optional condition for theme-mappings: the output name.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1822
diff
changeset
|
53 this.output = 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:
diff
changeset
|
54 |
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:
diff
changeset
|
55 this.pattern = Pattern.compile(patternStr); |
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:
diff
changeset
|
56 } |
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:
diff
changeset
|
57 |
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:
diff
changeset
|
58 |
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:
diff
changeset
|
59 public String getFrom() { |
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:
diff
changeset
|
60 return 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:
diff
changeset
|
61 } |
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:
diff
changeset
|
62 |
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:
diff
changeset
|
63 |
1822
6ed439ff61bf
Changed theme-mapping mechanism to include further condition (on master-artifacts attributes), added point themes for longitudinal.ws for calculations at locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1747
diff
changeset
|
64 /** |
6ed439ff61bf
Changed theme-mapping mechanism to include further condition (on master-artifacts attributes), added point themes for longitudinal.ws for calculations at locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1747
diff
changeset
|
65 * Get name of theme that is mapped to. |
6ed439ff61bf
Changed theme-mapping mechanism to include further condition (on master-artifacts attributes), added point themes for longitudinal.ws for calculations at locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1747
diff
changeset
|
66 */ |
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:
diff
changeset
|
67 public String getTo() { |
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:
diff
changeset
|
68 return to; |
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:
diff
changeset
|
69 } |
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:
diff
changeset
|
70 |
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:
diff
changeset
|
71 |
1822
6ed439ff61bf
Changed theme-mapping mechanism to include further condition (on master-artifacts attributes), added point themes for longitudinal.ws for calculations at locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1747
diff
changeset
|
72 /** |
6ed439ff61bf
Changed theme-mapping mechanism to include further condition (on master-artifacts attributes), added point themes for longitudinal.ws for calculations at locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1747
diff
changeset
|
73 * Get pattern. |
6ed439ff61bf
Changed theme-mapping mechanism to include further condition (on master-artifacts attributes), added point themes for longitudinal.ws for calculations at locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1747
diff
changeset
|
74 */ |
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:
diff
changeset
|
75 public String getPatternStr() { |
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:
diff
changeset
|
76 return patternStr; |
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:
diff
changeset
|
77 } |
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:
diff
changeset
|
78 |
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:
diff
changeset
|
79 |
1822
6ed439ff61bf
Changed theme-mapping mechanism to include further condition (on master-artifacts attributes), added point themes for longitudinal.ws for calculations at locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1747
diff
changeset
|
80 /** |
6ed439ff61bf
Changed theme-mapping mechanism to include further condition (on master-artifacts attributes), added point themes for longitudinal.ws for calculations at locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1747
diff
changeset
|
81 * Match regular expression against text. |
6ed439ff61bf
Changed theme-mapping mechanism to include further condition (on master-artifacts attributes), added point themes for longitudinal.ws for calculations at locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1747
diff
changeset
|
82 * |
6ed439ff61bf
Changed theme-mapping mechanism to include further condition (on master-artifacts attributes), added point themes for longitudinal.ws for calculations at locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1747
diff
changeset
|
83 * @param text string to be matched against. |
6ed439ff61bf
Changed theme-mapping mechanism to include further condition (on master-artifacts attributes), added point themes for longitudinal.ws for calculations at locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1747
diff
changeset
|
84 * @return true if pattern matches text or pattern is empty. |
6ed439ff61bf
Changed theme-mapping mechanism to include further condition (on master-artifacts attributes), added point themes for longitudinal.ws for calculations at locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1747
diff
changeset
|
85 */ |
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:
diff
changeset
|
86 public boolean applyPattern(String text) { |
1822
6ed439ff61bf
Changed theme-mapping mechanism to include further condition (on master-artifacts attributes), added point themes for longitudinal.ws for calculations at locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1747
diff
changeset
|
87 if (patternStr == null || patternStr.equals("")) { |
6ed439ff61bf
Changed theme-mapping mechanism to include further condition (on master-artifacts attributes), added point themes for longitudinal.ws for calculations at locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1747
diff
changeset
|
88 return true; |
6ed439ff61bf
Changed theme-mapping mechanism to include further condition (on master-artifacts attributes), added point themes for longitudinal.ws for calculations at locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1747
diff
changeset
|
89 } |
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:
diff
changeset
|
90 Matcher m = pattern.matcher(text); |
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:
diff
changeset
|
91 return m.matches(); |
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:
diff
changeset
|
92 } |
1822
6ed439ff61bf
Changed theme-mapping mechanism to include further condition (on master-artifacts attributes), added point themes for longitudinal.ws for calculations at locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1747
diff
changeset
|
93 |
6ed439ff61bf
Changed theme-mapping mechanism to include further condition (on master-artifacts attributes), added point themes for longitudinal.ws for calculations at locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1747
diff
changeset
|
94 |
6ed439ff61bf
Changed theme-mapping mechanism to include further condition (on master-artifacts attributes), added point themes for longitudinal.ws for calculations at locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1747
diff
changeset
|
95 /** |
6ed439ff61bf
Changed theme-mapping mechanism to include further condition (on master-artifacts attributes), added point themes for longitudinal.ws for calculations at locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1747
diff
changeset
|
96 * Inspects Artifacts data given the masterAttr-condition. |
6ed439ff61bf
Changed theme-mapping mechanism to include further condition (on master-artifacts attributes), added point themes for longitudinal.ws for calculations at locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1747
diff
changeset
|
97 * |
6ed439ff61bf
Changed theme-mapping mechanism to include further condition (on master-artifacts attributes), added point themes for longitudinal.ws for calculations at locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1747
diff
changeset
|
98 * The only condition implemented so far is 'key==value', for which |
6ed439ff61bf
Changed theme-mapping mechanism to include further condition (on master-artifacts attributes), added point themes for longitudinal.ws for calculations at locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1747
diff
changeset
|
99 * the Artifacts data with name "key" has to be of value "value" in order |
6ed439ff61bf
Changed theme-mapping mechanism to include further condition (on master-artifacts attributes), added point themes for longitudinal.ws for calculations at locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1747
diff
changeset
|
100 * for true to be returned. |
6ed439ff61bf
Changed theme-mapping mechanism to include further condition (on master-artifacts attributes), added point themes for longitudinal.ws for calculations at locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1747
diff
changeset
|
101 * |
6ed439ff61bf
Changed theme-mapping mechanism to include further condition (on master-artifacts attributes), added point themes for longitudinal.ws for calculations at locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1747
diff
changeset
|
102 * @param artifact Artifact of which to inspect data. |
6ed439ff61bf
Changed theme-mapping mechanism to include further condition (on master-artifacts attributes), added point themes for longitudinal.ws for calculations at locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1747
diff
changeset
|
103 * @return true if no condition is specified or condition is met. |
6ed439ff61bf
Changed theme-mapping mechanism to include further condition (on master-artifacts attributes), added point themes for longitudinal.ws for calculations at locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1747
diff
changeset
|
104 */ |
6ed439ff61bf
Changed theme-mapping mechanism to include further condition (on master-artifacts attributes), added point themes for longitudinal.ws for calculations at locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1747
diff
changeset
|
105 public boolean masterAttrMatches(FLYSArtifact artifact) { |
6ed439ff61bf
Changed theme-mapping mechanism to include further condition (on master-artifacts attributes), added point themes for longitudinal.ws for calculations at locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1747
diff
changeset
|
106 if (masterAttr == null || masterAttr.equals("")) { |
6ed439ff61bf
Changed theme-mapping mechanism to include further condition (on master-artifacts attributes), added point themes for longitudinal.ws for calculations at locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1747
diff
changeset
|
107 return true; |
6ed439ff61bf
Changed theme-mapping mechanism to include further condition (on master-artifacts attributes), added point themes for longitudinal.ws for calculations at locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1747
diff
changeset
|
108 } |
6ed439ff61bf
Changed theme-mapping mechanism to include further condition (on master-artifacts attributes), added point themes for longitudinal.ws for calculations at locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1747
diff
changeset
|
109 |
6ed439ff61bf
Changed theme-mapping mechanism to include further condition (on master-artifacts attributes), added point themes for longitudinal.ws for calculations at locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1747
diff
changeset
|
110 // Operator split. |
6ed439ff61bf
Changed theme-mapping mechanism to include further condition (on master-artifacts attributes), added point themes for longitudinal.ws for calculations at locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1747
diff
changeset
|
111 String[] parts = masterAttr.split("=="); |
6ed439ff61bf
Changed theme-mapping mechanism to include further condition (on master-artifacts attributes), added point themes for longitudinal.ws for calculations at locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1747
diff
changeset
|
112 if (parts.length != 2) { |
6ed439ff61bf
Changed theme-mapping mechanism to include further condition (on master-artifacts attributes), added point themes for longitudinal.ws for calculations at locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1747
diff
changeset
|
113 logger.error("ThemeMapping could not parse masterAttr.-condition:_" |
6ed439ff61bf
Changed theme-mapping mechanism to include further condition (on master-artifacts attributes), added point themes for longitudinal.ws for calculations at locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1747
diff
changeset
|
114 + masterAttr + "_"); |
6ed439ff61bf
Changed theme-mapping mechanism to include further condition (on master-artifacts attributes), added point themes for longitudinal.ws for calculations at locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1747
diff
changeset
|
115 return false; |
6ed439ff61bf
Changed theme-mapping mechanism to include further condition (on master-artifacts attributes), added point themes for longitudinal.ws for calculations at locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1747
diff
changeset
|
116 } |
6ed439ff61bf
Changed theme-mapping mechanism to include further condition (on master-artifacts attributes), added point themes for longitudinal.ws for calculations at locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1747
diff
changeset
|
117 |
6ed439ff61bf
Changed theme-mapping mechanism to include further condition (on master-artifacts attributes), added point themes for longitudinal.ws for calculations at locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1747
diff
changeset
|
118 // Test. |
6ed439ff61bf
Changed theme-mapping mechanism to include further condition (on master-artifacts attributes), added point themes for longitudinal.ws for calculations at locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1747
diff
changeset
|
119 return artifact.getDataAsString(parts[0]).equals(parts[1]); |
6ed439ff61bf
Changed theme-mapping mechanism to include further condition (on master-artifacts attributes), added point themes for longitudinal.ws for calculations at locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1747
diff
changeset
|
120 } |
1828
9562ca537143
Added new optional condition for theme-mappings: the output name.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1822
diff
changeset
|
121 |
9562ca537143
Added new optional condition for theme-mappings: the output name.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1822
diff
changeset
|
122 |
9562ca537143
Added new optional condition for theme-mappings: the output name.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1822
diff
changeset
|
123 /** |
9562ca537143
Added new optional condition for theme-mappings: the output name.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1822
diff
changeset
|
124 * Returns true if no output condition exists, or the condition is met |
9562ca537143
Added new optional condition for theme-mappings: the output name.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1822
diff
changeset
|
125 * in parameter output. |
9562ca537143
Added new optional condition for theme-mappings: the output name.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1822
diff
changeset
|
126 */ |
9562ca537143
Added new optional condition for theme-mappings: the output name.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1822
diff
changeset
|
127 public boolean outputMatches(String output) { |
9562ca537143
Added new optional condition for theme-mappings: the output name.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1822
diff
changeset
|
128 if (this.output == null || this.output.equals("")) { |
9562ca537143
Added new optional condition for theme-mappings: the output name.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1822
diff
changeset
|
129 return true; |
9562ca537143
Added new optional condition for theme-mappings: the output name.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1822
diff
changeset
|
130 } |
9562ca537143
Added new optional condition for theme-mappings: the output name.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1822
diff
changeset
|
131 |
9562ca537143
Added new optional condition for theme-mappings: the output name.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1822
diff
changeset
|
132 return this.output.equals(output); |
9562ca537143
Added new optional condition for theme-mappings: the output name.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1822
diff
changeset
|
133 } |
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:
diff
changeset
|
134 } |
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:
diff
changeset
|
135 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |