annotate artifacts/src/main/java/org/dive4elements/river/artifacts/model/ManagedFacetAdapter.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: 3083
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
1890
9144e5a5027b (Picky) cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1715
diff changeset
11 import org.apache.log4j.Logger;
9144e5a5027b (Picky) cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1715
diff changeset
12
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
13 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
14 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
15 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
16
5831
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 3083
diff changeset
17 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
18
5831
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 3083
diff changeset
19 import org.dive4elements.artifactdatabase.state.DefaultFacet;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 3083
diff changeset
20 import org.dive4elements.artifactdatabase.state.Facet;
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
21
5831
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 3083
diff changeset
22 import org.dive4elements.artifacts.common.utils.XMLUtils.ElementCreator;
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
23
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
24
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
25 public class ManagedFacetAdapter 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
26
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 protected 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
28
1061
b1b0a0b61845 Made facets cloneable with the right type.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 945
diff changeset
29 public ManagedFacetAdapter() {
b1b0a0b61845 Made facets cloneable with the right type.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 945
diff changeset
30 }
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
31
1890
9144e5a5027b (Picky) cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1715
diff changeset
32
9144e5a5027b (Picky) cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1715
diff changeset
33 protected Logger logger = Logger.getLogger(ManagedFacetAdapter.class);
9144e5a5027b (Picky) cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1715
diff changeset
34
1715
a70e0cbc5e02 Added support for removing themes from output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1061
diff changeset
35 public ManagedFacetAdapter(
a70e0cbc5e02 Added support for removing themes from output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1061
diff changeset
36 Facet facet,
a70e0cbc5e02 Added support for removing themes from output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1061
diff changeset
37 String uuid,
a70e0cbc5e02 Added support for removing themes from output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1061
diff changeset
38 int pos,
a70e0cbc5e02 Added support for removing themes from output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1061
diff changeset
39 int active,
a70e0cbc5e02 Added support for removing themes from output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1061
diff changeset
40 int visible
a70e0cbc5e02 Added support for removing themes from output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1061
diff changeset
41 ) {
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
42 super(
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 facet.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
44 facet.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
45 facet.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
46 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
47 pos,
1715
a70e0cbc5e02 Added support for removing themes from output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1061
diff changeset
48 active,
a70e0cbc5e02 Added support for removing themes from output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1061
diff changeset
49 visible);
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
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 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
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
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 @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
56 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
57 ElementCreator ec = new ElementCreator(
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 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
59 ArtifactNamespaceContext.NAMESPACE_URI,
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 ArtifactNamespaceContext.NAMESPACE_PREFIX);
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 Element e = (Element) facet.toXML(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
63 ec.addAttr(e, "artifact", getArtifact(), 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
64 ec.addAttr(e, "facet", getName(), 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
65 ec.addAttr(e, "pos", String.valueOf(getPosition()), 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
66 ec.addAttr(e, "active", String.valueOf(getActive()), true);
1715
a70e0cbc5e02 Added support for removing themes from output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1061
diff changeset
67 ec.addAttr(e, "visible", String.valueOf(getVisible()), true);
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
68
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 return e;
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 }
1061
b1b0a0b61845 Made facets cloneable with the right type.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 945
diff changeset
71
b1b0a0b61845 Made facets cloneable with the right type.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 945
diff changeset
72 @Override
b1b0a0b61845 Made facets cloneable with the right type.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 945
diff changeset
73 public Facet deepCopy() {
b1b0a0b61845 Made facets cloneable with the right type.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 945
diff changeset
74 ManagedFacetAdapter copy = new ManagedFacetAdapter();
b1b0a0b61845 Made facets cloneable with the right type.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 945
diff changeset
75 copy.set((DefaultFacet)this);
b1b0a0b61845 Made facets cloneable with the right type.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 945
diff changeset
76 copy.set((ManagedFacet)this);
b1b0a0b61845 Made facets cloneable with the right type.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 945
diff changeset
77 copy.facet = facet.deepCopy();
b1b0a0b61845 Made facets cloneable with the right type.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 945
diff changeset
78 return facet;
b1b0a0b61845 Made facets cloneable with the right type.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 945
diff changeset
79 }
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
80 }
3083
4bd3d8bbb60c Added missing vim lines.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1890
diff changeset
81 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org