annotate artifacts/src/main/java/org/dive4elements/river/artifacts/model/ManagedDomFacet.java @ 6139:7c2a30198592

Add boundToOut handling to ManagedFacets.
author Andre Heinecke <aheinecke@intevation.de>
date Fri, 31 May 2013 15:27:06 +0200
parents af13ceeba52a
children cc7df824d5c4
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 *
5994
af13ceeba52a Removed trailing whitespace.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5863
diff changeset
4 * This file is Free Software under the GNU AGPL (>=v3)
5863
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
5994
af13ceeba52a Removed trailing whitespace.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5863
diff changeset
6 * documentation coming with Dive4Elements River for details.
5863
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;
6139
7c2a30198592 Add boundToOut handling to ManagedFacets.
Andre Heinecke <aheinecke@intevation.de>
parents: 5994
diff changeset
16 import org.dive4elements.artifacts.common.utils.XMLUtils;
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
17
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
18
3076
5642a83420f2 FLYS artifacts: Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1813
diff changeset
19 /**
1636
c2edf0032cf8 Squash a bug about wrongly named position attribute ('pos' vs 'art:pos').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 945
diff changeset
20 * 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
21 * 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
22 * 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
23 * 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
24 * 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
25 * 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
26 * touched.
c2edf0032cf8 Squash a bug about wrongly named position attribute ('pos' vs 'art:pos').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 945
diff changeset
27 */
6139
7c2a30198592 Add boundToOut handling to ManagedFacets.
Andre Heinecke <aheinecke@intevation.de>
parents: 5994
diff changeset
28 public class ManagedDomFacet extends ManagedFacet
7c2a30198592 Add boundToOut handling to ManagedFacets.
Andre Heinecke <aheinecke@intevation.de>
parents: 5994
diff changeset
29 {
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
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 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
32
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 public ManagedDomFacet(Element facet) {
1715
a70e0cbc5e02 Added support for removing themes from output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1646
diff changeset
34 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
35 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
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
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 @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
40 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
41 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
42 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
43 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
44
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 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
46 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
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
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 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
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
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 @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
55 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
56 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
57 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
58 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
59
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 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
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
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 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
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
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 @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
68 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
69 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
70 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
71 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
72
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 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
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
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 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
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
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 @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
81 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
82 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
83 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
84 ArtifactNamespaceContext.NAMESPACE_URI,
1637
866c1f37f2bd Fix getPosition() in ManagedDomFacet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1636
diff changeset
85 "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
86
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 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
88 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
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
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 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
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
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 @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
97 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
98 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
99
1636
c2edf0032cf8 Squash a bug about wrongly named position attribute ('pos' vs 'art:pos').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 945
diff changeset
100 // 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
101 // 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
102 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
103 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
104 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
105 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
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
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 @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
110 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
111 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
112 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
113 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
114
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 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
116 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
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
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 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
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
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 @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
125 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
126 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
127
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 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
129 ArtifactNamespaceContext.NAMESPACE_URI,
1813
b3a67d946568 Fix bug where wrong attribute was set.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1715
diff changeset
130 "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
131 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
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
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
135 @Override
1715
a70e0cbc5e02 Added support for removing themes from output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1646
diff changeset
136 public int getVisible() {
a70e0cbc5e02 Added support for removing themes from output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1646
diff changeset
137 if (this.visible < 0) {
a70e0cbc5e02 Added support for removing themes from output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1646
diff changeset
138 String visible = facet.getAttributeNS(
a70e0cbc5e02 Added support for removing themes from output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1646
diff changeset
139 ArtifactNamespaceContext.NAMESPACE_URI, "visible");
a70e0cbc5e02 Added support for removing themes from output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1646
diff changeset
140
a70e0cbc5e02 Added support for removing themes from output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1646
diff changeset
141 if (visible != null && visible.length() > 0) {
a70e0cbc5e02 Added support for removing themes from output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1646
diff changeset
142 this.visible = Integer.parseInt(visible);
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
a70e0cbc5e02 Added support for removing themes from output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1646
diff changeset
146 return this.visible;
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
a70e0cbc5e02 Added support for removing themes from output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1646
diff changeset
150 @Override
a70e0cbc5e02 Added support for removing themes from output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1646
diff changeset
151 public void setVisible(int visible) {
a70e0cbc5e02 Added support for removing themes from output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1646
diff changeset
152 this.visible = visible;
a70e0cbc5e02 Added support for removing themes from output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1646
diff changeset
153
a70e0cbc5e02 Added support for removing themes from output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1646
diff changeset
154 facet.setAttributeNS(
a70e0cbc5e02 Added support for removing themes from output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1646
diff changeset
155 ArtifactNamespaceContext.NAMESPACE_URI,
a70e0cbc5e02 Added support for removing themes from output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1646
diff changeset
156 "visible",
a70e0cbc5e02 Added support for removing themes from output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1646
diff changeset
157 String.valueOf(getVisible()));
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
a70e0cbc5e02 Added support for removing themes from output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1646
diff changeset
161 @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
162 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
163 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
164 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
165 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
166
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 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
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
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 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
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
6139
7c2a30198592 Add boundToOut handling to ManagedFacets.
Andre Heinecke <aheinecke@intevation.de>
parents: 5994
diff changeset
173 @Override
7c2a30198592 Add boundToOut handling to ManagedFacets.
Andre Heinecke <aheinecke@intevation.de>
parents: 5994
diff changeset
174 public String getBoundToOut() {
7c2a30198592 Add boundToOut handling to ManagedFacets.
Andre Heinecke <aheinecke@intevation.de>
parents: 5994
diff changeset
175 if (boundToOut == null) {
7c2a30198592 Add boundToOut handling to ManagedFacets.
Andre Heinecke <aheinecke@intevation.de>
parents: 5994
diff changeset
176 String bondageAttr = this.facet.getAttributeNS(
7c2a30198592 Add boundToOut handling to ManagedFacets.
Andre Heinecke <aheinecke@intevation.de>
parents: 5994
diff changeset
177 ArtifactNamespaceContext.NAMESPACE_URI,
7c2a30198592 Add boundToOut handling to ManagedFacets.
Andre Heinecke <aheinecke@intevation.de>
parents: 5994
diff changeset
178 "boundToOut");
7c2a30198592 Add boundToOut handling to ManagedFacets.
Andre Heinecke <aheinecke@intevation.de>
parents: 5994
diff changeset
179 if (bondageAttr != null && !bondageAttr.isEmpty()) {
7c2a30198592 Add boundToOut handling to ManagedFacets.
Andre Heinecke <aheinecke@intevation.de>
parents: 5994
diff changeset
180 boundToOut = bondageAttr;
7c2a30198592 Add boundToOut handling to ManagedFacets.
Andre Heinecke <aheinecke@intevation.de>
parents: 5994
diff changeset
181 }
7c2a30198592 Add boundToOut handling to ManagedFacets.
Andre Heinecke <aheinecke@intevation.de>
parents: 5994
diff changeset
182 }
7c2a30198592 Add boundToOut handling to ManagedFacets.
Andre Heinecke <aheinecke@intevation.de>
parents: 5994
diff changeset
183 return boundToOut;
7c2a30198592 Add boundToOut handling to ManagedFacets.
Andre Heinecke <aheinecke@intevation.de>
parents: 5994
diff changeset
184 }
7c2a30198592 Add boundToOut handling to ManagedFacets.
Andre Heinecke <aheinecke@intevation.de>
parents: 5994
diff changeset
185
7c2a30198592 Add boundToOut handling to ManagedFacets.
Andre Heinecke <aheinecke@intevation.de>
parents: 5994
diff changeset
186
7c2a30198592 Add boundToOut handling to ManagedFacets.
Andre Heinecke <aheinecke@intevation.de>
parents: 5994
diff changeset
187 @Override
7c2a30198592 Add boundToOut handling to ManagedFacets.
Andre Heinecke <aheinecke@intevation.de>
parents: 5994
diff changeset
188 public void setBoundToOut(String value) {
7c2a30198592 Add boundToOut handling to ManagedFacets.
Andre Heinecke <aheinecke@intevation.de>
parents: 5994
diff changeset
189 boundToOut = value;
7c2a30198592 Add boundToOut handling to ManagedFacets.
Andre Heinecke <aheinecke@intevation.de>
parents: 5994
diff changeset
190
7c2a30198592 Add boundToOut handling to ManagedFacets.
Andre Heinecke <aheinecke@intevation.de>
parents: 5994
diff changeset
191 facet.setAttributeNS(
7c2a30198592 Add boundToOut handling to ManagedFacets.
Andre Heinecke <aheinecke@intevation.de>
parents: 5994
diff changeset
192 ArtifactNamespaceContext.NAMESPACE_URI,
7c2a30198592 Add boundToOut handling to ManagedFacets.
Andre Heinecke <aheinecke@intevation.de>
parents: 5994
diff changeset
193 ArtifactNamespaceContext.NAMESPACE_PREFIX + ":" + "boundToOut",
7c2a30198592 Add boundToOut handling to ManagedFacets.
Andre Heinecke <aheinecke@intevation.de>
parents: 5994
diff changeset
194 getBoundToOut());
7c2a30198592 Add boundToOut handling to ManagedFacets.
Andre Heinecke <aheinecke@intevation.de>
parents: 5994
diff changeset
195 }
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
196
1813
b3a67d946568 Fix bug where wrong attribute was set.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1715
diff changeset
197 /**
b3a67d946568 Fix bug where wrong attribute was set.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1715
diff changeset
198 * Import into document.
b3a67d946568 Fix bug where wrong attribute was set.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1715
diff changeset
199 * @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
200 */
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
201 @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
202 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
203 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
204 }
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
205 }
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
206 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org