Mercurial > dive4elements > river
comparison flys-client/src/main/java/de/intevation/flys/client/server/ArtifactDescriptionFactory.java @ 22:a85bac235069
Implemented code to parse the UIProvider that should be used for a current state.
flys-client/trunk@1336 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Tue, 22 Feb 2011 17:29:51 +0000 |
parents | f8a5f2c5e2b7 |
children | 88c530c25968 |
comparison
equal
deleted
inserted
replaced
21:e98a25b5c95a | 22:a85bac235069 |
---|---|
30 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> | 30 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> |
31 */ | 31 */ |
32 public class ArtifactDescriptionFactory { | 32 public class ArtifactDescriptionFactory { |
33 | 33 |
34 public static final String XPATH_STATE_NAME = "@art:name"; | 34 public static final String XPATH_STATE_NAME = "@art:name"; |
35 | |
36 public static final String XPATH_UIPROVIDER = "@art:uiprovider"; | |
35 | 37 |
36 /** | 38 /** |
37 * This method creates the {@link ArtifactDescription} of the DESCRIBE | 39 * This method creates the {@link ArtifactDescription} of the DESCRIBE |
38 * document <i>doc</i>. | 40 * document <i>doc</i>. |
39 * | 41 * |
78 Node data = ClientProtocolUtils.getSelectNode(dynamicNode); | 80 Node data = ClientProtocolUtils.getSelectNode(dynamicNode); |
79 NodeList choices = ClientProtocolUtils.getItemNodes(data); | 81 NodeList choices = ClientProtocolUtils.getItemNodes(data); |
80 String label = ClientProtocolUtils.getLabel(data); | 82 String label = ClientProtocolUtils.getLabel(data); |
81 | 83 |
82 DataItem[] dataItems = extractCurrentDataItems(choices); | 84 DataItem[] dataItems = extractCurrentDataItems(choices); |
85 String uiProvider = extractUIProvider(data); | |
83 | 86 |
84 return new DefaultData(label, null, null, dataItems); | 87 return new DefaultData(label, null, null, dataItems, uiProvider); |
85 } | 88 } |
86 | 89 |
87 | 90 |
88 /** | 91 /** |
89 * This method extract the {@link DataItem}s of the DESCRIBE document. | 92 * This method extract the {@link DataItem}s of the DESCRIBE document. |
113 dataItems.add(new DefaultDataItem(label, null, value)); | 116 dataItems.add(new DefaultDataItem(label, null, value)); |
114 } | 117 } |
115 | 118 |
116 return (DataItem[]) dataItems.toArray(new DataItem[count]); | 119 return (DataItem[]) dataItems.toArray(new DataItem[count]); |
117 } | 120 } |
121 | |
122 | |
123 /** | |
124 * This method extracts the UIProvider specified by the data node. | |
125 * | |
126 * @param data The data node. | |
127 * | |
128 * @return the UIProvider that is specified in the data node. | |
129 */ | |
130 protected static String extractUIProvider(Node data) { | |
131 return (String) XMLUtils.xpath( | |
132 data, | |
133 XPATH_UIPROVIDER, | |
134 XPathConstants.STRING, | |
135 ArtifactNamespaceContext.INSTANCE); | |
136 } | |
118 } | 137 } |
119 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : | 138 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |