annotate gnv-artifacts/src/main/java/de/intevation/gnv/utils/ArtifactXMLUtilities.java @ 612:e86d37008fd1

Added new Transition and State for using the PreSettingsValue for the decision if a Transition could be used and the usage of PreSettings as InputValues. gnv-artifacts/trunk@678 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Tim Englich <tim.englich@intevation.de>
date Fri, 12 Feb 2010 09:11:49 +0000
parents b8080695ea62
children dde7f51dbe1e
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.utils;
e4ecf3188bdf Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
5
79
e33c61735a4e Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents: 76
diff changeset
6 import java.io.ByteArrayInputStream;
71
e4ecf3188bdf Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
7 import java.io.IOException;
e4ecf3188bdf Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
8 import java.io.InputStream;
75
9345835e2bc1 Make the Interfaces Serializable to make them usable in the Artifactdatabase
Tim Englich <tim.englich@intevation.de>
parents: 71
diff changeset
9 import java.io.Serializable;
71
e4ecf3188bdf Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
10 import java.io.StringWriter;
79
e33c61735a4e Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents: 76
diff changeset
11 import java.io.UnsupportedEncodingException;
71
e4ecf3188bdf Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
12
e4ecf3188bdf Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
13 import javax.xml.parsers.DocumentBuilder;
e4ecf3188bdf Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
14 import javax.xml.parsers.DocumentBuilderFactory;
e4ecf3188bdf Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
15 import javax.xml.parsers.ParserConfigurationException;
e4ecf3188bdf Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
16 import javax.xml.transform.Transformer;
e4ecf3188bdf Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
17 import javax.xml.transform.TransformerConfigurationException;
e4ecf3188bdf Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
18 import javax.xml.transform.TransformerException;
e4ecf3188bdf Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
19 import javax.xml.transform.TransformerFactory;
e4ecf3188bdf Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
20 import javax.xml.transform.TransformerFactoryConfigurationError;
e4ecf3188bdf Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
21 import javax.xml.transform.dom.DOMSource;
e4ecf3188bdf Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
22 import javax.xml.transform.stream.StreamResult;
e4ecf3188bdf Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
23
e4ecf3188bdf Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
24 import org.apache.log4j.Logger;
e4ecf3188bdf Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
25 import org.w3c.dom.Document;
e4ecf3188bdf Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
26 import org.w3c.dom.Element;
217
3dcd2b0b456e Added configurable TimeGap Support to the TimeSeries-Chart-Generation. issu45
Tim Englich <tim.englich@intevation.de>
parents: 171
diff changeset
27 import org.w3c.dom.Node;
71
e4ecf3188bdf Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
28 import org.xml.sax.SAXException;
e4ecf3188bdf Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
29
e4ecf3188bdf Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
30 import de.intevation.artifacts.ArtifactNamespaceContext;
e4ecf3188bdf Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
31
e4ecf3188bdf Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
32 /**
e4ecf3188bdf Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
33 * @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: 89
diff changeset
34 *
71
e4ecf3188bdf Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
35 */
171
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 89
diff changeset
36 public class ArtifactXMLUtilities implements Serializable {
71
e4ecf3188bdf Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
37 /**
79
e33c61735a4e Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents: 76
diff changeset
38 *
e33c61735a4e Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents: 76
diff changeset
39 */
e33c61735a4e Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents: 76
diff changeset
40 private static final long serialVersionUID = -6236340358303411758L;
e33c61735a4e Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents: 76
diff changeset
41
e33c61735a4e Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents: 76
diff changeset
42 /**
71
e4ecf3188bdf Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
43 * the logger, used to log exceptions and additonaly information
e4ecf3188bdf Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
44 */
171
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 89
diff changeset
45 private static Logger log = Logger
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents: 217
diff changeset
46 .getLogger(ArtifactXMLUtilities.class);
171
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 89
diff changeset
47
76
2473440671ce Integrate UI-Representation for Describe into the FISArtifact.
Tim Englich <tim.englich@intevation.de>
parents: 75
diff changeset
48 public static final String XFORM_URL = "http://www.w3.org/2002/xforms";
2473440671ce Integrate UI-Representation for Describe into the FISArtifact.
Tim Englich <tim.englich@intevation.de>
parents: 75
diff changeset
49 public static final String XFORM_PREFIX = "xform";
171
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 89
diff changeset
50
71
e4ecf3188bdf Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
51 /**
e4ecf3188bdf Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
52 * Constructor
e4ecf3188bdf Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
53 */
e4ecf3188bdf Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
54 public ArtifactXMLUtilities() {
e4ecf3188bdf Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
55 }
171
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 89
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 * @param document
e4ecf3188bdf Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
59 * @return
e4ecf3188bdf Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
60 */
e4ecf3188bdf Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
61 public Element createArtifactElement(Document document, String name) {
171
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 89
diff changeset
62 Element node = document.createElementNS(
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 89
diff changeset
63 ArtifactNamespaceContext.NAMESPACE_URI, name);
71
e4ecf3188bdf Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
64 node.setPrefix(ArtifactNamespaceContext.NAMESPACE_PREFIX);
e4ecf3188bdf Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
65 return node;
e4ecf3188bdf Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
66 }
171
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 89
diff changeset
67
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 89
diff changeset
68 public String writeDocument2String(Document document) {
71
e4ecf3188bdf Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
69 try {
171
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 89
diff changeset
70 TransformerFactory transformerFactory = TransformerFactory
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 89
diff changeset
71 .newInstance();
71
e4ecf3188bdf Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
72 Transformer transformer = transformerFactory.newTransformer();
e4ecf3188bdf Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
73 DOMSource source = new DOMSource(document);
e4ecf3188bdf Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
74 StringWriter sw = new StringWriter();
171
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 89
diff changeset
75 StreamResult result = new StreamResult(sw);
71
e4ecf3188bdf Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
76 transformer.transform(source, result);
e4ecf3188bdf Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
77 return sw.getBuffer().toString();
e4ecf3188bdf Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
78 } catch (TransformerConfigurationException e) {
171
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 89
diff changeset
79 log.error(e, e);
71
e4ecf3188bdf Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
80 } catch (TransformerFactoryConfigurationError e) {
171
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 89
diff changeset
81 log.error(e, e);
71
e4ecf3188bdf Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
82 } catch (TransformerException e) {
171
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 89
diff changeset
83 log.error(e, e);
71
e4ecf3188bdf Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
84 }
e4ecf3188bdf Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
85 return null;
e4ecf3188bdf Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
86 }
79
e33c61735a4e Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents: 76
diff changeset
87
358
2f7a28f211c7 Fetch ChartTheme from CallContext instead of creating it each time before creating a chart.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 335
diff changeset
88 public static Document readDocument(InputStream inputStream) {
71
e4ecf3188bdf Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
89 Document returnValue = null;
e4ecf3188bdf Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
90 try {
171
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 89
diff changeset
91 DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 89
diff changeset
92 .newInstance();
71
e4ecf3188bdf Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
93 DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder();
171
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 89
diff changeset
94 returnValue = docBuilder.parse(inputStream);
71
e4ecf3188bdf Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
95 } catch (ParserConfigurationException e) {
171
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 89
diff changeset
96 log.error(e, e);
71
e4ecf3188bdf Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
97 } catch (SAXException e) {
171
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 89
diff changeset
98 log.error(e, e);
71
e4ecf3188bdf Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
99 } catch (IOException e) {
171
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 89
diff changeset
100 log.error(e, e);
71
e4ecf3188bdf Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
101 }
e4ecf3188bdf Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
102 return returnValue;
e4ecf3188bdf Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
103 }
171
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 89
diff changeset
104
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 89
diff changeset
105 public Document reInitDocument(Document document) {
79
e33c61735a4e Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents: 76
diff changeset
106 try {
171
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 89
diff changeset
107 byte[] barray = this.writeDocument2String(document).getBytes(
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 89
diff changeset
108 "UTF-8");
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 89
diff changeset
109 InputStream inputStream = new ByteArrayInputStream(barray);
79
e33c61735a4e Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents: 76
diff changeset
110 return this.readDocument(inputStream);
e33c61735a4e Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents: 76
diff changeset
111 } catch (UnsupportedEncodingException e) {
171
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 89
diff changeset
112 log.error(e, e);
79
e33c61735a4e Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents: 76
diff changeset
113 }
e33c61735a4e Implementation of the Static UI done
Tim Englich <tim.englich@intevation.de>
parents: 76
diff changeset
114 return document;
71
e4ecf3188bdf Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
115 }
171
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 89
diff changeset
116
456
b8080695ea62 Splitted code pathes of dynamic and static nodes. Static nodes contain the selected value only instead of transfering the whole stack of options again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 358
diff changeset
117 public static Element createXFormElement(Document document, String name) {
76
2473440671ce Integrate UI-Representation for Describe into the FISArtifact.
Tim Englich <tim.englich@intevation.de>
parents: 75
diff changeset
118 Element node = document.createElementNS(XFORM_URL, name);
2473440671ce Integrate UI-Representation for Describe into the FISArtifact.
Tim Englich <tim.englich@intevation.de>
parents: 75
diff changeset
119 node.setPrefix(XFORM_PREFIX);
2473440671ce Integrate UI-Representation for Describe into the FISArtifact.
Tim Englich <tim.englich@intevation.de>
parents: 75
diff changeset
120 return node;
2473440671ce Integrate UI-Representation for Describe into the FISArtifact.
Tim Englich <tim.englich@intevation.de>
parents: 75
diff changeset
121 }
171
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 89
diff changeset
122
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 89
diff changeset
123 public Document createExceptionReport(String message, Document document) {
88
1b12021905b9 Some CodeCleanup done.
Tim Englich <tim.englich@intevation.de>
parents: 79
diff changeset
124 log.debug("ArtifactXMLUtilities.createExceptionReport");
171
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 89
diff changeset
125 Element exceptionReportNode = this.createArtifactElement(document,
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 89
diff changeset
126 "exceptionreport");
88
1b12021905b9 Some CodeCleanup done.
Tim Englich <tim.englich@intevation.de>
parents: 79
diff changeset
127 document.appendChild(exceptionReportNode);
171
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 89
diff changeset
128 Element exceptionNode = this.createArtifactElement(document,
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 89
diff changeset
129 "exception");
88
1b12021905b9 Some CodeCleanup done.
Tim Englich <tim.englich@intevation.de>
parents: 79
diff changeset
130 exceptionNode.setTextContent(message);
1b12021905b9 Some CodeCleanup done.
Tim Englich <tim.englich@intevation.de>
parents: 79
diff changeset
131 exceptionReportNode.appendChild(exceptionNode);
1b12021905b9 Some CodeCleanup done.
Tim Englich <tim.englich@intevation.de>
parents: 79
diff changeset
132 return document;
1b12021905b9 Some CodeCleanup done.
Tim Englich <tim.englich@intevation.de>
parents: 79
diff changeset
133 }
171
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 89
diff changeset
134
7fb9441dd8af Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents: 89
diff changeset
135 public Document createSuccessReport(String message, Document document) {
89
cde042a0a395 Successreporting added
Tim Englich <tim.englich@intevation.de>
parents: 88
diff changeset
136 log.debug("ArtifactXMLUtilities.creatSuccessReport");
cde042a0a395 Successreporting added
Tim Englich <tim.englich@intevation.de>
parents: 88
diff changeset
137 Element reportNode = this.createArtifactElement(document, "result");
cde042a0a395 Successreporting added
Tim Englich <tim.englich@intevation.de>
parents: 88
diff changeset
138 document.appendChild(reportNode);
cde042a0a395 Successreporting added
Tim Englich <tim.englich@intevation.de>
parents: 88
diff changeset
139 Element successNode = this.createArtifactElement(document, "success");
cde042a0a395 Successreporting added
Tim Englich <tim.englich@intevation.de>
parents: 88
diff changeset
140 successNode.setTextContent(message);
cde042a0a395 Successreporting added
Tim Englich <tim.englich@intevation.de>
parents: 88
diff changeset
141 reportNode.appendChild(successNode);
cde042a0a395 Successreporting added
Tim Englich <tim.englich@intevation.de>
parents: 88
diff changeset
142 return document;
cde042a0a395 Successreporting added
Tim Englich <tim.englich@intevation.de>
parents: 88
diff changeset
143 }
217
3dcd2b0b456e Added configurable TimeGap Support to the TimeSeries-Chart-Generation. issu45
Tim Englich <tim.englich@intevation.de>
parents: 171
diff changeset
144
3dcd2b0b456e Added configurable TimeGap Support to the TimeSeries-Chart-Generation. issu45
Tim Englich <tim.englich@intevation.de>
parents: 171
diff changeset
145 public Node readConfiguration(String fileName){
3dcd2b0b456e Added configurable TimeGap Support to the TimeSeries-Chart-Generation. issu45
Tim Englich <tim.englich@intevation.de>
parents: 171
diff changeset
146 try {
3dcd2b0b456e Added configurable TimeGap Support to the TimeSeries-Chart-Generation. issu45
Tim Englich <tim.englich@intevation.de>
parents: 171
diff changeset
147 DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
3dcd2b0b456e Added configurable TimeGap Support to the TimeSeries-Chart-Generation. issu45
Tim Englich <tim.englich@intevation.de>
parents: 171
diff changeset
148 factory.setValidating(false);
3dcd2b0b456e Added configurable TimeGap Support to the TimeSeries-Chart-Generation. issu45
Tim Englich <tim.englich@intevation.de>
parents: 171
diff changeset
149 return factory.newDocumentBuilder().parse(fileName).getChildNodes().item(0);
3dcd2b0b456e Added configurable TimeGap Support to the TimeSeries-Chart-Generation. issu45
Tim Englich <tim.englich@intevation.de>
parents: 171
diff changeset
150 } catch (SAXException e) {
3dcd2b0b456e Added configurable TimeGap Support to the TimeSeries-Chart-Generation. issu45
Tim Englich <tim.englich@intevation.de>
parents: 171
diff changeset
151 log.error(e,e);
3dcd2b0b456e Added configurable TimeGap Support to the TimeSeries-Chart-Generation. issu45
Tim Englich <tim.englich@intevation.de>
parents: 171
diff changeset
152 return null;
3dcd2b0b456e Added configurable TimeGap Support to the TimeSeries-Chart-Generation. issu45
Tim Englich <tim.englich@intevation.de>
parents: 171
diff changeset
153 } catch (IOException e) {
3dcd2b0b456e Added configurable TimeGap Support to the TimeSeries-Chart-Generation. issu45
Tim Englich <tim.englich@intevation.de>
parents: 171
diff changeset
154 log.error(e,e);
3dcd2b0b456e Added configurable TimeGap Support to the TimeSeries-Chart-Generation. issu45
Tim Englich <tim.englich@intevation.de>
parents: 171
diff changeset
155 return null;
3dcd2b0b456e Added configurable TimeGap Support to the TimeSeries-Chart-Generation. issu45
Tim Englich <tim.englich@intevation.de>
parents: 171
diff changeset
156 } catch (ParserConfigurationException e) {
3dcd2b0b456e Added configurable TimeGap Support to the TimeSeries-Chart-Generation. issu45
Tim Englich <tim.englich@intevation.de>
parents: 171
diff changeset
157 log.error(e,e);
3dcd2b0b456e Added configurable TimeGap Support to the TimeSeries-Chart-Generation. issu45
Tim Englich <tim.englich@intevation.de>
parents: 171
diff changeset
158 return null;
3dcd2b0b456e Added configurable TimeGap Support to the TimeSeries-Chart-Generation. issu45
Tim Englich <tim.englich@intevation.de>
parents: 171
diff changeset
159 }
3dcd2b0b456e Added configurable TimeGap Support to the TimeSeries-Chart-Generation. issu45
Tim Englich <tim.englich@intevation.de>
parents: 171
diff changeset
160 }
71
e4ecf3188bdf Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
161
e4ecf3188bdf Integrated FIS-Artifact
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
162 }

http://dive4elements.wald.intevation.org