changeset 943:5de90b0cff8e

The WMSLayerFacet now writes the WMS URL and layernames to its XML representation. flys-artifacts/trunk@2353 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Mon, 18 Jul 2011 15:07:47 +0000
parents 796c54058dc4
children c256061287d7
files flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/artifacts/StaticFLYSArtifact.java flys-artifacts/src/main/java/de/intevation/flys/artifacts/WINFOArtifact.java flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/WMSLayerFacet.java
diffstat 4 files changed, 46 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog	Mon Jul 18 10:13:25 2011 +0000
+++ b/flys-artifacts/ChangeLog	Mon Jul 18 15:07:47 2011 +0000
@@ -1,3 +1,13 @@
+2011-07-18  Ingo Weinzierl <ingo@intevation.de>
+
+	* src/main/java/de/intevation/flys/artifacts/WINFOArtifact.java,
+	  src/main/java/de/intevation/flys/artifacts/StaticFLYSArtifact.java:
+	  Adapted the function call of ProtocolUtils.appendOutputModes().
+
+	* src/main/java/de/intevation/flys/artifacts/model/WMSLayerFacet.java:
+	  Override toXML() to add the URL and layernames to the XML representation
+	  of this facet.
+
 2011-07-18  Ingo Weinzierl <ingo@intevation.de>
 
 	* doc/conf/artifacts/wmsbackground.xml,
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/StaticFLYSArtifact.java	Mon Jul 18 10:13:25 2011 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/StaticFLYSArtifact.java	Mon Jul 18 15:07:47 2011 +0000
@@ -40,13 +40,17 @@
         desc.appendChild(root);
 
         ProtocolUtils.appendDescribeHeader(creator, root, identifier(), hash());
-        root.appendChild(createOutputModes(cc, creator));
+        root.appendChild(createOutputModes(cc, desc, creator));
 
         return desc;
     }
 
 
-    protected Element createOutputModes(CallContext cc, ElementCreator creator){
+    protected Element createOutputModes(
+        CallContext    cc,
+        Document       doc,
+        ElementCreator creator)
+    {
         Element outs = ProtocolUtils.createArtNode(
             creator, "outputmodes", null, null);
 
@@ -61,7 +65,7 @@
                 logger.debug("Found " + fs.size() + " current facets.");
                 if (!generated.isEmpty()) {
                     ProtocolUtils.appendOutputModes(
-                        creator, outs, generated);
+                        doc, outs, generated);
                 }
             }
             else {
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WINFOArtifact.java	Mon Jul 18 10:13:25 2011 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WINFOArtifact.java	Mon Jul 18 15:07:47 2011 +0000
@@ -194,7 +194,7 @@
 
             List<Output> generated = generateOutputs(list, fs);
 
-            ProtocolUtils.appendOutputModes(creator, outs, generated);
+            ProtocolUtils.appendOutputModes(doc, outs, generated);
         }
 
         try {
@@ -212,7 +212,7 @@
                         logger.debug("Found " + fs.size() + " current facets.");
                         if (!generated.isEmpty()) {
                             ProtocolUtils.appendOutputModes(
-                                creator, outs, generated);
+                                doc, outs, generated);
                         }
                     }
                     else {
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/WMSLayerFacet.java	Mon Jul 18 10:13:25 2011 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/WMSLayerFacet.java	Mon Jul 18 15:07:47 2011 +0000
@@ -5,13 +5,19 @@
 
 import org.apache.log4j.Logger;
 
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
 import de.intevation.artifacts.Artifact;
+import de.intevation.artifacts.ArtifactNamespaceContext;
 import de.intevation.artifacts.CallContext;
 
+import de.intevation.artifacts.common.utils.XMLUtils;
+import de.intevation.artifacts.common.utils.XMLUtils.ElementCreator;
+
 import de.intevation.artifactdatabase.state.DefaultFacet;
 
-import de.intevation.flys.artifacts.FLYSArtifact;
-
 import de.intevation.flys.artifacts.states.DefaultState.ComputeType;
 
 
@@ -73,4 +79,23 @@
     public Object getData(Artifact artifact, CallContext context) {
         return null;
     }
+
+
+    @Override
+    public Node toXML(Document doc) {
+        ElementCreator ec = new ElementCreator(
+            doc,
+            ArtifactNamespaceContext.NAMESPACE_URI,
+            ArtifactNamespaceContext.NAMESPACE_PREFIX);
+
+        Element facet = ec.create("facet");
+        ec.addAttr(facet, "description", description, true);
+        ec.addAttr(facet, "index", String.valueOf(index), true);
+        ec.addAttr(facet, "name", name, true);
+        ec.addAttr(facet, "url", url, true);
+        ec.addAttr(facet, "layers", layers.get(0), true);
+
+        return facet;
+    }
 }
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org