annotate gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/GNVDefaultArtifact.java @ 1138:2c00570ab3bd

merged doc
author Thomas Arendsen Hein <thomas@intevation.de>
date Fri, 28 Sep 2012 12:14:02 +0200
parents dec4257ad570
children
rev   line source
1115
f953c9a559d8 Added license file and license headers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
1 /*
f953c9a559d8 Added license file and license headers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
2 * Copyright (c) 2010 by Intevation GmbH
f953c9a559d8 Added license file and license headers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
3 *
f953c9a559d8 Added license file and license headers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
4 * This program is free software under the LGPL (>=v2.1)
f953c9a559d8 Added license file and license headers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
5 * Read the file LGPL.txt coming with the software for details
f953c9a559d8 Added license file and license headers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
6 * or visit http://www.gnu.org/licenses/ if it does not exist.
f953c9a559d8 Added license file and license headers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
7 */
f953c9a559d8 Added license file and license headers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
8
488
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
9 package de.intevation.gnv.artifacts;
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
10
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
11 import de.intevation.artifactdatabase.DefaultArtifact;
1117
dec4257ad570 Changed imports to fit new positions of XMLUtils and Config
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1115
diff changeset
12 import de.intevation.artifacts.common.utils.XMLUtils;
488
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
13
491
cbb6b592bc6f Mark the fis select node with an attribute 'fis', which is important for the XSL sheet to create a link to step back to this point.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 488
diff changeset
14 import de.intevation.artifacts.ArtifactNamespaceContext;
488
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
15 import de.intevation.artifacts.CallContext;
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
16 import de.intevation.artifacts.CallMeta;
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
17
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
18 import de.intevation.gnv.artifacts.ressource.RessourceFactory;
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
19
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
20 import org.apache.log4j.Logger;
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
21
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
22 import org.w3c.dom.Document;
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
23 import org.w3c.dom.Element;
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
24
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
25 /**
789
0dc115cbef0d Added javadoc for artifact package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 780
diff changeset
26 * The default gnv artifact. The only thing defined here is a method to append
0dc115cbef0d Added javadoc for artifact package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 780
diff changeset
27 * the selected fis to the describe document.
0dc115cbef0d Added javadoc for artifact package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 780
diff changeset
28 *
780
c4156275c1e1 Bring @author javadoc tags in form '@author <a href="john.doe@example.com">John Doe</a>'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 725
diff changeset
29 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
488
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
30 */
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
31 public class GNVDefaultArtifact extends DefaultArtifact {
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
32
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
33 private static Logger logger = Logger.getLogger(GNVDefaultArtifact.class);
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
34
789
0dc115cbef0d Added javadoc for artifact package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 780
diff changeset
35 /**
0dc115cbef0d Added javadoc for artifact package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 780
diff changeset
36 *
0dc115cbef0d Added javadoc for artifact package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 780
diff changeset
37 */
725
dde7f51dbe1e Improved exception handling while feeding an artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 491
diff changeset
38 public static final String EXCEPTION_NO_INPUT = "no.input.data";
dde7f51dbe1e Improved exception handling while feeding an artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 491
diff changeset
39
488
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
40
789
0dc115cbef0d Added javadoc for artifact package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 780
diff changeset
41 /**
0dc115cbef0d Added javadoc for artifact package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 780
diff changeset
42 * Constructor.
0dc115cbef0d Added javadoc for artifact package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 780
diff changeset
43 */
488
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
44 public GNVDefaultArtifact() {
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
45 super();
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
46 }
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
47
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
48
789
0dc115cbef0d Added javadoc for artifact package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 780
diff changeset
49 /**
0dc115cbef0d Added javadoc for artifact package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 780
diff changeset
50 * Append the selected fis to the describe document.
0dc115cbef0d Added javadoc for artifact package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 780
diff changeset
51 *
0dc115cbef0d Added javadoc for artifact package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 780
diff changeset
52 * @param document
0dc115cbef0d Added javadoc for artifact package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 780
diff changeset
53 * @param staticNode
0dc115cbef0d Added javadoc for artifact package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 780
diff changeset
54 * @param context
0dc115cbef0d Added javadoc for artifact package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 780
diff changeset
55 * @param fisName
0dc115cbef0d Added javadoc for artifact package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 780
diff changeset
56 */
488
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
57 protected void appendFis(
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
58 Document document,
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
59 Element staticNode,
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
60 CallContext context,
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
61 String fisName
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
62 ) {
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
63 RessourceFactory resource = RessourceFactory.getInstance();
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
64 CallMeta callMeta = (CallMeta) context.getMeta();
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
65
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
66 XMLUtils.ElementCreator creator = new XMLUtils.ElementCreator(
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
67 document,
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
68 XMLUtils.XFORM_URL,
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
69 XMLUtils.XFORM_PREFIX
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
70 );
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
71
491
cbb6b592bc6f Mark the fis select node with an attribute 'fis', which is important for the XSL sheet to create a link to step back to this point.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 488
diff changeset
72 XMLUtils.ElementCreator artCreator = new XMLUtils.ElementCreator(
cbb6b592bc6f Mark the fis select node with an attribute 'fis', which is important for the XSL sheet to create a link to step back to this point.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 488
diff changeset
73 document,
cbb6b592bc6f Mark the fis select node with an attribute 'fis', which is important for the XSL sheet to create a link to step back to this point.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 488
diff changeset
74 ArtifactNamespaceContext.NAMESPACE_URI,
cbb6b592bc6f Mark the fis select node with an attribute 'fis', which is important for the XSL sheet to create a link to step back to this point.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 488
diff changeset
75 ArtifactNamespaceContext.NAMESPACE_PREFIX
cbb6b592bc6f Mark the fis select node with an attribute 'fis', which is important for the XSL sheet to create a link to step back to this point.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 488
diff changeset
76 );
cbb6b592bc6f Mark the fis select node with an attribute 'fis', which is important for the XSL sheet to create a link to step back to this point.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 488
diff changeset
77
488
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
78 Element selectNode = creator.create("select1");
491
cbb6b592bc6f Mark the fis select node with an attribute 'fis', which is important for the XSL sheet to create a link to step back to this point.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 488
diff changeset
79 artCreator.addAttr(selectNode, "fis", "true", true);
488
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
80
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
81 Element labelNode = creator.create("label");
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
82 labelNode.setTextContent(
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
83 resource.getRessource(callMeta.getLanguages(), "fis", "fis")
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
84 );
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
85
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
86 Element choicesNode = creator.create("choices");
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
87
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
88 Element itemNode = creator.create("item");
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
89 creator.addAttr(itemNode, "selected", "true");
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
90
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
91 Element choiceLabel = creator.create("label");
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
92 choiceLabel.setTextContent(resource.getRessource(
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
93 callMeta.getLanguages(),
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
94 fisName,
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
95 fisName
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
96 ));
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
97
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
98 Element choiceValue = creator.create("value");
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
99 choiceValue.setTextContent(fisName);
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
100
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
101 itemNode.appendChild(choiceLabel);
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
102 itemNode.appendChild(choiceValue);
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
103 choicesNode.appendChild(itemNode);
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
104
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
105 selectNode.appendChild(labelNode);
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
106 selectNode.appendChild(choicesNode);
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
107
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
108 staticNode.appendChild(selectNode);
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
109 }
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
110 }
836
05bf8534a35a Using unix line endings only.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 789
diff changeset
111 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org