Mercurial > dive4elements > river
comparison flys-artifacts/src/main/java/de/intevation/flys/themes/ThemeMapping.java @ 1828:9562ca537143
Added new optional condition for theme-mappings: the output name.
flys-artifacts/trunk@3158 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Fri, 04 Nov 2011 08:59:42 +0000 |
parents | 6ed439ff61bf |
children | e74e707ff650 |
comparison
equal
deleted
inserted
replaced
1827:03f129fa0256 | 1828:9562ca537143 |
---|---|
26 protected String patternStr; | 26 protected String patternStr; |
27 | 27 |
28 /** Given masterAttr pattern (held against masterartifacts attributes). */ | 28 /** Given masterAttr pattern (held against masterartifacts attributes). */ |
29 protected String masterAttr; | 29 protected String masterAttr; |
30 | 30 |
31 /** Given output for which mapping is valid. */ | |
32 protected String output; | |
33 | |
31 protected Pattern pattern; | 34 protected Pattern pattern; |
32 | 35 |
33 | 36 |
34 public ThemeMapping(String from, String to) { | 37 public ThemeMapping(String from, String to) { |
35 this(from, to, null, null); | 38 this(from, to, null, null, null); |
36 } | 39 } |
37 | 40 |
38 | 41 |
39 public ThemeMapping( | 42 public ThemeMapping( |
40 String from, | 43 String from, |
41 String to, | 44 String to, |
42 String patternStr, | 45 String patternStr, |
43 String masterAttr) | 46 String masterAttr, |
47 String output) | |
44 { | 48 { |
45 this.from = from; | 49 this.from = from; |
46 this.to = to; | 50 this.to = to; |
47 this.patternStr = patternStr; | 51 this.patternStr = patternStr; |
48 this.masterAttr = masterAttr; | 52 this.masterAttr = masterAttr; |
53 this.output = output; | |
49 | 54 |
50 this.pattern = Pattern.compile(patternStr); | 55 this.pattern = Pattern.compile(patternStr); |
51 } | 56 } |
52 | 57 |
53 | 58 |
111 } | 116 } |
112 | 117 |
113 // Test. | 118 // Test. |
114 return artifact.getDataAsString(parts[0]).equals(parts[1]); | 119 return artifact.getDataAsString(parts[0]).equals(parts[1]); |
115 } | 120 } |
121 | |
122 | |
123 /** | |
124 * Returns true if no output condition exists, or the condition is met | |
125 * in parameter output. | |
126 */ | |
127 public boolean outputMatches(String output) { | |
128 if (this.output == null || this.output.equals("")) { | |
129 return true; | |
130 } | |
131 | |
132 return this.output.equals(output); | |
133 } | |
116 } | 134 } |
117 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : | 135 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |