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