Mercurial > dive4elements > river
annotate flys-artifacts/src/main/java/de/intevation/flys/themes/ThemeMapping.java @ 4837:9e25c7523485
Fixed calculation of effective width in MINFO SQ relation.
* Get all (including empty datasets) from db.
* Filter empty datasets when processing data of the same date.
* Added debug outputs.
author | Raimund Renkert <rrenkert@intevation.de> |
---|---|
date | Wed, 23 Jan 2013 11:14:41 +0100 |
parents | a5f65e8983be |
children |
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) { |
3453
e74e707ff650
Replace string comparison with empty string with length equals zero comparison
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1828
diff
changeset
|
87 if (patternStr == null || patternStr.length() == 0) { |
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
|
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); |
3785
a5f65e8983be
Merged revisions 5501-5502,5504-5508,5511-5513,5516-5519 via svnmerge from
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3781
diff
changeset
|
91 |
3781
8e713e9bb4d7
Defined colors for bed quality themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3453
diff
changeset
|
92 if (m.matches()) { |
8e713e9bb4d7
Defined colors for bed quality themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3453
diff
changeset
|
93 logger.debug("Pattern matches: " + text); |
8e713e9bb4d7
Defined colors for bed quality themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3453
diff
changeset
|
94 return true; |
8e713e9bb4d7
Defined colors for bed quality themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3453
diff
changeset
|
95 } |
8e713e9bb4d7
Defined colors for bed quality themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3453
diff
changeset
|
96 else { |
8e713e9bb4d7
Defined colors for bed quality themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3453
diff
changeset
|
97 logger.debug( |
8e713e9bb4d7
Defined colors for bed quality themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3453
diff
changeset
|
98 "Pattern '"+ text + "' does not match: " + this.patternStr); |
8e713e9bb4d7
Defined colors for bed quality themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3453
diff
changeset
|
99 return false; |
8e713e9bb4d7
Defined colors for bed quality themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3453
diff
changeset
|
100 } |
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
|
101 } |
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
|
102 |
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 |
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 * 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
|
106 * |
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 * 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
|
108 * 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
|
109 * 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
|
110 * |
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 * @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
|
112 * @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
|
113 */ |
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 public boolean masterAttrMatches(FLYSArtifact artifact) { |
3453
e74e707ff650
Replace string comparison with empty string with length equals zero comparison
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1828
diff
changeset
|
115 if (masterAttr == null || masterAttr.length() == 0) { |
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
|
116 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
|
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 |
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 // 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
|
120 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
|
121 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
|
122 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
|
123 + 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
|
124 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
|
125 } |
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
|
126 |
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
|
127 // Test. |
3781
8e713e9bb4d7
Defined colors for bed quality themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3453
diff
changeset
|
128 if (artifact.getDataAsString(parts[0]).equals(parts[1])) { |
8e713e9bb4d7
Defined colors for bed quality themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3453
diff
changeset
|
129 logger.debug("Matches master Attribute."); |
8e713e9bb4d7
Defined colors for bed quality themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3453
diff
changeset
|
130 return true; |
8e713e9bb4d7
Defined colors for bed quality themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3453
diff
changeset
|
131 } |
8e713e9bb4d7
Defined colors for bed quality themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3453
diff
changeset
|
132 else { |
8e713e9bb4d7
Defined colors for bed quality themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3453
diff
changeset
|
133 logger.debug("Does not match master Attribute."); |
8e713e9bb4d7
Defined colors for bed quality themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3453
diff
changeset
|
134 return false; |
8e713e9bb4d7
Defined colors for bed quality themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3453
diff
changeset
|
135 } |
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
|
136 } |
1828
9562ca537143
Added new optional condition for theme-mappings: the output name.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1822
diff
changeset
|
137 |
9562ca537143
Added new optional condition for theme-mappings: the output name.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1822
diff
changeset
|
138 |
9562ca537143
Added new optional condition for theme-mappings: the output name.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1822
diff
changeset
|
139 /** |
9562ca537143
Added new optional condition for theme-mappings: the output name.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1822
diff
changeset
|
140 * 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
|
141 * in parameter output. |
9562ca537143
Added new optional condition for theme-mappings: the output name.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1822
diff
changeset
|
142 */ |
9562ca537143
Added new optional condition for theme-mappings: the output name.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1822
diff
changeset
|
143 public boolean outputMatches(String output) { |
3453
e74e707ff650
Replace string comparison with empty string with length equals zero comparison
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1828
diff
changeset
|
144 if (this.output == null || this.output.length() == 0) { |
1828
9562ca537143
Added new optional condition for theme-mappings: the output name.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1822
diff
changeset
|
145 return true; |
9562ca537143
Added new optional condition for theme-mappings: the output name.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1822
diff
changeset
|
146 } |
9562ca537143
Added new optional condition for theme-mappings: the output name.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1822
diff
changeset
|
147 |
3781
8e713e9bb4d7
Defined colors for bed quality themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3453
diff
changeset
|
148 if (this.output.equals(output)) { |
8e713e9bb4d7
Defined colors for bed quality themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3453
diff
changeset
|
149 logger.debug("Output matches this mapping: " + output); |
8e713e9bb4d7
Defined colors for bed quality themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3453
diff
changeset
|
150 return true; |
8e713e9bb4d7
Defined colors for bed quality themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3453
diff
changeset
|
151 } |
8e713e9bb4d7
Defined colors for bed quality themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3453
diff
changeset
|
152 else { |
8e713e9bb4d7
Defined colors for bed quality themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3453
diff
changeset
|
153 logger.debug("Output '"+ output +"' does not match: "+ this.output); |
8e713e9bb4d7
Defined colors for bed quality themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3453
diff
changeset
|
154 return false; |
8e713e9bb4d7
Defined colors for bed quality themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3453
diff
changeset
|
155 } |
1828
9562ca537143
Added new optional condition for theme-mappings: the output name.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1822
diff
changeset
|
156 } |
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
|
157 } |
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
|
158 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |