Mercurial > dive4elements > river
comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/ManagedFacet.java @ 1190:f514894ec2fd
merged flys-artifacts/2.5
author | Thomas Arendsen Hein <thomas@intevation.de> |
---|---|
date | Fri, 28 Sep 2012 12:14:17 +0200 |
parents | b1b0a0b61845 |
children | 238145ef67da |
comparison
equal
deleted
inserted
replaced
917:b48c36076e17 | 1190:f514894ec2fd |
---|---|
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.artifacts.common.utils.XMLUtils.ElementCreator; | |
10 | |
11 import de.intevation.artifactdatabase.state.DefaultFacet; | |
12 import de.intevation.artifactdatabase.state.Facet; | |
13 | |
14 public class ManagedFacet extends DefaultFacet { | |
15 | |
16 /** The uuid of the owner artifact.*/ | |
17 protected String uuid; | |
18 | |
19 /** A property that determines the position of this facet.*/ | |
20 protected int position; | |
21 | |
22 /** A property that determines if this facet is active or not.*/ | |
23 protected int active; | |
24 | |
25 public ManagedFacet() { | |
26 } | |
27 | |
28 public ManagedFacet( | |
29 String name, | |
30 int index, | |
31 String desc, | |
32 String uuid, | |
33 int pos, | |
34 int active) | |
35 { | |
36 super(index, name, desc); | |
37 | |
38 this.uuid = uuid; | |
39 this.position = pos; | |
40 this.active = active; | |
41 } | |
42 | |
43 | |
44 public void setPosition(int pos) { | |
45 this.position = pos; | |
46 } | |
47 | |
48 | |
49 public int getPosition() { | |
50 return position; | |
51 } | |
52 | |
53 | |
54 public void setActive(int active) { | |
55 this.active = active; | |
56 } | |
57 | |
58 | |
59 public int getActive() { | |
60 return active; | |
61 } | |
62 | |
63 | |
64 public String getArtifact() { | |
65 return uuid; | |
66 } | |
67 | |
68 | |
69 public Node toXML(Document doc) { | |
70 ElementCreator ec = new ElementCreator( | |
71 doc, | |
72 ArtifactNamespaceContext.NAMESPACE_URI, | |
73 ArtifactNamespaceContext.NAMESPACE_PREFIX); | |
74 | |
75 Element facet = ec.create("theme"); | |
76 ec.addAttr(facet, "artifact", getArtifact(), true); | |
77 ec.addAttr(facet, "facet", getName(), true); | |
78 ec.addAttr(facet, "pos", String.valueOf(getPosition()), true); | |
79 ec.addAttr(facet, "active", String.valueOf(getActive()), true); | |
80 ec.addAttr(facet, "index", String.valueOf(getIndex()), true); | |
81 ec.addAttr(facet, "description", getDescription(), true); | |
82 | |
83 return facet; | |
84 } | |
85 | |
86 public void set(ManagedFacet other) { | |
87 uuid = other.uuid; | |
88 position = other.position; | |
89 active = other.active; | |
90 } | |
91 | |
92 @Override | |
93 public Facet deepCopy() { | |
94 ManagedFacet copy = new ManagedFacet(); | |
95 copy.set((DefaultFacet)this); | |
96 copy.set((ManagedFacet)this); | |
97 return copy; | |
98 } | |
99 } | |
100 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |