Mercurial > dive4elements > river
annotate artifacts/src/main/java/org/dive4elements/river/themes/ThemeMapping.java @ 5863:4897a58c8746
River artifacts: Added new copyright headers.
author | Sascha L. Teichmann <teichmann@intevation.de> |
---|---|
date | Sun, 28 Apr 2013 14:40:59 +0200 |
parents | 5aa05a7a34b7 |
children | 59ff03ff48f1 |
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 * |
4897a58c8746
River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
4 * This file is Free Software under the GNU AGPL (>=v3) |
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 |
4897a58c8746
River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
6 * documentation coming with Dive4Elements River for details. |
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:
3785
diff
changeset
|
9 package org.dive4elements.river.themes; |
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 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
|
12 |
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
|
13 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
|
14 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
|
15 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
|
16 |
5831
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3785
diff
changeset
|
17 import org.dive4elements.river.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
|
18 |
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
|
19 /** |
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
|
20 * 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
|
21 */ |
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
|
22 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
|
23 |
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 /** 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
|
25 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
|
26 |
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
|
27 /** 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
|
28 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
|
29 |
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 /** 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
|
31 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
|
32 |
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
|
33 /** 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
|
34 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
|
35 |
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
|
36 /** 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
|
37 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
|
38 |
1828
9562ca537143
Added new optional condition for theme-mappings: the output name.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1822
diff
changeset
|
39 /** 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
|
40 protected String output; |
9562ca537143
Added new optional condition for theme-mappings: the output name.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1822
diff
changeset
|
41 |
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
|
42 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
|
43 |
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
|
44 |
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
|
45 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
|
46 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
|
47 } |
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
|
48 |
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 |
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
|
50 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
|
51 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
|
52 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
|
53 String patternStr, |
1828
9562ca537143
Added new optional condition for theme-mappings: the output name.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1822
diff
changeset
|
54 String masterAttr, |
9562ca537143
Added new optional condition for theme-mappings: the output name.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1822
diff
changeset
|
55 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
|
56 { |
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
|
57 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
|
58 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
|
59 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
|
60 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
|
61 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
|
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 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
|
64 } |
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
|
65 |
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
|
66 |
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 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
|
68 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
|
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 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
|
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 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
|
76 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
|
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 * 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
|
82 */ |
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
|
83 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
|
84 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
|
85 } |
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 |
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
|
87 |
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 /** |
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 * 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
|
90 * |
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
|
91 * @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
|
92 * @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
|
93 */ |
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
|
94 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
|
95 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
|
96 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
|
97 } |
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
|
98 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
|
99 |
3781
8e713e9bb4d7
Defined colors for bed quality themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3453
diff
changeset
|
100 if (m.matches()) { |
8e713e9bb4d7
Defined colors for bed quality themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3453
diff
changeset
|
101 logger.debug("Pattern matches: " + text); |
8e713e9bb4d7
Defined colors for bed quality themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3453
diff
changeset
|
102 return true; |
8e713e9bb4d7
Defined colors for bed quality themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3453
diff
changeset
|
103 } |
8e713e9bb4d7
Defined colors for bed quality themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3453
diff
changeset
|
104 else { |
8e713e9bb4d7
Defined colors for bed quality themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3453
diff
changeset
|
105 logger.debug( |
8e713e9bb4d7
Defined colors for bed quality themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3453
diff
changeset
|
106 "Pattern '"+ text + "' does not match: " + this.patternStr); |
8e713e9bb4d7
Defined colors for bed quality themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3453
diff
changeset
|
107 return false; |
8e713e9bb4d7
Defined colors for bed quality themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3453
diff
changeset
|
108 } |
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
|
109 } |
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
|
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 |
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 /** |
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 * 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
|
114 * |
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 * 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
|
116 * 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
|
117 * 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
|
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 * @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
|
120 * @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
|
121 */ |
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 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
|
123 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
|
124 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
|
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 // 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
|
128 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
|
129 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
|
130 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
|
131 + 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
|
132 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
|
133 } |
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
|
134 |
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
|
135 // Test. |
3781
8e713e9bb4d7
Defined colors for bed quality themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3453
diff
changeset
|
136 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
|
137 logger.debug("Matches master Attribute."); |
8e713e9bb4d7
Defined colors for bed quality themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3453
diff
changeset
|
138 return true; |
8e713e9bb4d7
Defined colors for bed quality themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3453
diff
changeset
|
139 } |
8e713e9bb4d7
Defined colors for bed quality themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3453
diff
changeset
|
140 else { |
8e713e9bb4d7
Defined colors for bed quality themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3453
diff
changeset
|
141 logger.debug("Does not match master Attribute."); |
8e713e9bb4d7
Defined colors for bed quality themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3453
diff
changeset
|
142 return false; |
8e713e9bb4d7
Defined colors for bed quality themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3453
diff
changeset
|
143 } |
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
|
144 } |
1828
9562ca537143
Added new optional condition for theme-mappings: the output name.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1822
diff
changeset
|
145 |
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 /** |
9562ca537143
Added new optional condition for theme-mappings: the output name.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1822
diff
changeset
|
148 * 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
|
149 * in parameter output. |
9562ca537143
Added new optional condition for theme-mappings: the output name.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1822
diff
changeset
|
150 */ |
9562ca537143
Added new optional condition for theme-mappings: the output name.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1822
diff
changeset
|
151 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
|
152 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
|
153 return true; |
9562ca537143
Added new optional condition for theme-mappings: the output name.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1822
diff
changeset
|
154 } |
9562ca537143
Added new optional condition for theme-mappings: the output name.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1822
diff
changeset
|
155 |
3781
8e713e9bb4d7
Defined colors for bed quality themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3453
diff
changeset
|
156 if (this.output.equals(output)) { |
8e713e9bb4d7
Defined colors for bed quality themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3453
diff
changeset
|
157 logger.debug("Output matches this mapping: " + output); |
8e713e9bb4d7
Defined colors for bed quality themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3453
diff
changeset
|
158 return true; |
8e713e9bb4d7
Defined colors for bed quality themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3453
diff
changeset
|
159 } |
8e713e9bb4d7
Defined colors for bed quality themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3453
diff
changeset
|
160 else { |
8e713e9bb4d7
Defined colors for bed quality themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3453
diff
changeset
|
161 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
|
162 return false; |
8e713e9bb4d7
Defined colors for bed quality themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3453
diff
changeset
|
163 } |
1828
9562ca537143
Added new optional condition for theme-mappings: the output name.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1822
diff
changeset
|
164 } |
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
|
165 } |
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
|
166 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |