Mercurial > dive4elements > gnv-client
annotate gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/GNVArtifactBase.java @ 217:3dcd2b0b456e
Added configurable TimeGap Support to the TimeSeries-Chart-Generation. issu45
gnv-artifacts/trunk@275 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Tim Englich <tim.englich@intevation.de> |
---|---|
date | Thu, 29 Oct 2009 15:58:47 +0000 |
parents | a33d59f5791a |
children | ee2d4134d0b3 |
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 |
73
504570de21fd
Refactoring Work depending on Infrastructurchanges in the Artifact-Module
Tim Englich <tim.englich@intevation.de>
parents:
71
diff
changeset
|
6 import java.io.IOException; |
504570de21fd
Refactoring Work depending on Infrastructurchanges in the Artifact-Module
Tim Englich <tim.englich@intevation.de>
parents:
71
diff
changeset
|
7 import java.io.OutputStream; |
56
737d8bf63701
Required Inputelements integrated in BAsicArtifact-Descibe-Outputv
Tim Englich <tim.englich@intevation.de>
parents:
54
diff
changeset
|
8 import java.util.Collection; |
52
4d6a82b96059
First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
9 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
|
10 import java.util.Iterator; |
52
4d6a82b96059
First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
11 import java.util.Map; |
4d6a82b96059
First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
12 |
204
734ac082c8d1
Split the Configuration File in several small Documents to speed up the Artifactinstantiation and also make the administration of the Artifactdatabase easier. issue40 and issue59
Tim Englich <tim.englich@intevation.de>
parents:
194
diff
changeset
|
13 import javax.xml.parsers.DocumentBuilderFactory; |
734ac082c8d1
Split the Configuration File in several small Documents to speed up the Artifactinstantiation and also make the administration of the Artifactdatabase easier. issue40 and issue59
Tim Englich <tim.englich@intevation.de>
parents:
194
diff
changeset
|
14 import javax.xml.parsers.ParserConfigurationException; |
71
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
70
diff
changeset
|
15 import javax.xml.xpath.XPathConstants; |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
70
diff
changeset
|
16 |
52
4d6a82b96059
First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
17 import org.apache.log4j.Logger; |
4d6a82b96059
First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
18 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
|
19 import org.w3c.dom.Element; |
52
4d6a82b96059
First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
20 import org.w3c.dom.Node; |
4d6a82b96059
First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
21 import org.w3c.dom.NodeList; |
204
734ac082c8d1
Split the Configuration File in several small Documents to speed up the Artifactinstantiation and also make the administration of the Artifactdatabase easier. issue40 and issue59
Tim Englich <tim.englich@intevation.de>
parents:
194
diff
changeset
|
22 import org.xml.sax.SAXException; |
52
4d6a82b96059
First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
23 |
4d6a82b96059
First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
24 import de.intevation.artifactdatabase.Config; |
4d6a82b96059
First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
25 import de.intevation.artifactdatabase.DefaultArtifact; |
71
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
70
diff
changeset
|
26 import de.intevation.artifactdatabase.XMLUtils; |
70
0035862b0295
Refactoringwork done because of changes in the artifact-module
Tim Englich <tim.englich@intevation.de>
parents:
68
diff
changeset
|
27 import de.intevation.artifacts.ArtifactFactory; |
0035862b0295
Refactoringwork done because of changes in the artifact-module
Tim Englich <tim.englich@intevation.de>
parents:
68
diff
changeset
|
28 import de.intevation.artifacts.ArtifactNamespaceContext; |
73
504570de21fd
Refactoring Work depending on Infrastructurchanges in the Artifact-Module
Tim Englich <tim.englich@intevation.de>
parents:
71
diff
changeset
|
29 import de.intevation.artifacts.CallContext; |
117
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
116
diff
changeset
|
30 import de.intevation.artifacts.CallMeta; |
52
4d6a82b96059
First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
31 import de.intevation.gnv.artifacts.context.GNVArtifactContext; |
57
f01592cd6419
Funktionalität Feed initial bereitgestellt.
Tim Englich <tim.englich@intevation.de>
parents:
56
diff
changeset
|
32 import de.intevation.gnv.transition.DefaultInputData; |
f01592cd6419
Funktionalität Feed initial bereitgestellt.
Tim Englich <tim.englich@intevation.de>
parents:
56
diff
changeset
|
33 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
|
34 import de.intevation.gnv.transition.InputValue; |
64
5db77e0a8594
Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents:
61
diff
changeset
|
35 import de.intevation.gnv.transition.OutputMode; |
5db77e0a8594
Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents:
61
diff
changeset
|
36 import de.intevation.gnv.transition.OutputTransition; |
52
4d6a82b96059
First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
37 import de.intevation.gnv.transition.Transition; |
4d6a82b96059
First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
38 import de.intevation.gnv.transition.TransitionFactory; |
57
f01592cd6419
Funktionalität Feed initial bereitgestellt.
Tim Englich <tim.englich@intevation.de>
parents:
56
diff
changeset
|
39 import de.intevation.gnv.transition.exception.TransitionException; |
71
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
70
diff
changeset
|
40 import de.intevation.gnv.utils.ArtifactXMLUtilities; |
52
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 /** |
4d6a82b96059
First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
43 * @author Tim Englich <tim.englich@intevation.de> |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
44 * |
52
4d6a82b96059
First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
45 */ |
4d6a82b96059
First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
46 public abstract class GNVArtifactBase extends DefaultArtifact { |
4d6a82b96059
First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
47 /** |
4d6a82b96059
First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
48 * 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
|
49 */ |
4d6a82b96059
First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
50 private static Logger log = Logger.getLogger(GNVArtifactBase.class); |
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 * The UID of this Class |
4d6a82b96059
First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
53 */ |
4d6a82b96059
First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
54 private static final long serialVersionUID = -8907096744400741458L; |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
55 |
54
09b4bf848c7b
2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents:
52
diff
changeset
|
56 /** |
09b4bf848c7b
2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents:
52
diff
changeset
|
57 * 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
|
58 */ |
52
4d6a82b96059
First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
59 public static final String XPATH_IDENTIFIER_REPLACE = "IDENTIFIER"; |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
60 |
52
4d6a82b96059
First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
61 /** |
4d6a82b96059
First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
62 * 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
|
63 */ |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
64 public static final String XPATH_ARTIFACT_CONFIGURATION = "/artifact-database/artifacts/artifact[@name='" |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
65 + XPATH_IDENTIFIER_REPLACE |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
66 + "']"; |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
67 |
54
09b4bf848c7b
2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents:
52
diff
changeset
|
68 /** |
09b4bf848c7b
2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents:
52
diff
changeset
|
69 * The current Transition |
09b4bf848c7b
2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents:
52
diff
changeset
|
70 */ |
52
4d6a82b96059
First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
71 protected Transition current = null; |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
72 |
54
09b4bf848c7b
2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents:
52
diff
changeset
|
73 /** |
09b4bf848c7b
2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents:
52
diff
changeset
|
74 * 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
|
75 */ |
52
4d6a82b96059
First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
76 protected Map<String, Transition> transitions = null; |
4d6a82b96059
First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
77 |
54
09b4bf848c7b
2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents:
52
diff
changeset
|
78 /** |
09b4bf848c7b
2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents:
52
diff
changeset
|
79 * 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
|
80 */ |
52
4d6a82b96059
First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
81 protected String name = null; |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
82 |
71
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
70
diff
changeset
|
83 private ArtifactXMLUtilities xmlUtilities = new ArtifactXMLUtilities(); |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
84 |
52
4d6a82b96059
First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
85 /** |
4d6a82b96059
First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
86 * Constructor |
4d6a82b96059
First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
87 */ |
4d6a82b96059
First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
88 public GNVArtifactBase() { |
4d6a82b96059
First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
89 super(); |
4d6a82b96059
First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
90 } |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
91 |
58
f31343d80d53
Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents:
57
diff
changeset
|
92 /** |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
93 * @see de.intevation.artifactdatabase.DefaultArtifact#advance(org.w3c.dom.Document, |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
94 * de.intevation.artifacts.CallContext) |
58
f31343d80d53
Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents:
57
diff
changeset
|
95 */ |
f31343d80d53
Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents:
57
diff
changeset
|
96 @Override |
73
504570de21fd
Refactoring Work depending on Infrastructurchanges in the Artifact-Module
Tim Englich <tim.englich@intevation.de>
parents:
71
diff
changeset
|
97 public Document advance(Document target, CallContext context) { |
89
cde042a0a395
Successreporting added
Tim Englich <tim.englich@intevation.de>
parents:
88
diff
changeset
|
98 log.debug("GNVArtifactBase.advance"); |
71
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
70
diff
changeset
|
99 Document result = XMLUtils.newDocument(); |
88
1b12021905b9
Some CodeCleanup done.
Tim Englich <tim.englich@intevation.de>
parents:
78
diff
changeset
|
100 try { |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
101 if (this.current != null) { |
88
1b12021905b9
Some CodeCleanup done.
Tim Englich <tim.englich@intevation.de>
parents:
78
diff
changeset
|
102 String transitionName = this.readTransitionName(target); |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
103 log.debug("Transitionsname: " + transitionName); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
104 if (this.current.isTransitionReachable(transitionName)) { |
88
1b12021905b9
Some CodeCleanup done.
Tim Englich <tim.englich@intevation.de>
parents:
78
diff
changeset
|
105 // 1. Pr�fung ob Transition valide ist |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
106 if (this.current.validate()) { |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
107 |
88
1b12021905b9
Some CodeCleanup done.
Tim Englich <tim.englich@intevation.de>
parents:
78
diff
changeset
|
108 try { |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
109 Transition nextStep = this.transitions |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
110 .get(transitionName); |
88
1b12021905b9
Some CodeCleanup done.
Tim Englich <tim.englich@intevation.de>
parents:
78
diff
changeset
|
111 // 2.Ergebnisse Berechnen |
208
a33d59f5791a
Use super.identifier as uuid. issue3
Tim Englich <tim.englich@intevation.de>
parents:
207
diff
changeset
|
112 this.current.advance(super.identifier, context.getMeta()); |
204
734ac082c8d1
Split the Configuration File in several small Documents to speed up the Artifactinstantiation and also make the administration of the Artifactdatabase easier. issue40 and issue59
Tim Englich <tim.englich@intevation.de>
parents:
194
diff
changeset
|
113 // 3. Ergebnisse �bergeben |
208
a33d59f5791a
Use super.identifier as uuid. issue3
Tim Englich <tim.englich@intevation.de>
parents:
207
diff
changeset
|
114 nextStep.putInputData(this.current.getInputData(), |
a33d59f5791a
Use super.identifier as uuid. issue3
Tim Englich <tim.englich@intevation.de>
parents:
207
diff
changeset
|
115 super.identifier); |
88
1b12021905b9
Some CodeCleanup done.
Tim Englich <tim.englich@intevation.de>
parents:
78
diff
changeset
|
116 // 4. Umschalten auf neue Transistion |
1b12021905b9
Some CodeCleanup done.
Tim Englich <tim.englich@intevation.de>
parents:
78
diff
changeset
|
117 this.current = nextStep; |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
118 result = new ArtifactXMLUtilities() |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
119 .createSuccessReport("Advance success", |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
120 XMLUtils.newDocument()); |
88
1b12021905b9
Some CodeCleanup done.
Tim Englich <tim.englich@intevation.de>
parents:
78
diff
changeset
|
121 } catch (TransitionException e) { |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
122 log.error(e, e); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
123 result = new ArtifactXMLUtilities() |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
124 .createExceptionReport(e |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
125 .getLocalizedMessage(), XMLUtils |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
126 .newDocument()); |
88
1b12021905b9
Some CodeCleanup done.
Tim Englich <tim.englich@intevation.de>
parents:
78
diff
changeset
|
127 } |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
128 |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
129 } else { |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
130 String msg = "Advance nicht m�glich, da die Bedingungen f�r den �bergang " |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
131 + "in den neuen Zustand noch nicht gegeben ist."; |
88
1b12021905b9
Some CodeCleanup done.
Tim Englich <tim.englich@intevation.de>
parents:
78
diff
changeset
|
132 log.error(msg); |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
133 result = new ArtifactXMLUtilities() |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
134 .createExceptionReport(msg, XMLUtils |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
135 .newDocument()); |
58
f31343d80d53
Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents:
57
diff
changeset
|
136 } |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
137 |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
138 } else { |
88
1b12021905b9
Some CodeCleanup done.
Tim Englich <tim.englich@intevation.de>
parents:
78
diff
changeset
|
139 String msg = "Transitions�bergang wird nicht unterst�tzt."; |
1b12021905b9
Some CodeCleanup done.
Tim Englich <tim.englich@intevation.de>
parents:
78
diff
changeset
|
140 log.error(msg); |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
141 result = new ArtifactXMLUtilities().createExceptionReport( |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
142 msg, XMLUtils.newDocument()); |
58
f31343d80d53
Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents:
57
diff
changeset
|
143 } |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
144 } else { |
88
1b12021905b9
Some CodeCleanup done.
Tim Englich <tim.englich@intevation.de>
parents:
78
diff
changeset
|
145 String msg = "Kein Transitionsschritt aktiviert."; |
1b12021905b9
Some CodeCleanup done.
Tim Englich <tim.englich@intevation.de>
parents:
78
diff
changeset
|
146 log.error(msg); |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
147 result = new ArtifactXMLUtilities().createExceptionReport(msg, |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
148 XMLUtils.newDocument()); |
58
f31343d80d53
Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents:
57
diff
changeset
|
149 } |
88
1b12021905b9
Some CodeCleanup done.
Tim Englich <tim.englich@intevation.de>
parents:
78
diff
changeset
|
150 } catch (Exception e) { |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
151 log.error(e, e); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
152 result = new ArtifactXMLUtilities().createExceptionReport(e |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
153 .getLocalizedMessage(), XMLUtils.newDocument()); |
58
f31343d80d53
Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents:
57
diff
changeset
|
154 } |
f31343d80d53
Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents:
57
diff
changeset
|
155 return result; |
f31343d80d53
Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents:
57
diff
changeset
|
156 } |
f31343d80d53
Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents:
57
diff
changeset
|
157 |
f31343d80d53
Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents:
57
diff
changeset
|
158 protected String readTransitionName(Document document) { |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
159 String returnValue = Config.getStringXPath(document, |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
160 "action/target/@name"); |
58
f31343d80d53
Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents:
57
diff
changeset
|
161 return returnValue; |
f31343d80d53
Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents:
57
diff
changeset
|
162 } |
f31343d80d53
Artifact.advance initial implementiert
Tim Englich <tim.englich@intevation.de>
parents:
57
diff
changeset
|
163 |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
164 protected Node getConfigurationFragment(Document document) { |
52
4d6a82b96059
First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
165 log.debug("GNVArtifactBase.getConfigurationFragment"); |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
166 String xpathQuery = XPATH_ARTIFACT_CONFIGURATION.replaceAll( |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
167 XPATH_IDENTIFIER_REPLACE, this.name); |
52
4d6a82b96059
First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
168 log.debug(xpathQuery); |
204
734ac082c8d1
Split the Configuration File in several small Documents to speed up the Artifactinstantiation and also make the administration of the Artifactdatabase easier. issue40 and issue59
Tim Englich <tim.englich@intevation.de>
parents:
194
diff
changeset
|
169 |
734ac082c8d1
Split the Configuration File in several small Documents to speed up the Artifactinstantiation and also make the administration of the Artifactdatabase easier. issue40 and issue59
Tim Englich <tim.englich@intevation.de>
parents:
194
diff
changeset
|
170 Element configurationNode = (Element)Config.getNodeXPath(document, xpathQuery); |
734ac082c8d1
Split the Configuration File in several small Documents to speed up the Artifactinstantiation and also make the administration of the Artifactdatabase easier. issue40 and issue59
Tim Englich <tim.englich@intevation.de>
parents:
194
diff
changeset
|
171 |
734ac082c8d1
Split the Configuration File in several small Documents to speed up the Artifactinstantiation and also make the administration of the Artifactdatabase easier. issue40 and issue59
Tim Englich <tim.englich@intevation.de>
parents:
194
diff
changeset
|
172 String link = configurationNode.getAttribute("xlink:href"); |
734ac082c8d1
Split the Configuration File in several small Documents to speed up the Artifactinstantiation and also make the administration of the Artifactdatabase easier. issue40 and issue59
Tim Englich <tim.englich@intevation.de>
parents:
194
diff
changeset
|
173 if (link != null ){ |
734ac082c8d1
Split the Configuration File in several small Documents to speed up the Artifactinstantiation and also make the administration of the Artifactdatabase easier. issue40 and issue59
Tim Englich <tim.englich@intevation.de>
parents:
194
diff
changeset
|
174 String absolutFileName = Config.replaceConfigDir(link); |
217
3dcd2b0b456e
Added configurable TimeGap Support to the TimeSeries-Chart-Generation. issu45
Tim Englich <tim.englich@intevation.de>
parents:
208
diff
changeset
|
175 configurationNode = (Element)new ArtifactXMLUtilities().readConfiguration(absolutFileName); |
204
734ac082c8d1
Split the Configuration File in several small Documents to speed up the Artifactinstantiation and also make the administration of the Artifactdatabase easier. issue40 and issue59
Tim Englich <tim.englich@intevation.de>
parents:
194
diff
changeset
|
176 } |
734ac082c8d1
Split the Configuration File in several small Documents to speed up the Artifactinstantiation and also make the administration of the Artifactdatabase easier. issue40 and issue59
Tim Englich <tim.englich@intevation.de>
parents:
194
diff
changeset
|
177 |
734ac082c8d1
Split the Configuration File in several small Documents to speed up the Artifactinstantiation and also make the administration of the Artifactdatabase easier. issue40 and issue59
Tim Englich <tim.englich@intevation.de>
parents:
194
diff
changeset
|
178 return configurationNode; |
734ac082c8d1
Split the Configuration File in several small Documents to speed up the Artifactinstantiation and also make the administration of the Artifactdatabase easier. issue40 and issue59
Tim Englich <tim.englich@intevation.de>
parents:
194
diff
changeset
|
179 } |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
180 |
52
4d6a82b96059
First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
181 /** |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
182 * @see de.intevation.artifactdatabase.DefaultArtifact#feed(org.w3c.dom.Document, |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
183 * de.intevation.artifacts.CallContext) |
57
f01592cd6419
Funktionalität Feed initial bereitgestellt.
Tim Englich <tim.englich@intevation.de>
parents:
56
diff
changeset
|
184 */ |
f01592cd6419
Funktionalität Feed initial bereitgestellt.
Tim Englich <tim.englich@intevation.de>
parents:
56
diff
changeset
|
185 @Override |
73
504570de21fd
Refactoring Work depending on Infrastructurchanges in the Artifact-Module
Tim Englich <tim.englich@intevation.de>
parents:
71
diff
changeset
|
186 public Document feed(Document target, CallContext context) { |
89
cde042a0a395
Successreporting added
Tim Englich <tim.englich@intevation.de>
parents:
88
diff
changeset
|
187 log.debug("GNVArtifactBase.feed"); |
71
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
70
diff
changeset
|
188 Document result = XMLUtils.newDocument(); |
57
f01592cd6419
Funktionalität Feed initial bereitgestellt.
Tim Englich <tim.englich@intevation.de>
parents:
56
diff
changeset
|
189 try { |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
190 if (this.current != null) { |
194
00c1a931b9c3
Catch Exception that the Calling Program could not put no InputData
Tim Englich <tim.englich@intevation.de>
parents:
171
diff
changeset
|
191 Collection<InputData> inputData = this.parseInputData(target, |
00c1a931b9c3
Catch Exception that the Calling Program could not put no InputData
Tim Englich <tim.englich@intevation.de>
parents:
171
diff
changeset
|
192 "/action/data/input"); |
00c1a931b9c3
Catch Exception that the Calling Program could not put no InputData
Tim Englich <tim.englich@intevation.de>
parents:
171
diff
changeset
|
193 if (!inputData.isEmpty()){ |
208
a33d59f5791a
Use super.identifier as uuid. issue3
Tim Englich <tim.englich@intevation.de>
parents:
207
diff
changeset
|
194 this.current.putInputData(inputData, super.identifier); |
194
00c1a931b9c3
Catch Exception that the Calling Program could not put no InputData
Tim Englich <tim.englich@intevation.de>
parents:
171
diff
changeset
|
195 result = new ArtifactXMLUtilities().createSuccessReport( |
00c1a931b9c3
Catch Exception that the Calling Program could not put no InputData
Tim Englich <tim.englich@intevation.de>
parents:
171
diff
changeset
|
196 "Feed success", XMLUtils.newDocument()); |
00c1a931b9c3
Catch Exception that the Calling Program could not put no InputData
Tim Englich <tim.englich@intevation.de>
parents:
171
diff
changeset
|
197 }else{ |
00c1a931b9c3
Catch Exception that the Calling Program could not put no InputData
Tim Englich <tim.englich@intevation.de>
parents:
171
diff
changeset
|
198 String msg = "No Inputdata given. Please select at least one Entry."; |
00c1a931b9c3
Catch Exception that the Calling Program could not put no InputData
Tim Englich <tim.englich@intevation.de>
parents:
171
diff
changeset
|
199 log.warn(msg); |
00c1a931b9c3
Catch Exception that the Calling Program could not put no InputData
Tim Englich <tim.englich@intevation.de>
parents:
171
diff
changeset
|
200 result = new ArtifactXMLUtilities().createExceptionReport(msg, |
00c1a931b9c3
Catch Exception that the Calling Program could not put no InputData
Tim Englich <tim.englich@intevation.de>
parents:
171
diff
changeset
|
201 XMLUtils.newDocument()); |
00c1a931b9c3
Catch Exception that the Calling Program could not put no InputData
Tim Englich <tim.englich@intevation.de>
parents:
171
diff
changeset
|
202 } |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
203 } else { |
89
cde042a0a395
Successreporting added
Tim Englich <tim.englich@intevation.de>
parents:
88
diff
changeset
|
204 String msg = "No Transition instantiated"; |
cde042a0a395
Successreporting added
Tim Englich <tim.englich@intevation.de>
parents:
88
diff
changeset
|
205 log.warn(msg); |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
206 result = new ArtifactXMLUtilities().createExceptionReport(msg, |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
207 XMLUtils.newDocument()); |
57
f01592cd6419
Funktionalität Feed initial bereitgestellt.
Tim Englich <tim.englich@intevation.de>
parents:
56
diff
changeset
|
208 } |
f01592cd6419
Funktionalität Feed initial bereitgestellt.
Tim Englich <tim.englich@intevation.de>
parents:
56
diff
changeset
|
209 } catch (TransitionException e) { |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
210 log.error(e, e); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
211 result = new ArtifactXMLUtilities().createExceptionReport(e |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
212 .getLocalizedMessage(), XMLUtils.newDocument()); |
57
f01592cd6419
Funktionalität Feed initial bereitgestellt.
Tim Englich <tim.englich@intevation.de>
parents:
56
diff
changeset
|
213 } |
f01592cd6419
Funktionalität Feed initial bereitgestellt.
Tim Englich <tim.englich@intevation.de>
parents:
56
diff
changeset
|
214 return result; |
f01592cd6419
Funktionalität Feed initial bereitgestellt.
Tim Englich <tim.englich@intevation.de>
parents:
56
diff
changeset
|
215 } |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
216 |
57
f01592cd6419
Funktionalität Feed initial bereitgestellt.
Tim Englich <tim.englich@intevation.de>
parents:
56
diff
changeset
|
217 /** |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
218 * @see de.intevation.artifactdatabase.DefaultArtifact#setup(java.lang.String, |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
219 * java.lang.Object) |
52
4d6a82b96059
First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
220 */ |
4d6a82b96059
First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
221 @Override |
70
0035862b0295
Refactoringwork done because of changes in the artifact-module
Tim Englich <tim.englich@intevation.de>
parents:
68
diff
changeset
|
222 public void setup(String identifier, ArtifactFactory factory, Object context) { |
52
4d6a82b96059
First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
223 log.debug("GNVArtifactBase.setup"); |
70
0035862b0295
Refactoringwork done because of changes in the artifact-module
Tim Englich <tim.englich@intevation.de>
parents:
68
diff
changeset
|
224 super.setup(identifier, factory, context); |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
225 |
77
0e38f512f7e4
Some improvements an bugfixes done
Tim Englich <tim.englich@intevation.de>
parents:
73
diff
changeset
|
226 Object localContext = context; |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
227 if (context instanceof CallContext) { |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
228 localContext = ((CallContext) context).globalContext(); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
229 |
77
0e38f512f7e4
Some improvements an bugfixes done
Tim Englich <tim.englich@intevation.de>
parents:
73
diff
changeset
|
230 } |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
231 |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
232 if (localContext instanceof GNVArtifactContext) { |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
233 GNVArtifactContext gnvContext = (GNVArtifactContext) localContext; |
52
4d6a82b96059
First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
234 Document doc = gnvContext.getConfig(); |
4d6a82b96059
First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
235 Node artifactNode = this.getConfigurationFragment(doc); |
204
734ac082c8d1
Split the Configuration File in several small Documents to speed up the Artifactinstantiation and also make the administration of the Artifactdatabase easier. issue40 and issue59
Tim Englich <tim.englich@intevation.de>
parents:
194
diff
changeset
|
236 |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
237 NodeList transitionList = Config.getNodeSetXPath(artifactNode, |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
238 "transitions/transition"); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
239 this.transitions = new HashMap<String, Transition>(transitionList |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
240 .getLength()); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
241 for (int i = 0; i < transitionList.getLength(); i++) { |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
242 Transition tmpTransition = TransitionFactory.getInstance() |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
243 .createTransition(transitionList.item(i)); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
244 if (tmpTransition != null) { |
52
4d6a82b96059
First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
245 this.transitions.put(tmpTransition.getID(), tmpTransition); |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
246 if (this.current == null) { |
52
4d6a82b96059
First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
247 this.current = tmpTransition; |
4d6a82b96059
First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
248 } |
4d6a82b96059
First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
249 } |
4d6a82b96059
First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
250 } |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
251 |
52
4d6a82b96059
First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
252 } |
4d6a82b96059
First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
253 } |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
254 |
207
d87347142702
Store the Results of an Artifact not in the Artifact but in an ehcache instance. issue3
Tim Englich <tim.englich@intevation.de>
parents:
204
diff
changeset
|
255 protected Document createDescibeOutput(CallMeta callMeta, String uuid) { |
54
09b4bf848c7b
2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents:
52
diff
changeset
|
256 log.debug("GNVArtifactBase.createDescibeOutput"); |
71
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
70
diff
changeset
|
257 Document document = XMLUtils.newDocument(); |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
258 Element rootNode = this.createRootNode(document); |
54
09b4bf848c7b
2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents:
52
diff
changeset
|
259 this.createHeader(rootNode, document, "describe"); |
59
2c5d8f5bced1
Outputs integrated in describe and XForms integrated
Tim Englich <tim.englich@intevation.de>
parents:
58
diff
changeset
|
260 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
|
261 this.createCurrentState(rootNode, document); |
09b4bf848c7b
2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents:
52
diff
changeset
|
262 this.createReachableStates(rootNode, document); |
09b4bf848c7b
2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents:
52
diff
changeset
|
263 this.createModel(rootNode, document); |
207
d87347142702
Store the Results of an Artifact not in the Artifact but in an ehcache instance. issue3
Tim Englich <tim.englich@intevation.de>
parents:
204
diff
changeset
|
264 this.createUserInterface(rootNode, document, callMeta, uuid); |
54
09b4bf848c7b
2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents:
52
diff
changeset
|
265 return document; |
09b4bf848c7b
2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents:
52
diff
changeset
|
266 } |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
267 |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
268 protected Element createRootNode(Document document) { |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
269 Element rootNode = xmlUtilities.createArtifactElement(document, |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
270 "result"); |
54
09b4bf848c7b
2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents:
52
diff
changeset
|
271 document.appendChild(rootNode); |
09b4bf848c7b
2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents:
52
diff
changeset
|
272 return rootNode; |
09b4bf848c7b
2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents:
52
diff
changeset
|
273 } |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
274 |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
275 protected void createHeader(Element parent, Document document, |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
276 String documentType) { |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
277 Element typeNode = xmlUtilities.createArtifactElement(document, "type"); |
54
09b4bf848c7b
2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents:
52
diff
changeset
|
278 typeNode.setAttribute("name", documentType); |
09b4bf848c7b
2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents:
52
diff
changeset
|
279 parent.appendChild(typeNode); |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
280 |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
281 Element uuidNode = xmlUtilities.createArtifactElement(document, "uuid"); |
54
09b4bf848c7b
2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents:
52
diff
changeset
|
282 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
|
283 parent.appendChild(uuidNode); |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
284 |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
285 Element hashNode = xmlUtilities.createArtifactElement(document, "hash"); |
54
09b4bf848c7b
2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents:
52
diff
changeset
|
286 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
|
287 parent.appendChild(hashNode); |
89
cde042a0a395
Successreporting added
Tim Englich <tim.englich@intevation.de>
parents:
88
diff
changeset
|
288 } |
54
09b4bf848c7b
2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents:
52
diff
changeset
|
289 |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
290 protected void createReachableStates(Element parent, Document document) { |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
291 Element stateNode = xmlUtilities.createArtifactElement(document, |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
292 "reachable-states"); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
293 if (this.current != null) { |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
294 Iterator<String> states = this.current.reachableTransitions() |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
295 .iterator(); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
296 while (states.hasNext()) { |
54
09b4bf848c7b
2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents:
52
diff
changeset
|
297 String value = states.next(); |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
298 Element currentNode = xmlUtilities.createArtifactElement( |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
299 document, "state"); |
54
09b4bf848c7b
2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents:
52
diff
changeset
|
300 currentNode.setAttribute("name", value); |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
301 log.debug("Reachable State: " + value); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
302 currentNode.setAttribute("description", transitions.get(value) |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
303 .getDescription()); |
54
09b4bf848c7b
2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents:
52
diff
changeset
|
304 stateNode.appendChild(currentNode); |
09b4bf848c7b
2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents:
52
diff
changeset
|
305 } |
09b4bf848c7b
2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents:
52
diff
changeset
|
306 } |
09b4bf848c7b
2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents:
52
diff
changeset
|
307 parent.appendChild(stateNode); |
09b4bf848c7b
2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents:
52
diff
changeset
|
308 } |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
309 |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
310 protected void createCurrentState(Element parent, Document document) { |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
311 Element stateNode = xmlUtilities.createArtifactElement(document, |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
312 "state"); |
54
09b4bf848c7b
2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents:
52
diff
changeset
|
313 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
|
314 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
|
315 parent.appendChild(stateNode); |
09b4bf848c7b
2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents:
52
diff
changeset
|
316 } |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
317 |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
318 protected void createModel(Element parent, Document document) { |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
319 Element modelNode = xmlUtilities.createArtifactElement(document, |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
320 "model"); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
321 if (this.current != null) { |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
322 Collection<InputValue> inputValues = this.current |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
323 .getRequiredInputValues(); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
324 if (inputValues != null) { |
56
737d8bf63701
Required Inputelements integrated in BAsicArtifact-Descibe-Outputv
Tim Englich <tim.englich@intevation.de>
parents:
54
diff
changeset
|
325 Iterator<InputValue> it = inputValues.iterator(); |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
326 while (it.hasNext()) { |
56
737d8bf63701
Required Inputelements integrated in BAsicArtifact-Descibe-Outputv
Tim Englich <tim.englich@intevation.de>
parents:
54
diff
changeset
|
327 InputValue inputValue = it.next(); |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
328 Element inputNode = xmlUtilities.createArtifactElement( |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
329 document, "input"); |
56
737d8bf63701
Required Inputelements integrated in BAsicArtifact-Descibe-Outputv
Tim Englich <tim.englich@intevation.de>
parents:
54
diff
changeset
|
330 inputNode.setAttribute("name", inputValue.getName()); |
737d8bf63701
Required Inputelements integrated in BAsicArtifact-Descibe-Outputv
Tim Englich <tim.englich@intevation.de>
parents:
54
diff
changeset
|
331 inputNode.setAttribute("type", inputValue.getType()); |
737d8bf63701
Required Inputelements integrated in BAsicArtifact-Descibe-Outputv
Tim Englich <tim.englich@intevation.de>
parents:
54
diff
changeset
|
332 modelNode.appendChild(inputNode); |
737d8bf63701
Required Inputelements integrated in BAsicArtifact-Descibe-Outputv
Tim Englich <tim.englich@intevation.de>
parents:
54
diff
changeset
|
333 } |
737d8bf63701
Required Inputelements integrated in BAsicArtifact-Descibe-Outputv
Tim Englich <tim.englich@intevation.de>
parents:
54
diff
changeset
|
334 } |
737d8bf63701
Required Inputelements integrated in BAsicArtifact-Descibe-Outputv
Tim Englich <tim.englich@intevation.de>
parents:
54
diff
changeset
|
335 } |
54
09b4bf848c7b
2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents:
52
diff
changeset
|
336 parent.appendChild(modelNode); |
09b4bf848c7b
2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents:
52
diff
changeset
|
337 } |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
338 |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
339 protected void createUserInterface(Element parent, Document document, |
207
d87347142702
Store the Results of an Artifact not in the Artifact but in an ehcache instance. issue3
Tim Englich <tim.englich@intevation.de>
parents:
204
diff
changeset
|
340 CallMeta callMeta, String uuid) { |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
341 Element uiNode = xmlUtilities.createArtifactElement(document, "ui"); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
342 |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
343 if (this.current != null) { |
207
d87347142702
Store the Results of an Artifact not in the Artifact but in an ehcache instance. issue3
Tim Englich <tim.englich@intevation.de>
parents:
204
diff
changeset
|
344 this.current.describe(document, uiNode, callMeta, uuid); |
61
5f47881f7c97
Implementation of the MIN- / MAX-Value Representation
Tim Englich <tim.englich@intevation.de>
parents:
59
diff
changeset
|
345 } |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
346 |
54
09b4bf848c7b
2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents:
52
diff
changeset
|
347 parent.appendChild(uiNode); |
09b4bf848c7b
2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents:
52
diff
changeset
|
348 } |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
349 |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
350 protected void createOutputs(Element parent, Document document) { |
64
5db77e0a8594
Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents:
61
diff
changeset
|
351 log.debug("GNVArtifactBase.createOutputs"); |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
352 Element outputsNode = xmlUtilities.createArtifactElement(document, |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
353 "outputs"); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
354 if (this.current instanceof OutputTransition) { |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
355 Collection<OutputMode> outputModes = ((OutputTransition) this.current) |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
356 .getOutputModes(); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
357 if (outputModes != null) { |
64
5db77e0a8594
Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents:
61
diff
changeset
|
358 Iterator<OutputMode> it = outputModes.iterator(); |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
359 while (it.hasNext()) { |
64
5db77e0a8594
Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents:
61
diff
changeset
|
360 OutputMode outputMode = it.next(); |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
361 log.debug("Write Outputnode for " + outputMode.toString()); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
362 Element outputModeNode = xmlUtilities |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
363 .createArtifactElement(document, "output"); |
64
5db77e0a8594
Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents:
61
diff
changeset
|
364 outputModeNode.setAttribute("name", outputMode.getName()); |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
365 outputModeNode.setAttribute("description", outputMode |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
366 .getDescription()); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
367 outputModeNode.setAttribute("mime-type", outputMode |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
368 .getMimeType()); |
64
5db77e0a8594
Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents:
61
diff
changeset
|
369 outputsNode.appendChild(outputModeNode); |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
370 |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
371 Collection<InputValue> inputParameters = outputMode |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
372 .getInputParameters(); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
373 if (inputParameters != null) { |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
374 Element inputParametersNode = xmlUtilities |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
375 .createArtifactElement(document, "parameter"); |
91
bd284d8306db
Added Support for Patameters in OutputModes
Tim Englich <tim.englich@intevation.de>
parents:
90
diff
changeset
|
376 outputModeNode.appendChild(inputParametersNode); |
bd284d8306db
Added Support for Patameters in OutputModes
Tim Englich <tim.englich@intevation.de>
parents:
90
diff
changeset
|
377 Iterator<InputValue> it2 = inputParameters.iterator(); |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
378 while (it2.hasNext()) { |
91
bd284d8306db
Added Support for Patameters in OutputModes
Tim Englich <tim.englich@intevation.de>
parents:
90
diff
changeset
|
379 InputValue inputValue = it2.next(); |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
380 Element inputParameterNode = xmlUtilities |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
381 .createArtifactElement(document, |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
382 "parameter"); |
91
bd284d8306db
Added Support for Patameters in OutputModes
Tim Englich <tim.englich@intevation.de>
parents:
90
diff
changeset
|
383 inputParametersNode.appendChild(inputParameterNode); |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
384 inputParameterNode.setAttribute("name", inputValue |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
385 .getName()); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
386 inputParameterNode.setAttribute("type", inputValue |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
387 .getType()); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
388 inputParameterNode.setAttribute("value", inputValue |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
389 .getDefaultValue()); |
91
bd284d8306db
Added Support for Patameters in OutputModes
Tim Englich <tim.englich@intevation.de>
parents:
90
diff
changeset
|
390 } |
bd284d8306db
Added Support for Patameters in OutputModes
Tim Englich <tim.englich@intevation.de>
parents:
90
diff
changeset
|
391 } |
64
5db77e0a8594
Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents:
61
diff
changeset
|
392 } |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
393 } else { |
64
5db77e0a8594
Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents:
61
diff
changeset
|
394 log.warn("No Outputmodes given."); |
5db77e0a8594
Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents:
61
diff
changeset
|
395 } |
5db77e0a8594
Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents:
61
diff
changeset
|
396 } |
54
09b4bf848c7b
2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents:
52
diff
changeset
|
397 parent.appendChild(outputsNode); |
09b4bf848c7b
2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents:
52
diff
changeset
|
398 } |
09b4bf848c7b
2009-09-08 Tim Englich <tim.englich@intevation.de>
Tim Englich <tim.englich@intevation.de>
parents:
52
diff
changeset
|
399 |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
400 protected Collection<InputData> parseInputData(Document document, |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
401 String xPath) { |
57
f01592cd6419
Funktionalität Feed initial bereitgestellt.
Tim Englich <tim.englich@intevation.de>
parents:
56
diff
changeset
|
402 log.debug("GNVArtifactBase.parseInputData"); |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
403 HashMap<String, InputData> returnValue = null; |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
404 |
71
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
70
diff
changeset
|
405 log.debug(new ArtifactXMLUtilities().writeDocument2String(document)); |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
406 |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
407 NodeList inputElemets = (NodeList) XMLUtils.xpath(document, xPath, |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
408 XPathConstants.NODESET, ArtifactNamespaceContext.INSTANCE);// Config.getNodeSetXPath(document, |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
409 // ""); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
410 if (inputElemets != null) { |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
411 returnValue = new HashMap<String, InputData>(inputElemets |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
412 .getLength()); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
413 for (int i = 0; i < inputElemets.getLength(); i++) { |
204
734ac082c8d1
Split the Configuration File in several small Documents to speed up the Artifactinstantiation and also make the administration of the Artifactdatabase easier. issue40 and issue59
Tim Englich <tim.englich@intevation.de>
parents:
194
diff
changeset
|
414 Element inputDataNode = (Element)inputElemets.item(i); |
734ac082c8d1
Split the Configuration File in several small Documents to speed up the Artifactinstantiation and also make the administration of the Artifactdatabase easier. issue40 and issue59
Tim Englich <tim.englich@intevation.de>
parents:
194
diff
changeset
|
415 String name = inputDataNode.getAttribute("name"); |
734ac082c8d1
Split the Configuration File in several small Documents to speed up the Artifactinstantiation and also make the administration of the Artifactdatabase easier. issue40 and issue59
Tim Englich <tim.englich@intevation.de>
parents:
194
diff
changeset
|
416 String value = inputDataNode.getAttribute("value"); |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
417 |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
418 if (returnValue.containsKey(name)) { |
78
969faa37a11b
Added Multiselectsupport for InputValues
Tim Englich <tim.englich@intevation.de>
parents:
77
diff
changeset
|
419 InputData inputData = returnValue.get(name); |
969faa37a11b
Added Multiselectsupport for InputValues
Tim Englich <tim.englich@intevation.de>
parents:
77
diff
changeset
|
420 inputData.concartValue(value); |
969faa37a11b
Added Multiselectsupport for InputValues
Tim Englich <tim.englich@intevation.de>
parents:
77
diff
changeset
|
421 log.debug(inputData.toString()); |
969faa37a11b
Added Multiselectsupport for InputValues
Tim Englich <tim.englich@intevation.de>
parents:
77
diff
changeset
|
422 returnValue.put(name, inputData); |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
423 } else { |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
424 InputData inputData = new DefaultInputData(name, value); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
425 |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
426 returnValue.put(name, inputData); |
78
969faa37a11b
Added Multiselectsupport for InputValues
Tim Englich <tim.englich@intevation.de>
parents:
77
diff
changeset
|
427 } |
57
f01592cd6419
Funktionalität Feed initial bereitgestellt.
Tim Englich <tim.englich@intevation.de>
parents:
56
diff
changeset
|
428 } |
f01592cd6419
Funktionalität Feed initial bereitgestellt.
Tim Englich <tim.englich@intevation.de>
parents:
56
diff
changeset
|
429 } |
78
969faa37a11b
Added Multiselectsupport for InputValues
Tim Englich <tim.englich@intevation.de>
parents:
77
diff
changeset
|
430 return returnValue.values(); |
57
f01592cd6419
Funktionalität Feed initial bereitgestellt.
Tim Englich <tim.englich@intevation.de>
parents:
56
diff
changeset
|
431 } |
99
bb45c5097cb6
ehcache Integration for storing the chartresultvalues
Tim Englich <tim.englich@intevation.de>
parents:
91
diff
changeset
|
432 |
73
504570de21fd
Refactoring Work depending on Infrastructurchanges in the Artifact-Module
Tim Englich <tim.englich@intevation.de>
parents:
71
diff
changeset
|
433 /** |
117
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
116
diff
changeset
|
434 * @see de.intevation.artifactdatabase.DefaultArtifact#out(org.w3c.dom.Document, |
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
116
diff
changeset
|
435 * java.io.OutputStream, de.intevation.artifacts.CallContext) |
73
504570de21fd
Refactoring Work depending on Infrastructurchanges in the Artifact-Module
Tim Englich <tim.englich@intevation.de>
parents:
71
diff
changeset
|
436 */ |
504570de21fd
Refactoring Work depending on Infrastructurchanges in the Artifact-Module
Tim Englich <tim.englich@intevation.de>
parents:
71
diff
changeset
|
437 @Override |
117
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
116
diff
changeset
|
438 public void out(Document format, OutputStream outputStream, |
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
116
diff
changeset
|
439 CallContext context) throws IOException { |
68
d117fd4b82e5
Chartrendering integrated in Timeseries Transition
Tim Englich <tim.englich@intevation.de>
parents:
64
diff
changeset
|
440 log.debug("TGNVArtifactBase.out"); |
d117fd4b82e5
Chartrendering integrated in Timeseries Transition
Tim Englich <tim.englich@intevation.de>
parents:
64
diff
changeset
|
441 try { |
117
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
116
diff
changeset
|
442 |
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
116
diff
changeset
|
443 if (current != null && current instanceof OutputTransition) { |
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
116
diff
changeset
|
444 ((OutputTransition) current) |
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
116
diff
changeset
|
445 .out(this.readOutputType(format), this.parseInputData( |
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
116
diff
changeset
|
446 format, "/action/out/params/input"), |
208
a33d59f5791a
Use super.identifier as uuid. issue3
Tim Englich <tim.englich@intevation.de>
parents:
207
diff
changeset
|
447 outputStream, super.identifier, context.getMeta()); |
68
d117fd4b82e5
Chartrendering integrated in Timeseries Transition
Tim Englich <tim.englich@intevation.de>
parents:
64
diff
changeset
|
448 } |
d117fd4b82e5
Chartrendering integrated in Timeseries Transition
Tim Englich <tim.englich@intevation.de>
parents:
64
diff
changeset
|
449 } catch (TransitionException e) { |
117
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
116
diff
changeset
|
450 log.error(e, e); |
89
cde042a0a395
Successreporting added
Tim Englich <tim.englich@intevation.de>
parents:
88
diff
changeset
|
451 throw new IOException(e.getMessage()); |
68
d117fd4b82e5
Chartrendering integrated in Timeseries Transition
Tim Englich <tim.englich@intevation.de>
parents:
64
diff
changeset
|
452 } |
d117fd4b82e5
Chartrendering integrated in Timeseries Transition
Tim Englich <tim.englich@intevation.de>
parents:
64
diff
changeset
|
453 } |
73
504570de21fd
Refactoring Work depending on Infrastructurchanges in the Artifact-Module
Tim Englich <tim.englich@intevation.de>
parents:
71
diff
changeset
|
454 |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
455 protected String readOutputType(Document document) { |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
117
diff
changeset
|
456 String value = Config.getStringXPath(document, "action/out/@name"); |
68
d117fd4b82e5
Chartrendering integrated in Timeseries Transition
Tim Englich <tim.englich@intevation.de>
parents:
64
diff
changeset
|
457 return value; |
d117fd4b82e5
Chartrendering integrated in Timeseries Transition
Tim Englich <tim.englich@intevation.de>
parents:
64
diff
changeset
|
458 } |
52
4d6a82b96059
First Implementation of the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
459 } |