diff flys-client/src/main/java/de/intevation/flys/client/server/ArtifactDescriptionFactory.java @ 1571:1227878665b5

Introduced a DataFactory that should be used to create new Data instances. flys-client/trunk@3836 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Tue, 31 Jan 2012 10:34:54 +0000
parents c408074c6409
children f34bbb5fb6d2
line wrap: on
line diff
--- a/flys-client/src/main/java/de/intevation/flys/client/server/ArtifactDescriptionFactory.java	Mon Jan 30 14:36:54 2012 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/server/ArtifactDescriptionFactory.java	Tue Jan 31 10:34:54 2012 +0000
@@ -373,14 +373,7 @@
             for (int j = 0; j < size; j++) {
                 Node dataNode = dataNodes.item(j);
 
-                String dName = XMLUtils.xpathString(
-                    dataNode, "@art:name", ArtifactNamespaceContext.INSTANCE);
-                String dType = XMLUtils.xpathString(
-                    dataNode, "@art:type", ArtifactNamespaceContext.INSTANCE);
-
-                DataItem[] items = extractOldDataItems(dataNode);
-
-                list.add(new DefaultData(dName, dName, dType, items));
+                list.add(DataFactory.createDataFromElement((Element) dataNode));
 
                 data[i] = list;
             }
@@ -391,45 +384,6 @@
 
 
     /**
-     * This method extracts the data items from the data nodes that are placed
-     * in the static ui part of the DESCRIBE document.
-     *
-     * @param dataNode A data node that contains items.
-     *
-     * @return a list of DataItems.
-     */
-    protected static DataItem[] extractOldDataItems(Node dataNode) {
-        NodeList itemList = (NodeList) XMLUtils.xpath(
-            dataNode,
-            XPATH_STATIC_ITEM_NODE,
-            XPathConstants.NODESET,
-            ArtifactNamespaceContext.INSTANCE);
-
-        if (itemList == null || itemList.getLength() == 0) {
-            logger.debug("No old data items found.");
-            return null;
-        }
-
-        int count = itemList.getLength();
-
-        DataItem[] items = new DataItem[count];
-
-        for (int i = 0; i < count; i++) {
-            Node tmp = itemList.item(i);
-
-            String value = XMLUtils.xpathString(
-                tmp, "@art:value", ArtifactNamespaceContext.INSTANCE);
-            String label = XMLUtils.xpathString(
-                tmp, "@art:label", ArtifactNamespaceContext.INSTANCE);
-
-            items[i] = new DefaultDataItem(label, label, value);
-        }
-
-        return items;
-    }
-
-
-    /**
      * This method extracts the UIProvider specified by the data node.
      *
      * @param data The data node.

http://dive4elements.wald.intevation.org