annotate gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/GNVDefaultArtifact.java @ 605:e8ebdbc7f1e3

First step of removing the cache blob. The static part of the describe document will be created by using the input data stored at each state. Some TODOs left (see ChangeLog). gnv-artifacts/trunk@671 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Tue, 09 Feb 2010 14:27:55 +0000
parents cbb6b592bc6f
children dde7f51dbe1e
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
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 public GNVDefaultArtifact() {
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
26 super();
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
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
30 protected void appendFis(
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
31 Document document,
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
32 Element staticNode,
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
33 CallContext context,
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
34 String fisName
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
35 ) {
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
36 RessourceFactory resource = RessourceFactory.getInstance();
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
37 CallMeta callMeta = (CallMeta) context.getMeta();
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
38
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
39 XMLUtils.ElementCreator creator = new XMLUtils.ElementCreator(
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
40 document,
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
41 XMLUtils.XFORM_URL,
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
42 XMLUtils.XFORM_PREFIX
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
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
45 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
46 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
47 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
48 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
49 );
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
488
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
51 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
52 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
53
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
54 Element labelNode = creator.create("label");
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
55 labelNode.setTextContent(
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
56 resource.getRessource(callMeta.getLanguages(), "fis", "fis")
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
57 );
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
58
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
59 Element choicesNode = creator.create("choices");
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 itemNode = creator.create("item");
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
62 creator.addAttr(itemNode, "selected", "true");
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 choiceLabel = creator.create("label");
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
65 choiceLabel.setTextContent(resource.getRessource(
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
66 callMeta.getLanguages(),
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
67 fisName,
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
68 fisName
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
69 ));
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 Element choiceValue = creator.create("value");
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
72 choiceValue.setTextContent(fisName);
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 itemNode.appendChild(choiceLabel);
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
75 itemNode.appendChild(choiceValue);
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
76 choicesNode.appendChild(itemNode);
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
77
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
78 selectNode.appendChild(labelNode);
d265f5dc2979 Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
79 selectNode.appendChild(choicesNode);
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 staticNode.appendChild(selectNode);
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 }

http://dive4elements.wald.intevation.org