annotate gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/GNVArtifactBase.java @ 67:0e9762ebd18d

Refactor ChartFactory so that it is able to be compiled without errors. gnv-artifacts/trunk@50 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Tim Englich <tim.englich@intevation.de>
date Wed, 09 Sep 2009 13:14:12 +0000
parents 5db77e0a8594
children d117fd4b82e5
rev   line source
52
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1 /**
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
2 *
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
3 */
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
4 package de.intevation.gnv.artifacts;
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
5
57
f01592cd6419 Funktionalität Feed initial bereitgestellt.
Tim Englich <tim.englich@intevation.de>
parents: 56
diff changeset
6 import java.util.ArrayList;
56
737d8bf63701 Required Inputelements integrated in BAsicArtifact-Descibe-Outputv
Tim Englich <tim.englich@intevation.de>
parents: 54
diff changeset
7 import java.util.Collection;
52
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
8 import java.util.HashMap;
54
09b4bf848c7b 2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents: 52
diff changeset
9 import java.util.Iterator;
52
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
10 import java.util.Map;
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
11
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
12 import org.apache.log4j.Logger;
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
13 import org.w3c.dom.Document;
54
09b4bf848c7b 2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents: 52
diff changeset
14 import org.w3c.dom.Element;
52
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
15 import org.w3c.dom.Node;
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
16 import org.w3c.dom.NodeList;
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
17
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
18 import de.intevation.artifactdatabase.Config;
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
19 import de.intevation.artifactdatabase.DefaultArtifact;
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
20 import de.intevation.gnv.artifacts.context.GNVArtifactContext;
57
f01592cd6419 Funktionalität Feed initial bereitgestellt.
Tim Englich <tim.englich@intevation.de>
parents: 56
diff changeset
21 import de.intevation.gnv.transition.DefaultInputData;
f01592cd6419 Funktionalität Feed initial bereitgestellt.
Tim Englich <tim.englich@intevation.de>
parents: 56
diff changeset
22 import de.intevation.gnv.transition.InputData;
56
737d8bf63701 Required Inputelements integrated in BAsicArtifact-Descibe-Outputv
Tim Englich <tim.englich@intevation.de>
parents: 54
diff changeset
23 import de.intevation.gnv.transition.InputValue;
64
5db77e0a8594 Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents: 61
diff changeset
24 import de.intevation.gnv.transition.OutputMode;
5db77e0a8594 Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents: 61
diff changeset
25 import de.intevation.gnv.transition.OutputTransition;
52
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
26 import de.intevation.gnv.transition.Transition;
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
27 import de.intevation.gnv.transition.TransitionFactory;
57
f01592cd6419 Funktionalität Feed initial bereitgestellt.
Tim Englich <tim.englich@intevation.de>
parents: 56
diff changeset
28 import de.intevation.gnv.transition.exception.TransitionException;
52
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
29
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
30 /**
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
31 * @author Tim Englich <tim.englich@intevation.de>
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
32 *
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
33 */
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
34 public abstract class GNVArtifactBase extends DefaultArtifact {
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
35 /**
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
36 * the logger, used to log exceptions and additonaly information
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
37 */
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
38 private static Logger log = Logger.getLogger(GNVArtifactBase.class);
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
39 /**
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
40 * The UID of this Class
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
41 */
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
42 private static final long serialVersionUID = -8907096744400741458L;
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
43
54
09b4bf848c7b 2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents: 52
diff changeset
44 /**
09b4bf848c7b 2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents: 52
diff changeset
45 * The Identifier for the Replacement of the Artifactname
09b4bf848c7b 2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents: 52
diff changeset
46 */
52
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
47 public static final String XPATH_IDENTIFIER_REPLACE = "IDENTIFIER";
54
09b4bf848c7b 2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents: 52
diff changeset
48
52
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
49 /**
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
50 * The XPATH to the XML-Fragment that should be used for the Configuration
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
51 */
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
52 public static final String XPATH_ARTIFACT_CONFIGURATION= "/artifact-database/artifacts/artifact[@name='"+XPATH_IDENTIFIER_REPLACE+"']";
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
53
54
09b4bf848c7b 2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents: 52
diff changeset
54
09b4bf848c7b 2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents: 52
diff changeset
55 /**
09b4bf848c7b 2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents: 52
diff changeset
56 * The current Transition
09b4bf848c7b 2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents: 52
diff changeset
57 */
52
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
58 protected Transition current = null;
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
59
54
09b4bf848c7b 2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents: 52
diff changeset
60 /**
09b4bf848c7b 2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents: 52
diff changeset
61 * The Transitions that can be used
09b4bf848c7b 2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents: 52
diff changeset
62 */
52
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
63 protected Map<String, Transition> transitions = null;
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
64
54
09b4bf848c7b 2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents: 52
diff changeset
65 /**
09b4bf848c7b 2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents: 52
diff changeset
66 * The Name of the Artifact
09b4bf848c7b 2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents: 52
diff changeset
67 */
52
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
68 protected String name = null;
54
09b4bf848c7b 2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents: 52
diff changeset
69
52
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
70 /**
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
71 * Constructor
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
72 */
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
73 public GNVArtifactBase() {
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
74 super();
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
75 }
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
76
58
f31343d80d53 Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents: 57
diff changeset
77 /**
f31343d80d53 Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents: 57
diff changeset
78 * @see de.intevation.artifactdatabase.DefaultArtifact#advance(org.w3c.dom.Document, java.lang.Object)
f31343d80d53 Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents: 57
diff changeset
79 */
f31343d80d53 Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents: 57
diff changeset
80 @Override
f31343d80d53 Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents: 57
diff changeset
81 public Document advance(Document target, Object context) {
f31343d80d53 Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents: 57
diff changeset
82 Document result = super.newDocument();
f31343d80d53 Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents: 57
diff changeset
83 if (this.current != null){
f31343d80d53 Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents: 57
diff changeset
84 String transitionName = this.readTransitionName(target);
f31343d80d53 Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents: 57
diff changeset
85 if (this.current.isTransitionReachable(transitionName)){
f31343d80d53 Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents: 57
diff changeset
86 // 1. Pr�fung ob Transition valide ist
f31343d80d53 Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents: 57
diff changeset
87 if (this.current.validate()){
f31343d80d53 Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents: 57
diff changeset
88
f31343d80d53 Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents: 57
diff changeset
89 try {
f31343d80d53 Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents: 57
diff changeset
90 Transition nextStep = this.transitions.get(transitionName);
f31343d80d53 Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents: 57
diff changeset
91 // 2.Ergebnisse Berechnen
f31343d80d53 Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents: 57
diff changeset
92 this.current.advance();
f31343d80d53 Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents: 57
diff changeset
93 // 3. Ergebnisse �bergeben
f31343d80d53 Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents: 57
diff changeset
94 nextStep.setDescibeData(this.current.getDescibeData());
59
2c5d8f5bced1 Outputs integrated in describe and XForms integrated
Tim Englich <tim.englich@intevation.de>
parents: 58
diff changeset
95 nextStep.putInputData(this.current.getInputData());
58
f31343d80d53 Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents: 57
diff changeset
96 // 4. Umschalten auf neue Transistion
f31343d80d53 Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents: 57
diff changeset
97 this.current = nextStep;
f31343d80d53 Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents: 57
diff changeset
98 } catch (TransitionException e) {
f31343d80d53 Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents: 57
diff changeset
99 log.error(e,e);
f31343d80d53 Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents: 57
diff changeset
100 // TODO: Errormmessage senden.
f31343d80d53 Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents: 57
diff changeset
101 }
f31343d80d53 Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents: 57
diff changeset
102
f31343d80d53 Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents: 57
diff changeset
103 }else{
f31343d80d53 Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents: 57
diff changeset
104 log.error("Advance nicht m�glich, da die Bedingungen f�r den �bergang " +
f31343d80d53 Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents: 57
diff changeset
105 "in den neuen Zustand noch nicht gegeben ist.");
f31343d80d53 Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents: 57
diff changeset
106 // TODO: Errormmessage senden.
f31343d80d53 Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents: 57
diff changeset
107 }
f31343d80d53 Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents: 57
diff changeset
108
f31343d80d53 Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents: 57
diff changeset
109 }else{
f31343d80d53 Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents: 57
diff changeset
110 log.error("Transitions�bergang wird nicht unterst�tzt.");
f31343d80d53 Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents: 57
diff changeset
111 // TODO: Errormmessage senden.
f31343d80d53 Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents: 57
diff changeset
112 }
f31343d80d53 Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents: 57
diff changeset
113 }else{
f31343d80d53 Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents: 57
diff changeset
114 log.error("Kein Transitionsschritt aktiviert.");
f31343d80d53 Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents: 57
diff changeset
115 // TODO: Errormmessage senden.
f31343d80d53 Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents: 57
diff changeset
116 }
f31343d80d53 Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents: 57
diff changeset
117 return result;
f31343d80d53 Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents: 57
diff changeset
118 }
f31343d80d53 Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents: 57
diff changeset
119
f31343d80d53 Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents: 57
diff changeset
120 protected String readTransitionName(Document document) {
f31343d80d53 Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents: 57
diff changeset
121 String returnValue = Config.getStringXPath(document, "action/target/@name");
f31343d80d53 Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents: 57
diff changeset
122 return returnValue;
f31343d80d53 Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents: 57
diff changeset
123 }
f31343d80d53 Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents: 57
diff changeset
124
52
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
125 protected Node getConfigurationFragment(Document document){
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
126 log.debug("GNVArtifactBase.getConfigurationFragment");
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
127 String xpathQuery = XPATH_ARTIFACT_CONFIGURATION.replaceAll(XPATH_IDENTIFIER_REPLACE, this.name);
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
128 log.debug(xpathQuery);
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
129 return Config.getNodeXPath(document,xpathQuery);
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
130 }
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
131
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
132 /**
57
f01592cd6419 Funktionalität Feed initial bereitgestellt.
Tim Englich <tim.englich@intevation.de>
parents: 56
diff changeset
133 * @see de.intevation.artifactdatabase.DefaultArtifact#feed(org.w3c.dom.Document, java.lang.Object)
f01592cd6419 Funktionalität Feed initial bereitgestellt.
Tim Englich <tim.englich@intevation.de>
parents: 56
diff changeset
134 */
f01592cd6419 Funktionalität Feed initial bereitgestellt.
Tim Englich <tim.englich@intevation.de>
parents: 56
diff changeset
135 @Override
f01592cd6419 Funktionalität Feed initial bereitgestellt.
Tim Englich <tim.englich@intevation.de>
parents: 56
diff changeset
136 public Document feed(Document target, Object context) {
f01592cd6419 Funktionalität Feed initial bereitgestellt.
Tim Englich <tim.englich@intevation.de>
parents: 56
diff changeset
137 Document result = super.newDocument();
f01592cd6419 Funktionalität Feed initial bereitgestellt.
Tim Englich <tim.englich@intevation.de>
parents: 56
diff changeset
138 try {
f01592cd6419 Funktionalität Feed initial bereitgestellt.
Tim Englich <tim.englich@intevation.de>
parents: 56
diff changeset
139 if (this.current != null){
f01592cd6419 Funktionalität Feed initial bereitgestellt.
Tim Englich <tim.englich@intevation.de>
parents: 56
diff changeset
140 this.current.putInputData(this.parseInputData(target));
f01592cd6419 Funktionalität Feed initial bereitgestellt.
Tim Englich <tim.englich@intevation.de>
parents: 56
diff changeset
141 // TODO Ergebnisdokument erzeugen.
f01592cd6419 Funktionalität Feed initial bereitgestellt.
Tim Englich <tim.englich@intevation.de>
parents: 56
diff changeset
142 }
f01592cd6419 Funktionalität Feed initial bereitgestellt.
Tim Englich <tim.englich@intevation.de>
parents: 56
diff changeset
143 } catch (TransitionException e) {
f01592cd6419 Funktionalität Feed initial bereitgestellt.
Tim Englich <tim.englich@intevation.de>
parents: 56
diff changeset
144 log.error(e,e);
f01592cd6419 Funktionalität Feed initial bereitgestellt.
Tim Englich <tim.englich@intevation.de>
parents: 56
diff changeset
145 //TODO: Fehlerdokumenterzeugen.
f01592cd6419 Funktionalität Feed initial bereitgestellt.
Tim Englich <tim.englich@intevation.de>
parents: 56
diff changeset
146 }
f01592cd6419 Funktionalität Feed initial bereitgestellt.
Tim Englich <tim.englich@intevation.de>
parents: 56
diff changeset
147 return result;
f01592cd6419 Funktionalität Feed initial bereitgestellt.
Tim Englich <tim.englich@intevation.de>
parents: 56
diff changeset
148 }
f01592cd6419 Funktionalität Feed initial bereitgestellt.
Tim Englich <tim.englich@intevation.de>
parents: 56
diff changeset
149
f01592cd6419 Funktionalität Feed initial bereitgestellt.
Tim Englich <tim.englich@intevation.de>
parents: 56
diff changeset
150 /**
52
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
151 * @see de.intevation.artifactdatabase.DefaultArtifact#setup(java.lang.String, java.lang.Object)
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
152 */
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
153 @Override
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
154 public void setup(String identifier, Object context) {
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
155 log.debug("GNVArtifactBase.setup");
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
156 super.setup(identifier, context);
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
157 if (context instanceof GNVArtifactContext){
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
158 GNVArtifactContext gnvContext = (GNVArtifactContext)context;
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
159 Document doc = gnvContext.getConfig();
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
160 Node artifactNode = this.getConfigurationFragment(doc);
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
161 NodeList transitionList = Config.getNodeSetXPath(artifactNode, "transitions/transition");
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
162 this.transitions = new HashMap<String, Transition>(transitionList.getLength());
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
163 for (int i = 0 ; i < transitionList.getLength(); i++){
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
164 Transition tmpTransition = TransitionFactory.getInstance().createTransition(transitionList.item(i));
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
165 if (tmpTransition != null){
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
166 this.transitions.put(tmpTransition.getID(), tmpTransition);
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
167 if (this.current == null){
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
168 this.current = tmpTransition;
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
169 }
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
170 }
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
171 }
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
172
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
173 }
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
174 }
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
175
54
09b4bf848c7b 2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents: 52
diff changeset
176
09b4bf848c7b 2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents: 52
diff changeset
177 protected Document createDescibeOutput(){
09b4bf848c7b 2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents: 52
diff changeset
178 log.debug("GNVArtifactBase.createDescibeOutput");
09b4bf848c7b 2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents: 52
diff changeset
179 Document document = super.newDocument();
09b4bf848c7b 2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents: 52
diff changeset
180 Element rootNode = this.createRootNode(document);
09b4bf848c7b 2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents: 52
diff changeset
181 this.createHeader(rootNode, document, "describe");
59
2c5d8f5bced1 Outputs integrated in describe and XForms integrated
Tim Englich <tim.englich@intevation.de>
parents: 58
diff changeset
182 this.createOutputs(rootNode, document);
54
09b4bf848c7b 2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents: 52
diff changeset
183 this.createCurrentState(rootNode, document);
09b4bf848c7b 2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents: 52
diff changeset
184 this.createReachableStates(rootNode, document);
09b4bf848c7b 2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents: 52
diff changeset
185 this.createModel(rootNode, document);
09b4bf848c7b 2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents: 52
diff changeset
186 this.createUserInterface(rootNode, document);
09b4bf848c7b 2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents: 52
diff changeset
187
09b4bf848c7b 2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents: 52
diff changeset
188 return document;
09b4bf848c7b 2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents: 52
diff changeset
189 }
09b4bf848c7b 2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents: 52
diff changeset
190
09b4bf848c7b 2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents: 52
diff changeset
191 protected Element createRootNode(Document document){
09b4bf848c7b 2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents: 52
diff changeset
192 Element rootNode = createElement(document,"result");
09b4bf848c7b 2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents: 52
diff changeset
193 document.appendChild(rootNode);
09b4bf848c7b 2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents: 52
diff changeset
194 return rootNode;
09b4bf848c7b 2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents: 52
diff changeset
195 }
09b4bf848c7b 2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents: 52
diff changeset
196
09b4bf848c7b 2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents: 52
diff changeset
197 protected void createHeader(Element parent, Document document, String documentType){
09b4bf848c7b 2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents: 52
diff changeset
198 Element typeNode = createElement(document,"type");
09b4bf848c7b 2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents: 52
diff changeset
199 typeNode.setAttribute("name", documentType);
09b4bf848c7b 2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents: 52
diff changeset
200 parent.appendChild(typeNode);
09b4bf848c7b 2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents: 52
diff changeset
201
09b4bf848c7b 2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents: 52
diff changeset
202 Element uuidNode = createElement(document,"uuid");
09b4bf848c7b 2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents: 52
diff changeset
203 uuidNode.setAttribute("value", super.identifier);
09b4bf848c7b 2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents: 52
diff changeset
204 parent.appendChild(uuidNode);
09b4bf848c7b 2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents: 52
diff changeset
205
09b4bf848c7b 2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents: 52
diff changeset
206 Element hashNode = createElement(document,"hash");
09b4bf848c7b 2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents: 52
diff changeset
207 hashNode.setAttribute("value", this.hash());
09b4bf848c7b 2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents: 52
diff changeset
208 parent.appendChild(hashNode);
09b4bf848c7b 2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents: 52
diff changeset
209
09b4bf848c7b 2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents: 52
diff changeset
210
09b4bf848c7b 2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents: 52
diff changeset
211 }
09b4bf848c7b 2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents: 52
diff changeset
212 protected void createReachableStates(Element parent,Document document){
09b4bf848c7b 2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents: 52
diff changeset
213 Element stateNode = createElement(document,"reachable-states");
09b4bf848c7b 2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents: 52
diff changeset
214 if (this.current != null){
09b4bf848c7b 2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents: 52
diff changeset
215 Iterator<String> states = this.current.reachableTransitions().iterator();
09b4bf848c7b 2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents: 52
diff changeset
216 while(states.hasNext()){
09b4bf848c7b 2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents: 52
diff changeset
217 String value = states.next();
09b4bf848c7b 2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents: 52
diff changeset
218 Element currentNode = createElement(document,"state");
09b4bf848c7b 2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents: 52
diff changeset
219 currentNode.setAttribute("name", value);
09b4bf848c7b 2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents: 52
diff changeset
220 currentNode.setAttribute("description", transitions.get(value).getDescription());
09b4bf848c7b 2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents: 52
diff changeset
221 stateNode.appendChild(currentNode);
09b4bf848c7b 2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents: 52
diff changeset
222 }
09b4bf848c7b 2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents: 52
diff changeset
223 }
09b4bf848c7b 2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents: 52
diff changeset
224 parent.appendChild(stateNode);
09b4bf848c7b 2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents: 52
diff changeset
225 }
09b4bf848c7b 2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents: 52
diff changeset
226
09b4bf848c7b 2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents: 52
diff changeset
227 protected void createCurrentState(Element parent, Document document){
09b4bf848c7b 2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents: 52
diff changeset
228 Element stateNode = createElement(document,"state");
09b4bf848c7b 2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents: 52
diff changeset
229 stateNode.setAttribute("name", this.current.getID());
09b4bf848c7b 2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents: 52
diff changeset
230 stateNode.setAttribute("description", this.current.getDescription());
09b4bf848c7b 2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents: 52
diff changeset
231 parent.appendChild(stateNode);
09b4bf848c7b 2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents: 52
diff changeset
232 }
09b4bf848c7b 2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents: 52
diff changeset
233
09b4bf848c7b 2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents: 52
diff changeset
234
09b4bf848c7b 2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents: 52
diff changeset
235 protected void createModel(Element parent, Document document){
09b4bf848c7b 2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents: 52
diff changeset
236 Element modelNode = createElement(document,"model");
56
737d8bf63701 Required Inputelements integrated in BAsicArtifact-Descibe-Outputv
Tim Englich <tim.englich@intevation.de>
parents: 54
diff changeset
237 if (this.current != null){
737d8bf63701 Required Inputelements integrated in BAsicArtifact-Descibe-Outputv
Tim Englich <tim.englich@intevation.de>
parents: 54
diff changeset
238 Collection<InputValue> inputValues = this.current.getRequiredInputValues();
737d8bf63701 Required Inputelements integrated in BAsicArtifact-Descibe-Outputv
Tim Englich <tim.englich@intevation.de>
parents: 54
diff changeset
239 if (inputValues != null){
737d8bf63701 Required Inputelements integrated in BAsicArtifact-Descibe-Outputv
Tim Englich <tim.englich@intevation.de>
parents: 54
diff changeset
240 Iterator<InputValue> it = inputValues.iterator();
737d8bf63701 Required Inputelements integrated in BAsicArtifact-Descibe-Outputv
Tim Englich <tim.englich@intevation.de>
parents: 54
diff changeset
241 while(it.hasNext()){
737d8bf63701 Required Inputelements integrated in BAsicArtifact-Descibe-Outputv
Tim Englich <tim.englich@intevation.de>
parents: 54
diff changeset
242 InputValue inputValue = it.next();
737d8bf63701 Required Inputelements integrated in BAsicArtifact-Descibe-Outputv
Tim Englich <tim.englich@intevation.de>
parents: 54
diff changeset
243 Element inputNode = createElement(document,"input");
737d8bf63701 Required Inputelements integrated in BAsicArtifact-Descibe-Outputv
Tim Englich <tim.englich@intevation.de>
parents: 54
diff changeset
244 inputNode.setAttribute("name", inputValue.getName());
737d8bf63701 Required Inputelements integrated in BAsicArtifact-Descibe-Outputv
Tim Englich <tim.englich@intevation.de>
parents: 54
diff changeset
245 inputNode.setAttribute("type", inputValue.getType());
737d8bf63701 Required Inputelements integrated in BAsicArtifact-Descibe-Outputv
Tim Englich <tim.englich@intevation.de>
parents: 54
diff changeset
246 modelNode.appendChild(inputNode);
737d8bf63701 Required Inputelements integrated in BAsicArtifact-Descibe-Outputv
Tim Englich <tim.englich@intevation.de>
parents: 54
diff changeset
247 }
737d8bf63701 Required Inputelements integrated in BAsicArtifact-Descibe-Outputv
Tim Englich <tim.englich@intevation.de>
parents: 54
diff changeset
248 }
737d8bf63701 Required Inputelements integrated in BAsicArtifact-Descibe-Outputv
Tim Englich <tim.englich@intevation.de>
parents: 54
diff changeset
249 }
54
09b4bf848c7b 2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents: 52
diff changeset
250 parent.appendChild(modelNode);
09b4bf848c7b 2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents: 52
diff changeset
251 }
09b4bf848c7b 2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents: 52
diff changeset
252
09b4bf848c7b 2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents: 52
diff changeset
253 protected void createUserInterface(Element parent, Document document){
09b4bf848c7b 2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents: 52
diff changeset
254 Element uiNode = createElement(document,"ui");
09b4bf848c7b 2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents: 52
diff changeset
255
61
5f47881f7c97 Implementation of the MIN- / MAX-Value Representation
Tim Englich <tim.englich@intevation.de>
parents: 59
diff changeset
256 if (this.current != null){
5f47881f7c97 Implementation of the MIN- / MAX-Value Representation
Tim Englich <tim.englich@intevation.de>
parents: 59
diff changeset
257 this.current.describe(document, uiNode);
5f47881f7c97 Implementation of the MIN- / MAX-Value Representation
Tim Englich <tim.englich@intevation.de>
parents: 59
diff changeset
258 }
54
09b4bf848c7b 2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents: 52
diff changeset
259
09b4bf848c7b 2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents: 52
diff changeset
260 parent.appendChild(uiNode);
09b4bf848c7b 2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents: 52
diff changeset
261 }
09b4bf848c7b 2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents: 52
diff changeset
262
09b4bf848c7b 2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents: 52
diff changeset
263 protected void createOutputs(Element parent, Document document){
64
5db77e0a8594 Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents: 61
diff changeset
264 log.debug("GNVArtifactBase.createOutputs");
54
09b4bf848c7b 2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents: 52
diff changeset
265 Element outputsNode = createElement(document,"outputs");
64
5db77e0a8594 Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents: 61
diff changeset
266 if (this.current instanceof OutputTransition){
5db77e0a8594 Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents: 61
diff changeset
267 Collection<OutputMode> outputModes = ((OutputTransition)this.current).getOutputModes();
5db77e0a8594 Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents: 61
diff changeset
268 if (outputModes != null){
5db77e0a8594 Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents: 61
diff changeset
269 Iterator<OutputMode> it = outputModes.iterator();
5db77e0a8594 Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents: 61
diff changeset
270 while(it.hasNext()){
5db77e0a8594 Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents: 61
diff changeset
271 OutputMode outputMode = it.next();
5db77e0a8594 Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents: 61
diff changeset
272 log.debug("Write Outputnode for "+ outputMode.toString());
5db77e0a8594 Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents: 61
diff changeset
273 Element outputModeNode = createElement(document,"output");
5db77e0a8594 Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents: 61
diff changeset
274 outputModeNode.setAttribute("name", outputMode.getName());
5db77e0a8594 Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents: 61
diff changeset
275 outputModeNode.setAttribute("description", outputMode.getDescription());
5db77e0a8594 Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents: 61
diff changeset
276 outputModeNode.setAttribute("mime-type", outputMode.getMimeType());
5db77e0a8594 Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents: 61
diff changeset
277 outputsNode.appendChild(outputModeNode);
5db77e0a8594 Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents: 61
diff changeset
278 }
5db77e0a8594 Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents: 61
diff changeset
279 }else{
5db77e0a8594 Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents: 61
diff changeset
280 log.warn("No Outputmodes given.");
5db77e0a8594 Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents: 61
diff changeset
281 }
5db77e0a8594 Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents: 61
diff changeset
282 }
54
09b4bf848c7b 2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents: 52
diff changeset
283 parent.appendChild(outputsNode);
09b4bf848c7b 2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents: 52
diff changeset
284 }
09b4bf848c7b 2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents: 52
diff changeset
285
09b4bf848c7b 2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents: 52
diff changeset
286 /**
09b4bf848c7b 2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents: 52
diff changeset
287 * @param document
09b4bf848c7b 2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents: 52
diff changeset
288 * @return
09b4bf848c7b 2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents: 52
diff changeset
289 */
09b4bf848c7b 2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents: 52
diff changeset
290 private Element createElement(Document document, String name) {
09b4bf848c7b 2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents: 52
diff changeset
291 Element node = document.createElementNS(DefaultArtifact.NAMESPACE_URI, name);
09b4bf848c7b 2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents: 52
diff changeset
292 node.setPrefix(DefaultArtifact.NAMESPACE_PREFIX);
09b4bf848c7b 2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents: 52
diff changeset
293 return node;
09b4bf848c7b 2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents: 52
diff changeset
294 }
09b4bf848c7b 2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents: 52
diff changeset
295
57
f01592cd6419 Funktionalität Feed initial bereitgestellt.
Tim Englich <tim.englich@intevation.de>
parents: 56
diff changeset
296 protected Collection<InputData> parseInputData(Document document){
f01592cd6419 Funktionalität Feed initial bereitgestellt.
Tim Englich <tim.englich@intevation.de>
parents: 56
diff changeset
297 log.debug("GNVArtifactBase.parseInputData");
f01592cd6419 Funktionalität Feed initial bereitgestellt.
Tim Englich <tim.englich@intevation.de>
parents: 56
diff changeset
298 Collection<InputData> returnValue = null;
f01592cd6419 Funktionalität Feed initial bereitgestellt.
Tim Englich <tim.englich@intevation.de>
parents: 56
diff changeset
299
f01592cd6419 Funktionalität Feed initial bereitgestellt.
Tim Englich <tim.englich@intevation.de>
parents: 56
diff changeset
300 NodeList inputElemets = Config.getNodeSetXPath(document, "action/data/input");
f01592cd6419 Funktionalität Feed initial bereitgestellt.
Tim Englich <tim.englich@intevation.de>
parents: 56
diff changeset
301 if(inputElemets != null){
f01592cd6419 Funktionalität Feed initial bereitgestellt.
Tim Englich <tim.englich@intevation.de>
parents: 56
diff changeset
302 returnValue = new ArrayList<InputData>(inputElemets.getLength());
f01592cd6419 Funktionalität Feed initial bereitgestellt.
Tim Englich <tim.englich@intevation.de>
parents: 56
diff changeset
303 for (int i = 0; i < inputElemets.getLength(); i++){
f01592cd6419 Funktionalität Feed initial bereitgestellt.
Tim Englich <tim.englich@intevation.de>
parents: 56
diff changeset
304 Node inputDataNode = inputElemets.item(i);
f01592cd6419 Funktionalität Feed initial bereitgestellt.
Tim Englich <tim.englich@intevation.de>
parents: 56
diff changeset
305 InputData inputData = new DefaultInputData(Config.getStringXPath(inputDataNode,"@name"), Config.getStringXPath(inputDataNode,"@value"));
f01592cd6419 Funktionalität Feed initial bereitgestellt.
Tim Englich <tim.englich@intevation.de>
parents: 56
diff changeset
306 log.debug(inputData.toString());
f01592cd6419 Funktionalität Feed initial bereitgestellt.
Tim Englich <tim.englich@intevation.de>
parents: 56
diff changeset
307 returnValue.add(inputData);
f01592cd6419 Funktionalität Feed initial bereitgestellt.
Tim Englich <tim.englich@intevation.de>
parents: 56
diff changeset
308 }
f01592cd6419 Funktionalität Feed initial bereitgestellt.
Tim Englich <tim.englich@intevation.de>
parents: 56
diff changeset
309 }
f01592cd6419 Funktionalität Feed initial bereitgestellt.
Tim Englich <tim.englich@intevation.de>
parents: 56
diff changeset
310 return returnValue;
f01592cd6419 Funktionalität Feed initial bereitgestellt.
Tim Englich <tim.englich@intevation.de>
parents: 56
diff changeset
311 }
52
4d6a82b96059 First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
312 }

http://dive4elements.wald.intevation.org