annotate gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/GNVDefaultArtifact.java @ 488:d265f5dc2979

Appended the selected fis to the describe document. gnv-artifacts/trunk@564 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Mon, 18 Jan 2010 13:43:50 +0000
parents
children cbb6b592bc6f
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
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
6 import de.intevation.artifacts.CallContext;
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
7 import de.intevation.artifacts.CallMeta;
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
8
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
9 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
10
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
11 import org.apache.log4j.Logger;
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
12
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
13 import org.w3c.dom.Document;
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
14 import org.w3c.dom.Element;
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
15
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 * @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
18 */
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
19 public class GNVDefaultArtifact extends DefaultArtifact {
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
20
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
21 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
22
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
23
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
24 public GNVDefaultArtifact() {
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
25 super();
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
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
28
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
29 protected void appendFis(
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
30 Document document,
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
31 Element staticNode,
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
32 CallContext context,
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
33 String fisName
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
34 ) {
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
35 RessourceFactory resource = RessourceFactory.getInstance();
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
36 CallMeta callMeta = (CallMeta) context.getMeta();
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 XMLUtils.ElementCreator creator = new XMLUtils.ElementCreator(
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
39 document,
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
40 XMLUtils.XFORM_URL,
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
41 XMLUtils.XFORM_PREFIX
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
42 );
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
43
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
44 Element selectNode = creator.create("select1");
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
45 creator.addAttr(selectNode, "ref", "fis");
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 Element labelNode = creator.create("label");
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
48 labelNode.setTextContent(
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
49 resource.getRessource(callMeta.getLanguages(), "fis", "fis")
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
50 );
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
51
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
52 Element choicesNode = creator.create("choices");
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
53
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
54 Element itemNode = creator.create("item");
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
55 creator.addAttr(itemNode, "selected", "true");
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
56
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
57 Element choiceLabel = creator.create("label");
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
58 choiceLabel.setTextContent(resource.getRessource(
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
59 callMeta.getLanguages(),
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
60 fisName,
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
61 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
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
64 Element choiceValue = creator.create("value");
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
65 choiceValue.setTextContent(fisName);
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
66
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
67 itemNode.appendChild(choiceLabel);
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
68 itemNode.appendChild(choiceValue);
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
69 choicesNode.appendChild(itemNode);
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 selectNode.appendChild(labelNode);
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
72 selectNode.appendChild(choicesNode);
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
73
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
74 staticNode.appendChild(selectNode);
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 }

http://dive4elements.wald.intevation.org