diff flys-artifacts/src/main/java/de/intevation/flys/collections/FLYSArtifactCollection.java @ 1747:d2a17e990c70

Improved the Themes: we now support special themes for facets which need to match a given pattern string. flys-artifacts/trunk@3047 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Thu, 20 Oct 2011 13:45:45 +0000
parents 62efd1288e34
children 460374a08c44
line wrap: on
line diff
--- a/flys-artifacts/src/main/java/de/intevation/flys/collections/FLYSArtifactCollection.java	Thu Oct 20 13:29:54 2011 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/collections/FLYSArtifactCollection.java	Thu Oct 20 13:45:45 2011 +0000
@@ -302,6 +302,7 @@
                         art,
                         outName,
                         facetName,
+                        theme.getDescription(),
                         theme.getIndex(),
                         context),
                     theme.getActive() == 1);
@@ -473,6 +474,7 @@
         String      uuid,
         String      outName,
         String      facet,
+        String      pattern,
         int         index,
         CallContext context)
     throws    ArtifactDatabaseException
@@ -486,15 +488,10 @@
             ? (FLYSContext) context
             : (FLYSContext) context.globalContext();
 
-        Map<String, String> mappings = (Map<String, String>)
-            flysContext.get(FLYSContext.THEME_MAPPING);
-
-        String themeName = mappings.get(facet);
-
         Document attr = db.getCollectionItemAttribute(identifier(), uuid, meta);
 
         if (attr == null) {
-            attr = initItemAttribute(uuid, facet, index, context);
+            attr = initItemAttribute(uuid, facet, pattern, index, context);
 
             if (attr == null) {
                 return null;
@@ -514,7 +511,7 @@
             return null;
         }
 
-        log.debug("Search theme '" + themeName + "' in attribute.");
+        log.debug("Search theme for facet '" + facet + "' in attribute.");
 
         Node theme = (Node) XMLUtils.xpath(
             tmp,
@@ -526,7 +523,7 @@
         if (theme == null) {
             log.warn("Could not find the theme in attribute of: " + uuid);
 
-            Theme t = getThemeForFacet(uuid, facet, index, context);
+            Theme t = getThemeForFacet(uuid, facet, pattern, index, context);
 
             if (t == null) {
                 log.warn("No theme found for facet: " + facet);
@@ -619,12 +616,13 @@
     protected Document initItemAttribute(
         String      uuid,
         String      facet,
+        String      pattern,
         int         index,
         CallContext context)
     {
         log.info("FLYSArtifactCollection.initItemAttribute");
 
-        Theme t = getThemeForFacet(uuid, facet, index, context);
+        Theme t = getThemeForFacet(uuid, facet, pattern, index, context);
 
         if (t == null) {
             log.info("Could not find theme for facet. Cancel initialization.");
@@ -681,6 +679,7 @@
     protected Theme getThemeForFacet(
         String uuid,
         String facet,
+        String pattern,
         int    index,
         CallContext context)
     {
@@ -690,7 +689,7 @@
             ? (FLYSContext) context
             : (FLYSContext) context.globalContext();
 
-        Theme t = ThemeFactory.getTheme(flysContext, facet);
+        Theme t = ThemeFactory.getTheme(flysContext, facet, pattern);
 
         if (t != null) {
             t.setFacet(facet);

http://dive4elements.wald.intevation.org