annotate artifacts/src/main/java/org/dive4elements/river/artifacts/model/ManagedDomFacet.java @ 5863:4897a58c8746

River artifacts: Added new copyright headers.
author Sascha L. Teichmann <teichmann@intevation.de>
date Sun, 28 Apr 2013 14:40:59 +0200
parents 5aa05a7a34b7
children af13ceeba52a
rev   line source
5863
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
1 /* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
2 * Software engineering by Intevation GmbH
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
3 *
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
4 * This file is Free Software under the GNU AGPL (>=v3)
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
5 * and comes with ABSOLUTELY NO WARRANTY! Check out the
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
6 * documentation coming with Dive4Elements River for details.
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
7 */
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
8
5831
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4051
diff changeset
9 package org.dive4elements.river.artifacts.model;
945
59ae2a823e73 Use the Facet.toXML() method to write facet elements into the DESCRIBE document of the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
10
59ae2a823e73 Use the Facet.toXML() method to write facet elements into the DESCRIBE document of the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
11 import org.w3c.dom.Document;
59ae2a823e73 Use the Facet.toXML() method to write facet elements into the DESCRIBE document of the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
12 import org.w3c.dom.Element;
59ae2a823e73 Use the Facet.toXML() method to write facet elements into the DESCRIBE document of the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
13 import org.w3c.dom.Node;
59ae2a823e73 Use the Facet.toXML() method to write facet elements into the DESCRIBE document of the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
14
5831
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4051
diff changeset
15 import org.dive4elements.artifacts.ArtifactNamespaceContext;
945
59ae2a823e73 Use the Facet.toXML() method to write facet elements into the DESCRIBE document of the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
16
59ae2a823e73 Use the Facet.toXML() method to write facet elements into the DESCRIBE document of the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
17
3076
5642a83420f2 FLYS artifacts: Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1813
diff changeset
18 /**
1636
c2edf0032cf8 Squash a bug about wrongly named position attribute ('pos' vs 'art:pos').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 945
diff changeset
19 * Use an Element (DOM) to store the information about a facet.
c2edf0032cf8 Squash a bug about wrongly named position attribute ('pos' vs 'art:pos').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 945
diff changeset
20 * The intent of this facet type is to represent a facet
c2edf0032cf8 Squash a bug about wrongly named position attribute ('pos' vs 'art:pos').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 945
diff changeset
21 * stored in an Collection attribute. Different facets can have different
c2edf0032cf8 Squash a bug about wrongly named position attribute ('pos' vs 'art:pos').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 945
diff changeset
22 * attributes that we need to parse, but the only thing ManagedFacets need
c2edf0032cf8 Squash a bug about wrongly named position attribute ('pos' vs 'art:pos').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 945
diff changeset
23 * to do, is to adjust the attributes "active" and "position". So, those
c2edf0032cf8 Squash a bug about wrongly named position attribute ('pos' vs 'art:pos').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 945
diff changeset
24 * values are set directly on the Element, the other attributes aren't
c2edf0032cf8 Squash a bug about wrongly named position attribute ('pos' vs 'art:pos').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 945
diff changeset
25 * touched.
c2edf0032cf8 Squash a bug about wrongly named position attribute ('pos' vs 'art:pos').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 945
diff changeset
26 */
945
59ae2a823e73 Use the Facet.toXML() method to write facet elements into the DESCRIBE document of the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
27 public class ManagedDomFacet extends ManagedFacet {
59ae2a823e73 Use the Facet.toXML() method to write facet elements into the DESCRIBE document of the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
28
59ae2a823e73 Use the Facet.toXML() method to write facet elements into the DESCRIBE document of the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
29 protected Element facet;
59ae2a823e73 Use the Facet.toXML() method to write facet elements into the DESCRIBE document of the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
30
59ae2a823e73 Use the Facet.toXML() method to write facet elements into the DESCRIBE document of the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
31 public ManagedDomFacet(Element facet) {
1715
a70e0cbc5e02 Added support for removing themes from output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1646
diff changeset
32 super(null, -1, null, null, -1, -1, -1);
945
59ae2a823e73 Use the Facet.toXML() method to write facet elements into the DESCRIBE document of the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
33
59ae2a823e73 Use the Facet.toXML() method to write facet elements into the DESCRIBE document of the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
34 this.facet = facet;
59ae2a823e73 Use the Facet.toXML() method to write facet elements into the DESCRIBE document of the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
35 }
59ae2a823e73 Use the Facet.toXML() method to write facet elements into the DESCRIBE document of the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
36
59ae2a823e73 Use the Facet.toXML() method to write facet elements into the DESCRIBE document of the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
37
59ae2a823e73 Use the Facet.toXML() method to write facet elements into the DESCRIBE document of the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
38 @Override
59ae2a823e73 Use the Facet.toXML() method to write facet elements into the DESCRIBE document of the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
39 public int getIndex() {
59ae2a823e73 Use the Facet.toXML() method to write facet elements into the DESCRIBE document of the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
40 if (this.index < 0) {
59ae2a823e73 Use the Facet.toXML() method to write facet elements into the DESCRIBE document of the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
41 String index = facet.getAttributeNS(
59ae2a823e73 Use the Facet.toXML() method to write facet elements into the DESCRIBE document of the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
42 ArtifactNamespaceContext.NAMESPACE_URI, "index");
59ae2a823e73 Use the Facet.toXML() method to write facet elements into the DESCRIBE document of the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
43
59ae2a823e73 Use the Facet.toXML() method to write facet elements into the DESCRIBE document of the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
44 if (index != null && index.length() > 0) {
59ae2a823e73 Use the Facet.toXML() method to write facet elements into the DESCRIBE document of the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
45 this.index = Integer.parseInt(index);
59ae2a823e73 Use the Facet.toXML() method to write facet elements into the DESCRIBE document of the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
46 }
59ae2a823e73 Use the Facet.toXML() method to write facet elements into the DESCRIBE document of the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
47 }
59ae2a823e73 Use the Facet.toXML() method to write facet elements into the DESCRIBE document of the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
48
59ae2a823e73 Use the Facet.toXML() method to write facet elements into the DESCRIBE document of the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
49 return this.index;
59ae2a823e73 Use the Facet.toXML() method to write facet elements into the DESCRIBE document of the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
50 }
59ae2a823e73 Use the Facet.toXML() method to write facet elements into the DESCRIBE document of the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
51
59ae2a823e73 Use the Facet.toXML() method to write facet elements into the DESCRIBE document of the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
52
59ae2a823e73 Use the Facet.toXML() method to write facet elements into the DESCRIBE document of the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
53 @Override
59ae2a823e73 Use the Facet.toXML() method to write facet elements into the DESCRIBE document of the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
54 public String getName() {
59ae2a823e73 Use the Facet.toXML() method to write facet elements into the DESCRIBE document of the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
55 if (this.name == null || this.name.length() == 0) {
59ae2a823e73 Use the Facet.toXML() method to write facet elements into the DESCRIBE document of the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
56 String name = facet.getAttributeNS(
59ae2a823e73 Use the Facet.toXML() method to write facet elements into the DESCRIBE document of the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
57 ArtifactNamespaceContext.NAMESPACE_URI, "facet");
59ae2a823e73 Use the Facet.toXML() method to write facet elements into the DESCRIBE document of the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
58
59ae2a823e73 Use the Facet.toXML() method to write facet elements into the DESCRIBE document of the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
59 this.name = name;
59ae2a823e73 Use the Facet.toXML() method to write facet elements into the DESCRIBE document of the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
60 }
59ae2a823e73 Use the Facet.toXML() method to write facet elements into the DESCRIBE document of the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
61
59ae2a823e73 Use the Facet.toXML() method to write facet elements into the DESCRIBE document of the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
62 return this.name;
59ae2a823e73 Use the Facet.toXML() method to write facet elements into the DESCRIBE document of the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
63 }
59ae2a823e73 Use the Facet.toXML() method to write facet elements into the DESCRIBE document of the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
64
59ae2a823e73 Use the Facet.toXML() method to write facet elements into the DESCRIBE document of the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
65
59ae2a823e73 Use the Facet.toXML() method to write facet elements into the DESCRIBE document of the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
66 @Override
59ae2a823e73 Use the Facet.toXML() method to write facet elements into the DESCRIBE document of the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
67 public String getDescription() {
59ae2a823e73 Use the Facet.toXML() method to write facet elements into the DESCRIBE document of the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
68 if (this.description == null || this.description.length() == 0) {
59ae2a823e73 Use the Facet.toXML() method to write facet elements into the DESCRIBE document of the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
69 String description = facet.getAttributeNS(
59ae2a823e73 Use the Facet.toXML() method to write facet elements into the DESCRIBE document of the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
70 ArtifactNamespaceContext.NAMESPACE_URI, "description");
59ae2a823e73 Use the Facet.toXML() method to write facet elements into the DESCRIBE document of the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
71
59ae2a823e73 Use the Facet.toXML() method to write facet elements into the DESCRIBE document of the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
72 this.description = description;
59ae2a823e73 Use the Facet.toXML() method to write facet elements into the DESCRIBE document of the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
73 }
59ae2a823e73 Use the Facet.toXML() method to write facet elements into the DESCRIBE document of the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
74
59ae2a823e73 Use the Facet.toXML() method to write facet elements into the DESCRIBE document of the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
75 return this.description;
59ae2a823e73 Use the Facet.toXML() method to write facet elements into the DESCRIBE document of the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
76 }
59ae2a823e73 Use the Facet.toXML() method to write facet elements into the DESCRIBE document of the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
77
59ae2a823e73 Use the Facet.toXML() method to write facet elements into the DESCRIBE document of the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
78
59ae2a823e73 Use the Facet.toXML() method to write facet elements into the DESCRIBE document of the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
79 @Override
59ae2a823e73 Use the Facet.toXML() method to write facet elements into the DESCRIBE document of the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
80 public int getPosition() {
59ae2a823e73 Use the Facet.toXML() method to write facet elements into the DESCRIBE document of the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
81 if (this.position < 0) {
59ae2a823e73 Use the Facet.toXML() method to write facet elements into the DESCRIBE document of the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
82 String position = facet.getAttributeNS(
1636
c2edf0032cf8 Squash a bug about wrongly named position attribute ('pos' vs 'art:pos').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 945
diff changeset
83 ArtifactNamespaceContext.NAMESPACE_URI,
1637
866c1f37f2bd Fix getPosition() in ManagedDomFacet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1636
diff changeset
84 "pos");
945
59ae2a823e73 Use the Facet.toXML() method to write facet elements into the DESCRIBE document of the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
85
59ae2a823e73 Use the Facet.toXML() method to write facet elements into the DESCRIBE document of the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
86 if (position != null && position.length() > 0) {
59ae2a823e73 Use the Facet.toXML() method to write facet elements into the DESCRIBE document of the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
87 this.position = Integer.parseInt(position);
59ae2a823e73 Use the Facet.toXML() method to write facet elements into the DESCRIBE document of the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
88 }
59ae2a823e73 Use the Facet.toXML() method to write facet elements into the DESCRIBE document of the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
89 }
59ae2a823e73 Use the Facet.toXML() method to write facet elements into the DESCRIBE document of the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
90
59ae2a823e73 Use the Facet.toXML() method to write facet elements into the DESCRIBE document of the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
91 return this.position;
59ae2a823e73 Use the Facet.toXML() method to write facet elements into the DESCRIBE document of the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
92 }
59ae2a823e73 Use the Facet.toXML() method to write facet elements into the DESCRIBE document of the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
93
59ae2a823e73 Use the Facet.toXML() method to write facet elements into the DESCRIBE document of the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
94
59ae2a823e73 Use the Facet.toXML() method to write facet elements into the DESCRIBE document of the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
95 @Override
59ae2a823e73 Use the Facet.toXML() method to write facet elements into the DESCRIBE document of the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
96 public void setPosition(int position) {
59ae2a823e73 Use the Facet.toXML() method to write facet elements into the DESCRIBE document of the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
97 this.position = position;
59ae2a823e73 Use the Facet.toXML() method to write facet elements into the DESCRIBE document of the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
98
1636
c2edf0032cf8 Squash a bug about wrongly named position attribute ('pos' vs 'art:pos').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 945
diff changeset
99 // TODO Evaluate whether other set/getAttributes also need
c2edf0032cf8 Squash a bug about wrongly named position attribute ('pos' vs 'art:pos').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 945
diff changeset
100 // to use the NAMESPACE_PREFIX.
945
59ae2a823e73 Use the Facet.toXML() method to write facet elements into the DESCRIBE document of the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
101 facet.setAttributeNS(
59ae2a823e73 Use the Facet.toXML() method to write facet elements into the DESCRIBE document of the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
102 ArtifactNamespaceContext.NAMESPACE_URI,
1636
c2edf0032cf8 Squash a bug about wrongly named position attribute ('pos' vs 'art:pos').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 945
diff changeset
103 ArtifactNamespaceContext.NAMESPACE_PREFIX + ":" + "pos",
945
59ae2a823e73 Use the Facet.toXML() method to write facet elements into the DESCRIBE document of the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
104 String.valueOf(position));
59ae2a823e73 Use the Facet.toXML() method to write facet elements into the DESCRIBE document of the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
105 }
59ae2a823e73 Use the Facet.toXML() method to write facet elements into the DESCRIBE document of the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
106
59ae2a823e73 Use the Facet.toXML() method to write facet elements into the DESCRIBE document of the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
107
59ae2a823e73 Use the Facet.toXML() method to write facet elements into the DESCRIBE document of the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
108 @Override
59ae2a823e73 Use the Facet.toXML() method to write facet elements into the DESCRIBE document of the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
109 public int getActive() {
59ae2a823e73 Use the Facet.toXML() method to write facet elements into the DESCRIBE document of the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
110 if (this.active < 0) {
59ae2a823e73 Use the Facet.toXML() method to write facet elements into the DESCRIBE document of the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
111 String active = facet.getAttributeNS(
59ae2a823e73 Use the Facet.toXML() method to write facet elements into the DESCRIBE document of the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
112 ArtifactNamespaceContext.NAMESPACE_URI, "active");
59ae2a823e73 Use the Facet.toXML() method to write facet elements into the DESCRIBE document of the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
113
59ae2a823e73 Use the Facet.toXML() method to write facet elements into the DESCRIBE document of the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
114 if (active != null && active.length() > 0) {
59ae2a823e73 Use the Facet.toXML() method to write facet elements into the DESCRIBE document of the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
115 this.active = Integer.parseInt(active);
59ae2a823e73 Use the Facet.toXML() method to write facet elements into the DESCRIBE document of the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
116 }
59ae2a823e73 Use the Facet.toXML() method to write facet elements into the DESCRIBE document of the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
117 }
59ae2a823e73 Use the Facet.toXML() method to write facet elements into the DESCRIBE document of the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
118
59ae2a823e73 Use the Facet.toXML() method to write facet elements into the DESCRIBE document of the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
119 return this.active;
59ae2a823e73 Use the Facet.toXML() method to write facet elements into the DESCRIBE document of the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
120 }
59ae2a823e73 Use the Facet.toXML() method to write facet elements into the DESCRIBE document of the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
121
59ae2a823e73 Use the Facet.toXML() method to write facet elements into the DESCRIBE document of the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
122
59ae2a823e73 Use the Facet.toXML() method to write facet elements into the DESCRIBE document of the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
123 @Override
59ae2a823e73 Use the Facet.toXML() method to write facet elements into the DESCRIBE document of the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
124 public void setActive(int active) {
59ae2a823e73 Use the Facet.toXML() method to write facet elements into the DESCRIBE document of the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
125 this.active = active;
59ae2a823e73 Use the Facet.toXML() method to write facet elements into the DESCRIBE document of the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
126
59ae2a823e73 Use the Facet.toXML() method to write facet elements into the DESCRIBE document of the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
127 facet.setAttributeNS(
59ae2a823e73 Use the Facet.toXML() method to write facet elements into the DESCRIBE document of the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
128 ArtifactNamespaceContext.NAMESPACE_URI,
1813
b3a67d946568 Fix bug where wrong attribute was set.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1715
diff changeset
129 "art:active",
945
59ae2a823e73 Use the Facet.toXML() method to write facet elements into the DESCRIBE document of the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
130 String.valueOf(active));
59ae2a823e73 Use the Facet.toXML() method to write facet elements into the DESCRIBE document of the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
131 }
59ae2a823e73 Use the Facet.toXML() method to write facet elements into the DESCRIBE document of the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
132
59ae2a823e73 Use the Facet.toXML() method to write facet elements into the DESCRIBE document of the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
133
59ae2a823e73 Use the Facet.toXML() method to write facet elements into the DESCRIBE document of the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
134 @Override
1715
a70e0cbc5e02 Added support for removing themes from output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1646
diff changeset
135 public int getVisible() {
a70e0cbc5e02 Added support for removing themes from output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1646
diff changeset
136 if (this.visible < 0) {
a70e0cbc5e02 Added support for removing themes from output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1646
diff changeset
137 String visible = facet.getAttributeNS(
a70e0cbc5e02 Added support for removing themes from output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1646
diff changeset
138 ArtifactNamespaceContext.NAMESPACE_URI, "visible");
a70e0cbc5e02 Added support for removing themes from output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1646
diff changeset
139
a70e0cbc5e02 Added support for removing themes from output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1646
diff changeset
140 if (visible != null && visible.length() > 0) {
a70e0cbc5e02 Added support for removing themes from output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1646
diff changeset
141 this.visible = Integer.parseInt(visible);
a70e0cbc5e02 Added support for removing themes from output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1646
diff changeset
142 }
a70e0cbc5e02 Added support for removing themes from output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1646
diff changeset
143 }
a70e0cbc5e02 Added support for removing themes from output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1646
diff changeset
144
a70e0cbc5e02 Added support for removing themes from output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1646
diff changeset
145 return this.visible;
a70e0cbc5e02 Added support for removing themes from output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1646
diff changeset
146 }
a70e0cbc5e02 Added support for removing themes from output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1646
diff changeset
147
a70e0cbc5e02 Added support for removing themes from output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1646
diff changeset
148
a70e0cbc5e02 Added support for removing themes from output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1646
diff changeset
149 @Override
a70e0cbc5e02 Added support for removing themes from output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1646
diff changeset
150 public void setVisible(int visible) {
a70e0cbc5e02 Added support for removing themes from output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1646
diff changeset
151 this.visible = visible;
a70e0cbc5e02 Added support for removing themes from output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1646
diff changeset
152
a70e0cbc5e02 Added support for removing themes from output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1646
diff changeset
153 facet.setAttributeNS(
a70e0cbc5e02 Added support for removing themes from output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1646
diff changeset
154 ArtifactNamespaceContext.NAMESPACE_URI,
a70e0cbc5e02 Added support for removing themes from output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1646
diff changeset
155 "visible",
a70e0cbc5e02 Added support for removing themes from output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1646
diff changeset
156 String.valueOf(getVisible()));
a70e0cbc5e02 Added support for removing themes from output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1646
diff changeset
157 }
a70e0cbc5e02 Added support for removing themes from output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1646
diff changeset
158
a70e0cbc5e02 Added support for removing themes from output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1646
diff changeset
159
a70e0cbc5e02 Added support for removing themes from output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1646
diff changeset
160 @Override
945
59ae2a823e73 Use the Facet.toXML() method to write facet elements into the DESCRIBE document of the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
161 public String getArtifact() {
59ae2a823e73 Use the Facet.toXML() method to write facet elements into the DESCRIBE document of the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
162 if (this.uuid == null || this.uuid.length() == 0) {
59ae2a823e73 Use the Facet.toXML() method to write facet elements into the DESCRIBE document of the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
163 String uuid = facet.getAttributeNS(
59ae2a823e73 Use the Facet.toXML() method to write facet elements into the DESCRIBE document of the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
164 ArtifactNamespaceContext.NAMESPACE_URI, "artifact");
59ae2a823e73 Use the Facet.toXML() method to write facet elements into the DESCRIBE document of the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
165
59ae2a823e73 Use the Facet.toXML() method to write facet elements into the DESCRIBE document of the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
166 this.uuid = uuid;
59ae2a823e73 Use the Facet.toXML() method to write facet elements into the DESCRIBE document of the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
167 }
59ae2a823e73 Use the Facet.toXML() method to write facet elements into the DESCRIBE document of the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
168
59ae2a823e73 Use the Facet.toXML() method to write facet elements into the DESCRIBE document of the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
169 return this.uuid;
59ae2a823e73 Use the Facet.toXML() method to write facet elements into the DESCRIBE document of the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
170 }
59ae2a823e73 Use the Facet.toXML() method to write facet elements into the DESCRIBE document of the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
171
59ae2a823e73 Use the Facet.toXML() method to write facet elements into the DESCRIBE document of the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
172
1813
b3a67d946568 Fix bug where wrong attribute was set.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1715
diff changeset
173 /**
b3a67d946568 Fix bug where wrong attribute was set.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1715
diff changeset
174 * Import into document.
b3a67d946568 Fix bug where wrong attribute was set.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1715
diff changeset
175 * @param doc Document to be imported to.
b3a67d946568 Fix bug where wrong attribute was set.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1715
diff changeset
176 */
945
59ae2a823e73 Use the Facet.toXML() method to write facet elements into the DESCRIBE document of the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
177 @Override
59ae2a823e73 Use the Facet.toXML() method to write facet elements into the DESCRIBE document of the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
178 public Node toXML(Document doc) {
59ae2a823e73 Use the Facet.toXML() method to write facet elements into the DESCRIBE document of the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
179 return doc.importNode(facet, true);
59ae2a823e73 Use the Facet.toXML() method to write facet elements into the DESCRIBE document of the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
180 }
59ae2a823e73 Use the Facet.toXML() method to write facet elements into the DESCRIBE document of the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
181 }
59ae2a823e73 Use the Facet.toXML() method to write facet elements into the DESCRIBE document of the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
182 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org