Mercurial > dive4elements > gnv-client
annotate gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/fis/FISArtifact.java @ 174:dbf68950b4d9
Added real Coordinate-Query to HorizontalProfile- and VerticalProfile-Mesh
gnv-artifacts/trunk@213 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Tim Englich <tim.englich@intevation.de> |
---|---|
date | Tue, 13 Oct 2009 10:17:46 +0000 |
parents | 7fb9441dd8af |
children | 734ac082c8d1 |
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 |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
100 .reInitDocument(this.productArtifact.describe(context)); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
101 log.debug("Descibe ==> " |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
102 + this.xmlUtilities |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
103 .writeDocument2String(descibeDocument)); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
104 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
|
105 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
|
106 "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
|
107 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
|
108 .createAdvanceProductArtifactDocument(uuid, hash, |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
109 targetName)); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
110 log.debug("Advance ==> " |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
111 + this.xmlUtilities |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
112 .writeDocument2String(advanceDocument)); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
113 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
|
114 } else { |
88
1b12021905b9
Some CodeCleanup done.
Tim Englich <tim.englich@intevation.de>
parents:
82
diff
changeset
|
115 String msg = "Artifact is not configured properly. Call feed first."; |
1b12021905b9
Some CodeCleanup done.
Tim Englich <tim.englich@intevation.de>
parents:
82
diff
changeset
|
116 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
|
117 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
|
118 XMLUtils.newDocument()); |
71
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
119 } |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
120 } else { |
88
1b12021905b9
Some CodeCleanup done.
Tim Englich <tim.englich@intevation.de>
parents:
82
diff
changeset
|
121 result = this.productArtifact.advance(target, context); |
71
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
122 } |
88
1b12021905b9
Some CodeCleanup done.
Tim Englich <tim.englich@intevation.de>
parents:
82
diff
changeset
|
123 return result; |
71
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
124 } |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
125 |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
126 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
|
127 String hash, |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
128 String targetName) { |
71
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
129 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
|
130 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
|
131 "action"); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
132 |
71
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
133 Element typeNode = xmlUtilities.createArtifactElement(document, "type"); |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
134 typeNode.setAttribute("name", "advanve"); |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
135 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
|
136 |
71
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
137 Element uuidNode = xmlUtilities.createArtifactElement(document, "uuid"); |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
138 uuidNode.setAttribute("value", uuid); |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
139 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
|
140 |
71
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
141 Element hashNode = xmlUtilities.createArtifactElement(document, "hash"); |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
142 hashNode.setAttribute("value", hash); |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
143 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
|
144 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
|
145 "target"); |
71
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
146 targetNode.setAttribute("name", targetName); |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
147 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
|
148 |
71
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
149 document.appendChild(rootNode); |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
150 return document; |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
151 } |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
152 |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
153 private Document createFeedProductArtifactDocument(String uuid, String hash) { |
71
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
154 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
|
155 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
|
156 "action"); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
157 |
71
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
158 Element typeNode = xmlUtilities.createArtifactElement(document, "type"); |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
159 typeNode.setAttribute("name", "feed"); |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
160 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
|
161 |
71
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
162 Element uuidNode = xmlUtilities.createArtifactElement(document, "uuid"); |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
163 uuidNode.setAttribute("value", uuid); |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
164 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
|
165 |
71
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
166 Element hashNode = xmlUtilities.createArtifactElement(document, "hash"); |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
167 hashNode.setAttribute("value", hash); |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
168 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
|
169 |
71
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
170 Element dataNode = xmlUtilities.createArtifactElement(document, "data"); |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
171 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
|
172 |
71
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
173 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
|
174 if (parameter != null) { |
71
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
175 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
|
176 while (parameterIt.hasNext()) { |
71
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
177 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
|
178 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
|
179 document, "input"); |
71
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
180 inputNode.setAttribute("name", inputData.getName()); |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
181 inputNode.setAttribute("value", inputData.getValue()); |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
182 dataNode.appendChild(inputNode); |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
183 } |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
184 } |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
185 document.appendChild(rootNode); |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
186 return document; |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
187 |
71
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
188 } |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
189 |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
190 /** |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
191 * @see de.intevation.artifactdatabase.DefaultArtifact#describe(java.lang.Object) |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
192 */ |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
193 @Override |
73
504570de21fd
Refactoring Work depending on Infrastructurchanges in the Artifact-Module
Tim Englich <tim.englich@intevation.de>
parents:
71
diff
changeset
|
194 public Document describe(CallContext context) { |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
195 if (this.productArtifact == null) { |
117
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
115
diff
changeset
|
196 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
|
197 } else { |
79
e33c61735a4e
Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents:
78
diff
changeset
|
198 Document document = this.productArtifact.describe(context); |
e33c61735a4e
Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents:
78
diff
changeset
|
199 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
|
200 Node staticNode = Config |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
201 .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
|
202 if (staticNode != null) { |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
203 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
|
204 .getMeta()); |
79
e33c61735a4e
Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents:
78
diff
changeset
|
205 staticNode.insertBefore(staticUI, staticNode.getFirstChild()); |
e33c61735a4e
Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents:
78
diff
changeset
|
206 } |
e33c61735a4e
Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents:
78
diff
changeset
|
207 return document; |
71
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
208 } |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
209 } |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
210 |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
211 /** |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
212 * @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
|
213 * java.lang.Object) |
71
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
214 */ |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
215 @Override |
73
504570de21fd
Refactoring Work depending on Infrastructurchanges in the Artifact-Module
Tim Englich <tim.englich@intevation.de>
parents:
71
diff
changeset
|
216 public Document feed(Document target, CallContext context) { |
89
cde042a0a395
Successreporting added
Tim Englich <tim.englich@intevation.de>
parents:
88
diff
changeset
|
217 log.debug("FISArtifact.feed"); |
cde042a0a395
Successreporting added
Tim Englich <tim.englich@intevation.de>
parents:
88
diff
changeset
|
218 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
|
219 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
|
220 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
|
221 "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
|
222 log.debug("Looking for ProductArtifact " + productName); |
71
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
223 if (this.products.containsKey(productName)) { |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
224 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
|
225 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
|
226 "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
|
227 .newDocument()); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
228 } else { |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
229 String msg = "Product does not exists for " + productName; |
88
1b12021905b9
Some CodeCleanup done.
Tim Englich <tim.englich@intevation.de>
parents:
82
diff
changeset
|
230 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
|
231 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
|
232 XMLUtils.newDocument()); |
71
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
233 } |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
234 } else { |
89
cde042a0a395
Successreporting added
Tim Englich <tim.englich@intevation.de>
parents:
88
diff
changeset
|
235 log.debug("Feed a Productartifact"); |
cde042a0a395
Successreporting added
Tim Englich <tim.englich@intevation.de>
parents:
88
diff
changeset
|
236 result = this.productArtifact.feed(target, context); |
71
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
237 } |
89
cde042a0a395
Successreporting added
Tim Englich <tim.englich@intevation.de>
parents:
88
diff
changeset
|
238 return result; |
71
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
239 } |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
240 |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
241 /** |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
242 * @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
|
243 * java.lang.Object) |
71
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
244 */ |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
245 @Override |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
246 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
|
247 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
|
248 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
|
249 this.productArtifact.out(format, outputStream, context); |
71
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
250 } |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
251 } |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
252 |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
253 /** |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
254 * Constructor |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
255 */ |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
256 public FISArtifact() { |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
257 super(); |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
258 } |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
259 |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
260 /** |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
261 * @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
|
262 * 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
|
263 */ |
71
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
264 @Override |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
265 public void setup(String identifier, ArtifactFactory factory, Object context) { |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
266 log.debug("FISArtifact.setup"); |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
267 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
|
268 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
|
269 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
|
270 GNVArtifactContext gnvContext = (GNVArtifactContext) context; |
71
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
271 Document doc = gnvContext.getConfig(); |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
272 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
|
273 |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
274 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
|
275 "products/product"); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
276 if (products != null) { |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
277 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
|
278 .getLength()); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
279 for (int i = 0; i < products.getLength(); i++) { |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
280 Node productNode = products.item(i); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
281 String productName = Config.getStringXPath(productNode, |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
282 "@name"); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
283 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
|
284 productNode, "parameters/parameter"); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
285 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
|
286 if (parameterNodes != null) { |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
287 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
|
288 .getLength()); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
289 for (int j = 0; j < parameterNodes.getLength(); j++) { |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
290 Node parameterNode = parameterNodes.item(j); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
291 String name = Config.getStringXPath(parameterNode, |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
292 "@name"); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
293 String value = Config.getStringXPath(parameterNode, |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
294 "@value"); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
295 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
|
296 } |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
297 } |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
298 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
|
299 "artifact-factory"); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
300 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
|
301 .createArtitfactFactor(doc, artifactFactoryNode); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
302 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
|
303 productName, parameter, artifactFactory)); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
304 } |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
305 } |
71
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
306 } |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
307 } |
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 protected Node getConfigurationFragment(Document document) { |
71
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
310 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
|
311 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
|
312 XPATH_IDENTIFIER_REPLACE, this.name); |
71
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
313 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
|
314 return Config.getNodeXPath(document, xpathQuery); |
71
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
315 } |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
316 |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
317 protected Document createDescibeOutput(CallMeta callMeta) { |
71
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
318 log.debug("GNVArtifactBase.createDescibeOutput"); |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
319 Document document = XMLUtils.newDocument(); |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
320 Element rootNode = this.createRootNode(document); |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
321 this.createHeader(rootNode, document, "describe"); |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
322 this.createOutputs(rootNode, document); |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
323 this.createCurrentState(rootNode, document); |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
324 this.createReachableStates(rootNode, document); |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
325 this.createModel(rootNode, document); |
117
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
115
diff
changeset
|
326 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
|
327 |
71
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
328 return document; |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
329 } |
171
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 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
|
332 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
|
333 "result"); |
71
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
334 document.appendChild(rootNode); |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
335 return rootNode; |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
336 } |
171
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 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
|
339 String documentType) { |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
340 Element typeNode = xmlUtilities.createArtifactElement(document, "type"); |
71
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
341 typeNode.setAttribute("name", documentType); |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
342 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
|
343 |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
344 Element uuidNode = xmlUtilities.createArtifactElement(document, "uuid"); |
71
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
345 uuidNode.setAttribute("value", super.identifier); |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
346 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
|
347 |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
348 Element hashNode = xmlUtilities.createArtifactElement(document, "hash"); |
71
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
349 hashNode.setAttribute("value", this.hash()); |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
350 parent.appendChild(hashNode); |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
351 |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
352 } |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
353 |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
354 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
|
355 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
|
356 "reachable-states"); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
357 if (this.products != null) { |
71
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
358 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
|
359 while (products.hasNext()) { |
71
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
360 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
|
361 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
|
362 document, "state"); |
71
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
363 currentNode.setAttribute("name", product.getName()); |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
364 currentNode.setAttribute("description", product.getName()); |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
365 stateNode.appendChild(currentNode); |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
366 } |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
367 } |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
368 parent.appendChild(stateNode); |
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 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
|
372 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
|
373 "state"); |
71
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
374 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
|
375 stateNode.setAttribute("description", |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
376 "Initialer Stand Auswahl des products"); |
71
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
377 parent.appendChild(stateNode); |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
378 } |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
379 |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
380 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
|
381 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
|
382 "model"); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
383 |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
384 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
|
385 "input"); |
71
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
386 inputNode.setAttribute("name", "product"); |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
387 inputNode.setAttribute("type", "String"); |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
388 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
|
389 |
71
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
390 parent.appendChild(modelNode); |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
391 } |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
392 |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
393 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
|
394 CallMeta callMeta) { |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
395 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
|
396 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
|
397 Node dynamic = xmlUtilities.createArtifactElement(document, "dynamic"); |
79
e33c61735a4e
Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents:
78
diff
changeset
|
398 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
|
399 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
|
400 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
|
401 |
79
e33c61735a4e
Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents:
78
diff
changeset
|
402 dynamic.appendChild(selectNode); |
76
2473440671ce
Integrate UI-Representation for Describe into the FISArtifact.
Tim Englich <tim.englich@intevation.de>
parents:
73
diff
changeset
|
403 } |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
404 |
71
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
405 parent.appendChild(uiNode); |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
406 } |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
407 |
79
e33c61735a4e
Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents:
78
diff
changeset
|
408 /** |
e33c61735a4e
Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents:
78
diff
changeset
|
409 * @param document |
e33c61735a4e
Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents:
78
diff
changeset
|
410 * @param xmlUtilities |
e33c61735a4e
Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents:
78
diff
changeset
|
411 * @return |
e33c61735a4e
Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents:
78
diff
changeset
|
412 */ |
117
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
115
diff
changeset
|
413 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
|
414 |
79
e33c61735a4e
Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents:
78
diff
changeset
|
415 ArtifactXMLUtilities xmlUtilities = new ArtifactXMLUtilities(); |
e33c61735a4e
Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents:
78
diff
changeset
|
416 String selectboxName = "product"; |
e33c61735a4e
Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents:
78
diff
changeset
|
417 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
|
418 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
|
419 "select1"); |
79
e33c61735a4e
Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents:
78
diff
changeset
|
420 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
|
421 |
79
e33c61735a4e
Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents:
78
diff
changeset
|
422 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
|
423 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
|
424 callMeta.getLanguages(), selectboxName, selectboxName)); |
79
e33c61735a4e
Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents:
78
diff
changeset
|
425 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
|
426 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
|
427 "choices"); |
79
e33c61735a4e
Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents:
78
diff
changeset
|
428 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
|
429 while (it.hasNext()) { |
79
e33c61735a4e
Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents:
78
diff
changeset
|
430 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
|
431 Element itemNode = xmlUtilities |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
432 .createXFormElement(document, "item"); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
433 |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
434 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
|
435 && 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
|
436 itemNode.setAttribute("selected", "true"); |
5eb62df21f9a
Added Support for Vertical Profiles Marnet, STAUN, IMIS
Tim Englich <tim.englich@intevation.de>
parents:
79
diff
changeset
|
437 } |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
438 |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
439 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
|
440 "label"); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
441 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
|
442 .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
|
443 p.getName())); |
79
e33c61735a4e
Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents:
78
diff
changeset
|
444 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
|
445 |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
446 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
|
447 "value"); |
79
e33c61735a4e
Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents:
78
diff
changeset
|
448 choicValueNode.setTextContent(p.getName()); |
e33c61735a4e
Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents:
78
diff
changeset
|
449 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
|
450 |
79
e33c61735a4e
Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents:
78
diff
changeset
|
451 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
|
452 |
79
e33c61735a4e
Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents:
78
diff
changeset
|
453 } |
e33c61735a4e
Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents:
78
diff
changeset
|
454 return selectNode; |
e33c61735a4e
Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents:
78
diff
changeset
|
455 } |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
456 |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
118
diff
changeset
|
457 protected void createOutputs(Element parent, Document document) { |
71
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
458 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
|
459 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
|
460 "outputs"); |
71
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
461 parent.appendChild(outputsNode); |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
462 } |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
463 |
e4ecf3188bdf
Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
464 } |