annotate gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/GNVDefaultArtifact.java @ 763:e4d1fded433b

Bugfix: The Description of an InputData-Object will now only be fetched if the Name of the data of the Current State is equal to the Name of the InputData-Object. gnv-artifacts/trunk@818 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Tim Englich <tim.englich@intevation.de>
date Mon, 22 Mar 2010 12:52:09 +0000
parents dde7f51dbe1e
children c4156275c1e1
rev   line source
488
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
1 package de.intevation.gnv.artifacts;
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
2
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
3 import de.intevation.artifactdatabase.DefaultArtifact;
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
4 import de.intevation.artifactdatabase.XMLUtils;
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
5
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
6 import de.intevation.artifacts.ArtifactNamespaceContext;
488
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
7 import de.intevation.artifacts.CallContext;
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
8 import de.intevation.artifacts.CallMeta;
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
9
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
10 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
11
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
12 import org.apache.log4j.Logger;
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
13
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
14 import org.w3c.dom.Document;
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
15 import org.w3c.dom.Element;
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
16
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 * @author Ingo Weinzierl <ingo.weinzierl@intevation.de>
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 public class GNVDefaultArtifact extends DefaultArtifact {
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 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
23
725
dde7f51dbe1e Improved exception handling while feeding an artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 491
diff changeset
24 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
25
488
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
26
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
27 public GNVDefaultArtifact() {
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
28 super();
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
29 }
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
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
32 protected void appendFis(
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
33 Document document,
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
34 Element staticNode,
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
35 CallContext context,
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
36 String fisName
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
37 ) {
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
38 RessourceFactory resource = RessourceFactory.getInstance();
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
39 CallMeta callMeta = (CallMeta) context.getMeta();
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
40
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
41 XMLUtils.ElementCreator creator = new XMLUtils.ElementCreator(
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
42 document,
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
43 XMLUtils.XFORM_URL,
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
44 XMLUtils.XFORM_PREFIX
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
45 );
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
46
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
47 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
48 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
49 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
50 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
51 );
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
52
488
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
53 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
54 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
55
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
56 Element labelNode = creator.create("label");
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
57 labelNode.setTextContent(
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
58 resource.getRessource(callMeta.getLanguages(), "fis", "fis")
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
59 );
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
60
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
61 Element choicesNode = creator.create("choices");
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 Element itemNode = creator.create("item");
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
64 creator.addAttr(itemNode, "selected", "true");
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 Element choiceLabel = creator.create("label");
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
67 choiceLabel.setTextContent(resource.getRessource(
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
68 callMeta.getLanguages(),
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
69 fisName,
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
70 fisName
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
71 ));
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
72
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
73 Element choiceValue = creator.create("value");
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
74 choiceValue.setTextContent(fisName);
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
75
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
76 itemNode.appendChild(choiceLabel);
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
77 itemNode.appendChild(choiceValue);
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
78 choicesNode.appendChild(itemNode);
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
79
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
80 selectNode.appendChild(labelNode);
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
81 selectNode.appendChild(choicesNode);
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
82
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
83 staticNode.appendChild(selectNode);
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 }

http://dive4elements.wald.intevation.org