Mercurial > dive4elements > river
annotate flys-client/src/main/java/de/intevation/flys/client/server/ArtifactDescriptionFactory.java @ 215:e02f50a3ad59
Improved the exception handling of artifact / collection specific operations. Warning dialog are displayed after such an exception.
flys-client/trunk@1657 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Fri, 08 Apr 2011 08:51:28 +0000 |
parents | 8f719fa1a691 |
children | 27ffaf628b54 |
rev | line source |
---|---|
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
|
1 package de.intevation.flys.client.server; |
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
|
2 |
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
|
3 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
|
4 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
|
5 |
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
|
6 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
|
7 |
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
|
8 import org.w3c.dom.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
|
9 import org.w3c.dom.Node; |
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 import org.w3c.dom.NodeList; |
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 |
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 de.intevation.artifacts.common.ArtifactNamespaceContext; |
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 import de.intevation.artifacts.common.utils.ClientProtocolUtils; |
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 de.intevation.artifacts.common.utils.XMLUtils; |
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 |
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
|
16 import de.intevation.flys.client.shared.model.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
|
17 import de.intevation.flys.client.shared.model.DataItem; |
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
|
18 import de.intevation.flys.client.shared.model.DataList; |
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
|
19 import de.intevation.flys.client.shared.model.DefaultArtifactDescription; |
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
|
20 import de.intevation.flys.client.shared.model.DefaultData; |
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
|
21 import de.intevation.flys.client.shared.model.DefaultDataItem; |
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
|
22 import de.intevation.flys.client.shared.model.DefaultOutputMode; |
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
|
23 import de.intevation.flys.client.shared.model.OutputMode; |
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
|
24 |
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
|
25 |
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
|
26 /** |
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
|
27 * 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
|
28 * 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
|
29 * {@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
|
30 * 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
|
31 * |
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
|
32 * @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
|
33 */ |
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
|
34 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
|
35 |
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
|
36 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
|
37 |
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
|
38 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
|
39 |
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
|
40 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
|
41 |
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
|
42 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
|
43 |
34
bf84bcd4e11b
Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
32
diff
changeset
|
44 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
|
45 |
bf84bcd4e11b
Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
32
diff
changeset
|
46 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
|
47 |
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
|
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 * 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
|
50 * 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
|
51 * |
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
|
52 * @param doc A 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
|
53 * |
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 * @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
|
55 */ |
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
|
56 public static ArtifactDescription createArtifactDescription(Document doc) { |
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
|
57 System.out.println("ArtifactDescriptionFactory - create()"); |
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
|
58 |
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
|
59 Node currentState = ClientProtocolUtils.getCurrentState(doc); |
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
|
60 Node staticNode = ClientProtocolUtils.getStaticUI(doc); |
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
|
61 Node dynamicNode = ClientProtocolUtils.getDynamicUI(doc); |
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
|
62 Node reachable = ClientProtocolUtils.getReachableStates(doc); |
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
|
63 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
|
64 |
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
|
65 String state = (String) XMLUtils.xpath( |
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
|
66 currentState, |
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
|
67 XPATH_STATE_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
|
68 XPathConstants.STRING, |
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 ArtifactNamespaceContext.INSTANCE); |
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 System.out.println("Current state name: " + state); |
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 |
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
|
72 DataList currentData = extractCurrentData(dynamicNode, 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
|
73 DataList[] old = extractOldData(staticNode); |
34
bf84bcd4e11b
Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
32
diff
changeset
|
74 String[] states = extractReachableStates(reachable); |
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
|
75 OutputMode[] outs = extractOutputModes(outputs); |
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
|
76 |
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
|
77 return new DefaultArtifactDescription( |
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
|
78 old, |
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
|
79 currentData, |
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
|
80 state, |
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
|
81 states, |
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
|
82 outs); |
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
|
83 } |
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
|
84 |
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
|
85 |
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 /** |
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
|
87 * 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
|
88 * 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
|
89 * |
f8a5f2c5e2b7
The DESCRIBE document returned by the artifact server is parsed after calling create() of the artifact service and a new Artifact is created with an ArtifactDescription that contains the UUID, HASH, und the current Data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
90 * @param dynamicNode The dynamic node of the DESCRIBE document. |
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
|
91 * @param state 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
|
92 * |
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
|
93 * @return A {@link Data} object that represents the data which might be |
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
|
94 * entered by the user in the current state or null, if no data might be |
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
|
95 * entered. |
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 */ |
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
|
97 protected static DataList extractCurrentData(Node dynamicNode, String 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
|
98 System.out.println("ArtifactDescriptionFactory - extractCurrentData()"); |
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 |
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
|
100 NodeList data = ClientProtocolUtils.getSelectNode(dynamicNode); |
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
|
101 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
|
102 |
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
|
103 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
|
104 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
|
105 } |
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
|
106 |
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
|
107 int dataNum = data.getLength(); |
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
|
108 DataList list = new DataList(state, dataNum, uiProvider); |
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
|
109 |
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
|
110 for (int i = 0; i < dataNum; i++) { |
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
|
111 Node d = data.item(i); |
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
|
112 |
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
|
113 NodeList choices = ClientProtocolUtils.getItemNodes(d); |
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
|
114 String label = ClientProtocolUtils.getLabel(d); |
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
|
115 String name = XMLUtils.xpathString( |
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
|
116 d, "@art:name", ArtifactNamespaceContext.INSTANCE); |
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
|
117 |
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
|
118 DataItem[] dataItems = extractCurrentDataItems(choices); |
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
|
119 |
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 list.add(new DefaultData(name, label, null, dataItems)); |
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 } |
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 |
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
|
123 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
|
124 } |
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
|
125 |
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
|
126 |
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
|
127 /** |
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
|
128 * 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
|
129 * |
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
|
130 * @param items The items in 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
|
131 * |
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
|
132 * @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
|
133 */ |
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
|
134 protected static DataItem[] extractCurrentDataItems(NodeList items) { |
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
|
135 System.out.println( |
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
|
136 "ArtifactDescriptionFactory - extractCurrentDataItems()"); |
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
|
137 |
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
|
138 if (items == null || items.getLength() == 0) { |
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
|
139 System.out.println("No data items found."); |
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
|
140 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
|
141 } |
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
|
142 |
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
|
143 int count = items.getLength(); |
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
|
144 |
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
|
145 List<DataItem> dataItems = new ArrayList<DataItem>(count); |
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
|
146 |
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
|
147 for (int i = 0; i < count; 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
|
148 Node item = items.item(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
|
149 String label = ClientProtocolUtils.getLabel(item); |
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
|
150 String value = ClientProtocolUtils.getValue(item); |
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
|
151 |
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
|
152 dataItems.add(new DefaultDataItem(label, null, value)); |
f8a5f2c5e2b7
The DESCRIBE document returned by the artifact server is parsed after calling create() of the artifact service and a new Artifact is created with an ArtifactDescription that contains the UUID, HASH, und the current Data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
153 } |
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
|
154 |
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
|
155 return (DataItem[]) dataItems.toArray(new DataItem[count]); |
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
|
156 } |
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
|
157 |
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
|
158 |
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
|
159 /** |
34
bf84bcd4e11b
Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
32
diff
changeset
|
160 * 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
|
161 * part of the DESCRIBE document. |
bf84bcd4e11b
Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
32
diff
changeset
|
162 * |
bf84bcd4e11b
Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
32
diff
changeset
|
163 * @param staticNode The static ui node of the DESCRIBE. |
bf84bcd4e11b
Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
32
diff
changeset
|
164 * |
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
|
165 * @return the DataList objects. |
34
bf84bcd4e11b
Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
32
diff
changeset
|
166 */ |
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
|
167 protected static DataList[] extractOldData(Node staticNode) { |
34
bf84bcd4e11b
Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
32
diff
changeset
|
168 System.out.println("ArtifactDescriptionFactory - extractOldData()"); |
bf84bcd4e11b
Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
32
diff
changeset
|
169 |
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
|
170 NodeList stateNodes = (NodeList) XMLUtils.xpath( |
34
bf84bcd4e11b
Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
32
diff
changeset
|
171 staticNode, |
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
|
172 XPATH_STATIC_STATE_NODE, |
34
bf84bcd4e11b
Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
32
diff
changeset
|
173 XPathConstants.NODESET, |
bf84bcd4e11b
Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
32
diff
changeset
|
174 ArtifactNamespaceContext.INSTANCE); |
bf84bcd4e11b
Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
32
diff
changeset
|
175 |
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
|
176 if (stateNodes == null || stateNodes.getLength() == 0) { |
34
bf84bcd4e11b
Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
32
diff
changeset
|
177 System.out.println("No old items found."); |
bf84bcd4e11b
Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
32
diff
changeset
|
178 return null; |
bf84bcd4e11b
Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
32
diff
changeset
|
179 } |
bf84bcd4e11b
Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
32
diff
changeset
|
180 |
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
|
181 int count = stateNodes.getLength(); |
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
|
182 DataList[] data = new DataList[count]; |
34
bf84bcd4e11b
Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
32
diff
changeset
|
183 |
bf84bcd4e11b
Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
32
diff
changeset
|
184 for (int i = 0; i < count; i++) { |
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
|
185 Node tmp = stateNodes.item(i); |
34
bf84bcd4e11b
Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
32
diff
changeset
|
186 |
bf84bcd4e11b
Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
32
diff
changeset
|
187 String name = XMLUtils.xpathString( |
bf84bcd4e11b
Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
32
diff
changeset
|
188 tmp, "@art:name", ArtifactNamespaceContext.INSTANCE); |
52
1d0be51ab93b
The DataList has a label now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
51
diff
changeset
|
189 String uiprovider = XMLUtils.xpathString( |
1d0be51ab93b
The DataList has a label now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
51
diff
changeset
|
190 tmp, "@art:uiprovider", ArtifactNamespaceContext.INSTANCE); |
1d0be51ab93b
The DataList has a label now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
51
diff
changeset
|
191 String label = XMLUtils.xpathString( |
1d0be51ab93b
The DataList has a label now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
51
diff
changeset
|
192 tmp, "@art:label", ArtifactNamespaceContext.INSTANCE); |
34
bf84bcd4e11b
Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
32
diff
changeset
|
193 |
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
|
194 NodeList dataNodes = (NodeList) XMLUtils.xpath( |
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
|
195 tmp, |
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
|
196 XPATH_STATIC_DATA_NODE, |
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
|
197 XPathConstants.NODESET, |
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
|
198 ArtifactNamespaceContext.INSTANCE); |
34
bf84bcd4e11b
Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
32
diff
changeset
|
199 |
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
|
200 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
|
201 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
|
202 } |
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
|
203 |
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
|
204 int size = dataNodes.getLength(); |
52
1d0be51ab93b
The DataList has a label now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
51
diff
changeset
|
205 DataList list = new DataList(name, size, uiprovider, label); |
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
|
206 |
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
|
207 for (int j = 0; j < size; j++) { |
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
|
208 Node dataNode = dataNodes.item(j); |
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
|
209 |
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
|
210 String dName = XMLUtils.xpathString( |
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
|
211 dataNode, "@art:name", ArtifactNamespaceContext.INSTANCE); |
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
|
212 String dType = XMLUtils.xpathString( |
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
|
213 dataNode, "@art:type", ArtifactNamespaceContext.INSTANCE); |
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
|
214 |
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 DataItem[] items = extractOldDataItems(dataNode); |
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 list.add(new DefaultData(dName, dName, dType, items)); |
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
|
218 |
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
|
219 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
|
220 } |
34
bf84bcd4e11b
Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
32
diff
changeset
|
221 } |
bf84bcd4e11b
Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
32
diff
changeset
|
222 |
bf84bcd4e11b
Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
32
diff
changeset
|
223 return data; |
bf84bcd4e11b
Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
32
diff
changeset
|
224 } |
bf84bcd4e11b
Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
32
diff
changeset
|
225 |
bf84bcd4e11b
Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
32
diff
changeset
|
226 |
bf84bcd4e11b
Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
32
diff
changeset
|
227 /** |
bf84bcd4e11b
Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
32
diff
changeset
|
228 * This method extracts the data items from the data nodes that are placed |
bf84bcd4e11b
Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
32
diff
changeset
|
229 * in the static ui part of the DESCRIBE document. |
bf84bcd4e11b
Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
32
diff
changeset
|
230 * |
bf84bcd4e11b
Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
32
diff
changeset
|
231 * @param dataNode A data node that contains items. |
bf84bcd4e11b
Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
32
diff
changeset
|
232 * |
bf84bcd4e11b
Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
32
diff
changeset
|
233 * @return a list of DataItems. |
bf84bcd4e11b
Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
32
diff
changeset
|
234 */ |
bf84bcd4e11b
Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
32
diff
changeset
|
235 protected static DataItem[] extractOldDataItems(Node dataNode) { |
bf84bcd4e11b
Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
32
diff
changeset
|
236 NodeList itemList = (NodeList) XMLUtils.xpath( |
bf84bcd4e11b
Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
32
diff
changeset
|
237 dataNode, |
bf84bcd4e11b
Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
32
diff
changeset
|
238 XPATH_STATIC_ITEM_NODE, |
bf84bcd4e11b
Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
32
diff
changeset
|
239 XPathConstants.NODESET, |
bf84bcd4e11b
Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
32
diff
changeset
|
240 ArtifactNamespaceContext.INSTANCE); |
bf84bcd4e11b
Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
32
diff
changeset
|
241 |
bf84bcd4e11b
Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
32
diff
changeset
|
242 if (itemList == null || itemList.getLength() == 0) { |
bf84bcd4e11b
Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
32
diff
changeset
|
243 System.out.println("No old data items found."); |
bf84bcd4e11b
Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
32
diff
changeset
|
244 return null; |
bf84bcd4e11b
Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
32
diff
changeset
|
245 } |
bf84bcd4e11b
Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
32
diff
changeset
|
246 |
bf84bcd4e11b
Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
32
diff
changeset
|
247 int count = itemList.getLength(); |
bf84bcd4e11b
Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
32
diff
changeset
|
248 |
bf84bcd4e11b
Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
32
diff
changeset
|
249 DataItem[] items = new DataItem[count]; |
bf84bcd4e11b
Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
32
diff
changeset
|
250 |
bf84bcd4e11b
Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
32
diff
changeset
|
251 for (int i = 0; i < count; i++) { |
bf84bcd4e11b
Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
32
diff
changeset
|
252 Node tmp = itemList.item(i); |
bf84bcd4e11b
Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
32
diff
changeset
|
253 |
bf84bcd4e11b
Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
32
diff
changeset
|
254 String value = XMLUtils.xpathString( |
bf84bcd4e11b
Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
32
diff
changeset
|
255 tmp, "@art:value", ArtifactNamespaceContext.INSTANCE); |
61
f983d5ce6402
Display human readable strings of the selected values in the UI.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
52
diff
changeset
|
256 String label = XMLUtils.xpathString( |
f983d5ce6402
Display human readable strings of the selected values in the UI.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
52
diff
changeset
|
257 tmp, "@art:label", ArtifactNamespaceContext.INSTANCE); |
34
bf84bcd4e11b
Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
32
diff
changeset
|
258 |
61
f983d5ce6402
Display human readable strings of the selected values in the UI.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
52
diff
changeset
|
259 items[i] = new DefaultDataItem(label, label, value); |
34
bf84bcd4e11b
Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
32
diff
changeset
|
260 } |
bf84bcd4e11b
Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
32
diff
changeset
|
261 |
bf84bcd4e11b
Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
32
diff
changeset
|
262 return items; |
bf84bcd4e11b
Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
32
diff
changeset
|
263 } |
bf84bcd4e11b
Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
32
diff
changeset
|
264 |
bf84bcd4e11b
Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
32
diff
changeset
|
265 |
bf84bcd4e11b
Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
32
diff
changeset
|
266 /** |
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
|
267 * 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
|
268 * |
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
|
269 * @param data 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
|
270 * |
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
|
271 * @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
|
272 */ |
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
|
273 protected static String extractUIProvider(Node ui) { |
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
|
274 return (String) XMLUtils.xpath( |
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
|
275 ui, |
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
|
276 XPATH_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
|
277 XPathConstants.STRING, |
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
|
278 ArtifactNamespaceContext.INSTANCE); |
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 } |
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
|
280 |
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
|
281 |
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
|
282 /** |
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
|
283 * 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
|
284 * |
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
|
285 * @param reachable The reachable states node. |
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
|
286 * |
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
|
287 * @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
|
288 */ |
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
|
289 protected static String[] extractReachableStates(Node reachable) { |
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
|
290 System.out.println("ArtifactDescriptionFactory - extractReachableStates()"); |
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
|
291 |
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
|
292 NodeList list = (NodeList) XMLUtils.xpath( |
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
|
293 reachable, |
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
|
294 XPATH_REACHABLE_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
|
295 XPathConstants.NODESET, |
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
|
296 ArtifactNamespaceContext.INSTANCE); |
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
|
297 |
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
|
298 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
|
299 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
|
300 } |
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
|
301 |
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
|
302 int count = list.getLength(); |
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
|
303 |
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
|
304 String[] states = new String[count]; |
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
|
305 |
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
|
306 for (int i = 0; i < count; i++) { |
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
|
307 Node state = list.item(i); |
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
|
308 |
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
|
309 String name = XMLUtils.xpathString( |
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
|
310 state, "@art:name", ArtifactNamespaceContext.INSTANCE); |
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
|
311 |
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
|
312 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
|
313 } |
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
|
314 |
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
|
315 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
|
316 } |
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
|
317 |
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
|
318 |
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
|
319 /** |
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
|
320 * 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
|
321 * |
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
|
322 * @param outputs A list of nodes that contain information about output |
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
|
323 * 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
|
324 * |
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
|
325 * @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
|
326 */ |
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
|
327 protected static OutputMode[] extractOutputModes(NodeList outputs) { |
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
|
328 System.out.println("ArtifactDescriptionFactory - extractOutputModes()"); |
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
|
329 |
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
|
330 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
|
331 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
|
332 } |
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
|
333 |
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
|
334 int size = outputs.getLength(); |
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
|
335 |
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
|
336 List<OutputMode> outs = new ArrayList<OutputMode>(size); |
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
|
337 |
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
|
338 for (int i = 0; i < size; i++) { |
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
|
339 Node out = outputs.item(i); |
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
|
340 |
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
|
341 String name = XMLUtils.xpathString( |
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
|
342 out, "@art:name", ArtifactNamespaceContext.INSTANCE); |
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
|
343 String desc = XMLUtils.xpathString( |
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
|
344 out, "@art:description", ArtifactNamespaceContext.INSTANCE); |
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
|
345 String mimeType = XMLUtils.xpathString( |
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
|
346 out, "@art:mime-type", ArtifactNamespaceContext.INSTANCE); |
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
|
347 |
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
|
348 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
|
349 outs.add(new DefaultOutputMode(name, desc, mimeType)); |
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
|
350 } |
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
|
351 else { |
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
|
352 System.err.println("Found an invalid output mode."); |
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
|
353 } |
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
|
354 } |
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
|
355 |
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
|
356 return (OutputMode[]) outs.toArray(new OutputMode[size]); |
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
|
357 } |
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
|
358 } |
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
|
359 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |