diff gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/GNVArtifactBase.java @ 488:d265f5dc2979

Appended the selected fis to the describe document. gnv-artifacts/trunk@564 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Mon, 18 Jan 2010 13:43:50 +0000
parents 20dde2b6f1b5
children cef17cc90fd0
line wrap: on
line diff
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/GNVArtifactBase.java	Mon Jan 18 11:40:41 2010 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/GNVArtifactBase.java	Mon Jan 18 13:43:50 2010 +0000
@@ -4,7 +4,6 @@
 package de.intevation.gnv.artifacts;
 
 import de.intevation.artifactdatabase.Config;
-import de.intevation.artifactdatabase.DefaultArtifact;
 import de.intevation.artifactdatabase.ProxyArtifact;
 import de.intevation.artifactdatabase.XMLUtils;
 
@@ -65,7 +64,7 @@
  * @author Ingo Weinzierl      (ingo.weinzierl@intevation.de)
  * @author Sascha L. Teichmann (sascha.teichmann@intevation.de)
  */
-public abstract class GNVArtifactBase extends DefaultArtifact {
+public abstract class GNVArtifactBase extends GNVDefaultArtifact {
     /**
      * the logger, used to log exceptions and additonaly information
      */
@@ -364,7 +363,6 @@
         log.debug("GNVArtifactBase.getConfigurationFragment");
         String xpathQuery = XPATH_ARTIFACT_CONFIGURATION.replaceAll(
                 XPATH_IDENTIFIER_REPLACE, this.name);
-        log.debug(xpathQuery);
         
         Element configurationNode = (Element)Config.getNodeXPath(document, xpathQuery);
         
@@ -424,7 +422,7 @@
         log.debug("GNVArtifactBase.describe");
 
         Document document = createDescibeOutput(
-            context.getMeta(),
+            context,
             identifier,
             getIncludeUIFromDocument(data)
         );
@@ -449,13 +447,6 @@
             ArtifactNamespaceContext.NAMESPACE_PREFIX
         );
 
-        if (staticNode != null) {
-            Element staticUI = createSelectBox(
-                artCreator, creator, document, context
-            );
-            staticNode.insertBefore(staticUI, staticNode.getFirstChild());
-        }
-
         return document;
     }
 
@@ -508,12 +499,16 @@
 
         }
     }
-    
 
-    protected Document createDescibeOutput(CallMeta callMeta, String uuid, boolean incudeUI) {
+
+    protected Document createDescibeOutput(
+        CallContext context,
+        String      uuid,
+        boolean     incudeUI
+    ) {
         log.debug("GNVArtifactBase.createDescibeOutput");
         Document document = XMLUtils.newDocument();
-        
+
         XMLUtils.ElementCreator creator = new XMLUtils.ElementCreator(
             document,
             ArtifactNamespaceContext.NAMESPACE_URI,
@@ -526,7 +521,7 @@
         this.createReachableStates(creator, rootNode, document);
         this.createModel(creator, rootNode, document);
         if (incudeUI){
-            this.createUserInterface(creator, rootNode, document, callMeta, uuid);
+            this.createUserInterface(creator, rootNode, document, context, uuid);
         }
 
         return document;
@@ -616,6 +611,7 @@
         return selectNode;
     }
 
+
     protected void createReachableStates(
         XMLUtils.ElementCreator creator,
         Element                 parent,
@@ -705,18 +701,37 @@
         XMLUtils.ElementCreator creator,
         Element                 parent,
         Document                document,
-        CallMeta                callMeta,
-        String uuid
+        CallContext             context,
+        String                  uuid
     ) {
-        Element uiNode = creator.create("ui");
+        XMLUtils.ElementCreator xCreator = new XMLUtils.ElementCreator(
+            document,
+            XMLUtils.XFORM_URL,
+            XMLUtils.XFORM_PREFIX
+        );
+
+        Element uiNode     = creator.create("ui");
+        Element staticNode = creator.create("static");
+        Element dynamic    = creator.create("dynamic");
+
+        uiNode.appendChild(staticNode);
+        uiNode.appendChild(dynamic);
+
+        parent.appendChild(uiNode);
+
+        // append fis to dynamic part
+        appendFis(document, staticNode, context, product.getArtifactFactory());
 
         if (this.current != null) {
+            Element staticUI = createSelectBox(
+                creator, xCreator, document, context
+            );
+            staticNode.appendChild(staticUI);
+
             this.current.describe(
-                document, uiNode, callMeta, uuid
+                document, uiNode, context.getMeta(), uuid
             );
         }
-
-        parent.appendChild(uiNode);
     }
 
 

http://dive4elements.wald.intevation.org