Mercurial > dive4elements > river
annotate flys-client/src/main/java/de/intevation/flys/client/server/ArtifactDescriptionFactory.java @ 34:bf84bcd4e11b
Parse static data from DESCRIBE.
flys-client/trunk@1454 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Thu, 10 Mar 2011 13:40:29 +0000 |
parents | 88c530c25968 |
children | b6b89ff1adee |
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.Data; |
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
|
18 import de.intevation.flys.client.shared.model.DataItem; |
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
|
19 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
|
20 import de.intevation.flys.client.shared.model.DefaultDataItem; |
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.DefaultArtifactDescription; |
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
|
22 |
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
|
23 |
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 * 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
|
26 * 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
|
27 * {@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
|
28 * 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
|
29 * |
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 * @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
|
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 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
|
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 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
|
35 |
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
|
36 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
|
37 |
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
|
38 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
|
39 |
34
bf84bcd4e11b
Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
32
diff
changeset
|
40 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
|
41 |
bf84bcd4e11b
Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
32
diff
changeset
|
42 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
|
43 |
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
|
44 /** |
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 * 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
|
46 * 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
|
47 * |
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 * @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
|
49 * |
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 * @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
|
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 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
|
53 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
|
54 |
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 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
|
56 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
|
57 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
|
58 Node reachable = ClientProtocolUtils.getReachableStates(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
|
59 |
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 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
|
61 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
|
62 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
|
63 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
|
64 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
|
65 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
|
66 |
34
bf84bcd4e11b
Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
32
diff
changeset
|
67 Data currentData = extractCurrentData(dynamicNode); |
bf84bcd4e11b
Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
32
diff
changeset
|
68 Data[] old = extractOldData(staticNode); |
bf84bcd4e11b
Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
32
diff
changeset
|
69 String[] states = extractReachableStates(reachable); |
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
|
70 |
34
bf84bcd4e11b
Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
32
diff
changeset
|
71 return new DefaultArtifactDescription(old, currentData, state, states); |
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
|
72 } |
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
|
73 |
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
|
74 |
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 * 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
|
77 * 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
|
78 * |
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
|
79 * @param dynamicNode The dynamic node 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
|
80 * |
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
|
81 * @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
|
82 * 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
|
83 * 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
|
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 protected static Data extractCurrentData(Node dynamicNode) { |
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 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
|
87 |
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 Node data = ClientProtocolUtils.getSelectNode(dynamicNode); |
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 NodeList choices = ClientProtocolUtils.getItemNodes(data); |
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 String label = ClientProtocolUtils.getLabel(data); |
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
|
91 |
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 DataItem[] dataItems = extractCurrentDataItems(choices); |
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
|
93 String uiProvider = extractUIProvider(data); |
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
|
94 |
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
|
95 return new DefaultData(label, null, null, dataItems, uiProvider); |
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 } |
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
|
97 |
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 * 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
|
101 * |
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 * @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
|
103 * |
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
|
104 * @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
|
105 */ |
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 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
|
107 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
|
108 "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
|
109 |
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
|
110 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
|
111 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
|
112 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
|
113 } |
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
|
114 |
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 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
|
116 |
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
|
117 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
|
118 |
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 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
|
120 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
|
121 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
|
122 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
|
123 |
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 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
|
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 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
|
128 } |
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
|
129 |
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
|
130 |
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
|
131 /** |
34
bf84bcd4e11b
Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
32
diff
changeset
|
132 * 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
|
133 * part of the DESCRIBE document. |
bf84bcd4e11b
Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
32
diff
changeset
|
134 * |
bf84bcd4e11b
Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
32
diff
changeset
|
135 * @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
|
136 * |
bf84bcd4e11b
Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
32
diff
changeset
|
137 * @return the Data objects. |
bf84bcd4e11b
Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
32
diff
changeset
|
138 */ |
bf84bcd4e11b
Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
32
diff
changeset
|
139 protected static Data[] extractOldData(Node staticNode) { |
bf84bcd4e11b
Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
32
diff
changeset
|
140 System.out.println("ArtifactDescriptionFactory - extractOldData()"); |
bf84bcd4e11b
Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
32
diff
changeset
|
141 |
bf84bcd4e11b
Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
32
diff
changeset
|
142 NodeList dataNodes = (NodeList) XMLUtils.xpath( |
bf84bcd4e11b
Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
32
diff
changeset
|
143 staticNode, |
bf84bcd4e11b
Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
32
diff
changeset
|
144 XPATH_STATIC_DATA_NODE, |
bf84bcd4e11b
Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
32
diff
changeset
|
145 XPathConstants.NODESET, |
bf84bcd4e11b
Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
32
diff
changeset
|
146 ArtifactNamespaceContext.INSTANCE); |
bf84bcd4e11b
Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
32
diff
changeset
|
147 |
bf84bcd4e11b
Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
32
diff
changeset
|
148 if (dataNodes == null || dataNodes.getLength() == 0) { |
bf84bcd4e11b
Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
32
diff
changeset
|
149 System.out.println("No old items found."); |
bf84bcd4e11b
Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
32
diff
changeset
|
150 return null; |
bf84bcd4e11b
Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
32
diff
changeset
|
151 } |
bf84bcd4e11b
Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
32
diff
changeset
|
152 |
bf84bcd4e11b
Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
32
diff
changeset
|
153 int count = dataNodes.getLength(); |
bf84bcd4e11b
Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
32
diff
changeset
|
154 |
bf84bcd4e11b
Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
32
diff
changeset
|
155 Data[] data = new Data[count]; |
bf84bcd4e11b
Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
32
diff
changeset
|
156 |
bf84bcd4e11b
Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
32
diff
changeset
|
157 for (int i = 0; i < count; i++) { |
bf84bcd4e11b
Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
32
diff
changeset
|
158 Node tmp = dataNodes.item(i); |
bf84bcd4e11b
Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
32
diff
changeset
|
159 |
bf84bcd4e11b
Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
32
diff
changeset
|
160 String name = XMLUtils.xpathString( |
bf84bcd4e11b
Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
32
diff
changeset
|
161 tmp, "@art:name", ArtifactNamespaceContext.INSTANCE); |
bf84bcd4e11b
Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
32
diff
changeset
|
162 String type = XMLUtils.xpathString( |
bf84bcd4e11b
Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
32
diff
changeset
|
163 tmp, "@art:type", ArtifactNamespaceContext.INSTANCE); |
bf84bcd4e11b
Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
32
diff
changeset
|
164 |
bf84bcd4e11b
Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
32
diff
changeset
|
165 DataItem[] items = extractOldDataItems(tmp); |
bf84bcd4e11b
Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
32
diff
changeset
|
166 |
bf84bcd4e11b
Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
32
diff
changeset
|
167 data[i] = new DefaultData(name, name, type, items, null); |
bf84bcd4e11b
Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
32
diff
changeset
|
168 } |
bf84bcd4e11b
Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
32
diff
changeset
|
169 |
bf84bcd4e11b
Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
32
diff
changeset
|
170 return data; |
bf84bcd4e11b
Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
32
diff
changeset
|
171 } |
bf84bcd4e11b
Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
32
diff
changeset
|
172 |
bf84bcd4e11b
Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
32
diff
changeset
|
173 |
bf84bcd4e11b
Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
32
diff
changeset
|
174 /** |
bf84bcd4e11b
Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
32
diff
changeset
|
175 * 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
|
176 * 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
|
177 * |
bf84bcd4e11b
Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
32
diff
changeset
|
178 * @param dataNode A data node that contains items. |
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 * @return a list of DataItems. |
bf84bcd4e11b
Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
32
diff
changeset
|
181 */ |
bf84bcd4e11b
Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
32
diff
changeset
|
182 protected static DataItem[] extractOldDataItems(Node dataNode) { |
bf84bcd4e11b
Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
32
diff
changeset
|
183 NodeList itemList = (NodeList) XMLUtils.xpath( |
bf84bcd4e11b
Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
32
diff
changeset
|
184 dataNode, |
bf84bcd4e11b
Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
32
diff
changeset
|
185 XPATH_STATIC_ITEM_NODE, |
bf84bcd4e11b
Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
32
diff
changeset
|
186 XPathConstants.NODESET, |
bf84bcd4e11b
Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
32
diff
changeset
|
187 ArtifactNamespaceContext.INSTANCE); |
bf84bcd4e11b
Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
32
diff
changeset
|
188 |
bf84bcd4e11b
Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
32
diff
changeset
|
189 if (itemList == null || itemList.getLength() == 0) { |
bf84bcd4e11b
Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
32
diff
changeset
|
190 System.out.println("No old data items found."); |
bf84bcd4e11b
Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
32
diff
changeset
|
191 return null; |
bf84bcd4e11b
Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
32
diff
changeset
|
192 } |
bf84bcd4e11b
Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
32
diff
changeset
|
193 |
bf84bcd4e11b
Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
32
diff
changeset
|
194 int count = itemList.getLength(); |
bf84bcd4e11b
Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
32
diff
changeset
|
195 |
bf84bcd4e11b
Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
32
diff
changeset
|
196 DataItem[] items = new DataItem[count]; |
bf84bcd4e11b
Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
32
diff
changeset
|
197 |
bf84bcd4e11b
Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
32
diff
changeset
|
198 for (int i = 0; i < count; i++) { |
bf84bcd4e11b
Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
32
diff
changeset
|
199 Node tmp = itemList.item(i); |
bf84bcd4e11b
Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
32
diff
changeset
|
200 |
bf84bcd4e11b
Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
32
diff
changeset
|
201 String value = XMLUtils.xpathString( |
bf84bcd4e11b
Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
32
diff
changeset
|
202 tmp, "@art:value", ArtifactNamespaceContext.INSTANCE); |
bf84bcd4e11b
Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
32
diff
changeset
|
203 |
bf84bcd4e11b
Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
32
diff
changeset
|
204 // TODO extract the human readable value (description) from node |
bf84bcd4e11b
Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
32
diff
changeset
|
205 items[i] = new DefaultDataItem(value, value, value); |
bf84bcd4e11b
Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
32
diff
changeset
|
206 } |
bf84bcd4e11b
Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
32
diff
changeset
|
207 |
bf84bcd4e11b
Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
32
diff
changeset
|
208 return items; |
bf84bcd4e11b
Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
32
diff
changeset
|
209 } |
bf84bcd4e11b
Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
32
diff
changeset
|
210 |
bf84bcd4e11b
Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
32
diff
changeset
|
211 |
bf84bcd4e11b
Parse static data from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
32
diff
changeset
|
212 /** |
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
|
213 * 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
|
214 * |
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
|
215 * @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
|
216 * |
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
|
217 * @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
|
218 */ |
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
|
219 protected static String extractUIProvider(Node data) { |
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
|
220 return (String) XMLUtils.xpath( |
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
|
221 data, |
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
|
222 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
|
223 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
|
224 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
|
225 } |
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
|
226 |
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
|
227 |
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
|
228 /** |
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
|
229 * 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
|
230 * |
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
|
231 * @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
|
232 * |
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
|
233 * @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
|
234 */ |
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
|
235 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
|
236 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
|
237 |
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
|
238 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
|
239 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
|
240 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
|
241 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
|
242 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
|
243 |
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
|
244 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
|
245 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
|
246 } |
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
|
247 |
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
|
248 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
|
249 |
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
|
250 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
|
251 |
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
|
252 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
|
253 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
|
254 |
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
|
255 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
|
256 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
|
257 |
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
|
258 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
|
259 } |
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
|
260 |
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
|
261 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
|
262 } |
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
|
263 } |
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
|
264 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |