Mercurial > dive4elements > river
diff flys-artifacts/src/main/java/de/intevation/flys/themes/ThemeFactory.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 | 6f047a407f84 |
line wrap: on
line diff
--- a/flys-artifacts/src/main/java/de/intevation/flys/themes/ThemeFactory.java Fri Nov 04 08:52:33 2011 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/themes/ThemeFactory.java Fri Nov 04 08:59:42 2011 +0000 @@ -59,29 +59,21 @@ /** - * Returns the theme for a specified output type and facet. - * - * @param c The FLYSContext that stores the mappings and themes. - * @param name The name of the mapping. - * - * @return a theme. - */ - public static Theme getTheme(FLYSContext c, String name) { - return getTheme(c, name, null); - } - - - /** * Get first matching theme for facet. * - * @param name Name to match "from" of theme mapping. + * @param name Name to match "from" of theme mapping. * @param pattern String to 'compare' to pattern in mapping. + * @param output Name of the current output * * @return First matching theme. */ - public static Theme getTheme(FLYSContext c, String name, String pattern) { - - logger.debug("Search theme for: " + name + " - " + pattern); + public static Theme getTheme( + FLYSContext c, + String name, + String pattern, + String output) + { + logger.debug("Search theme for: " + name + " - pattern: " + pattern); if (c == null || name == null) { logger.warn("Cannot search for theme."); @@ -113,7 +105,8 @@ for (ThemeMapping tm: mapping) { if (name.equals(tm.getFrom()) && tm.applyPattern(pattern) - && tm.masterAttrMatches(artifact)) + && tm.masterAttrMatches(artifact) + && tm.outputMatches(output)) { return t.get(tm.getTo()); } @@ -121,7 +114,7 @@ String msg = "No theme found for '" + name + - "' with pattern '" + pattern + "'."; + "' with pattern '" + pattern + "' and output " + output + "."; logger.warn(msg);