diff flys-artifacts/src/main/java/de/intevation/flys/collections/FLYSArtifactCollection.java @ 694:68c6c75a6f7c facets-slt

Add index and description of facets to collections describe document. flys-artifacts/branches/facets-slt@2136 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Thu, 16 Jun 2011 14:10:49 +0000
parents 44175d4720f8
children 45cd58a2a2bb
line wrap: on
line diff
--- a/flys-artifacts/src/main/java/de/intevation/flys/collections/FLYSArtifactCollection.java	Thu Jun 16 13:24:00 2011 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/collections/FLYSArtifactCollection.java	Thu Jun 16 14:10:49 2011 +0000
@@ -719,30 +719,29 @@
                 return;
             }
 
-            for (int i = 0; i < num; i++) {
-                Node theme = themes.item(i);
-
-                String name = XMLUtils.xpathString(
-                    theme, "@art:facet", ArtifactNamespaceContext.INSTANCE);
+            String uri = ArtifactNamespaceContext.NAMESPACE_URI;
 
-                String uuid = XMLUtils.xpathString(
-                    theme, "@art:artifact", ArtifactNamespaceContext.INSTANCE);
+            for (int i = 0; i < num; i++) {
+                Element theme = (Element) themes.item(i);
 
-                String pos = XMLUtils.xpathString(
-                    theme, "@art:pos", ArtifactNamespaceContext.INSTANCE);
+                String name   = theme.getAttributeNS(uri, "facet");
+                String uuid   = theme.getAttributeNS(uri, "artifact");
+                String pos    = theme.getAttributeNS(uri, "pos");
+                String active = theme.getAttributeNS(uri, "active");
+                String idx    = theme.getAttributeNS(uri, "index");
+                String desc   = theme.getAttributeNS(uri, "description");
 
-                String active = XMLUtils.xpathString(
-                    theme, "@art:active", ArtifactNamespaceContext.INSTANCE);
-
-                addTheme(uuid, name, pos, active);
+                addTheme(uuid, name, idx, pos, active, desc);
             }
         }
 
         protected void addTheme(
             String uuid,
             String name,
+            String index,
             String position,
-            String active)
+            String active,
+            String description)
         {
             if (logger.isDebugEnabled()) {
                 logger.debug("Add theme: ");
@@ -755,10 +754,11 @@
             try {
                 int pos = Integer.parseInt(position);
                 int act = Integer.parseInt(active);
+                int idx = Integer.parseInt(index);
 
                 themes.put(
                     new Integer(pos-1),
-                    new ManagedFacet(name, null, uuid, pos, act));
+                    new ManagedFacet(name, idx, description, uuid, pos, act));
             }
             catch (NumberFormatException nfe) {
                 logger.warn(nfe, nfe);

http://dive4elements.wald.intevation.org