annotate gwt-client/src/main/java/org/dive4elements/river/client/server/FLYSArtifactCreator.java @ 9709:b74f817435fe

comment removed
author dnt_bjoernsen <d.tironi@bjoernsen.de>
date Wed, 27 Jan 2021 11:47:38 +0100
parents 02739b8c010d
children
rev   line source
5861
172338b1407f GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
1 /* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde
172338b1407f GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
2 * Software engineering by Intevation GmbH
172338b1407f GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
3 *
5993
ea9eef426962 Removed trailing whitespace.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5861
diff changeset
4 * This file is Free Software under the GNU AGPL (>=v3)
5861
172338b1407f GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
5 * and comes with ABSOLUTELY NO WARRANTY! Check out the
5993
ea9eef426962 Removed trailing whitespace.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5861
diff changeset
6 * documentation coming with Dive4Elements River for details.
5861
172338b1407f GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
7 */
172338b1407f GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
8
5835
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
9 package org.dive4elements.river.client.server;
14
fe2f4d1dd784 Integrated the httpclient for the communication between client and server. It is now possible to create a new WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
10
870
d5fb88ba99d2 Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 862
diff changeset
11 import java.util.ArrayList;
d5fb88ba99d2 Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 862
diff changeset
12 import java.util.List;
d5fb88ba99d2 Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 862
diff changeset
13
d5fb88ba99d2 Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 862
diff changeset
14 import javax.xml.xpath.XPathConstants;
d5fb88ba99d2 Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 862
diff changeset
15
1367
ab8eb2f544f2 Replaced stdout and stderr logging with log4j loggers in server classes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 870
diff changeset
16 import org.apache.log4j.Logger;
5835
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
17 import org.dive4elements.artifacts.common.ArtifactNamespaceContext;
9071
a561b882436d create module bundu (Betrieb & Unterhaltung)
gernotbelger
parents: 8995
diff changeset
18 import org.dive4elements.artifacts.common.utils.XMLUtils;
5835
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
19 import org.dive4elements.artifacts.httpclient.utils.ArtifactCreator;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
20 import org.dive4elements.river.client.shared.model.Artifact;
9072
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 9071
diff changeset
21 import org.dive4elements.river.client.shared.model.BUNDUArtifact;
5835
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
22 import org.dive4elements.river.client.shared.model.CalculationMessage;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
23 import org.dive4elements.river.client.shared.model.ChartArtifact;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
24 import org.dive4elements.river.client.shared.model.DefaultArtifact;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
25 import org.dive4elements.river.client.shared.model.FixAnalysisArtifact;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
26 import org.dive4elements.river.client.shared.model.GaugeDischargeCurveArtifact;
9071
a561b882436d create module bundu (Betrieb & Unterhaltung)
gernotbelger
parents: 8995
diff changeset
27 import org.dive4elements.river.client.shared.model.MINFOArtifact;
5835
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
28 import org.dive4elements.river.client.shared.model.MapArtifact;
8854
7bbfb24e6eec SINFO - first prototype of BArt Fließtiefen
gernotbelger
parents: 8203
diff changeset
29 import org.dive4elements.river.client.shared.model.SINFOArtifact;
5835
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
30 import org.dive4elements.river.client.shared.model.StaticSQRelationArtifact;
8995
8c3e5682cb60 Introduced UNFO module
gernotbelger
parents: 8854
diff changeset
31 import org.dive4elements.river.client.shared.model.UINFOArtifact;
5835
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
32 import org.dive4elements.river.client.shared.model.WINFOArtifact;
9071
a561b882436d create module bundu (Betrieb & Unterhaltung)
gernotbelger
parents: 8995
diff changeset
33 import org.w3c.dom.Document;
a561b882436d create module bundu (Betrieb & Unterhaltung)
gernotbelger
parents: 8995
diff changeset
34 import org.w3c.dom.Element;
a561b882436d create module bundu (Betrieb & Unterhaltung)
gernotbelger
parents: 8995
diff changeset
35 import org.w3c.dom.NodeList;
14
fe2f4d1dd784 Integrated the httpclient for the communication between client and server. It is now possible to create a new WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
36
fe2f4d1dd784 Integrated the httpclient for the communication between client and server. It is now possible to create a new WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
37 /**
fe2f4d1dd784 Integrated the httpclient for the communication between client and server. It is now possible to create a new WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
38 * An implementation of an {@link ArtifactCreator}. This class uses the document
fe2f4d1dd784 Integrated the httpclient for the communication between client and server. It is now possible to create a new WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
39 * that is returned by the artifact server to parse important information (like
fe2f4d1dd784 Integrated the httpclient for the communication between client and server. It is now possible to create a new WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
40 * uuid, hash) and returns a new {@link Artifact} instance.
fe2f4d1dd784 Integrated the httpclient for the communication between client and server. It is now possible to create a new WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
41 *
fe2f4d1dd784 Integrated the httpclient for the communication between client and server. It is now possible to create a new WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
42 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
fe2f4d1dd784 Integrated the httpclient for the communication between client and server. It is now possible to create a new WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
43 */
fe2f4d1dd784 Integrated the httpclient for the communication between client and server. It is now possible to create a new WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
44 public class FLYSArtifactCreator implements ArtifactCreator {
fe2f4d1dd784 Integrated the httpclient for the communication between client and server. It is now possible to create a new WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
45
9071
a561b882436d create module bundu (Betrieb & Unterhaltung)
gernotbelger
parents: 8995
diff changeset
46 private static final Logger log = Logger.getLogger(FLYSArtifactCreator.class);
1367
ab8eb2f544f2 Replaced stdout and stderr logging with log4j loggers in server classes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 870
diff changeset
47
9071
a561b882436d create module bundu (Betrieb & Unterhaltung)
gernotbelger
parents: 8995
diff changeset
48 /** The XPath to the artifact's uuid. */
16
f8a5f2c5e2b7 The DESCRIBE document returned by the artifact server is parsed after calling create() of the artifact service and a new Artifact is created with an ArtifactDescription that contains the UUID, HASH, und the current Data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 14
diff changeset
49 public static final String XPATH_UUID = "/art:result/art:uuid/@art:value";
f8a5f2c5e2b7 The DESCRIBE document returned by the artifact server is parsed after calling create() of the artifact service and a new Artifact is created with an ArtifactDescription that contains the UUID, HASH, und the current Data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 14
diff changeset
50
9071
a561b882436d create module bundu (Betrieb & Unterhaltung)
gernotbelger
parents: 8995
diff changeset
51 /** The XPath to the artifact's hash value. */
16
f8a5f2c5e2b7 The DESCRIBE document returned by the artifact server is parsed after calling create() of the artifact service and a new Artifact is created with an ArtifactDescription that contains the UUID, HASH, und the current Data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 14
diff changeset
52 public static final String XPATH_HASH = "/art:result/art:hash/@art:value";
f8a5f2c5e2b7 The DESCRIBE document returned by the artifact server is parsed after calling create() of the artifact service and a new Artifact is created with an ArtifactDescription that contains the UUID, HASH, und the current Data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 14
diff changeset
53
9071
a561b882436d create module bundu (Betrieb & Unterhaltung)
gernotbelger
parents: 8995
diff changeset
54 /** The XPath to the artifact's name value. */
227
7f7f6d2c4b2c We can now distinuish between different artifact types based on its name in the DESCRIBE. The ArtifactCreator returns concrete instances of Artifacts now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 16
diff changeset
55 public static final String XPATH_NAME = "/art:result/art:name/@art:value";
7f7f6d2c4b2c We can now distinuish between different artifact types based on its name in the DESCRIBE. The ArtifactCreator returns concrete instances of Artifacts now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 16
diff changeset
56
9071
a561b882436d create module bundu (Betrieb & Unterhaltung)
gernotbelger
parents: 8995
diff changeset
57 /**
a561b882436d create module bundu (Betrieb & Unterhaltung)
gernotbelger
parents: 8995
diff changeset
58 * The XPath to the value that determines if the artifact is processing in
a561b882436d create module bundu (Betrieb & Unterhaltung)
gernotbelger
parents: 8995
diff changeset
59 * background.
a561b882436d create module bundu (Betrieb & Unterhaltung)
gernotbelger
parents: 8995
diff changeset
60 */
a561b882436d create module bundu (Betrieb & Unterhaltung)
gernotbelger
parents: 8995
diff changeset
61 public static final String XPATH_BACKGROUND_VALUE = "/art:result/art:background-processing/@art:value";
870
d5fb88ba99d2 Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 862
diff changeset
62
9071
a561b882436d create module bundu (Betrieb & Unterhaltung)
gernotbelger
parents: 8995
diff changeset
63 /** The XPath that points to the (if existing) background messages. */
a561b882436d create module bundu (Betrieb & Unterhaltung)
gernotbelger
parents: 8995
diff changeset
64 public static final String XPATH_BACKGROUND = "/art:result/art:background-processing";
16
f8a5f2c5e2b7 The DESCRIBE document returned by the artifact server is parsed after calling create() of the artifact service and a new Artifact is created with an ArtifactDescription that contains the UUID, HASH, und the current Data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 14
diff changeset
65
14
fe2f4d1dd784 Integrated the httpclient for the communication between client and server. It is now possible to create a new WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
66 /**
fe2f4d1dd784 Integrated the httpclient for the communication between client and server. It is now possible to create a new WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
67 * Creates a new instance of an {@link ArtifactCreator}.
fe2f4d1dd784 Integrated the httpclient for the communication between client and server. It is now possible to create a new WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
68 */
fe2f4d1dd784 Integrated the httpclient for the communication between client and server. It is now possible to create a new WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
69 public FLYSArtifactCreator() {
fe2f4d1dd784 Integrated the httpclient for the communication between client and server. It is now possible to create a new WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
70 }
fe2f4d1dd784 Integrated the httpclient for the communication between client and server. It is now possible to create a new WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
71
fe2f4d1dd784 Integrated the httpclient for the communication between client and server. It is now possible to create a new WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
72 /**
fe2f4d1dd784 Integrated the httpclient for the communication between client and server. It is now possible to create a new WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
73 * This concreate implementation returns an instance of {@link Artifact}
fe2f4d1dd784 Integrated the httpclient for the communication between client and server. It is now possible to create a new WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
74 * that is used in the FLYS GWT Client code.
fe2f4d1dd784 Integrated the httpclient for the communication between client and server. It is now possible to create a new WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
75 *
9071
a561b882436d create module bundu (Betrieb & Unterhaltung)
gernotbelger
parents: 8995
diff changeset
76 * @param doc
a561b882436d create module bundu (Betrieb & Unterhaltung)
gernotbelger
parents: 8995
diff changeset
77 * A document that describes the artifact that has been created
a561b882436d create module bundu (Betrieb & Unterhaltung)
gernotbelger
parents: 8995
diff changeset
78 * in the artifact server.
14
fe2f4d1dd784 Integrated the httpclient for the communication between client and server. It is now possible to create a new WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
79 *
fe2f4d1dd784 Integrated the httpclient for the communication between client and server. It is now possible to create a new WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
80 * @return an instance if {@link Artifact}.
fe2f4d1dd784 Integrated the httpclient for the communication between client and server. It is now possible to create a new WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
81 */
9071
a561b882436d create module bundu (Betrieb & Unterhaltung)
gernotbelger
parents: 8995
diff changeset
82 @Override
a561b882436d create module bundu (Betrieb & Unterhaltung)
gernotbelger
parents: 8995
diff changeset
83 public Object create(final Document doc) {
a561b882436d create module bundu (Betrieb & Unterhaltung)
gernotbelger
parents: 8995
diff changeset
84 final Artifact artifact = extractArtifact(doc);
a561b882436d create module bundu (Betrieb & Unterhaltung)
gernotbelger
parents: 8995
diff changeset
85 artifact.setArtifactDescription(ArtifactDescriptionFactory.createArtifactDescription(doc));
16
f8a5f2c5e2b7 The DESCRIBE document returned by the artifact server is parsed after calling create() of the artifact service and a new Artifact is created with an ArtifactDescription that contains the UUID, HASH, und the current Data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 14
diff changeset
86
f8a5f2c5e2b7 The DESCRIBE document returned by the artifact server is parsed after calling create() of the artifact service and a new Artifact is created with an ArtifactDescription that contains the UUID, HASH, und the current Data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 14
diff changeset
87 return artifact;
f8a5f2c5e2b7 The DESCRIBE document returned by the artifact server is parsed after calling create() of the artifact service and a new Artifact is created with an ArtifactDescription that contains the UUID, HASH, und the current Data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 14
diff changeset
88 }
f8a5f2c5e2b7 The DESCRIBE document returned by the artifact server is parsed after calling create() of the artifact service and a new Artifact is created with an ArtifactDescription that contains the UUID, HASH, und the current Data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 14
diff changeset
89
f8a5f2c5e2b7 The DESCRIBE document returned by the artifact server is parsed after calling create() of the artifact service and a new Artifact is created with an ArtifactDescription that contains the UUID, HASH, und the current Data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 14
diff changeset
90 /**
f8a5f2c5e2b7 The DESCRIBE document returned by the artifact server is parsed after calling create() of the artifact service and a new Artifact is created with an ArtifactDescription that contains the UUID, HASH, und the current Data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 14
diff changeset
91 * This method extracts the UUID und HASH information of the returned
f8a5f2c5e2b7 The DESCRIBE document returned by the artifact server is parsed after calling create() of the artifact service and a new Artifact is created with an ArtifactDescription that contains the UUID, HASH, und the current Data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 14
diff changeset
92 * artifact document.
f8a5f2c5e2b7 The DESCRIBE document returned by the artifact server is parsed after calling create() of the artifact service and a new Artifact is created with an ArtifactDescription that contains the UUID, HASH, und the current Data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 14
diff changeset
93 *
9071
a561b882436d create module bundu (Betrieb & Unterhaltung)
gernotbelger
parents: 8995
diff changeset
94 * @param doc
a561b882436d create module bundu (Betrieb & Unterhaltung)
gernotbelger
parents: 8995
diff changeset
95 * The result of the CREATE operation.
16
f8a5f2c5e2b7 The DESCRIBE document returned by the artifact server is parsed after calling create() of the artifact service and a new Artifact is created with an ArtifactDescription that contains the UUID, HASH, und the current Data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 14
diff changeset
96 *
f8a5f2c5e2b7 The DESCRIBE document returned by the artifact server is parsed after calling create() of the artifact service and a new Artifact is created with an ArtifactDescription that contains the UUID, HASH, und the current Data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 14
diff changeset
97 * @return an instance of an {@link Artifact}.
f8a5f2c5e2b7 The DESCRIBE document returned by the artifact server is parsed after calling create() of the artifact service and a new Artifact is created with an ArtifactDescription that contains the UUID, HASH, und the current Data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 14
diff changeset
98 */
9071
a561b882436d create module bundu (Betrieb & Unterhaltung)
gernotbelger
parents: 8995
diff changeset
99 protected Artifact extractArtifact(final Document doc) {
8203
238fc722f87a sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5993
diff changeset
100 log.debug("FLYSArtifactCreator - extractArtifact()");
16
f8a5f2c5e2b7 The DESCRIBE document returned by the artifact server is parsed after calling create() of the artifact service and a new Artifact is created with an ArtifactDescription that contains the UUID, HASH, und the current Data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 14
diff changeset
101
9071
a561b882436d create module bundu (Betrieb & Unterhaltung)
gernotbelger
parents: 8995
diff changeset
102 final String uuid = XMLUtils.xpathString(doc, XPATH_UUID, ArtifactNamespaceContext.INSTANCE);
16
f8a5f2c5e2b7 The DESCRIBE document returned by the artifact server is parsed after calling create() of the artifact service and a new Artifact is created with an ArtifactDescription that contains the UUID, HASH, und the current Data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 14
diff changeset
103
9071
a561b882436d create module bundu (Betrieb & Unterhaltung)
gernotbelger
parents: 8995
diff changeset
104 final String hash = XMLUtils.xpathString(doc, XPATH_HASH, ArtifactNamespaceContext.INSTANCE);
16
f8a5f2c5e2b7 The DESCRIBE document returned by the artifact server is parsed after calling create() of the artifact service and a new Artifact is created with an ArtifactDescription that contains the UUID, HASH, und the current Data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 14
diff changeset
105
9071
a561b882436d create module bundu (Betrieb & Unterhaltung)
gernotbelger
parents: 8995
diff changeset
106 String name = XMLUtils.xpathString(doc, XPATH_NAME, ArtifactNamespaceContext.INSTANCE);
227
7f7f6d2c4b2c We can now distinuish between different artifact types based on its name in the DESCRIBE. The ArtifactCreator returns concrete instances of Artifacts now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 16
diff changeset
107
9071
a561b882436d create module bundu (Betrieb & Unterhaltung)
gernotbelger
parents: 8995
diff changeset
108 final String backgroundStr = XMLUtils.xpathString(doc, XPATH_BACKGROUND_VALUE, ArtifactNamespaceContext.INSTANCE);
862
c9549074ecd1 Parse Artifact's 'background-processing' attribute and lock the UI if this attribute is true.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 227
diff changeset
109
c9549074ecd1 Parse Artifact's 'background-processing' attribute and lock the UI if this attribute is true.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 227
diff changeset
110 boolean background = false;
c9549074ecd1 Parse Artifact's 'background-processing' attribute and lock the UI if this attribute is true.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 227
diff changeset
111 if (backgroundStr != null && backgroundStr.length() > 0) {
c9549074ecd1 Parse Artifact's 'background-processing' attribute and lock the UI if this attribute is true.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 227
diff changeset
112 background = Boolean.valueOf(backgroundStr);
c9549074ecd1 Parse Artifact's 'background-processing' attribute and lock the UI if this attribute is true.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 227
diff changeset
113 }
c9549074ecd1 Parse Artifact's 'background-processing' attribute and lock the UI if this attribute is true.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 227
diff changeset
114
9071
a561b882436d create module bundu (Betrieb & Unterhaltung)
gernotbelger
parents: 8995
diff changeset
115 final List<CalculationMessage> msg = parseBackgroundMessages(doc);
870
d5fb88ba99d2 Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 862
diff changeset
116
8203
238fc722f87a sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5993
diff changeset
117 log.debug("NEW Artifact UUID: " + uuid);
238fc722f87a sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5993
diff changeset
118 log.debug("NEW Artifact HASH: " + hash);
238fc722f87a sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5993
diff changeset
119 log.debug("NEW Artifact NAME: " + name);
238fc722f87a sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5993
diff changeset
120 log.debug("NEW Artifact IN BACKGROUND: " + background);
227
7f7f6d2c4b2c We can now distinuish between different artifact types based on its name in the DESCRIBE. The ArtifactCreator returns concrete instances of Artifacts now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 16
diff changeset
121
7f7f6d2c4b2c We can now distinuish between different artifact types based on its name in the DESCRIBE. The ArtifactCreator returns concrete instances of Artifacts now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 16
diff changeset
122 if (name == null) {
870
d5fb88ba99d2 Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 862
diff changeset
123 return new DefaultArtifact(uuid, hash, background, msg);
227
7f7f6d2c4b2c We can now distinuish between different artifact types based on its name in the DESCRIBE. The ArtifactCreator returns concrete instances of Artifacts now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 16
diff changeset
124 }
7f7f6d2c4b2c We can now distinuish between different artifact types based on its name in the DESCRIBE. The ArtifactCreator returns concrete instances of Artifacts now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 16
diff changeset
125
7f7f6d2c4b2c We can now distinuish between different artifact types based on its name in the DESCRIBE. The ArtifactCreator returns concrete instances of Artifacts now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 16
diff changeset
126 name = name.trim();
7f7f6d2c4b2c We can now distinuish between different artifact types based on its name in the DESCRIBE. The ArtifactCreator returns concrete instances of Artifacts now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 16
diff changeset
127
9071
a561b882436d create module bundu (Betrieb & Unterhaltung)
gernotbelger
parents: 8995
diff changeset
128 // FIXME: why do we have a super sophisticated artifact-framework if, in the end, module dependent stuff is still
a561b882436d create module bundu (Betrieb & Unterhaltung)
gernotbelger
parents: 8995
diff changeset
129 // switched manually....
8854
7bbfb24e6eec SINFO - first prototype of BArt Fließtiefen
gernotbelger
parents: 8203
diff changeset
130 if (name.equals("winfo")) {
8203
238fc722f87a sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5993
diff changeset
131 log.debug("+++++ NEW WINFO ARTIFACT.");
870
d5fb88ba99d2 Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 862
diff changeset
132 return new WINFOArtifact(uuid, hash, background, msg);
227
7f7f6d2c4b2c We can now distinuish between different artifact types based on its name in the DESCRIBE. The ArtifactCreator returns concrete instances of Artifacts now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 16
diff changeset
133 }
8854
7bbfb24e6eec SINFO - first prototype of BArt Fließtiefen
gernotbelger
parents: 8203
diff changeset
134
7bbfb24e6eec SINFO - first prototype of BArt Fließtiefen
gernotbelger
parents: 8203
diff changeset
135 if (name.equals("new_map")) {
8203
238fc722f87a sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5993
diff changeset
136 log.debug("+++++ NEW MAP ARTIFACT.");
1513
f43862cc1e6e Added new artifact 'MapArtifact' for module 'new map'. This allows to open an
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1367
diff changeset
137 return new MapArtifact(uuid, hash, background, msg);
f43862cc1e6e Added new artifact 'MapArtifact' for module 'new map'. This allows to open an
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1367
diff changeset
138 }
9071
a561b882436d create module bundu (Betrieb & Unterhaltung)
gernotbelger
parents: 8995
diff changeset
139
8854
7bbfb24e6eec SINFO - first prototype of BArt Fließtiefen
gernotbelger
parents: 8203
diff changeset
140 if (name.equals("new_chart")) {
8203
238fc722f87a sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5993
diff changeset
141 log.debug("+++++ NEW CHART ARTIFACT.");
1530
f1f0e9c75026 Added new artifact to be able to open existing 'new chart' projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1521
diff changeset
142 return new ChartArtifact(uuid, hash, background, msg);
f1f0e9c75026 Added new artifact to be able to open existing 'new chart' projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1521
diff changeset
143 }
9071
a561b882436d create module bundu (Betrieb & Unterhaltung)
gernotbelger
parents: 8995
diff changeset
144
8854
7bbfb24e6eec SINFO - first prototype of BArt Fließtiefen
gernotbelger
parents: 8203
diff changeset
145 if (name.equals("minfo")) {
8203
238fc722f87a sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5993
diff changeset
146 log.debug("+++++ NEW MINFO ARTIFACT.");
2520
fe67f1345687 Added a MINFOArtifact and improved the DistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1530
diff changeset
147 return new MINFOArtifact(uuid, hash, background, msg);
fe67f1345687 Added a MINFOArtifact and improved the DistancePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1530
diff changeset
148 }
9071
a561b882436d create module bundu (Betrieb & Unterhaltung)
gernotbelger
parents: 8995
diff changeset
149
8854
7bbfb24e6eec SINFO - first prototype of BArt Fließtiefen
gernotbelger
parents: 8203
diff changeset
150 if (name.equals("fixanalysis")) {
8203
238fc722f87a sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5993
diff changeset
151 log.debug("+++++ NEW FIXANALYSIS ARTIFACT.");
2541
f0191dedee49 Added fixanalysis artifact.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2520
diff changeset
152 return new FixAnalysisArtifact(uuid, hash, background, msg);
f0191dedee49 Added fixanalysis artifact.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2520
diff changeset
153 }
9071
a561b882436d create module bundu (Betrieb & Unterhaltung)
gernotbelger
parents: 8995
diff changeset
154
8854
7bbfb24e6eec SINFO - first prototype of BArt Fließtiefen
gernotbelger
parents: 8203
diff changeset
155 if (name.equals("gaugedischargecurve")) {
8203
238fc722f87a sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5993
diff changeset
156 log.debug("+++++ NEW GAUGEDISCHARGECURVE ARTIFACT.");
3865
436eec3be6ff Allow to create a discharge curve from a gauge info
Bjoern Ricks <bjoern.ricks@intevation.de>
parents: 2541
diff changeset
157 return new GaugeDischargeCurveArtifact(uuid, hash, background, msg);
436eec3be6ff Allow to create a discharge curve from a gauge info
Bjoern Ricks <bjoern.ricks@intevation.de>
parents: 2541
diff changeset
158 }
9071
a561b882436d create module bundu (Betrieb & Unterhaltung)
gernotbelger
parents: 8995
diff changeset
159
8854
7bbfb24e6eec SINFO - first prototype of BArt Fließtiefen
gernotbelger
parents: 8203
diff changeset
160 if (name.equals("staticsqrelation")) {
8203
238fc722f87a sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5993
diff changeset
161 log.debug("+++++ STATICSQRELATION ARTIFACT.");
5503
b660090b417d Create a new sq relation project on measurement station record click.
Raimund Renkert <rrenkert@intevation.de>
parents: 3998
diff changeset
162 return new StaticSQRelationArtifact(uuid, hash, background, msg);
b660090b417d Create a new sq relation project on measurement station record click.
Raimund Renkert <rrenkert@intevation.de>
parents: 3998
diff changeset
163 }
16
f8a5f2c5e2b7 The DESCRIBE document returned by the artifact server is parsed after calling create() of the artifact service and a new Artifact is created with an ArtifactDescription that contains the UUID, HASH, und the current Data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 14
diff changeset
164
8854
7bbfb24e6eec SINFO - first prototype of BArt Fließtiefen
gernotbelger
parents: 8203
diff changeset
165 if (name.equals("sinfo")) {
7bbfb24e6eec SINFO - first prototype of BArt Fließtiefen
gernotbelger
parents: 8203
diff changeset
166 log.debug("+++++ NEW SINFO ARTIFACT.");
7bbfb24e6eec SINFO - first prototype of BArt Fließtiefen
gernotbelger
parents: 8203
diff changeset
167 return new SINFOArtifact(uuid, hash, background, msg);
7bbfb24e6eec SINFO - first prototype of BArt Fließtiefen
gernotbelger
parents: 8203
diff changeset
168 }
7bbfb24e6eec SINFO - first prototype of BArt Fließtiefen
gernotbelger
parents: 8203
diff changeset
169
8995
8c3e5682cb60 Introduced UNFO module
gernotbelger
parents: 8854
diff changeset
170 if (name.equals("uinfo")) {
9071
a561b882436d create module bundu (Betrieb & Unterhaltung)
gernotbelger
parents: 8995
diff changeset
171 log.debug("+++++ NEW UINFO ARTIFACT.");
a561b882436d create module bundu (Betrieb & Unterhaltung)
gernotbelger
parents: 8995
diff changeset
172 return new UINFOArtifact(uuid, hash, background, msg);
8995
8c3e5682cb60 Introduced UNFO module
gernotbelger
parents: 8854
diff changeset
173 }
9071
a561b882436d create module bundu (Betrieb & Unterhaltung)
gernotbelger
parents: 8995
diff changeset
174 if (name.equals("bundu")) {
a561b882436d create module bundu (Betrieb & Unterhaltung)
gernotbelger
parents: 8995
diff changeset
175 log.debug("+++++ NEW BUNDU ARTIFACT.");
9072
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 9071
diff changeset
176 return new BUNDUArtifact(uuid, hash, background, msg);
9071
a561b882436d create module bundu (Betrieb & Unterhaltung)
gernotbelger
parents: 8995
diff changeset
177 }
870
d5fb88ba99d2 Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 862
diff changeset
178 return new DefaultArtifact(uuid, hash, background, msg);
d5fb88ba99d2 Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 862
diff changeset
179 }
d5fb88ba99d2 Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 862
diff changeset
180
9071
a561b882436d create module bundu (Betrieb & Unterhaltung)
gernotbelger
parents: 8995
diff changeset
181 public static List<CalculationMessage> parseBackgroundMessages(final Document d) {
a561b882436d create module bundu (Betrieb & Unterhaltung)
gernotbelger
parents: 8995
diff changeset
182 final NodeList list = (NodeList) XMLUtils.xpath(d, XPATH_BACKGROUND, XPathConstants.NODESET, ArtifactNamespaceContext.INSTANCE);
870
d5fb88ba99d2 Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 862
diff changeset
183
9071
a561b882436d create module bundu (Betrieb & Unterhaltung)
gernotbelger
parents: 8995
diff changeset
184 final int len = list != null ? list.getLength() : 0;
870
d5fb88ba99d2 Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 862
diff changeset
185
8203
238fc722f87a sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5993
diff changeset
186 log.debug("Found " + len + " background messages.");
870
d5fb88ba99d2 Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 862
diff changeset
187
9071
a561b882436d create module bundu (Betrieb & Unterhaltung)
gernotbelger
parents: 8995
diff changeset
188 final List<CalculationMessage> res = new ArrayList<CalculationMessage>(len);
870
d5fb88ba99d2 Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 862
diff changeset
189
d5fb88ba99d2 Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 862
diff changeset
190 for (int i = 0; i < len; i++) {
9071
a561b882436d create module bundu (Betrieb & Unterhaltung)
gernotbelger
parents: 8995
diff changeset
191 final CalculationMessage msg = parseBackgroundMessage((Element) list.item(i));
870
d5fb88ba99d2 Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 862
diff changeset
192
d5fb88ba99d2 Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 862
diff changeset
193 if (msg != null) {
d5fb88ba99d2 Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 862
diff changeset
194 res.add(msg);
d5fb88ba99d2 Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 862
diff changeset
195 }
d5fb88ba99d2 Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 862
diff changeset
196 }
d5fb88ba99d2 Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 862
diff changeset
197
d5fb88ba99d2 Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 862
diff changeset
198 return res;
d5fb88ba99d2 Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 862
diff changeset
199 }
d5fb88ba99d2 Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 862
diff changeset
200
9071
a561b882436d create module bundu (Betrieb & Unterhaltung)
gernotbelger
parents: 8995
diff changeset
201 public static CalculationMessage parseBackgroundMessage(final Element e) {
a561b882436d create module bundu (Betrieb & Unterhaltung)
gernotbelger
parents: 8995
diff changeset
202 final String steps = e.getAttribute("art:steps");
a561b882436d create module bundu (Betrieb & Unterhaltung)
gernotbelger
parents: 8995
diff changeset
203 final String currentStep = e.getAttribute("art:currentStep");
a561b882436d create module bundu (Betrieb & Unterhaltung)
gernotbelger
parents: 8995
diff changeset
204 final String message = e.getTextContent();
870
d5fb88ba99d2 Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 862
diff changeset
205
9071
a561b882436d create module bundu (Betrieb & Unterhaltung)
gernotbelger
parents: 8995
diff changeset
206 final int lenCurStep = currentStep != null ? currentStep.length() : 0;
a561b882436d create module bundu (Betrieb & Unterhaltung)
gernotbelger
parents: 8995
diff changeset
207 final int lenSteps = steps != null ? steps.length() : 0;
a561b882436d create module bundu (Betrieb & Unterhaltung)
gernotbelger
parents: 8995
diff changeset
208 final int lenMessage = message != null ? message.length() : 0;
870
d5fb88ba99d2 Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 862
diff changeset
209
d5fb88ba99d2 Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 862
diff changeset
210 if (lenSteps > 0 && lenMessage > 0 && lenCurStep > 0) {
d5fb88ba99d2 Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 862
diff changeset
211 try {
9071
a561b882436d create module bundu (Betrieb & Unterhaltung)
gernotbelger
parents: 8995
diff changeset
212 return new CalculationMessage(Integer.parseInt(steps), Integer.parseInt(currentStep), message);
870
d5fb88ba99d2 Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 862
diff changeset
213
d5fb88ba99d2 Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 862
diff changeset
214 }
9071
a561b882436d create module bundu (Betrieb & Unterhaltung)
gernotbelger
parents: 8995
diff changeset
215 catch (final NumberFormatException nfe) {
870
d5fb88ba99d2 Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 862
diff changeset
216 nfe.printStackTrace();
d5fb88ba99d2 Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 862
diff changeset
217 }
d5fb88ba99d2 Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 862
diff changeset
218 }
d5fb88ba99d2 Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 862
diff changeset
219
d5fb88ba99d2 Display status message and progress information in the WSPLGEN loading panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 862
diff changeset
220 return null;
14
fe2f4d1dd784 Integrated the httpclient for the communication between client and server. It is now possible to create a new WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
221 }
fe2f4d1dd784 Integrated the httpclient for the communication between client and server. It is now possible to create a new WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
222 }
fe2f4d1dd784 Integrated the httpclient for the communication between client and server. It is now possible to create a new WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
223 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org