Mercurial > dive4elements > river
comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/ManagedFacetAdapter.java @ 3468:f37e7e8907cb
merged flys-artifacts/2.8.1
author | Thomas Arendsen Hein <thomas@intevation.de> |
---|---|
date | Fri, 28 Sep 2012 12:14:39 +0200 |
parents | 4bd3d8bbb60c |
children |
comparison
equal
deleted
inserted
replaced
3387:5ffad8bde8ad | 3468:f37e7e8907cb |
---|---|
1 package de.intevation.flys.artifacts.model; | |
2 | |
3 import org.apache.log4j.Logger; | |
4 | |
5 import org.w3c.dom.Document; | |
6 import org.w3c.dom.Element; | |
7 import org.w3c.dom.Node; | |
8 | |
9 import de.intevation.artifacts.ArtifactNamespaceContext; | |
10 | |
11 import de.intevation.artifactdatabase.state.DefaultFacet; | |
12 import de.intevation.artifactdatabase.state.Facet; | |
13 | |
14 import de.intevation.artifacts.common.utils.XMLUtils.ElementCreator; | |
15 | |
16 | |
17 public class ManagedFacetAdapter extends ManagedFacet { | |
18 | |
19 protected Facet facet; | |
20 | |
21 public ManagedFacetAdapter() { | |
22 } | |
23 | |
24 | |
25 protected Logger logger = Logger.getLogger(ManagedFacetAdapter.class); | |
26 | |
27 public ManagedFacetAdapter( | |
28 Facet facet, | |
29 String uuid, | |
30 int pos, | |
31 int active, | |
32 int visible | |
33 ) { | |
34 super( | |
35 facet.getName(), | |
36 facet.getIndex(), | |
37 facet.getDescription(), | |
38 uuid, | |
39 pos, | |
40 active, | |
41 visible); | |
42 | |
43 this.facet = facet; | |
44 } | |
45 | |
46 | |
47 @Override | |
48 public Node toXML(Document doc) { | |
49 ElementCreator ec = new ElementCreator( | |
50 doc, | |
51 ArtifactNamespaceContext.NAMESPACE_URI, | |
52 ArtifactNamespaceContext.NAMESPACE_PREFIX); | |
53 | |
54 Element e = (Element) facet.toXML(doc); | |
55 ec.addAttr(e, "artifact", getArtifact(), true); | |
56 ec.addAttr(e, "facet", getName(), true); | |
57 ec.addAttr(e, "pos", String.valueOf(getPosition()), true); | |
58 ec.addAttr(e, "active", String.valueOf(getActive()), true); | |
59 ec.addAttr(e, "visible", String.valueOf(getVisible()), true); | |
60 | |
61 return e; | |
62 } | |
63 | |
64 @Override | |
65 public Facet deepCopy() { | |
66 ManagedFacetAdapter copy = new ManagedFacetAdapter(); | |
67 copy.set((DefaultFacet)this); | |
68 copy.set((ManagedFacet)this); | |
69 copy.facet = facet.deepCopy(); | |
70 return facet; | |
71 } | |
72 } | |
73 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |