Mercurial > dive4elements > gnv-client
annotate gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/fis/FISArtifact.java @ 255:5403452c06fc
Added proper values for calculating the Statistics of VerticalProfiles and HorizontalProfiles issue86
gnv-artifacts/trunk@330 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Tim Englich <tim.englich@intevation.de> |
---|---|
date | Thu, 12 Nov 2009 14:47:20 +0000 |
parents | 3e82b4f1c455 |
children | 3eff9241ea1e |
rev | line source |
---|---|
71
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
1 /** |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
2 * |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
3 */ |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
4 package de.intevation.gnv.artifacts.fis; |
e4ecf3188bdf
Integrated FIS-Artifact
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; |
71
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
8 import java.util.ArrayList; |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
9 import java.util.Collection; |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
10 import java.util.HashMap; |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
11 import java.util.Iterator; |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
12 import java.util.Map; |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
13 |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
14 import org.apache.log4j.Logger; |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
15 import org.w3c.dom.Document; |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
16 import org.w3c.dom.Element; |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
17 import org.w3c.dom.Node; |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
18 import org.w3c.dom.NodeList; |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
19 |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
20 import de.intevation.artifactdatabase.Config; |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
21 import de.intevation.artifactdatabase.DefaultArtifact; |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
22 import de.intevation.artifactdatabase.XMLUtils; |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
23 import de.intevation.artifacts.Artifact; |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
24 import de.intevation.artifacts.ArtifactFactory; |
73
504570de21fd
Refactoring Work depending on Infrastructurchanges in the Artifact-Module
Tim Englich <tim.englich@intevation.de>
parents:
71
diff
changeset
|
25 import de.intevation.artifacts.CallContext; |
117
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
115
diff
changeset
|
26 import de.intevation.artifacts.CallMeta; |
71
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
27 import de.intevation.gnv.artifacts.GNVArtifactBase; |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
28 import de.intevation.gnv.artifacts.context.GNVArtifactContext; |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
29 import de.intevation.gnv.artifacts.fis.product.DefaultProduct; |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
30 import de.intevation.gnv.artifacts.fis.product.Product; |
117
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
115
diff
changeset
|
31 import de.intevation.gnv.artifacts.ressource.RessourceFactory; |
71
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
32 import de.intevation.gnv.transition.DefaultInputData; |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
33 import de.intevation.gnv.transition.InputData; |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
34 import de.intevation.gnv.utils.ArtifactFactoryUtilities; |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
35 import de.intevation.gnv.utils.ArtifactXMLUtilities; |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
36 |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
37 /** |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
38 * @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:
118
diff
changeset
|
39 * |
71
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
40 */ |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
41 public class FISArtifact extends DefaultArtifact { |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
42 |
71
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
43 /** |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
44 * the logger, used to log exceptions and additonaly information |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
45 */ |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
46 private static Logger log = Logger.getLogger(GNVArtifactBase.class); |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
47 /** |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
48 * The UID of this Class |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
49 */ |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
50 private static final long serialVersionUID = 2874044542701727083L; |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
51 |
71
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
52 /** |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
53 * The Identifier for the Replacement of the Artifactname |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
54 */ |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
55 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:
118
diff
changeset
|
56 |
71
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
57 /** |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
58 * The XPATH to the XML-Fragment that should be used for the Configuration |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
59 */ |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
60 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:
118
diff
changeset
|
61 + XPATH_IDENTIFIER_REPLACE |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
62 + "']"; |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
63 |
71
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
64 /** |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
65 * The Name of the Artifact |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
66 */ |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
67 private String name = null; |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
68 |
71
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
69 private Map<String, Product> products = null; |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
70 |
71
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
71 private Artifact productArtifact = null; |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
72 |
71
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
73 private Product current = null; |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
74 |
71
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
75 private ArtifactXMLUtilities xmlUtilities = new ArtifactXMLUtilities(); |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
76 |
71
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
77 /** |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
78 * @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:
118
diff
changeset
|
79 * de.intevation.artifacts.CallContext) |
71
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
80 */ |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
81 @Override |
73
504570de21fd
Refactoring Work depending on Infrastructurchanges in the Artifact-Module
Tim Englich <tim.englich@intevation.de>
parents:
71
diff
changeset
|
82 public Document advance(Document target, CallContext context) { |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
83 |
88
1b12021905b9
Some CodeCleanup done.
Tim Englich <tim.englich@intevation.de>
parents:
82
diff
changeset
|
84 Document result = null; |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
85 if (this.productArtifact == null) { |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
86 if (this.current != null) { |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
87 |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
88 String uuid = Config.getStringXPath(target, |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
89 "action/uuid/@value"); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
90 String hash = Config.getStringXPath(target, |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
91 "action/hash/@value"); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
92 this.productArtifact = this.current.getArtifactFactory() |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
93 .createArtifact(uuid, context); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
94 Document feedDocument = xmlUtilities.reInitDocument(this |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
95 .createFeedProductArtifactDocument(uuid, hash)); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
96 log.debug("Feed ==> " |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
97 + this.xmlUtilities |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
98 .writeDocument2String(feedDocument)); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
99 Document descibeDocument = xmlUtilities |
222
3e82b4f1c455
Removed some Compilation-Errors according to API-Changes in the ArtifactDatabase.
Tim Englich <tim.englich@intevation.de>
parents:
204
diff
changeset
|
100 .reInitDocument(this. |
3e82b4f1c455
Removed some Compilation-Errors according to API-Changes in the ArtifactDatabase.
Tim Englich <tim.englich@intevation.de>
parents:
204
diff
changeset
|
101 productArtifact. |
3e82b4f1c455
Removed some Compilation-Errors according to API-Changes in the ArtifactDatabase.
Tim Englich <tim.englich@intevation.de>
parents:
204
diff
changeset
|
102 describe(xmlUtilities. |
3e82b4f1c455
Removed some Compilation-Errors according to API-Changes in the ArtifactDatabase.
Tim Englich <tim.englich@intevation.de>
parents:
204
diff
changeset
|
103 reInitDocument(this. |
3e82b4f1c455
Removed some Compilation-Errors according to API-Changes in the ArtifactDatabase.
Tim Englich <tim.englich@intevation.de>
parents:
204
diff
changeset
|
104 createDescribeRequestBody(uuid, |
3e82b4f1c455
Removed some Compilation-Errors according to API-Changes in the ArtifactDatabase.
Tim Englich <tim.englich@intevation.de>
parents:
204
diff
changeset
|
105 hash, |
3e82b4f1c455
Removed some Compilation-Errors according to API-Changes in the ArtifactDatabase.
Tim Englich <tim.englich@intevation.de>
parents:
204
diff
changeset
|
106 false)), |
3e82b4f1c455
Removed some Compilation-Errors according to API-Changes in the ArtifactDatabase.
Tim Englich <tim.englich@intevation.de>
parents:
204
diff
changeset
|
107 context)); |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
108 log.debug("Descibe ==> " |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
109 + this.xmlUtilities |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
110 .writeDocument2String(descibeDocument)); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
111 this.productArtifact.feed(feedDocument, context); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
112 String targetName = Config.getStringXPath(descibeDocument, |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
113 "result/reachable-states/state/@name"); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
114 Document advanceDocument = xmlUtilities.reInitDocument(this |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
115 .createAdvanceProductArtifactDocument(uuid, hash, |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
116 targetName)); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
117 log.debug("Advance ==> " |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
118 + this.xmlUtilities |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
119 .writeDocument2String(advanceDocument)); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
120 result = this.productArtifact.advance(advanceDocument, context); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
121 } else { |
88
1b12021905b9
Some CodeCleanup done.
Tim Englich <tim.englich@intevation.de>
parents:
82
diff
changeset
|
122 String msg = "Artifact is not configured properly. Call feed first."; |
1b12021905b9
Some CodeCleanup done.
Tim Englich <tim.englich@intevation.de>
parents:
82
diff
changeset
|
123 log.error(msg); |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
124 result = new ArtifactXMLUtilities().createExceptionReport(msg, |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
125 XMLUtils.newDocument()); |
71
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
126 } |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
127 } else { |
88
1b12021905b9
Some CodeCleanup done.
Tim Englich <tim.englich@intevation.de>
parents:
82
diff
changeset
|
128 result = this.productArtifact.advance(target, context); |
71
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
129 } |
88
1b12021905b9
Some CodeCleanup done.
Tim Englich <tim.englich@intevation.de>
parents:
82
diff
changeset
|
130 return result; |
71
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
131 } |
222
3e82b4f1c455
Removed some Compilation-Errors according to API-Changes in the ArtifactDatabase.
Tim Englich <tim.englich@intevation.de>
parents:
204
diff
changeset
|
132 |
3e82b4f1c455
Removed some Compilation-Errors according to API-Changes in the ArtifactDatabase.
Tim Englich <tim.englich@intevation.de>
parents:
204
diff
changeset
|
133 private Document createDescribeRequestBody(String uuid, |
3e82b4f1c455
Removed some Compilation-Errors according to API-Changes in the ArtifactDatabase.
Tim Englich <tim.englich@intevation.de>
parents:
204
diff
changeset
|
134 String hash, |
3e82b4f1c455
Removed some Compilation-Errors according to API-Changes in the ArtifactDatabase.
Tim Englich <tim.englich@intevation.de>
parents:
204
diff
changeset
|
135 boolean includeUI){ |
3e82b4f1c455
Removed some Compilation-Errors according to API-Changes in the ArtifactDatabase.
Tim Englich <tim.englich@intevation.de>
parents:
204
diff
changeset
|
136 Document document = XMLUtils.newDocument(); |
3e82b4f1c455
Removed some Compilation-Errors according to API-Changes in the ArtifactDatabase.
Tim Englich <tim.englich@intevation.de>
parents:
204
diff
changeset
|
137 |
3e82b4f1c455
Removed some Compilation-Errors according to API-Changes in the ArtifactDatabase.
Tim Englich <tim.englich@intevation.de>
parents:
204
diff
changeset
|
138 Element rootNode = xmlUtilities.createArtifactElement(document,"action"); |
3e82b4f1c455
Removed some Compilation-Errors according to API-Changes in the ArtifactDatabase.
Tim Englich <tim.englich@intevation.de>
parents:
204
diff
changeset
|
139 document.appendChild(rootNode); |
3e82b4f1c455
Removed some Compilation-Errors according to API-Changes in the ArtifactDatabase.
Tim Englich <tim.englich@intevation.de>
parents:
204
diff
changeset
|
140 |
3e82b4f1c455
Removed some Compilation-Errors according to API-Changes in the ArtifactDatabase.
Tim Englich <tim.englich@intevation.de>
parents:
204
diff
changeset
|
141 Element typeNode = this.xmlUtilities.createArtifactElement(document, "type"); |
3e82b4f1c455
Removed some Compilation-Errors according to API-Changes in the ArtifactDatabase.
Tim Englich <tim.englich@intevation.de>
parents:
204
diff
changeset
|
142 typeNode.setAttribute("name", "describe"); |
3e82b4f1c455
Removed some Compilation-Errors according to API-Changes in the ArtifactDatabase.
Tim Englich <tim.englich@intevation.de>
parents:
204
diff
changeset
|
143 rootNode.appendChild(typeNode); |
3e82b4f1c455
Removed some Compilation-Errors according to API-Changes in the ArtifactDatabase.
Tim Englich <tim.englich@intevation.de>
parents:
204
diff
changeset
|
144 |
3e82b4f1c455
Removed some Compilation-Errors according to API-Changes in the ArtifactDatabase.
Tim Englich <tim.englich@intevation.de>
parents:
204
diff
changeset
|
145 Element uuidNode = this.xmlUtilities.createArtifactElement(document, "uuid"); |
3e82b4f1c455
Removed some Compilation-Errors according to API-Changes in the ArtifactDatabase.
Tim Englich <tim.englich@intevation.de>
parents:
204
diff
changeset
|
146 uuidNode.setAttribute("value",uuid); |
3e82b4f1c455
Removed some Compilation-Errors according to API-Changes in the ArtifactDatabase.
Tim Englich <tim.englich@intevation.de>
parents:
204
diff
changeset
|
147 rootNode.appendChild(uuidNode); |
3e82b4f1c455
Removed some Compilation-Errors according to API-Changes in the ArtifactDatabase.
Tim Englich <tim.englich@intevation.de>
parents:
204
diff
changeset
|
148 |
3e82b4f1c455
Removed some Compilation-Errors according to API-Changes in the ArtifactDatabase.
Tim Englich <tim.englich@intevation.de>
parents:
204
diff
changeset
|
149 Element hashNode = this.xmlUtilities.createArtifactElement(document, "hash"); |
3e82b4f1c455
Removed some Compilation-Errors according to API-Changes in the ArtifactDatabase.
Tim Englich <tim.englich@intevation.de>
parents:
204
diff
changeset
|
150 hashNode.setAttribute("value", hash); |
3e82b4f1c455
Removed some Compilation-Errors according to API-Changes in the ArtifactDatabase.
Tim Englich <tim.englich@intevation.de>
parents:
204
diff
changeset
|
151 rootNode.appendChild(hashNode); |
3e82b4f1c455
Removed some Compilation-Errors according to API-Changes in the ArtifactDatabase.
Tim Englich <tim.englich@intevation.de>
parents:
204
diff
changeset
|
152 |
3e82b4f1c455
Removed some Compilation-Errors according to API-Changes in the ArtifactDatabase.
Tim Englich <tim.englich@intevation.de>
parents:
204
diff
changeset
|
153 Element includeUINode = this.xmlUtilities.createArtifactElement(document, "include-ui"); |
3e82b4f1c455
Removed some Compilation-Errors according to API-Changes in the ArtifactDatabase.
Tim Englich <tim.englich@intevation.de>
parents:
204
diff
changeset
|
154 includeUINode.setTextContent(""+includeUI); |
3e82b4f1c455
Removed some Compilation-Errors according to API-Changes in the ArtifactDatabase.
Tim Englich <tim.englich@intevation.de>
parents:
204
diff
changeset
|
155 rootNode.appendChild(includeUINode); |
3e82b4f1c455
Removed some Compilation-Errors according to API-Changes in the ArtifactDatabase.
Tim Englich <tim.englich@intevation.de>
parents:
204
diff
changeset
|
156 |
3e82b4f1c455
Removed some Compilation-Errors according to API-Changes in the ArtifactDatabase.
Tim Englich <tim.englich@intevation.de>
parents:
204
diff
changeset
|
157 return document; |
3e82b4f1c455
Removed some Compilation-Errors according to API-Changes in the ArtifactDatabase.
Tim Englich <tim.englich@intevation.de>
parents:
204
diff
changeset
|
158 } |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
159 |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
160 private Document createAdvanceProductArtifactDocument(String uuid, |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
161 String hash, |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
162 String targetName) { |
71
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
163 Document document = XMLUtils.newDocument(); |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
164 Element rootNode = xmlUtilities.createArtifactElement(document, |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
165 "action"); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
166 |
71
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
167 Element typeNode = xmlUtilities.createArtifactElement(document, "type"); |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
168 typeNode.setAttribute("name", "advanve"); |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
169 rootNode.appendChild(typeNode); |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
170 |
71
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
171 Element uuidNode = xmlUtilities.createArtifactElement(document, "uuid"); |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
172 uuidNode.setAttribute("value", uuid); |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
173 rootNode.appendChild(uuidNode); |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
174 |
71
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
175 Element hashNode = xmlUtilities.createArtifactElement(document, "hash"); |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
176 hashNode.setAttribute("value", hash); |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
177 rootNode.appendChild(hashNode); |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
178 Element targetNode = xmlUtilities.createArtifactElement(document, |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
179 "target"); |
71
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
180 targetNode.setAttribute("name", targetName); |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
181 rootNode.appendChild(targetNode); |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
182 |
71
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
183 document.appendChild(rootNode); |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
184 return document; |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
185 } |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
186 |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
187 private Document createFeedProductArtifactDocument(String uuid, String hash) { |
71
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
188 Document document = XMLUtils.newDocument(); |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
189 Element rootNode = xmlUtilities.createArtifactElement(document, |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
190 "action"); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
191 |
71
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
192 Element typeNode = xmlUtilities.createArtifactElement(document, "type"); |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
193 typeNode.setAttribute("name", "feed"); |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
194 rootNode.appendChild(typeNode); |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
195 |
71
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
196 Element uuidNode = xmlUtilities.createArtifactElement(document, "uuid"); |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
197 uuidNode.setAttribute("value", uuid); |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
198 rootNode.appendChild(uuidNode); |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
199 |
71
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
200 Element hashNode = xmlUtilities.createArtifactElement(document, "hash"); |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
201 hashNode.setAttribute("value", hash); |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
202 rootNode.appendChild(hashNode); |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
203 |
71
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
204 Element dataNode = xmlUtilities.createArtifactElement(document, "data"); |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
205 rootNode.appendChild(dataNode); |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
206 |
71
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
207 Collection<InputData> parameter = this.current.getParameter(); |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
208 if (parameter != null) { |
71
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
209 Iterator<InputData> parameterIt = parameter.iterator(); |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
210 while (parameterIt.hasNext()) { |
71
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
211 InputData inputData = parameterIt.next(); |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
212 Element inputNode = xmlUtilities.createArtifactElement( |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
213 document, "input"); |
71
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
214 inputNode.setAttribute("name", inputData.getName()); |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
215 inputNode.setAttribute("value", inputData.getValue()); |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
216 dataNode.appendChild(inputNode); |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
217 } |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
218 } |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
219 document.appendChild(rootNode); |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
220 return document; |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
221 |
71
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
222 } |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
223 |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
224 /** |
222
3e82b4f1c455
Removed some Compilation-Errors according to API-Changes in the ArtifactDatabase.
Tim Englich <tim.englich@intevation.de>
parents:
204
diff
changeset
|
225 * @see de.intevation.artifactdatabase.DefaultArtifact#describe(org.w3c.dom.Document, de.intevation.artifacts.CallContext) |
71
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
226 */ |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
227 @Override |
222
3e82b4f1c455
Removed some Compilation-Errors according to API-Changes in the ArtifactDatabase.
Tim Englich <tim.englich@intevation.de>
parents:
204
diff
changeset
|
228 public Document describe(Document data, CallContext context) { |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
229 if (this.productArtifact == null) { |
117
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
115
diff
changeset
|
230 return this.createDescibeOutput(context.getMeta()); |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
231 } else { |
222
3e82b4f1c455
Removed some Compilation-Errors according to API-Changes in the ArtifactDatabase.
Tim Englich <tim.englich@intevation.de>
parents:
204
diff
changeset
|
232 Document document = this.productArtifact.describe(data,context); |
79
e33c61735a4e
Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents:
78
diff
changeset
|
233 document = new ArtifactXMLUtilities().reInitDocument(document); |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
234 Node staticNode = Config |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
235 .getNodeXPath(document, "/result/ui/static"); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
236 if (staticNode != null) { |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
237 Node staticUI = this.createSelectBox(document, context |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
238 .getMeta()); |
79
e33c61735a4e
Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents:
78
diff
changeset
|
239 staticNode.insertBefore(staticUI, staticNode.getFirstChild()); |
e33c61735a4e
Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents:
78
diff
changeset
|
240 } |
e33c61735a4e
Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents:
78
diff
changeset
|
241 return document; |
71
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
242 } |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
243 } |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
244 |
222
3e82b4f1c455
Removed some Compilation-Errors according to API-Changes in the ArtifactDatabase.
Tim Englich <tim.englich@intevation.de>
parents:
204
diff
changeset
|
245 |
71
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
246 /** |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
247 * @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:
118
diff
changeset
|
248 * java.lang.Object) |
71
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
249 */ |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
250 @Override |
73
504570de21fd
Refactoring Work depending on Infrastructurchanges in the Artifact-Module
Tim Englich <tim.englich@intevation.de>
parents:
71
diff
changeset
|
251 public Document feed(Document target, CallContext context) { |
89
cde042a0a395
Successreporting added
Tim Englich <tim.englich@intevation.de>
parents:
88
diff
changeset
|
252 log.debug("FISArtifact.feed"); |
cde042a0a395
Successreporting added
Tim Englich <tim.englich@intevation.de>
parents:
88
diff
changeset
|
253 Document result = null; |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
254 if (this.productArtifact == null) { |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
255 String productName = Config.getStringXPath(target, |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
256 "action/data/input[@name='product']/@value"); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
257 log.debug("Looking for ProductArtifact " + productName); |
71
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
258 if (this.products.containsKey(productName)) { |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
259 this.current = this.products.get(productName); |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
260 result = new ArtifactXMLUtilities().createSuccessReport( |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
261 "Feed success New ProductArtifact created", XMLUtils |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
262 .newDocument()); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
263 } else { |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
264 String msg = "Product does not exists for " + productName; |
88
1b12021905b9
Some CodeCleanup done.
Tim Englich <tim.englich@intevation.de>
parents:
82
diff
changeset
|
265 log.error(msg); |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
266 result = new ArtifactXMLUtilities().createExceptionReport(msg, |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
267 XMLUtils.newDocument()); |
71
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
268 } |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
269 } else { |
89
cde042a0a395
Successreporting added
Tim Englich <tim.englich@intevation.de>
parents:
88
diff
changeset
|
270 log.debug("Feed a Productartifact"); |
cde042a0a395
Successreporting added
Tim Englich <tim.englich@intevation.de>
parents:
88
diff
changeset
|
271 result = this.productArtifact.feed(target, context); |
71
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
272 } |
89
cde042a0a395
Successreporting added
Tim Englich <tim.englich@intevation.de>
parents:
88
diff
changeset
|
273 return result; |
71
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
274 } |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
275 |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
276 /** |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
277 * @see de.intevation.artifactdatabase.DefaultArtifact#out(org.w3c.dom.Document, |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
278 * java.lang.Object) |
71
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
279 */ |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
280 @Override |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
281 public void out(Document format, OutputStream outputStream, |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
282 CallContext context) throws IOException { |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
283 if (this.productArtifact != null) { |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
284 this.productArtifact.out(format, outputStream, context); |
71
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
285 } |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
286 } |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
287 |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
288 /** |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
289 * Constructor |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
290 */ |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
291 public FISArtifact() { |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
292 super(); |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
293 } |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
294 |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
295 /** |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
296 * @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:
118
diff
changeset
|
297 * de.intevation.artifacts.ArtifactFactory, java.lang.Object) |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
298 */ |
71
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
299 @Override |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
300 public void setup(String identifier, ArtifactFactory factory, Object context) { |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
301 log.debug("FISArtifact.setup"); |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
302 this.name = factory.getName(); |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
303 super.setup(identifier, factory, context); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
304 if (context instanceof GNVArtifactContext) { |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
305 GNVArtifactContext gnvContext = (GNVArtifactContext) context; |
71
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
306 Document doc = gnvContext.getConfig(); |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
307 Node artifactNode = this.getConfigurationFragment(doc); |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
308 |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
309 NodeList products = Config.getNodeSetXPath(artifactNode, |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
310 "products/product"); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
311 if (products != null) { |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
312 this.products = new HashMap<String, Product>(products |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
313 .getLength()); |
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:
171
diff
changeset
|
314 |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
315 for (int i = 0; i < products.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:
171
diff
changeset
|
316 Element productNode = (Element)products.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:
171
diff
changeset
|
317 String productName = productNode.getAttribute("name"); |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
318 NodeList parameterNodes = Config.getNodeSetXPath( |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
319 productNode, "parameters/parameter"); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
320 Collection<InputData> parameter = null; |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
321 if (parameterNodes != null) { |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
322 parameter = new ArrayList<InputData>(parameterNodes |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
323 .getLength()); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
324 for (int j = 0; j < parameterNodes.getLength(); j++) { |
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:
171
diff
changeset
|
325 Element parameterNode = (Element)parameterNodes.item(j); |
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:
171
diff
changeset
|
326 String name = parameterNode.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:
171
diff
changeset
|
327 String value = parameterNode.getAttribute("value"); |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
328 parameter.add(new DefaultInputData(name, value)); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
329 } |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
330 } |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
331 Node artifactFactoryNode = Config.getNodeXPath(productNode, |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
332 "artifact-factory"); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
333 ArtifactFactory artifactFactory = new ArtifactFactoryUtilities() |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
334 .createArtitfactFactor(doc, artifactFactoryNode); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
335 this.products.put(productName, new DefaultProduct( |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
336 productName, parameter, artifactFactory)); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
337 } |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
338 } |
71
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
339 } |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
340 } |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
341 |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
342 protected Node getConfigurationFragment(Document document) { |
71
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
343 log.debug("GNVArtifactBase.getConfigurationFragment"); |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
344 String xpathQuery = XPATH_ARTIFACT_CONFIGURATION.replaceAll( |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
345 XPATH_IDENTIFIER_REPLACE, this.name); |
71
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
346 log.debug(xpathQuery); |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
347 return Config.getNodeXPath(document, xpathQuery); |
71
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
348 } |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
349 |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
350 protected Document createDescibeOutput(CallMeta callMeta) { |
71
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
351 log.debug("GNVArtifactBase.createDescibeOutput"); |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
352 Document document = XMLUtils.newDocument(); |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
353 Element rootNode = this.createRootNode(document); |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
354 this.createHeader(rootNode, document, "describe"); |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
355 this.createOutputs(rootNode, document); |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
356 this.createCurrentState(rootNode, document); |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
357 this.createReachableStates(rootNode, document); |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
358 this.createModel(rootNode, document); |
117
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
115
diff
changeset
|
359 this.createUserInterface(rootNode, document, callMeta); |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
360 |
71
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
361 return document; |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
362 } |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
363 |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
364 protected Element createRootNode(Document document) { |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
365 Element rootNode = xmlUtilities.createArtifactElement(document, |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
366 "result"); |
71
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
367 document.appendChild(rootNode); |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
368 return rootNode; |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
369 } |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
370 |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
371 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:
118
diff
changeset
|
372 String documentType) { |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
373 Element typeNode = xmlUtilities.createArtifactElement(document, "type"); |
71
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
374 typeNode.setAttribute("name", documentType); |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
375 parent.appendChild(typeNode); |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
376 |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
377 Element uuidNode = xmlUtilities.createArtifactElement(document, "uuid"); |
71
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
378 uuidNode.setAttribute("value", super.identifier); |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
379 parent.appendChild(uuidNode); |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
380 |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
381 Element hashNode = xmlUtilities.createArtifactElement(document, "hash"); |
71
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
382 hashNode.setAttribute("value", this.hash()); |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
383 parent.appendChild(hashNode); |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
384 |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
385 } |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
386 |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
387 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:
118
diff
changeset
|
388 Element stateNode = xmlUtilities.createArtifactElement(document, |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
389 "reachable-states"); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
390 if (this.products != null) { |
71
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
391 Iterator<Product> products = this.products.values().iterator(); |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
392 while (products.hasNext()) { |
71
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
393 Product product = products.next(); |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
394 Element currentNode = xmlUtilities.createArtifactElement( |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
395 document, "state"); |
71
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
396 currentNode.setAttribute("name", product.getName()); |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
397 currentNode.setAttribute("description", product.getName()); |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
398 stateNode.appendChild(currentNode); |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
399 } |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
400 } |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
401 parent.appendChild(stateNode); |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
402 } |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
403 |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
404 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:
118
diff
changeset
|
405 Element stateNode = xmlUtilities.createArtifactElement(document, |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
406 "state"); |
71
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
407 stateNode.setAttribute("name", "choose-product"); |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
408 stateNode.setAttribute("description", |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
409 "Initialer Stand Auswahl des products"); |
71
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
410 parent.appendChild(stateNode); |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
411 } |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
412 |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
413 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:
118
diff
changeset
|
414 Element modelNode = xmlUtilities.createArtifactElement(document, |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
415 "model"); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
416 |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
417 Element inputNode = xmlUtilities.createArtifactElement(document, |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
418 "input"); |
71
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
419 inputNode.setAttribute("name", "product"); |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
420 inputNode.setAttribute("type", "String"); |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
421 modelNode.appendChild(inputNode); |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
422 |
71
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
423 parent.appendChild(modelNode); |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
424 } |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
425 |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
426 protected void createUserInterface(Element parent, Document document, |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
427 CallMeta callMeta) { |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
428 Element uiNode = xmlUtilities.createArtifactElement(document, "ui"); |
76
2473440671ce
Integrate UI-Representation for Describe into the FISArtifact.
Tim Englich <tim.englich@intevation.de>
parents:
73
diff
changeset
|
429 ArtifactXMLUtilities xmlUtilities = new ArtifactXMLUtilities(); |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
430 Node dynamic = xmlUtilities.createArtifactElement(document, "dynamic"); |
79
e33c61735a4e
Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents:
78
diff
changeset
|
431 uiNode.appendChild(dynamic); |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
432 if (this.products != null && !this.products.isEmpty()) { |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
433 Element selectNode = createSelectBox(document, callMeta); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
434 |
79
e33c61735a4e
Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents:
78
diff
changeset
|
435 dynamic.appendChild(selectNode); |
76
2473440671ce
Integrate UI-Representation for Describe into the FISArtifact.
Tim Englich <tim.englich@intevation.de>
parents:
73
diff
changeset
|
436 } |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
437 |
71
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
438 parent.appendChild(uiNode); |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
439 } |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
440 |
79
e33c61735a4e
Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents:
78
diff
changeset
|
441 /** |
e33c61735a4e
Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents:
78
diff
changeset
|
442 * @param document |
e33c61735a4e
Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents:
78
diff
changeset
|
443 * @param xmlUtilities |
e33c61735a4e
Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents:
78
diff
changeset
|
444 * @return |
e33c61735a4e
Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents:
78
diff
changeset
|
445 */ |
117
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
115
diff
changeset
|
446 private Element createSelectBox(Document document, CallMeta callMeta) { |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
447 |
79
e33c61735a4e
Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents:
78
diff
changeset
|
448 ArtifactXMLUtilities xmlUtilities = new ArtifactXMLUtilities(); |
e33c61735a4e
Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents:
78
diff
changeset
|
449 String selectboxName = "product"; |
e33c61735a4e
Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents:
78
diff
changeset
|
450 Iterator<Product> it = this.products.values().iterator(); |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
451 Element selectNode = xmlUtilities.createXFormElement(document, |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
452 "select1"); |
79
e33c61735a4e
Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents:
78
diff
changeset
|
453 selectNode.setAttribute("ref", selectboxName); |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
454 |
79
e33c61735a4e
Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents:
78
diff
changeset
|
455 Element lableNode = xmlUtilities.createXFormElement(document, "label"); |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
456 lableNode.setTextContent(RessourceFactory.getInstance().getRessource( |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
457 callMeta.getLanguages(), selectboxName, selectboxName)); |
79
e33c61735a4e
Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents:
78
diff
changeset
|
458 selectNode.appendChild(lableNode); |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
459 Element choiceNode = xmlUtilities.createXFormElement(document, |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
460 "choices"); |
79
e33c61735a4e
Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents:
78
diff
changeset
|
461 selectNode.appendChild(choiceNode); |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
462 while (it.hasNext()) { |
79
e33c61735a4e
Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents:
78
diff
changeset
|
463 Product p = it.next(); |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
464 Element itemNode = xmlUtilities |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
465 .createXFormElement(document, "item"); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
466 |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
467 if (this.current != null |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
468 && this.current.getName().equals(p.getName())) { |
82
5eb62df21f9a
Added Support for Vertical Profiles Marnet, STAUN, IMIS
Tim Englich <tim.englich@intevation.de>
parents:
79
diff
changeset
|
469 itemNode.setAttribute("selected", "true"); |
5eb62df21f9a
Added Support for Vertical Profiles Marnet, STAUN, IMIS
Tim Englich <tim.englich@intevation.de>
parents:
79
diff
changeset
|
470 } |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
471 |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
472 Element choiceLableNode = xmlUtilities.createXFormElement(document, |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
473 "label"); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
474 choiceLableNode.setTextContent(RessourceFactory.getInstance() |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
475 .getRessource(callMeta.getLanguages(), p.getName(), |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
476 p.getName())); |
79
e33c61735a4e
Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents:
78
diff
changeset
|
477 itemNode.appendChild(choiceLableNode); |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
478 |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
479 Element choicValueNode = xmlUtilities.createXFormElement(document, |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
480 "value"); |
79
e33c61735a4e
Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents:
78
diff
changeset
|
481 choicValueNode.setTextContent(p.getName()); |
e33c61735a4e
Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents:
78
diff
changeset
|
482 itemNode.appendChild(choicValueNode); |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
483 |
79
e33c61735a4e
Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents:
78
diff
changeset
|
484 choiceNode.appendChild(itemNode); |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
485 |
79
e33c61735a4e
Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents:
78
diff
changeset
|
486 } |
e33c61735a4e
Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents:
78
diff
changeset
|
487 return selectNode; |
e33c61735a4e
Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents:
78
diff
changeset
|
488 } |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
489 |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
490 protected void createOutputs(Element parent, Document document) { |
71
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
491 log.debug("GNVArtifactBase.createOutputs"); |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
492 Element outputsNode = xmlUtilities.createArtifactElement(document, |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
493 "outputs"); |
71
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
494 parent.appendChild(outputsNode); |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
495 } |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
496 |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
497 } |