comparison 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
comparison
equal deleted inserted replaced
487:9da25f0c5962 488:d265f5dc2979
1 package de.intevation.gnv.artifacts;
2
3 import de.intevation.artifactdatabase.DefaultArtifact;
4 import de.intevation.artifactdatabase.XMLUtils;
5
6 import de.intevation.artifacts.CallContext;
7 import de.intevation.artifacts.CallMeta;
8
9 import de.intevation.gnv.artifacts.ressource.RessourceFactory;
10
11 import org.apache.log4j.Logger;
12
13 import org.w3c.dom.Document;
14 import org.w3c.dom.Element;
15
16 /**
17 * @author Ingo Weinzierl <ingo.weinzierl@intevation.de>
18 */
19 public class GNVDefaultArtifact extends DefaultArtifact {
20
21 private static Logger logger = Logger.getLogger(GNVDefaultArtifact.class);
22
23
24 public GNVDefaultArtifact() {
25 super();
26 }
27
28
29 protected void appendFis(
30 Document document,
31 Element staticNode,
32 CallContext context,
33 String fisName
34 ) {
35 RessourceFactory resource = RessourceFactory.getInstance();
36 CallMeta callMeta = (CallMeta) context.getMeta();
37
38 XMLUtils.ElementCreator creator = new XMLUtils.ElementCreator(
39 document,
40 XMLUtils.XFORM_URL,
41 XMLUtils.XFORM_PREFIX
42 );
43
44 Element selectNode = creator.create("select1");
45 creator.addAttr(selectNode, "ref", "fis");
46
47 Element labelNode = creator.create("label");
48 labelNode.setTextContent(
49 resource.getRessource(callMeta.getLanguages(), "fis", "fis")
50 );
51
52 Element choicesNode = creator.create("choices");
53
54 Element itemNode = creator.create("item");
55 creator.addAttr(itemNode, "selected", "true");
56
57 Element choiceLabel = creator.create("label");
58 choiceLabel.setTextContent(resource.getRessource(
59 callMeta.getLanguages(),
60 fisName,
61 fisName
62 ));
63
64 Element choiceValue = creator.create("value");
65 choiceValue.setTextContent(fisName);
66
67 itemNode.appendChild(choiceLabel);
68 itemNode.appendChild(choiceValue);
69 choicesNode.appendChild(itemNode);
70
71 selectNode.appendChild(labelNode);
72 selectNode.appendChild(choicesNode);
73
74 staticNode.appendChild(selectNode);
75 }
76 }

http://dive4elements.wald.intevation.org