Mercurial > dive4elements > gnv-client
diff 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 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/GNVDefaultArtifact.java Mon Jan 18 13:43:50 2010 +0000 @@ -0,0 +1,76 @@ +package de.intevation.gnv.artifacts; + +import de.intevation.artifactdatabase.DefaultArtifact; +import de.intevation.artifactdatabase.XMLUtils; + +import de.intevation.artifacts.CallContext; +import de.intevation.artifacts.CallMeta; + +import de.intevation.gnv.artifacts.ressource.RessourceFactory; + +import org.apache.log4j.Logger; + +import org.w3c.dom.Document; +import org.w3c.dom.Element; + +/** + * @author Ingo Weinzierl <ingo.weinzierl@intevation.de> + */ +public class GNVDefaultArtifact extends DefaultArtifact { + + private static Logger logger = Logger.getLogger(GNVDefaultArtifact.class); + + + public GNVDefaultArtifact() { + super(); + } + + + protected void appendFis( + Document document, + Element staticNode, + CallContext context, + String fisName + ) { + RessourceFactory resource = RessourceFactory.getInstance(); + CallMeta callMeta = (CallMeta) context.getMeta(); + + XMLUtils.ElementCreator creator = new XMLUtils.ElementCreator( + document, + XMLUtils.XFORM_URL, + XMLUtils.XFORM_PREFIX + ); + + Element selectNode = creator.create("select1"); + creator.addAttr(selectNode, "ref", "fis"); + + Element labelNode = creator.create("label"); + labelNode.setTextContent( + resource.getRessource(callMeta.getLanguages(), "fis", "fis") + ); + + Element choicesNode = creator.create("choices"); + + Element itemNode = creator.create("item"); + creator.addAttr(itemNode, "selected", "true"); + + Element choiceLabel = creator.create("label"); + choiceLabel.setTextContent(resource.getRessource( + callMeta.getLanguages(), + fisName, + fisName + )); + + Element choiceValue = creator.create("value"); + choiceValue.setTextContent(fisName); + + itemNode.appendChild(choiceLabel); + itemNode.appendChild(choiceValue); + choicesNode.appendChild(itemNode); + + selectNode.appendChild(labelNode); + selectNode.appendChild(choicesNode); + + staticNode.appendChild(selectNode); + } +}