comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/StaticFLYSArtifact.java @ 937:9e813e9137a5

Added a monitor that creates new artifacts for default themes in charts and maps. flys-artifacts/trunk@2329 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Thu, 14 Jul 2011 11:27:01 +0000
parents
children 5de90b0cff8e
comparison
equal deleted inserted replaced
936:759808931a2e 937:9e813e9137a5
1 package de.intevation.flys.artifacts;
2
3 import java.util.List;
4
5 import org.apache.log4j.Logger;
6
7 import org.w3c.dom.Document;
8 import org.w3c.dom.Element;
9
10 import de.intevation.artifacts.ArtifactNamespaceContext;
11 import de.intevation.artifacts.CallContext;
12
13 import de.intevation.artifactdatabase.ProtocolUtils;
14 import de.intevation.artifactdatabase.state.Facet;
15 import de.intevation.artifactdatabase.state.Output;
16 import de.intevation.artifactdatabase.state.State;
17
18 import de.intevation.artifacts.common.utils.XMLUtils;
19 import de.intevation.artifacts.common.utils.XMLUtils.ElementCreator;
20
21
22 public abstract class StaticFLYSArtifact extends FLYSArtifact {
23
24 private static final Logger logger =
25 Logger.getLogger(StaticFLYSArtifact.class);
26
27
28 @Override
29 public Document describe(Document data, CallContext cc) {
30 logger.debug("Describe artifact: " + identifier());
31
32 Document desc = XMLUtils.newDocument();
33
34 ElementCreator creator = new ElementCreator(
35 desc,
36 ArtifactNamespaceContext.NAMESPACE_URI,
37 ArtifactNamespaceContext.NAMESPACE_PREFIX);
38
39 Element root = ProtocolUtils.createRootNode(creator);
40 desc.appendChild(root);
41
42 ProtocolUtils.appendDescribeHeader(creator, root, identifier(), hash());
43 root.appendChild(createOutputModes(cc, creator));
44
45 return desc;
46 }
47
48
49 protected Element createOutputModes(CallContext cc, ElementCreator creator){
50 Element outs = ProtocolUtils.createArtNode(
51 creator, "outputmodes", null, null);
52
53 State state = getCurrentState(cc);
54 List<Output> list = state.getOutputs();
55
56 if (list != null && list.size() > 0) {
57 List<Facet> fs = facets.get(state.getID());
58 if (fs != null && fs.size() > 0) {
59 List<Output> generated = generateOutputs(list, fs);
60
61 logger.debug("Found " + fs.size() + " current facets.");
62 if (!generated.isEmpty()) {
63 ProtocolUtils.appendOutputModes(
64 creator, outs, generated);
65 }
66 }
67 else {
68 logger.debug("No facets found for the current state.");
69 }
70 }
71
72 return outs;
73 }
74 }
75 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org