changeset 79:e33c61735a4e

Implementation of the Static UI done gnv-artifacts/trunk@101 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Tim Englich <tim.englich@intevation.de>
date Thu, 17 Sep 2009 13:38:12 +0000 (2009-09-17)
parents 969faa37a11b
children 29a7ba731838
files gnv-artifacts/Changelog gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/fis/FISArtifact.java gnv-artifacts/src/main/java/de/intevation/gnv/transition/MinMaxTransition.java gnv-artifacts/src/main/java/de/intevation/gnv/transition/TransitionBase.java gnv-artifacts/src/main/java/de/intevation/gnv/transition/describedata/DefaultKeyValueDescribeData.java gnv-artifacts/src/main/java/de/intevation/gnv/transition/describedata/DefaultMinMaxDescribeData.java gnv-artifacts/src/main/java/de/intevation/gnv/transition/describedata/KeyValueDescibeData.java gnv-artifacts/src/main/java/de/intevation/gnv/transition/describedata/MinMaxDescribeData.java gnv-artifacts/src/main/java/de/intevation/gnv/transition/describedata/NamedArrayList.java gnv-artifacts/src/main/java/de/intevation/gnv/transition/describedata/NamedCollection.java gnv-artifacts/src/main/java/de/intevation/gnv/utils/ArtifactXMLUtilities.java gnv-artifacts/src/test/ressources/conf.xml
diffstat 12 files changed, 386 insertions(+), 68 deletions(-) [+]
line wrap: on
line diff
--- a/gnv-artifacts/Changelog	Wed Sep 16 12:38:24 2009 +0000
+++ b/gnv-artifacts/Changelog	Thu Sep 17 13:38:12 2009 +0000
@@ -1,3 +1,32 @@
+2009-09-17  Tim Englich  <tim.englich@intevation.de>
+    * src/test/ressources/conf.xml Edited: 
+      Some structurechanges done.
+      
+    * src/main/java/de/intevation/gnv/utils/ArtifactXMLUtilities.java Edited:
+      Fixed Bug supporting UTF-8 Documents properly. 
+    * src/main/java/de/intevation/gnv/transition/describedata/DefaultKeyValueDescribeData.java Edited, 
+    * src/main/java/de/intevation/gnv/transition/describedata/KeyValueDescibeData.java Edited,
+     Added Methods for setting and getting the selection-state of this objects. 
+    
+    * src/main/java/de/intevation/gnv/transition/describedata/DefaultMinMaxDescribeData.java Edited, 
+      src/main/java/de/intevation/gnv/transition/describedata/MinMaxDescribeData.java Edited:
+      Added setter for min an max-Values and getters an setters for minName  and maxName
+       
+    * src/main/java/de/intevation/gnv/transition/describedata/NamedCollection.java Added, 
+      src/main/java/de/intevation/gnv/transition/describedata/NamedArrayList.java Added:
+      Collection ans an Implementation of this Collection for Storing Name of the Collection and if 
+      the Values in it are multiselectable.
+     
+    * src/main/java/de/intevation/gnv/transition/TransitionBase.java :
+     Static UI-Support and valid SelectionStorage added.
+     I added also an imporvement of the multiselect Methods for Datasets 
+    * src/main/java/de/intevation/gnv/transition/MinMaxTransition.java Edited:
+      Storage of changed Values added
+      
+    * src/main/java/de/intevation/gnv/artifacts/fis/FISArtifact.java Edited:
+      Static UI Support Added
+       
+       
 2009-09-16  Tim Englich  <tim.englich@intevation.de>
 
     * src/test/ressources/conf.xml Edited,
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/fis/FISArtifact.java	Wed Sep 16 12:38:24 2009 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/fis/FISArtifact.java	Thu Sep 17 13:38:12 2009 +0000
@@ -81,18 +81,22 @@
     public Document advance(Document target, CallContext context) {
         if (this.productArtifact == null){
             if (this.current != null){
-                String uuid = Config.getStringXPath(target, "action/uuid/@value"); // TODO: m�ssen wir f�r das subartifact eine ver�nderte uuid f�hren?
-                String hash = Config.getStringXPath(target, "action/hash/@value");
-                this.productArtifact = this.current.getArtifactFactory().createArtifact(uuid, context);
-                Document feedDocument =  xmlUtilities.reInitDocument(this.createFeedProductArtifactDocument(uuid, hash));
-                log.debug("Feed ==> "+this.xmlUtilities.writeDocument2String(feedDocument));
-                Document descibeDocument =  xmlUtilities.reInitDocument(this.productArtifact.describe(context));
-                log.debug("Descibe ==> "+this.xmlUtilities.writeDocument2String(descibeDocument));
-                this.productArtifact.feed(feedDocument, context);
-                String targetName =  Config.getStringXPath(descibeDocument, "result/reachable-states/state/@name");
-                Document advanceDocument = xmlUtilities.reInitDocument(this.createAdvanceProductArtifactDocument(uuid, hash, targetName));
-                log.debug("Advance ==> "+this.xmlUtilities.writeDocument2String(advanceDocument));
-                return this.productArtifact.advance(advanceDocument, context);
+                try {
+                    String uuid = Config.getStringXPath(target, "action/uuid/@value"); // TODO: m�ssen wir f�r das subartifact eine ver�nderte uuid f�hren?
+                    String hash = Config.getStringXPath(target, "action/hash/@value");
+                    this.productArtifact = this.current.getArtifactFactory().createArtifact(uuid, context);
+                    Document feedDocument =  xmlUtilities.reInitDocument(this.createFeedProductArtifactDocument(uuid, hash));
+                    log.debug("Feed ==> "+this.xmlUtilities.writeDocument2String(feedDocument));
+                    Document descibeDocument =  xmlUtilities.reInitDocument(this.productArtifact.describe(context));
+                    log.debug("Descibe ==> "+this.xmlUtilities.writeDocument2String(descibeDocument));
+                    this.productArtifact.feed(feedDocument, context);
+                    String targetName =  Config.getStringXPath(descibeDocument, "result/reachable-states/state/@name");
+                    Document advanceDocument = xmlUtilities.reInitDocument(this.createAdvanceProductArtifactDocument(uuid, hash, targetName));
+                    log.debug("Advance ==> "+this.xmlUtilities.writeDocument2String(advanceDocument));
+                    return this.productArtifact.advance(advanceDocument, context);
+                } catch (RuntimeException e) {
+                    log.error(e,e);
+                }
             }else{
                 log.warn("Artifact is not configured properly. Call feed first.");
                 // TODO Fehlerdokument erzeugen.
@@ -169,7 +173,14 @@
         if (this.productArtifact == null){
             return this.createDescibeOutput();
         }else{
-            return this.productArtifact.describe(context);
+            Document document = this.productArtifact.describe(context);
+            document = new ArtifactXMLUtilities().reInitDocument(document);
+            Node staticNode = Config.getNodeXPath(document, "/result/ui/static");
+            if (staticNode != null){
+                Node staticUI = this.createSelectBox(document);
+                staticNode.insertBefore(staticUI, staticNode.getFirstChild());
+            }
+            return document;
         }
     }
 
@@ -328,38 +339,52 @@
     protected void createUserInterface(Element parent, Document document){
         Element uiNode = xmlUtilities.createArtifactElement(document,"ui");
         ArtifactXMLUtilities xmlUtilities = new ArtifactXMLUtilities();
+        Node dynamic = xmlUtilities.createArtifactElement(document, "dynamic"); 
+        uiNode.appendChild(dynamic);
         if (this.products != null && !this.products.isEmpty()){
-            String selectboxName = "product";
-            Iterator<Product> it = this.products.values().iterator();
-            Element selectNode = xmlUtilities.createXFormElement(document,"select1");
-            selectNode.setAttribute("ref", selectboxName);
-            uiNode.appendChild(selectNode);
-            
-            Element lableNode = xmlUtilities.createXFormElement(document, "label");
-            lableNode.setTextContent(selectboxName);
-            selectNode.appendChild(lableNode);
-            Element choiceNode = xmlUtilities.createXFormElement(document, "choices");
-            selectNode.appendChild(choiceNode);
-            while (it.hasNext()){
-                Product p = it.next();
-                Element itemNode = xmlUtilities.createXFormElement(document, "item");
-                
-                
-                Element choiceLableNode = xmlUtilities.createXFormElement(document, "label");
-                choiceLableNode.setTextContent(p.getName());
-                itemNode.appendChild(choiceLableNode);
-                
-                Element choicValueNode = xmlUtilities.createXFormElement(document, "value");
-                choicValueNode.setTextContent(p.getName());
-                itemNode.appendChild(choicValueNode);
-                
-                choiceNode.appendChild(itemNode);
-                
-            }
+            Element selectNode = createSelectBox(document);
+ 
+            dynamic.appendChild(selectNode);
         }
         
         parent.appendChild(uiNode);
     }
+    /**
+     * @param document
+     * @param xmlUtilities
+     * @return
+     */
+    private Element createSelectBox(Document document) {
+        ArtifactXMLUtilities xmlUtilities = new ArtifactXMLUtilities();
+        String selectboxName = "product";
+        Iterator<Product> it = this.products.values().iterator();
+        Element selectNode = xmlUtilities.createXFormElement(document,"select1");
+        selectNode.setAttribute("ref", selectboxName);
+        
+        
+        Element lableNode = xmlUtilities.createXFormElement(document, "label");
+        lableNode.setTextContent(selectboxName);
+        selectNode.appendChild(lableNode);
+        Element choiceNode = xmlUtilities.createXFormElement(document, "choices");
+        selectNode.appendChild(choiceNode);
+        while (it.hasNext()){
+            Product p = it.next();
+            Element itemNode = xmlUtilities.createXFormElement(document, "item");
+            
+            
+            Element choiceLableNode = xmlUtilities.createXFormElement(document, "label");
+            choiceLableNode.setTextContent(p.getName());
+            itemNode.appendChild(choiceLableNode);
+            
+            Element choicValueNode = xmlUtilities.createXFormElement(document, "value");
+            choicValueNode.setTextContent(p.getName());
+            itemNode.appendChild(choicValueNode);
+            
+            choiceNode.appendChild(itemNode);
+            
+        }
+        return selectNode;
+    }
     
     protected void createOutputs(Element parent, Document document){
         log.debug("GNVArtifactBase.createOutputs");
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/transition/MinMaxTransition.java	Wed Sep 16 12:38:24 2009 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/transition/MinMaxTransition.java	Thu Sep 17 13:38:12 2009 +0000
@@ -42,8 +42,12 @@
             this.descibeData = new ArrayList<Object>();
         }
         if (result != null && result.size() == 1){
+            
+            Object[] names = this.inputValueNames.toArray();
+            String minName = names[names.length-2].toString();
+            String maxName = names[names.length-1].toString();
             Result value = result.iterator().next();
-            DescribeData describeData = new DefaultMinMaxDescribeData(value.getObject("MIN"), value.getObject("MAX"));
+            DescribeData describeData = new DefaultMinMaxDescribeData(minName, maxName,value.getObject("MIN"), value.getObject("MAX"));
             log.debug(describeData.toString());
             this.descibeData.add(describeData);
         }else{
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/transition/TransitionBase.java	Wed Sep 16 12:38:24 2009 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/transition/TransitionBase.java	Thu Sep 17 13:38:12 2009 +0000
@@ -8,8 +8,10 @@
 import java.util.Date;
 import java.util.GregorianCalendar;
 import java.util.HashMap;
+import java.util.HashSet;
 import java.util.Iterator;
 import java.util.Map;
+import java.util.Set;
 
 import org.apache.log4j.Logger;
 import org.w3c.dom.Document;
@@ -27,6 +29,8 @@
 import de.intevation.gnv.transition.describedata.DefaultKeyValueDescribeData;
 import de.intevation.gnv.transition.describedata.KeyValueDescibeData;
 import de.intevation.gnv.transition.describedata.MinMaxDescribeData;
+import de.intevation.gnv.transition.describedata.NamedArrayList;
+import de.intevation.gnv.transition.describedata.NamedCollection;
 import de.intevation.gnv.transition.exception.TransitionException;
 import de.intevation.gnv.utils.ArtifactXMLUtilities;
 
@@ -50,13 +54,15 @@
     
     private String description = null;
     
-
+    private String dataName = null;
+    
+    private boolean dataMultiSelect = false;
 
     protected String queryID = null;
     
     private Collection<String> reachableTransitions = null;
     
-    private Collection<String> inputValueNames = null;
+    protected Collection<String> inputValueNames = null;
     
     private Map<String,InputValue> inputValues = null;
     
@@ -133,6 +139,13 @@
         this.queryID = Config.getStringXPath(configuration,"queryID");
         log.info("QueryID ==> "+ this.queryID);
         
+        this.dataName = Config.getStringXPath(configuration,"dataname");
+        
+        String dataMultiSelectValue = Config.getStringXPath(configuration,"data-multiselect");
+        if (dataMultiSelectValue != null){
+            this.dataMultiSelect  = Boolean.parseBoolean(dataMultiSelectValue);
+        }
+        
     }
 
     /**
@@ -163,7 +176,7 @@
                     if (this.inputData == null){
                         this.inputData = new HashMap<String,InputData>(inputData.size());
                     }
-                    // TODO validate Value; und Valueconcatenieren
+                    this.setSelection(tmpItem);
                     this.inputData.put(tmpItem.getName(),tmpItem);
                     
                 }else{
@@ -175,7 +188,65 @@
         }else{
             log.warn("No Inputdata given");
         }
+    }
     
+    private void setSelection(InputData inputData){
+        log.debug("TransitionBase.setSelection");
+        
+        Object o = this.getDescribeData(inputData.getName());
+        if(o != null){
+            if (o instanceof Collection<?>){
+                Collection<KeyValueDescibeData> values = (Collection<KeyValueDescibeData>)o;
+                
+                String value = inputData.getValue();
+                String[] selectedValues = value.split(",");
+                Set<String> selectedItems = new HashSet<String>(selectedValues.length);
+                for (int i = 0; i < selectedValues.length; i++){
+                    selectedItems.add(selectedValues[i].trim());
+                }
+                // Selektion umsetzen
+                Iterator<KeyValueDescibeData> it = values.iterator();
+                while (it.hasNext()){
+                    KeyValueDescibeData data = it.next();
+                    String key = ""+data.getKey();
+                    boolean selected = selectedItems.contains(key);
+                    data.setSelected(selected);
+                }
+            }else if (o instanceof MinMaxDescribeData){
+                MinMaxDescribeData data = (MinMaxDescribeData)o;
+                if (inputData.getName().equals(data.getMinName())){
+                    // TODO: m�ssen die werte geparst werden?
+                    data.setMinValue(inputData.getValue());
+                }
+                if (inputData.getName().equals(data.getMaxName())){
+                    // TODO: m�ssen die werte geparst werden?
+                    data.setMaxValue(inputData.getValue());
+                }
+            }
+        }
+    }
+    
+    private Object getDescribeData(String name){
+        if (this.descibeData != null){
+            Iterator<Object> it = this.descibeData.iterator();
+            while (it.hasNext()){
+                Object o = it.next();
+                if (o instanceof NamedCollection<?>){
+                    if (name.equals(((NamedCollection<?>)o).getName())){
+                        return o;
+                    }
+                }else if (o instanceof MinMaxDescribeData){
+                    if (name.equals(((MinMaxDescribeData)o).getMinName())){
+                        return o;
+                    }
+                    if (name.equals(((MinMaxDescribeData)o).getMaxName())){
+                        return o;
+                    }
+                }
+            }
+        }
+        return null;
+        
     }
 
     /**
@@ -225,11 +296,11 @@
         if (this.descibeData == null){
             this.descibeData = new ArrayList<Object>();
         }
-        
-        Iterator<Result> it = result.iterator();
-        Collection<KeyValueDescibeData> keyValueDescibeData = new ArrayList<KeyValueDescibeData>(result.size());
-        while(it.hasNext()){
-            Result resultValue = it.next();
+                Iterator<Result> rit = result.iterator();
+        NamedCollection<KeyValueDescibeData> keyValueDescibeData = new NamedArrayList<KeyValueDescibeData>(this.dataName,result.size());
+        keyValueDescibeData.setMultiSelect(this.dataMultiSelect);
+        while(rit.hasNext()){
+            Result resultValue = rit.next();
             keyValueDescibeData.add(new DefaultKeyValueDescribeData(resultValue.getInteger("KEY").intValue(), resultValue.getString("VALUE")));
         }
         this.descibeData.add(keyValueDescibeData);
@@ -243,16 +314,27 @@
         if(this.descibeData != null){
             ArtifactXMLUtilities xmlutilities = new ArtifactXMLUtilities();
             Iterator<Object> it = this.descibeData.iterator();
+            Node staticNode = xmlutilities.createArtifactElement(document, "static");
+            Node dynamic = xmlutilities.createArtifactElement(document, "dynamic");
+            rootNode.appendChild(staticNode);
+            rootNode.appendChild(dynamic);
             while (it.hasNext()){
                 
                 Object o = it.next();
-                if (!it.hasNext()){
-                    if (o instanceof Collection<?>){
+                if (o instanceof Collection<?>){
                         // TODO: HACK:
                         // BESSERE L�SUNG FINDEN
-                        Object[] names = this.inputValueNames.toArray();
-                        String name = names[names.length-1].toString();
-                        boolean multiselect = this.inputValues.get(name).isMultiselect();
+                        String name = null;
+                        boolean multiselect = false;
+                        if (o instanceof NamedCollection<?>){
+                            NamedCollection<?> nc = ((NamedCollection<?>)o);
+                            name = nc.getName();
+                            multiselect  = nc.isMultiSelect();
+                        }else{
+                            Object[] names = this.inputValueNames.toArray();
+                            name = names[names.length-1].toString();
+                        }
+                       
                         
                         Element selectNode = xmlutilities.createXFormElement(document,multiselect ? "select" : "select1");
                         selectNode.setAttribute("ref", name);
@@ -261,12 +343,16 @@
                         lableNode.setTextContent(name);
                         Element choiceNode = xmlutilities.createXFormElement(document, "choices");
                         
-                        Collection<KeyValueDescibeData> values = (Collection)o;
+                        Collection<KeyValueDescibeData> values = (Collection<KeyValueDescibeData>)o;
                         Iterator<KeyValueDescibeData> resultIt = values.iterator();
                         while (resultIt.hasNext()){
                             KeyValueDescibeData result = resultIt.next();
                             Element itemNode = xmlutilities.createXFormElement(document, "item");
                             
+                            if (result.isSelected()){
+                                itemNode.setAttribute("selected", "true");
+                            }
+                            
                             
                             Element choiceLableNode = xmlutilities.createXFormElement(document, "label");
                             choiceLableNode.setTextContent(result.getValue());
@@ -275,12 +361,17 @@
                             Element choicValueNode = xmlutilities.createXFormElement(document, "value");
                             choicValueNode.setTextContent(""+result.getKey());
                             itemNode.appendChild(choicValueNode);
-                            
                             choiceNode.appendChild(itemNode);
                         }
                         selectNode.appendChild(lableNode);
                         selectNode.appendChild(choiceNode);
-                        rootNode.appendChild(selectNode);
+                        
+                        if (!it.hasNext()){
+                            dynamic.appendChild(selectNode);
+                        }else{
+                            staticNode.appendChild(selectNode);
+                        }
+                       
                     }else if (o instanceof MinMaxDescribeData){
                         MinMaxDescribeData descibeData = (MinMaxDescribeData)o;
                         Object min = descibeData.getMinValue();
@@ -315,16 +406,18 @@
                         inputMaxValueNode.setTextContent(max.toString());
                         inputMaxNode.appendChild(inputMaxValueNode);
                         
-                        rootNode.appendChild(inputMinNode);
-                        rootNode.appendChild(inputMaxNode);
                         
+                        if (!it.hasNext()){
+                            dynamic.appendChild(inputMinNode);
+                            dynamic.appendChild(inputMaxNode);
+                        }else{
+                            staticNode.appendChild(inputMinNode);
+                            staticNode.appendChild(inputMaxNode);
+                        }
                     }
-    
                 }
             }
         }
-       
-    }
 
     /**
      * @see de.intevation.gnv.transition.Transition#getDescibeData()
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/transition/describedata/DefaultKeyValueDescribeData.java	Wed Sep 16 12:38:24 2009 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/transition/describedata/DefaultKeyValueDescribeData.java	Thu Sep 17 13:38:12 2009 +0000
@@ -17,6 +17,8 @@
     
     private String value = null;
     
+    private boolean selected = false;
+    
     public DefaultKeyValueDescribeData(int key, String value) {
         super();
         this.key = key;
@@ -37,4 +39,18 @@
         return this.value;
     }
 
+    /**
+     * @see de.intevation.gnv.transition.describedata.KeyValueDescibeData#isSelected()
+     */
+    public boolean isSelected() {
+        return this.selected;
+    }
+
+    /**
+     * @see de.intevation.gnv.transition.describedata.KeyValueDescibeData#setSelected(boolean)
+     */
+    public void setSelected(boolean selected) {
+        this.selected = selected;
+    }
+
 }
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/transition/describedata/DefaultMinMaxDescribeData.java	Wed Sep 16 12:38:24 2009 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/transition/describedata/DefaultMinMaxDescribeData.java	Thu Sep 17 13:38:12 2009 +0000
@@ -16,11 +16,17 @@
     private Object minValue = null;
     
     private Object maxValue = null;
+    
+    private String minName = null;
+    
+    private String maxName = null;
     /**
      * Constructor
      */
-    public DefaultMinMaxDescribeData( Object minValue, Object maxValue) {
+    public DefaultMinMaxDescribeData(String minName, String maxName,  Object minValue, Object maxValue) {
         super();
+        this.minName = minName;
+        this.maxName = maxName;
         this.minValue = minValue;
         this.maxValue = maxValue;
     }
@@ -46,6 +52,34 @@
     public String toString() {
         return "MIN: "+this.minValue.toString()+" ; MAX: "+this.maxValue.toString();
     }
+
+    /**
+     * @see de.intevation.gnv.transition.describedata.MinMaxDescribeData#getName()
+     */
+    public String getMinName() {
+        return this.minName;
+    }
+
+    /**
+     * @see de.intevation.gnv.transition.describedata.MinMaxDescribeData#getMaxName()
+     */
+    public String getMaxName() {
+        return this.maxName;
+    }
+
+    /**
+     * @see de.intevation.gnv.transition.describedata.MinMaxDescribeData#setMaxValue(java.lang.Object)
+     */
+    public void setMaxValue(Object maxValue) {
+        this.maxValue = maxValue;
+    }
+
+    /**
+     * @see de.intevation.gnv.transition.describedata.MinMaxDescribeData#setMinValue(java.lang.Object)
+     */
+    public void setMinValue(Object minValue) {
+        this.minValue = minValue;
+    }
     
 
 }
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/transition/describedata/KeyValueDescibeData.java	Wed Sep 16 12:38:24 2009 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/transition/describedata/KeyValueDescibeData.java	Thu Sep 17 13:38:12 2009 +0000
@@ -14,5 +14,9 @@
     public int getKey();
     
     public String getValue();
+    
+    public boolean isSelected();
+    
+    public void setSelected(boolean selected);
 
 }
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/transition/describedata/MinMaxDescribeData.java	Wed Sep 16 12:38:24 2009 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/transition/describedata/MinMaxDescribeData.java	Thu Sep 17 13:38:12 2009 +0000
@@ -10,5 +10,11 @@
     
     public Object getMinValue();
     public Object getMaxValue();
+    
+    public void setMinValue(Object minValue);
+    public void setMaxValue(Object maxValue);
+    
+    public String getMinName();
+    public String getMaxName();
 
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/transition/describedata/NamedArrayList.java	Thu Sep 17 13:38:12 2009 +0000
@@ -0,0 +1,66 @@
+/**
+ *
+ */
+package de.intevation.gnv.transition.describedata;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+/**
+ * @author Tim Englich <tim.englich@intevation.de>
+ *
+ */
+public class NamedArrayList<E> extends ArrayList<E> implements NamedCollection<E> {
+    /**
+     *
+     */
+    private static final long serialVersionUID = 8172229594749676354L;
+
+    private String name = null;
+    
+    private boolean multiSelect = false;
+    /**
+     * Constructor
+     */
+    public NamedArrayList(String name) {
+        this.name = name;
+    }
+
+    /**
+     * Constructor
+     * @param initialCapacity
+     */
+    public NamedArrayList(String name, int initialCapacity) {
+        super(initialCapacity);
+        this.name = name;
+    }
+
+    /**
+     * Constructor
+     * @param c
+     */
+    public NamedArrayList(String name, Collection<E> c) {
+        super(c);
+        this.name = name;
+    }
+
+    /**
+     * @see de.intevation.gnv.transition.describedata.NamedCollection#getName()
+     */
+    public String getName() {
+        return this.name;
+    }
+    /**
+     * @see de.intevation.gnv.transition.describedata.NamedCollection#isMultiSelect()
+     */
+    public boolean isMultiSelect() {
+        return multiSelect;
+    }
+
+    /**
+     * @see de.intevation.gnv.transition.describedata.NamedCollection#setMultiSelect(boolean)
+     */
+    public void setMultiSelect(boolean multiSelect) {
+        this.multiSelect = multiSelect;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/transition/describedata/NamedCollection.java	Thu Sep 17 13:38:12 2009 +0000
@@ -0,0 +1,19 @@
+/**
+ *
+ */
+package de.intevation.gnv.transition.describedata;
+
+import java.util.Collection;
+
+/**
+ * @author Tim Englich <tim.englich@intevation.de>
+ *
+ */
+public interface NamedCollection<E> extends Collection<E> {
+
+    public String getName();
+    
+    public boolean isMultiSelect();
+    
+    public void setMultiSelect(boolean multiSelect);
+}
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/utils/ArtifactXMLUtilities.java	Wed Sep 16 12:38:24 2009 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/utils/ArtifactXMLUtilities.java	Thu Sep 17 13:38:12 2009 +0000
@@ -3,12 +3,12 @@
  */
 package de.intevation.gnv.utils;
 
-import java.io.File;
+import java.io.ByteArrayInputStream;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.Serializable;
-import java.io.StringBufferInputStream;
 import java.io.StringWriter;
+import java.io.UnsupportedEncodingException;
 
 import javax.xml.parsers.DocumentBuilder;
 import javax.xml.parsers.DocumentBuilderFactory;
@@ -35,6 +35,11 @@
  */
 public class ArtifactXMLUtilities implements Serializable{
     /**
+     *
+     */
+    private static final long serialVersionUID = -6236340358303411758L;
+
+    /**
      * the logger, used to log exceptions and additonaly information
      */
     private static Logger log = Logger.getLogger(TimeSeriesOutputTransition.class);
@@ -77,6 +82,9 @@
         return null;
     }
     
+
+    
+    
     public Document readDocument(InputStream inputStream){
         Document returnValue = null;
         try {
@@ -94,9 +102,15 @@
     }
     
     public Document reInitDocument(Document document){
-        
-        StringBufferInputStream inputStream = new StringBufferInputStream(this.writeDocument2String(document));
-        return this.readDocument(inputStream);
+        try {
+            byte[] barray = this.writeDocument2String(document).getBytes("UTF-8");
+            InputStream inputStream = new ByteArrayInputStream(barray); 
+            //StringBufferInputStream inputStream = new StringBufferInputStream();
+            return this.readDocument(inputStream);
+        } catch (UnsupportedEncodingException e) {
+            log.error(e,e);
+        }
+        return document;
     }
     
     public Element createXFormElement(Document document, String name) {
--- a/gnv-artifacts/src/test/ressources/conf.xml	Wed Sep 16 12:38:24 2009 +0000
+++ b/gnv-artifacts/src/test/ressources/conf.xml	Thu Sep 17 13:38:12 2009 +0000
@@ -56,6 +56,8 @@
                 
                 <transition id="timeseries_timeseriespoint" description="timeseries_timeseriespoint" transition="de.intevation.gnv.transition.DefaultTransition">
                     <queryID>timeseries_timeseriespoint</queryID>
+                    <dataname>featureid</dataname>
+                    <data-multiselect>false</data-multiselect>
                     <reachableTransitions>
                         <transition>timeseries_parameter</transition>
                     </reachableTransitions>
@@ -66,6 +68,8 @@
                 
                 <transition id="timeseries_parameter" description="timeseries_parameter" transition="de.intevation.gnv.transition.DefaultTransition">
                     <queryID>timeseries_parameter</queryID>
+                    <dataname>parameterid</dataname>
+                    <data-multiselect>true</data-multiselect>
                     <reachableTransitions>
                         <transition>timeseries_depth_height</transition>
                     </reachableTransitions>
@@ -76,6 +80,8 @@
                 
                  <transition id="timeseries_depth_height" description="timeseries_depth_height" transition="de.intevation.gnv.transition.DefaultTransition">
                     <queryID>timeseries_depth_height</queryID>
+                    <dataname>measurementid</dataname>
+                    <data-multiselect>true</data-multiselect>
                     <reachableTransitions>
                          <transition>timeseries_interval</transition>
                     </reachableTransitions>
@@ -87,6 +93,8 @@
                 
                 <transition id="timeseries_interval" description="timeseries_interval" transition="de.intevation.gnv.transition.MinMaxTransition">
                     <queryID>timeseries_interval</queryID>
+                    <dataname>minvalue</dataname>
+                    <data-multiselect>false</data-multiselect>
                     <reachableTransitions>
                         <transition>timeseries_calculate_results</transition>
                     </reachableTransitions>

http://dive4elements.wald.intevation.org