annotate gwt-client/src/main/java/org/dive4elements/river/client/server/ArtifactDescriptionFactory.java @ 9390:f575ff573cbb

"Name der Peilung" columname minfo.
author gernotbelger
date Thu, 09 Aug 2018 15:22:31 +0200
parents 5e38e2924c07
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;
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:
diff changeset
10
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:
diff changeset
11 import java.util.ArrayList;
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:
diff changeset
12 import java.util.List;
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:
diff changeset
13
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:
diff changeset
14 import javax.xml.xpath.XPathConstants;
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:
diff changeset
15
1367
ab8eb2f544f2 Replaced stdout and stderr logging with log4j loggers in server classes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 839
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;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
18 import org.dive4elements.artifacts.common.utils.ClientProtocolUtils;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
19 import org.dive4elements.artifacts.common.utils.XMLUtils;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
20 import org.dive4elements.river.client.shared.model.ArtifactDescription;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
21 import org.dive4elements.river.client.shared.model.DataItem;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
22 import org.dive4elements.river.client.shared.model.DataList;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
23 import org.dive4elements.river.client.shared.model.DefaultArtifactDescription;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
24 import org.dive4elements.river.client.shared.model.DefaultData;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
25 import org.dive4elements.river.client.shared.model.DefaultDataItem;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
26 import org.dive4elements.river.client.shared.model.DefaultOutputMode;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
27 import org.dive4elements.river.client.shared.model.DoubleArrayData;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
28 import org.dive4elements.river.client.shared.model.DoubleRangeData;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
29 import org.dive4elements.river.client.shared.model.IntegerArrayData;
9390
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
30 import org.dive4elements.river.client.shared.model.IntegerOptionsData;
5835
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
31 import org.dive4elements.river.client.shared.model.IntegerRangeData;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
32 import org.dive4elements.river.client.shared.model.LongRangeData;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
33 import org.dive4elements.river.client.shared.model.OutputMode;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
34 import org.dive4elements.river.client.shared.model.Recommendation;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
35 import org.dive4elements.river.client.shared.model.WQDataItem;
9390
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
36 import org.w3c.dom.Document;
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
37 import org.w3c.dom.Element;
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
38 import org.w3c.dom.Node;
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
39 import org.w3c.dom.NodeList;
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:
diff changeset
40
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:
diff changeset
41 /**
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:
diff changeset
42 * This factory class helps creating an {@link ArtifactDescription} based on the
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:
diff changeset
43 * DESCRIBE document of an artifact returned by the artifact server. Use the
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:
diff changeset
44 * {@link createArtifactDescription(org.w3c.dom.Document)} method with the
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:
diff changeset
45 * DESCRIBE document to create such an {@link ArtifactDescription}.
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:
diff changeset
46 *
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:
diff changeset
47 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
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:
diff changeset
48 */
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:
diff changeset
49 public class ArtifactDescriptionFactory {
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:
diff changeset
50
9390
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
51 private static final Logger log = Logger.getLogger(ArtifactDescriptionFactory.class);
1367
ab8eb2f544f2 Replaced stdout and stderr logging with log4j loggers in server classes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 839
diff changeset
52
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:
diff changeset
53 public static final String XPATH_STATE_NAME = "@art:name";
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:
diff changeset
54
22
a85bac235069 Implemented code to parse the UIProvider that should be used for a current state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 16
diff changeset
55 public static final String XPATH_UIPROVIDER = "@art:uiprovider";
a85bac235069 Implemented code to parse the UIProvider that should be used for a current state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 16
diff changeset
56
2500
69a498896c9c Create a link to an online help page and put it in front of the input panels.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1595
diff changeset
57 public static final String XPATH_HELP_TEXT = "@art:helpText";
69a498896c9c Create a link to an online help page and put it in front of the input panels.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1595
diff changeset
58
32
88c530c25968 Added a service for the ADVANCE operation and a service that bundles FEED and ADVANCE in a single service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 22
diff changeset
59 public static final String XPATH_REACHABLE_STATE = "art:state";
88c530c25968 Added a service for the ADVANCE operation and a service that bundles FEED and ADVANCE in a single service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 22
diff changeset
60
51
a2923d63f530 Introduced a data structure DataList to manage to list of Data objects of a single state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 37
diff changeset
61 public static final String XPATH_STATIC_STATE_NODE = "art:state";
a2923d63f530 Introduced a data structure DataList to manage to list of Data objects of a single state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 37
diff changeset
62
34
bf84bcd4e11b Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 32
diff changeset
63 public static final String XPATH_STATIC_DATA_NODE = "art:data";
bf84bcd4e11b Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 32
diff changeset
64
bf84bcd4e11b Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 32
diff changeset
65 public static final String XPATH_STATIC_ITEM_NODE = "art:item";
bf84bcd4e11b Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 32
diff changeset
66
9390
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
67 public static final String XPATH_RECOMMENDED_ARTIFACTS = "/art:result/art:recommended-artifacts//*[@factory]";
803
653ae84533e7 Read/create recommended Artifacts and add them to the current Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 565
diff changeset
68
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:
diff changeset
69 /**
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:
diff changeset
70 * This method creates the {@link ArtifactDescription} of the DESCRIBE
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:
diff changeset
71 * document <i>doc</i>.
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:
diff changeset
72 *
9390
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
73 * @param doc
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
74 * A DESCRIBE document.
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:
diff changeset
75 *
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:
diff changeset
76 * @return the {@link ArtifactDescription}.
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:
diff changeset
77 */
9390
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
78 public static ArtifactDescription createArtifactDescription(final Document doc) {
8203
238fc722f87a sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7825
diff changeset
79 log.debug("ArtifactDescriptionFactory.createArtifactDescription");
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:
diff changeset
80
9390
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
81 final Node currentState = ClientProtocolUtils.getCurrentState(doc);
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
82 final Node staticNode = ClientProtocolUtils.getStaticUI(doc);
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
83 final Node dynamicNode = ClientProtocolUtils.getDynamicUI(doc);
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
84 final Node reachable = ClientProtocolUtils.getReachableStates(doc);
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
85 final NodeList outputs = ClientProtocolUtils.getOutputModes(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:
diff changeset
86
9390
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
87 final String state = (String) XMLUtils.xpath(currentState, XPATH_STATE_NAME, XPathConstants.STRING, ArtifactNamespaceContext.INSTANCE);
1367
ab8eb2f544f2 Replaced stdout and stderr logging with log4j loggers in server classes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 839
diff changeset
88
8203
238fc722f87a sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7825
diff changeset
89 log.debug("Current state name: " + state);
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:
diff changeset
90
9390
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
91 final DataList currentData = extractCurrentData(dynamicNode, state);
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
92 final DataList[] old = extractOldData(staticNode);
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
93 final String[] states = extractReachableStates(reachable);
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
94 final OutputMode[] outs = extractOutputModes(outputs);
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
95 final Recommendation[] rec = extractRecommendedArtifacts(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:
diff changeset
96
9390
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
97 return new DefaultArtifactDescription(old, currentData, state, states, outs, rec);
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:
diff changeset
98 }
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:
diff changeset
99
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:
diff changeset
100 /**
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:
diff changeset
101 * This method extracts the data that the user is able to enter in the
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:
diff changeset
102 * current state of the 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:
diff changeset
103 *
9390
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
104 * @param dynamicNode
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
105 * The dynamic node of the DESCRIBE document.
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
106 * @param state
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
107 * The name of the current state.
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:
diff changeset
108 *
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:
diff changeset
109 * @return A {@link Data} object that represents the data which might be
9390
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
110 * entered by the user in the current state or null, if no data might be
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
111 * entered.
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:
diff changeset
112 */
9390
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
113 protected static DataList extractCurrentData(final Node dynamicNode, final String state) {
8203
238fc722f87a sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7825
diff changeset
114 log.debug("ArtifactDescriptionFactory.extractCurrentData");
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:
diff changeset
115
9390
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
116 final NodeList data = ClientProtocolUtils.getSelectNode(dynamicNode);
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
117 final String help = extractHelpText(dynamicNode);
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
118 final String uiProvider = extractUIProvider(dynamicNode);
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:
diff changeset
119
51
a2923d63f530 Introduced a data structure DataList to manage to list of Data objects of a single state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 37
diff changeset
120 if (data == null || data.getLength() == 0) {
a2923d63f530 Introduced a data structure DataList to manage to list of Data objects of a single state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 37
diff changeset
121 return null;
a2923d63f530 Introduced a data structure DataList to manage to list of Data objects of a single state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 37
diff changeset
122 }
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:
diff changeset
123
9390
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
124 final int dataNum = data.getLength();
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
125 final DataList list = new DataList(state, dataNum, uiProvider, null, help);
51
a2923d63f530 Introduced a data structure DataList to manage to list of Data objects of a single state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 37
diff changeset
126
a2923d63f530 Introduced a data structure DataList to manage to list of Data objects of a single state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 37
diff changeset
127 for (int i = 0; i < dataNum; i++) {
9390
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
128 final Element d = (Element) data.item(i);
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
129 final String label = ClientProtocolUtils.getLabel(d);
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
130 final String name = XMLUtils.xpathString(d, "@art:name", ArtifactNamespaceContext.INSTANCE);
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
131 final String type = XMLUtils.xpathString(d, "@art:type", ArtifactNamespaceContext.INSTANCE);
51
a2923d63f530 Introduced a data structure DataList to manage to list of Data objects of a single state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 37
diff changeset
132
8203
238fc722f87a sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7825
diff changeset
133 log.debug("Create new IntegerRangeData object for: " + name);
238fc722f87a sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7825
diff changeset
134 log.debug("New Data is from type: " + type);
51
a2923d63f530 Introduced a data structure DataList to manage to list of Data objects of a single state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 37
diff changeset
135
1592
f34bbb5fb6d2 Added TODO and handle dynamic data of unknown type.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1571
diff changeset
136 // TODO replace with DataFactory.
f34bbb5fb6d2 Added TODO and handle dynamic data of unknown type.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1571
diff changeset
137
1522
df9baca681a0 Added a new Data type IntegerRangeData that stores min and max integer values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1367
diff changeset
138 if (type == null || type.length() == 0) {
9390
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
139 final NodeList choices = ClientProtocolUtils.getItemNodes(d);
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
140 final DataItem[] dataItems = extractCurrentDataItems(choices);
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
141 final DataItem def = extractDefaultDataItem(d);
51
a2923d63f530 Introduced a data structure DataList to manage to list of Data objects of a single state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 37
diff changeset
142
1522
df9baca681a0 Added a new Data type IntegerRangeData that stores min and max integer values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1367
diff changeset
143 list.add(new DefaultData(name, label, null, dataItems, def));
9390
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
144 } else if (type.equals("intrange")) {
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
145 final String min = ClientProtocolUtils.getMinNode(d);
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
146 final String max = ClientProtocolUtils.getMaxNode(d);
1566
c408074c6409 Initialize the min and max fields in RangePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1527
diff changeset
147
9390
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
148 final String defMin = ClientProtocolUtils.getDefMin(d);
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
149 final String defMax = ClientProtocolUtils.getDefMax(d);
1522
df9baca681a0 Added a new Data type IntegerRangeData that stores min and max integer values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1367
diff changeset
150
df9baca681a0 Added a new Data type IntegerRangeData that stores min and max integer values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1367
diff changeset
151 try {
9390
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
152 final int lower = Integer.parseInt(min);
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
153 final int upper = Integer.parseInt(max);
4132
f6c73ee1b7f1 #543 Validate date range in client gauge time range selection state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3379
diff changeset
154
f6c73ee1b7f1 #543 Validate date range in client gauge time range selection state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3379
diff changeset
155 if (defMin != null && defMax != null) {
9390
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
156 list.add(new IntegerRangeData(name, label, lower, upper, Integer.parseInt(defMin), Integer.parseInt(defMax)));
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
157 } else {
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
158 list.add(new IntegerRangeData(name, label, lower, upper));
4132
f6c73ee1b7f1 #543 Validate date range in client gauge time range selection state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3379
diff changeset
159 }
f6c73ee1b7f1 #543 Validate date range in client gauge time range selection state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3379
diff changeset
160 }
9390
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
161 catch (final NumberFormatException nfe) {
8203
238fc722f87a sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7825
diff changeset
162 log.warn("NumberFormatException: ", nfe);
4132
f6c73ee1b7f1 #543 Validate date range in client gauge time range selection state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3379
diff changeset
163 }
9390
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
164 } else if (type.equals("longrange")) {
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
165 final String min = ClientProtocolUtils.getMinNode(d);
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
166 final String max = ClientProtocolUtils.getMaxNode(d);
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
167
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
168 final String defMin = ClientProtocolUtils.getDefMin(d);
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
169 final String defMax = ClientProtocolUtils.getDefMax(d);
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
170
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
171 try {
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
172 final long lower = Long.valueOf(min);
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
173 final long upper = Long.valueOf(max);
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
174
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
175 if (defMin != null && defMax != null) {
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
176 list.add(new LongRangeData(name, label, lower, upper, Long.valueOf(defMin), Long.valueOf(defMax)));
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
177 }
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
178 }
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
179 catch (final NumberFormatException nfe) {
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
180 log.warn("NumberFormatException: ", nfe);
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
181 }
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
182 } else if (type.equals("intarray")) {
1527
252c22237fe7 Added new Data classes for integer array and integer options.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1522
diff changeset
183 list.add(new IntegerArrayData(name, label, null));
9390
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
184 } else if (type.equals("intoptions") && uiProvider.startsWith("parameter-matrix")// uiProvider.equals("parameter-matrix") // what the...? used to be
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
185 // "equals", but column-name for "itemname" refactoring created new
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
186 // UIProviderFactory-Names starting with "parameter-matrix"
8856
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8203
diff changeset
187 ) {
2532
261347ea60b8 Added new Data type StringOptionsData; allow this Data type for ParameterMatrixPanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2521
diff changeset
188 list.add(DataFactory.createIntegerOptionsData(d, name, label));
9390
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
189 } else if (type.equals("options")) {
2532
261347ea60b8 Added new Data type StringOptionsData; allow this Data type for ParameterMatrixPanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2521
diff changeset
190 list.add(DataFactory.createStringOptionsData(d, name, label));
9390
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
191 } else if (type.equals("intoptions")) {
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
192 final NodeList choices = ClientProtocolUtils.getItemNodes(d);
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
193 final DataItem[] opts = extractCurrentDataItems(choices);
1527
252c22237fe7 Added new Data classes for integer array and integer options.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1522
diff changeset
194
252c22237fe7 Added new Data classes for integer array and integer options.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1522
diff changeset
195 list.add(new IntegerOptionsData(name, label, opts));
9390
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
196 } else if (type.equals("doublearray")) {
1595
e53d773e6992 Display inserted W/Q values in WQSimpleArrayPanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1593
diff changeset
197 list.add(new DoubleArrayData(name, label, null));
9390
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
198 } else if (type.equals("multiattribute")) {
7825
b9decb8bfb21 Added the new multiattribute data type.
Raimund Renkert <rrenkert@intevation.de>
parents: 6136
diff changeset
199 list.add(DataFactory.createMultiAttributeData(d, name, label));
9390
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
200 } else {
8203
238fc722f87a sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7825
diff changeset
201 log.warn("Unrecognized Dynamic data type.");
9390
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
202 final NodeList choices = ClientProtocolUtils.getItemNodes(d);
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
203 final DataItem[] dataItems = extractCurrentDataItems(choices);
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
204 final DataItem def = extractDefaultDataItem(d);
1592
f34bbb5fb6d2 Added TODO and handle dynamic data of unknown type.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1571
diff changeset
205
9390
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
206 final String min = ClientProtocolUtils.getMinNode(d);
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
207 final String max = ClientProtocolUtils.getMaxNode(d);
1593
ff9d71469b7c Adjusted to be able to feed data to reference curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1592
diff changeset
208 if (min != null && max != null) {
9390
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
209 list.add(new DoubleRangeData(name, label, Double.valueOf(min), Double.valueOf(max), Double.valueOf(min), Double.valueOf(max)));
1593
ff9d71469b7c Adjusted to be able to feed data to reference curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1592
diff changeset
210 }
ff9d71469b7c Adjusted to be able to feed data to reference curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1592
diff changeset
211
1592
f34bbb5fb6d2 Added TODO and handle dynamic data of unknown type.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1571
diff changeset
212 list.add(new DefaultData(name, label, null, dataItems, def));
f34bbb5fb6d2 Added TODO and handle dynamic data of unknown type.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1571
diff changeset
213 }
f34bbb5fb6d2 Added TODO and handle dynamic data of unknown type.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1571
diff changeset
214
51
a2923d63f530 Introduced a data structure DataList to manage to list of Data objects of a single state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 37
diff changeset
215 }
a2923d63f530 Introduced a data structure DataList to manage to list of Data objects of a single state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 37
diff changeset
216
a2923d63f530 Introduced a data structure DataList to manage to list of Data objects of a single state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 37
diff changeset
217 return list;
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:
diff changeset
218 }
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:
diff changeset
219
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:
diff changeset
220 /**
515
27ffaf628b54 The default values/labels for Data objects are read from DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 65
diff changeset
221 * This method extracts the default value of a Data object.
27ffaf628b54 The default values/labels for Data objects are read from DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 65
diff changeset
222 *
9390
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
223 * @param data
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
224 * The data object node.
515
27ffaf628b54 The default values/labels for Data objects are read from DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 65
diff changeset
225 *
27ffaf628b54 The default values/labels for Data objects are read from DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 65
diff changeset
226 * @return the default DataItem.
27ffaf628b54 The default values/labels for Data objects are read from DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 65
diff changeset
227 */
9390
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
228 protected static DataItem extractDefaultDataItem(final Node data) {
8203
238fc722f87a sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7825
diff changeset
229 log.debug("ArtifactDescriptionFactory.extractDefaultDataItem");
515
27ffaf628b54 The default values/labels for Data objects are read from DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 65
diff changeset
230
9390
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
231 final String value = XMLUtils.xpathString(data, "@art:defaultValue", ArtifactNamespaceContext.INSTANCE);
515
27ffaf628b54 The default values/labels for Data objects are read from DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 65
diff changeset
232
9390
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
233 final String label = XMLUtils.xpathString(data, "@art:defaultLabel", ArtifactNamespaceContext.INSTANCE);
515
27ffaf628b54 The default values/labels for Data objects are read from DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 65
diff changeset
234
27ffaf628b54 The default values/labels for Data objects are read from DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 65
diff changeset
235 if (value != null && label != null) {
27ffaf628b54 The default values/labels for Data objects are read from DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 65
diff changeset
236 return new DefaultDataItem(label, null, value);
27ffaf628b54 The default values/labels for Data objects are read from DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 65
diff changeset
237 }
27ffaf628b54 The default values/labels for Data objects are read from DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 65
diff changeset
238
27ffaf628b54 The default values/labels for Data objects are read from DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 65
diff changeset
239 return null;
27ffaf628b54 The default values/labels for Data objects are read from DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 65
diff changeset
240 }
27ffaf628b54 The default values/labels for Data objects are read from DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 65
diff changeset
241
27ffaf628b54 The default values/labels for Data objects are read from DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 65
diff changeset
242 /**
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:
diff changeset
243 * This method extract the {@link DataItem}s of the DESCRIBE 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:
diff changeset
244 *
9390
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
245 * @param items
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
246 * The items in the DESCRIBE document.
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:
diff changeset
247 *
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:
diff changeset
248 * @return the {@link DataItem}s.
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:
diff changeset
249 */
9390
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
250 protected static DataItem[] extractCurrentDataItems(final NodeList items) {
8203
238fc722f87a sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7825
diff changeset
251 log.debug("ArtifactDescriptionFactory.extractCurrentDataItems");
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:
diff changeset
252
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:
diff changeset
253 if (items == null || items.getLength() == 0) {
8203
238fc722f87a sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7825
diff changeset
254 log.debug("No data items found.");
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:
diff changeset
255 return null;
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:
diff changeset
256 }
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:
diff changeset
257
9390
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
258 final int count = items.getLength();
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:
diff changeset
259
9390
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
260 final List<DataItem> dataItems = new ArrayList<DataItem>(count);
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:
diff changeset
261
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:
diff changeset
262 for (int i = 0; i < count; i++) {
9390
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
263 final Node item = items.item(i);
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
264 final String label = ClientProtocolUtils.getLabel(item);
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
265 final String value = ClientProtocolUtils.getValue(item);
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:
diff changeset
266
9390
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
267 final double[] mmQ = extractMinMaxQValues(item);
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
268 final double[] mmW = extractMinMaxWValues(item);
565
a078ba1c139d Introduced a client side input validation for the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 515
diff changeset
269
a078ba1c139d Introduced a client side input validation for the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 515
diff changeset
270 if (mmQ != null || mmW != null) {
a078ba1c139d Introduced a client side input validation for the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 515
diff changeset
271 dataItems.add(new WQDataItem(label, null, value, mmQ, mmW));
9390
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
272 } else {
565
a078ba1c139d Introduced a client side input validation for the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 515
diff changeset
273 dataItems.add(new DefaultDataItem(label, null, value));
a078ba1c139d Introduced a client side input validation for the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 515
diff changeset
274 }
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:
diff changeset
275 }
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:
diff changeset
276
3379
0de61fc9d281 Removed some superfluous casts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2532
diff changeset
277 return dataItems.toArray(new DataItem[count]);
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:
diff changeset
278 }
22
a85bac235069 Implemented code to parse the UIProvider that should be used for a current state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 16
diff changeset
279
9390
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
280 protected static double[] extractMinMaxQValues(final Node item) {
8203
238fc722f87a sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7825
diff changeset
281 log.debug("ArtifactDescriptionFactory.extractMinMaxQValues");
565
a078ba1c139d Introduced a client side input validation for the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 515
diff changeset
282
a078ba1c139d Introduced a client side input validation for the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 515
diff changeset
283 if (item == null) {
8203
238fc722f87a sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7825
diff changeset
284 log.debug("This node is empty - no min/max Q values.");
565
a078ba1c139d Introduced a client side input validation for the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 515
diff changeset
285 return null;
a078ba1c139d Introduced a client side input validation for the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 515
diff changeset
286 }
a078ba1c139d Introduced a client side input validation for the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 515
diff changeset
287
9390
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
288 final Node node = (Node) XMLUtils.xpath(item, "art:range[@art:type='Q']", XPathConstants.NODE, ArtifactNamespaceContext.INSTANCE);
565
a078ba1c139d Introduced a client side input validation for the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 515
diff changeset
289
a078ba1c139d Introduced a client side input validation for the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 515
diff changeset
290 if (node == null) {
8203
238fc722f87a sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7825
diff changeset
291 log.debug("No min/max Q values found.");
565
a078ba1c139d Introduced a client side input validation for the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 515
diff changeset
292 return null;
a078ba1c139d Introduced a client side input validation for the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 515
diff changeset
293 }
a078ba1c139d Introduced a client side input validation for the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 515
diff changeset
294
a078ba1c139d Introduced a client side input validation for the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 515
diff changeset
295 return extractMinMaxValues(node);
a078ba1c139d Introduced a client side input validation for the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 515
diff changeset
296 }
a078ba1c139d Introduced a client side input validation for the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 515
diff changeset
297
9390
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
298 protected static double[] extractMinMaxWValues(final Node item) {
8203
238fc722f87a sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7825
diff changeset
299 log.debug("ArtifactDescriptionFactory.extractMinMaxWValues");
565
a078ba1c139d Introduced a client side input validation for the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 515
diff changeset
300
a078ba1c139d Introduced a client side input validation for the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 515
diff changeset
301 if (item == null) {
8203
238fc722f87a sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7825
diff changeset
302 log.debug("This node is empty - no min/max W values.");
565
a078ba1c139d Introduced a client side input validation for the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 515
diff changeset
303 return null;
a078ba1c139d Introduced a client side input validation for the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 515
diff changeset
304 }
a078ba1c139d Introduced a client side input validation for the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 515
diff changeset
305
9390
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
306 final Node node = (Node) XMLUtils.xpath(item, "art:range[@art:type='W']", XPathConstants.NODE, ArtifactNamespaceContext.INSTANCE);
565
a078ba1c139d Introduced a client side input validation for the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 515
diff changeset
307
a078ba1c139d Introduced a client side input validation for the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 515
diff changeset
308 if (node == null) {
8203
238fc722f87a sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7825
diff changeset
309 log.debug("No min/max W values found.");
565
a078ba1c139d Introduced a client side input validation for the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 515
diff changeset
310 return null;
a078ba1c139d Introduced a client side input validation for the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 515
diff changeset
311 }
a078ba1c139d Introduced a client side input validation for the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 515
diff changeset
312
a078ba1c139d Introduced a client side input validation for the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 515
diff changeset
313 return extractMinMaxValues(node);
a078ba1c139d Introduced a client side input validation for the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 515
diff changeset
314 }
a078ba1c139d Introduced a client side input validation for the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 515
diff changeset
315
9390
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
316 protected static double[] extractMinMaxValues(final Node node) {
8203
238fc722f87a sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7825
diff changeset
317 log.debug("ArtifactDescriptionFactory.extractMinMaxValues");
565
a078ba1c139d Introduced a client side input validation for the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 515
diff changeset
318
9390
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
319 final String minStr = XMLUtils.xpathString(node, "art:min/text()", ArtifactNamespaceContext.INSTANCE);
565
a078ba1c139d Introduced a client side input validation for the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 515
diff changeset
320
9390
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
321 final String maxStr = XMLUtils.xpathString(node, "art:max/text()", ArtifactNamespaceContext.INSTANCE);
565
a078ba1c139d Introduced a client side input validation for the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 515
diff changeset
322
a078ba1c139d Introduced a client side input validation for the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 515
diff changeset
323 if (maxStr == null || minStr == null) {
8203
238fc722f87a sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7825
diff changeset
324 log.debug("No min/max values found.");
565
a078ba1c139d Introduced a client side input validation for the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 515
diff changeset
325 return null;
a078ba1c139d Introduced a client side input validation for the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 515
diff changeset
326 }
a078ba1c139d Introduced a client side input validation for the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 515
diff changeset
327
a078ba1c139d Introduced a client side input validation for the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 515
diff changeset
328 try {
9390
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
329 final double min = Double.valueOf(minStr);
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
330 final double max = Double.valueOf(maxStr);
565
a078ba1c139d Introduced a client side input validation for the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 515
diff changeset
331
a078ba1c139d Introduced a client side input validation for the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 515
diff changeset
332 return new double[] { min, max };
a078ba1c139d Introduced a client side input validation for the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 515
diff changeset
333 }
9390
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
334 catch (final NumberFormatException nfe) {
8203
238fc722f87a sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7825
diff changeset
335 log.debug("Error while parsing min/max values.");
565
a078ba1c139d Introduced a client side input validation for the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 515
diff changeset
336 }
a078ba1c139d Introduced a client side input validation for the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 515
diff changeset
337
a078ba1c139d Introduced a client side input validation for the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 515
diff changeset
338 return null;
a078ba1c139d Introduced a client side input validation for the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 515
diff changeset
339 }
a078ba1c139d Introduced a client side input validation for the adapted WQ panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 515
diff changeset
340
22
a85bac235069 Implemented code to parse the UIProvider that should be used for a current state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 16
diff changeset
341 /**
34
bf84bcd4e11b Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 32
diff changeset
342 * This method extracts the data objects from the data node of the static ui
bf84bcd4e11b Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 32
diff changeset
343 * part of the DESCRIBE document.
bf84bcd4e11b Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 32
diff changeset
344 *
9390
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
345 * @param staticNode
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
346 * The static ui node of the DESCRIBE.
34
bf84bcd4e11b Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 32
diff changeset
347 *
51
a2923d63f530 Introduced a data structure DataList to manage to list of Data objects of a single state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 37
diff changeset
348 * @return the DataList objects.
34
bf84bcd4e11b Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 32
diff changeset
349 */
9390
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
350 protected static DataList[] extractOldData(final Node staticNode) {
8203
238fc722f87a sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7825
diff changeset
351 log.debug("ArtifactDescriptionFactory.extractOldData()");
34
bf84bcd4e11b Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 32
diff changeset
352
9390
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
353 final NodeList stateNodes = (NodeList) XMLUtils.xpath(staticNode, XPATH_STATIC_STATE_NODE, XPathConstants.NODESET, ArtifactNamespaceContext.INSTANCE);
34
bf84bcd4e11b Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 32
diff changeset
354
51
a2923d63f530 Introduced a data structure DataList to manage to list of Data objects of a single state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 37
diff changeset
355 if (stateNodes == null || stateNodes.getLength() == 0) {
8203
238fc722f87a sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7825
diff changeset
356 log.debug("No old items found.");
34
bf84bcd4e11b Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 32
diff changeset
357 return null;
bf84bcd4e11b Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 32
diff changeset
358 }
bf84bcd4e11b Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 32
diff changeset
359
9390
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
360 final int count = stateNodes.getLength();
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
361 final DataList[] data = new DataList[count];
34
bf84bcd4e11b Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 32
diff changeset
362
bf84bcd4e11b Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 32
diff changeset
363 for (int i = 0; i < count; i++) {
9390
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
364 final Node tmp = stateNodes.item(i);
34
bf84bcd4e11b Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 32
diff changeset
365
9390
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
366 final String name = XMLUtils.xpathString(tmp, "@art:name", ArtifactNamespaceContext.INSTANCE);
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
367 final String uiprovider = XMLUtils.xpathString(tmp, "@art:uiprovider", ArtifactNamespaceContext.INSTANCE);
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
368 final String label = XMLUtils.xpathString(tmp, "@art:label", ArtifactNamespaceContext.INSTANCE);
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
369 final String help = XMLUtils.xpathString(tmp, "@art:helpText", ArtifactNamespaceContext.INSTANCE);
34
bf84bcd4e11b Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 32
diff changeset
370
9390
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
371 final NodeList dataNodes = (NodeList) XMLUtils.xpath(tmp, XPATH_STATIC_DATA_NODE, XPathConstants.NODESET, ArtifactNamespaceContext.INSTANCE);
34
bf84bcd4e11b Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 32
diff changeset
372
51
a2923d63f530 Introduced a data structure DataList to manage to list of Data objects of a single state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 37
diff changeset
373 if (dataNodes == null || dataNodes.getLength() == 0) {
a2923d63f530 Introduced a data structure DataList to manage to list of Data objects of a single state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 37
diff changeset
374 continue;
a2923d63f530 Introduced a data structure DataList to manage to list of Data objects of a single state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 37
diff changeset
375 }
a2923d63f530 Introduced a data structure DataList to manage to list of Data objects of a single state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 37
diff changeset
376
9390
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
377 final int size = dataNodes.getLength();
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
378 final DataList list = new DataList(name, size, uiprovider, label, help);
51
a2923d63f530 Introduced a data structure DataList to manage to list of Data objects of a single state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 37
diff changeset
379
a2923d63f530 Introduced a data structure DataList to manage to list of Data objects of a single state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 37
diff changeset
380 for (int j = 0; j < size; j++) {
9390
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
381 final Node dataNode = dataNodes.item(j);
51
a2923d63f530 Introduced a data structure DataList to manage to list of Data objects of a single state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 37
diff changeset
382
1571
1227878665b5 Introduced a DataFactory that should be used to create new Data instances.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1566
diff changeset
383 list.add(DataFactory.createDataFromElement((Element) dataNode));
51
a2923d63f530 Introduced a data structure DataList to manage to list of Data objects of a single state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 37
diff changeset
384
a2923d63f530 Introduced a data structure DataList to manage to list of Data objects of a single state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 37
diff changeset
385 data[i] = list;
a2923d63f530 Introduced a data structure DataList to manage to list of Data objects of a single state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 37
diff changeset
386 }
34
bf84bcd4e11b Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 32
diff changeset
387 }
bf84bcd4e11b Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 32
diff changeset
388
bf84bcd4e11b Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 32
diff changeset
389 return data;
bf84bcd4e11b Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 32
diff changeset
390 }
bf84bcd4e11b Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 32
diff changeset
391
bf84bcd4e11b Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 32
diff changeset
392 /**
22
a85bac235069 Implemented code to parse the UIProvider that should be used for a current state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 16
diff changeset
393 * This method extracts the UIProvider specified by the data node.
a85bac235069 Implemented code to parse the UIProvider that should be used for a current state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 16
diff changeset
394 *
9390
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
395 * @param data
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
396 * The data node.
22
a85bac235069 Implemented code to parse the UIProvider that should be used for a current state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 16
diff changeset
397 *
a85bac235069 Implemented code to parse the UIProvider that should be used for a current state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 16
diff changeset
398 * @return the UIProvider that is specified in the data node.
a85bac235069 Implemented code to parse the UIProvider that should be used for a current state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 16
diff changeset
399 */
9390
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
400 protected static String extractUIProvider(final Node ui) {
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
401 return (String) XMLUtils.xpath(ui, XPATH_UIPROVIDER, XPathConstants.STRING, ArtifactNamespaceContext.INSTANCE);
22
a85bac235069 Implemented code to parse the UIProvider that should be used for a current state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 16
diff changeset
402 }
32
88c530c25968 Added a service for the ADVANCE operation and a service that bundles FEED and ADVANCE in a single service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 22
diff changeset
403
88c530c25968 Added a service for the ADVANCE operation and a service that bundles FEED and ADVANCE in a single service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 22
diff changeset
404 /**
2500
69a498896c9c Create a link to an online help page and put it in front of the input panels.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1595
diff changeset
405 * This method extracts the help text specified by the data node.
69a498896c9c Create a link to an online help page and put it in front of the input panels.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1595
diff changeset
406 *
9390
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
407 * @param ui
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
408 * The data node.
2500
69a498896c9c Create a link to an online help page and put it in front of the input panels.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1595
diff changeset
409 *
69a498896c9c Create a link to an online help page and put it in front of the input panels.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1595
diff changeset
410 * @return the help text.
69a498896c9c Create a link to an online help page and put it in front of the input panels.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1595
diff changeset
411 */
9390
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
412 protected static String extractHelpText(final Node ui) {
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
413 return (String) XMLUtils.xpath(ui, XPATH_HELP_TEXT, XPathConstants.STRING, ArtifactNamespaceContext.INSTANCE);
2500
69a498896c9c Create a link to an online help page and put it in front of the input panels.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1595
diff changeset
414 }
69a498896c9c Create a link to an online help page and put it in front of the input panels.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1595
diff changeset
415
69a498896c9c Create a link to an online help page and put it in front of the input panels.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1595
diff changeset
416 /**
32
88c530c25968 Added a service for the ADVANCE operation and a service that bundles FEED and ADVANCE in a single service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 22
diff changeset
417 * This method extracts the reachable states of the current artifact.
88c530c25968 Added a service for the ADVANCE operation and a service that bundles FEED and ADVANCE in a single service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 22
diff changeset
418 *
9390
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
419 * @param reachable
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
420 * The reachable states node.
32
88c530c25968 Added a service for the ADVANCE operation and a service that bundles FEED and ADVANCE in a single service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 22
diff changeset
421 *
88c530c25968 Added a service for the ADVANCE operation and a service that bundles FEED and ADVANCE in a single service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 22
diff changeset
422 * @return an array with identifiers of reachable states.
88c530c25968 Added a service for the ADVANCE operation and a service that bundles FEED and ADVANCE in a single service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 22
diff changeset
423 */
9390
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
424 protected static String[] extractReachableStates(final Node reachable) {
8203
238fc722f87a sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7825
diff changeset
425 log.debug("ArtifactDescriptionFactory.extractReachableStates()");
32
88c530c25968 Added a service for the ADVANCE operation and a service that bundles FEED and ADVANCE in a single service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 22
diff changeset
426
9390
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
427 final NodeList list = (NodeList) XMLUtils.xpath(reachable, XPATH_REACHABLE_STATE, XPathConstants.NODESET, ArtifactNamespaceContext.INSTANCE);
32
88c530c25968 Added a service for the ADVANCE operation and a service that bundles FEED and ADVANCE in a single service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 22
diff changeset
428
88c530c25968 Added a service for the ADVANCE operation and a service that bundles FEED and ADVANCE in a single service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 22
diff changeset
429 if (list == null || list.getLength() == 0) {
88c530c25968 Added a service for the ADVANCE operation and a service that bundles FEED and ADVANCE in a single service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 22
diff changeset
430 return null;
88c530c25968 Added a service for the ADVANCE operation and a service that bundles FEED and ADVANCE in a single service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 22
diff changeset
431 }
88c530c25968 Added a service for the ADVANCE operation and a service that bundles FEED and ADVANCE in a single service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 22
diff changeset
432
9390
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
433 final int count = list.getLength();
32
88c530c25968 Added a service for the ADVANCE operation and a service that bundles FEED and ADVANCE in a single service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 22
diff changeset
434
9390
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
435 final String[] states = new String[count];
32
88c530c25968 Added a service for the ADVANCE operation and a service that bundles FEED and ADVANCE in a single service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 22
diff changeset
436
88c530c25968 Added a service for the ADVANCE operation and a service that bundles FEED and ADVANCE in a single service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 22
diff changeset
437 for (int i = 0; i < count; i++) {
9390
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
438 final Node state = list.item(i);
32
88c530c25968 Added a service for the ADVANCE operation and a service that bundles FEED and ADVANCE in a single service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 22
diff changeset
439
9390
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
440 final String name = XMLUtils.xpathString(state, "@art:name", ArtifactNamespaceContext.INSTANCE);
32
88c530c25968 Added a service for the ADVANCE operation and a service that bundles FEED and ADVANCE in a single service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 22
diff changeset
441
88c530c25968 Added a service for the ADVANCE operation and a service that bundles FEED and ADVANCE in a single service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 22
diff changeset
442 states[i] = name;
88c530c25968 Added a service for the ADVANCE operation and a service that bundles FEED and ADVANCE in a single service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 22
diff changeset
443 }
88c530c25968 Added a service for the ADVANCE operation and a service that bundles FEED and ADVANCE in a single service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 22
diff changeset
444
88c530c25968 Added a service for the ADVANCE operation and a service that bundles FEED and ADVANCE in a single service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 22
diff changeset
445 return states;
88c530c25968 Added a service for the ADVANCE operation and a service that bundles FEED and ADVANCE in a single service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 22
diff changeset
446 }
65
8f719fa1a691 The output modes of an artifact are extracted from DESCRIBE document and put into the ArtifactDescription.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 61
diff changeset
447
8f719fa1a691 The output modes of an artifact are extracted from DESCRIBE document and put into the ArtifactDescription.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 61
diff changeset
448 /**
8f719fa1a691 The output modes of an artifact are extracted from DESCRIBE document and put into the ArtifactDescription.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 61
diff changeset
449 * This method extract available output modes of the the current artifact.
8f719fa1a691 The output modes of an artifact are extracted from DESCRIBE document and put into the ArtifactDescription.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 61
diff changeset
450 *
9390
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
451 * @param outputs
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
452 * A list of nodes that contain information about output
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
453 * modes.
65
8f719fa1a691 The output modes of an artifact are extracted from DESCRIBE document and put into the ArtifactDescription.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 61
diff changeset
454 *
8f719fa1a691 The output modes of an artifact are extracted from DESCRIBE document and put into the ArtifactDescription.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 61
diff changeset
455 * @return an array of Output modes.
8f719fa1a691 The output modes of an artifact are extracted from DESCRIBE document and put into the ArtifactDescription.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 61
diff changeset
456 */
9390
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
457 protected static OutputMode[] extractOutputModes(final NodeList outputs) {
8203
238fc722f87a sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7825
diff changeset
458 log.debug("ArtifactDescriptionFactory.extractOutputModes");
65
8f719fa1a691 The output modes of an artifact are extracted from DESCRIBE document and put into the ArtifactDescription.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 61
diff changeset
459
8f719fa1a691 The output modes of an artifact are extracted from DESCRIBE document and put into the ArtifactDescription.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 61
diff changeset
460 if (outputs == null || outputs.getLength() == 0) {
8f719fa1a691 The output modes of an artifact are extracted from DESCRIBE document and put into the ArtifactDescription.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 61
diff changeset
461 return null;
8f719fa1a691 The output modes of an artifact are extracted from DESCRIBE document and put into the ArtifactDescription.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 61
diff changeset
462 }
8f719fa1a691 The output modes of an artifact are extracted from DESCRIBE document and put into the ArtifactDescription.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 61
diff changeset
463
9390
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
464 final int size = outputs.getLength();
65
8f719fa1a691 The output modes of an artifact are extracted from DESCRIBE document and put into the ArtifactDescription.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 61
diff changeset
465
9390
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
466 final List<OutputMode> outs = new ArrayList<OutputMode>(size);
65
8f719fa1a691 The output modes of an artifact are extracted from DESCRIBE document and put into the ArtifactDescription.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 61
diff changeset
467
8f719fa1a691 The output modes of an artifact are extracted from DESCRIBE document and put into the ArtifactDescription.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 61
diff changeset
468 for (int i = 0; i < size; i++) {
9390
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
469 final Node out = outputs.item(i);
65
8f719fa1a691 The output modes of an artifact are extracted from DESCRIBE document and put into the ArtifactDescription.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 61
diff changeset
470
9390
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
471 final String name = XMLUtils.xpathString(out, "@art:name", ArtifactNamespaceContext.INSTANCE);
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
472 final String desc = XMLUtils.xpathString(out, "@art:description", ArtifactNamespaceContext.INSTANCE);
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
473 final String mimeType = XMLUtils.xpathString(out, "@art:mime-type", ArtifactNamespaceContext.INSTANCE);
65
8f719fa1a691 The output modes of an artifact are extracted from DESCRIBE document and put into the ArtifactDescription.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 61
diff changeset
474
8f719fa1a691 The output modes of an artifact are extracted from DESCRIBE document and put into the ArtifactDescription.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 61
diff changeset
475 if (name != null) {
8f719fa1a691 The output modes of an artifact are extracted from DESCRIBE document and put into the ArtifactDescription.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 61
diff changeset
476 outs.add(new DefaultOutputMode(name, desc, mimeType));
9390
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
477 } else {
8203
238fc722f87a sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7825
diff changeset
478 log.debug("Found an invalid output mode.");
65
8f719fa1a691 The output modes of an artifact are extracted from DESCRIBE document and put into the ArtifactDescription.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 61
diff changeset
479 }
8f719fa1a691 The output modes of an artifact are extracted from DESCRIBE document and put into the ArtifactDescription.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 61
diff changeset
480 }
8f719fa1a691 The output modes of an artifact are extracted from DESCRIBE document and put into the ArtifactDescription.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 61
diff changeset
481
9390
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
482 return outs.toArray(new OutputMode[size]);
65
8f719fa1a691 The output modes of an artifact are extracted from DESCRIBE document and put into the ArtifactDescription.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 61
diff changeset
483 }
803
653ae84533e7 Read/create recommended Artifacts and add them to the current Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 565
diff changeset
484
9390
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
485 protected static Recommendation[] extractRecommendedArtifacts(final Document doc) {
8203
238fc722f87a sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7825
diff changeset
486 log.debug("ArtifactDescriptionFactory.extractRecommendedArtifacts.");
803
653ae84533e7 Read/create recommended Artifacts and add them to the current Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 565
diff changeset
487
9390
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
488 final NodeList list = (NodeList) XMLUtils.xpath(doc, XPATH_RECOMMENDED_ARTIFACTS, XPathConstants.NODESET, ArtifactNamespaceContext.INSTANCE);
803
653ae84533e7 Read/create recommended Artifacts and add them to the current Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 565
diff changeset
489
9390
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
490 final int num = list != null ? list.getLength() : 0;
803
653ae84533e7 Read/create recommended Artifacts and add them to the current Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 565
diff changeset
491
9390
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
492 final Recommendation[] rec = new Recommendation[num];
803
653ae84533e7 Read/create recommended Artifacts and add them to the current Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 565
diff changeset
493
653ae84533e7 Read/create recommended Artifacts and add them to the current Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 565
diff changeset
494 for (int i = 0; i < num; i++) {
9390
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
495 final Element e = (Element) list.item(i);
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
496 final String factory = e.getAttribute("factory");
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
497 final String index = e.getAttribute("ids");
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
498 final String targetOut = e.getAttribute("target_out");
803
653ae84533e7 Read/create recommended Artifacts and add them to the current Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 565
diff changeset
499
807
6f65e70fa11d Repaired broken recommendation parsing from Artifact's DESCRIBE document (which structure has changed).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 803
diff changeset
500 if (factory != null && factory.length() > 0) {
9390
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
501 log.debug("Adding Recommendation. Factory: " + factory + " IDs: " + index + " target out " + targetOut);
f575ff573cbb "Name der Peilung" columname minfo.
gernotbelger
parents: 8856
diff changeset
502 rec[i] = new Recommendation(factory, index, null, null, targetOut);
803
653ae84533e7 Read/create recommended Artifacts and add them to the current Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 565
diff changeset
503 }
653ae84533e7 Read/create recommended Artifacts and add them to the current Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 565
diff changeset
504 }
653ae84533e7 Read/create recommended Artifacts and add them to the current Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 565
diff changeset
505
807
6f65e70fa11d Repaired broken recommendation parsing from Artifact's DESCRIBE document (which structure has changed).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 803
diff changeset
506 return rec;
803
653ae84533e7 Read/create recommended Artifacts and add them to the current Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 565
diff changeset
507 }
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:
diff changeset
508 }
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:
diff changeset
509 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org