diff flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/ManagedFacetAdapter.java @ 3318:dbe2f85bf160

merged flys-artifacts/2.8
author Thomas Arendsen Hein <thomas@intevation.de>
date Fri, 28 Sep 2012 12:14:35 +0200
parents 4bd3d8bbb60c
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/ManagedFacetAdapter.java	Fri Sep 28 12:14:35 2012 +0200
@@ -0,0 +1,73 @@
+package de.intevation.flys.artifacts.model;
+
+import org.apache.log4j.Logger;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+import de.intevation.artifacts.ArtifactNamespaceContext;
+
+import de.intevation.artifactdatabase.state.DefaultFacet;
+import de.intevation.artifactdatabase.state.Facet;
+
+import de.intevation.artifacts.common.utils.XMLUtils.ElementCreator;
+
+
+public class ManagedFacetAdapter extends ManagedFacet {
+
+    protected Facet facet;
+
+    public ManagedFacetAdapter() {
+    }
+
+
+    protected Logger logger = Logger.getLogger(ManagedFacetAdapter.class);
+
+    public ManagedFacetAdapter(
+        Facet   facet,
+        String  uuid,
+        int     pos,
+        int     active,
+        int     visible
+    ) {
+        super(
+            facet.getName(),
+            facet.getIndex(),
+            facet.getDescription(),
+            uuid,
+            pos,
+            active,
+            visible);
+
+        this.facet = facet;
+    }
+
+
+    @Override
+    public Node toXML(Document doc) {
+        ElementCreator ec = new ElementCreator(
+            doc,
+            ArtifactNamespaceContext.NAMESPACE_URI,
+            ArtifactNamespaceContext.NAMESPACE_PREFIX);
+
+        Element e = (Element) facet.toXML(doc);
+        ec.addAttr(e, "artifact", getArtifact(), true);
+        ec.addAttr(e, "facet", getName(), true);
+        ec.addAttr(e, "pos", String.valueOf(getPosition()), true);
+        ec.addAttr(e, "active", String.valueOf(getActive()), true);
+        ec.addAttr(e, "visible", String.valueOf(getVisible()), true);
+
+        return e;
+    }
+
+    @Override
+    public Facet deepCopy() {
+        ManagedFacetAdapter copy = new ManagedFacetAdapter();
+        copy.set((DefaultFacet)this);
+        copy.set((ManagedFacet)this);
+        copy.facet = facet.deepCopy();
+        return facet;
+    }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org