Mercurial > dive4elements > river
annotate flys-client/src/main/java/de/intevation/flys/client/server/DescribeCollectionServiceImpl.java @ 581:210339fd1a34
Removed more expensive XPath.
flys-client/trunk@2169 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Mon, 20 Jun 2011 16:25:48 +0000 |
parents | 5277f46a63c2 |
children | 78907f0fb939 |
rev | line source |
---|---|
99
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.flys.client.server; |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
2 |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
3 import java.util.ArrayList; |
524
ba238f917b94
The theme list information stored in the attribute of a collection is read and added in form of Themes and ThemeLists to the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
270
diff
changeset
|
4 import java.util.HashMap; |
99
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
5 import java.util.List; |
524
ba238f917b94
The theme list information stored in the attribute of a collection is read and added in form of Themes and ThemeLists to the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
270
diff
changeset
|
6 import java.util.Map; |
99
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
7 |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
8 import javax.xml.xpath.XPathConstants; |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
9 |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
10 import org.w3c.dom.Document; |
575
5277f46a63c2
The description of a facet is now displayed in the ChartThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
524
diff
changeset
|
11 import org.w3c.dom.Element; |
99
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
12 import org.w3c.dom.Node; |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
13 import org.w3c.dom.NodeList; |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
14 |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
15 import com.google.gwt.user.server.rpc.RemoteServiceServlet; |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
16 |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
17 import de.intevation.artifacts.common.ArtifactNamespaceContext; |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
18 import de.intevation.artifacts.common.utils.ClientProtocolUtils; |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
19 import de.intevation.artifacts.common.utils.XMLUtils; |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
20 |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
21 import de.intevation.artifacts.httpclient.exceptions.ConnectionException; |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
22 import de.intevation.artifacts.httpclient.http.HttpClient; |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
23 import de.intevation.artifacts.httpclient.http.HttpClientImpl; |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
24 import de.intevation.artifacts.httpclient.http.response.DocumentResponseHandler; |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
25 |
215
e02f50a3ad59
Improved the exception handling of artifact / collection specific operations. Warning dialog are displayed after such an exception.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
101
diff
changeset
|
26 import de.intevation.flys.client.shared.exceptions.ServerException; |
99
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
27 import de.intevation.flys.client.shared.model.Collection; |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
28 import de.intevation.flys.client.shared.model.CollectionItem; |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
29 import de.intevation.flys.client.shared.model.DefaultCollection; |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
30 import de.intevation.flys.client.shared.model.DefaultCollectionItem; |
270
d01b0d81b92a
Parse the facets of a Collection and distinguish between an ordinary OutputMode and an ExportMode (new).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
229
diff
changeset
|
31 import de.intevation.flys.client.shared.model.DefaultFacet; |
99
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
32 import de.intevation.flys.client.shared.model.DefaultOutputMode; |
524
ba238f917b94
The theme list information stored in the attribute of a collection is read and added in form of Themes and ThemeLists to the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
270
diff
changeset
|
33 import de.intevation.flys.client.shared.model.DefaultTheme; |
270
d01b0d81b92a
Parse the facets of a Collection and distinguish between an ordinary OutputMode and an ExportMode (new).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
229
diff
changeset
|
34 import de.intevation.flys.client.shared.model.ExportMode; |
d01b0d81b92a
Parse the facets of a Collection and distinguish between an ordinary OutputMode and an ExportMode (new).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
229
diff
changeset
|
35 import de.intevation.flys.client.shared.model.Facet; |
99
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
36 import de.intevation.flys.client.shared.model.OutputMode; |
524
ba238f917b94
The theme list information stored in the attribute of a collection is read and added in form of Themes and ThemeLists to the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
270
diff
changeset
|
37 import de.intevation.flys.client.shared.model.Theme; |
ba238f917b94
The theme list information stored in the attribute of a collection is read and added in form of Themes and ThemeLists to the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
270
diff
changeset
|
38 import de.intevation.flys.client.shared.model.ThemeList; |
99
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
39 import de.intevation.flys.client.client.services.DescribeCollectionService; |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
40 |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
41 |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
42 /** |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
43 * This service implements a method that queries the DESCRIBE document of a |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
44 * specific collection and returns a Collection object with the information of |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
45 * the document. |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
46 * |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
47 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
48 */ |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
49 public class DescribeCollectionServiceImpl |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
50 extends RemoteServiceServlet |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
51 implements DescribeCollectionService |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
52 { |
215
e02f50a3ad59
Improved the exception handling of artifact / collection specific operations. Warning dialog are displayed after such an exception.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
101
diff
changeset
|
53 /** The error message key that is thrown if an error occured while |
e02f50a3ad59
Improved the exception handling of artifact / collection specific operations. Warning dialog are displayed after such an exception.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
101
diff
changeset
|
54 * describe() a Collection.*/ |
e02f50a3ad59
Improved the exception handling of artifact / collection specific operations. Warning dialog are displayed after such an exception.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
101
diff
changeset
|
55 public static final String ERROR_DESCRIBE_COLLECTION = |
e02f50a3ad59
Improved the exception handling of artifact / collection specific operations. Warning dialog are displayed after such an exception.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
101
diff
changeset
|
56 "error_describe_collection"; |
e02f50a3ad59
Improved the exception handling of artifact / collection specific operations. Warning dialog are displayed after such an exception.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
101
diff
changeset
|
57 |
270
d01b0d81b92a
Parse the facets of a Collection and distinguish between an ordinary OutputMode and an ExportMode (new).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
229
diff
changeset
|
58 public static final String XPATH_FACETS = "art:facets/art:facet"; |
d01b0d81b92a
Parse the facets of a Collection and distinguish between an ordinary OutputMode and an ExportMode (new).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
229
diff
changeset
|
59 |
215
e02f50a3ad59
Improved the exception handling of artifact / collection specific operations. Warning dialog are displayed after such an exception.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
101
diff
changeset
|
60 |
229
924da6695800
Each service is now called with the name of the current locale to set the request object's locale manually in the HttpClient.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
215
diff
changeset
|
61 public Collection describe(String uuid, String serverUrl, String locale) |
215
e02f50a3ad59
Improved the exception handling of artifact / collection specific operations. Warning dialog are displayed after such an exception.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
101
diff
changeset
|
62 throws ServerException |
e02f50a3ad59
Improved the exception handling of artifact / collection specific operations. Warning dialog are displayed after such an exception.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
101
diff
changeset
|
63 { |
99
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
64 System.out.println("DescribeCollectionServiceImpl.describe"); |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
65 |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
66 Document describe = ClientProtocolUtils.newDescribeCollectionDocument( |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
67 uuid); |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
68 |
229
924da6695800
Each service is now called with the name of the current locale to set the request object's locale manually in the HttpClient.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
215
diff
changeset
|
69 HttpClient client = new HttpClientImpl(serverUrl, locale); |
99
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
70 |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
71 try { |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
72 Document response = (Document) client.doCollectionAction( |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
73 describe, uuid, new DocumentResponseHandler()); |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
74 |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
75 Collection c = parseCollection(response); |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
76 |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
77 if (c == null) { |
215
e02f50a3ad59
Improved the exception handling of artifact / collection specific operations. Warning dialog are displayed after such an exception.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
101
diff
changeset
|
78 throw new ServerException(ERROR_DESCRIBE_COLLECTION); |
99
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
79 } |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
80 |
524
ba238f917b94
The theme list information stored in the attribute of a collection is read and added in form of Themes and ThemeLists to the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
270
diff
changeset
|
81 System.out.println("Collection successfully parsed."); |
ba238f917b94
The theme list information stored in the attribute of a collection is read and added in form of Themes and ThemeLists to the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
270
diff
changeset
|
82 |
99
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
83 return c; |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
84 } |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
85 catch (ConnectionException ce) { |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
86 System.err.println(ce.getLocalizedMessage()); |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
87 } |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
88 |
215
e02f50a3ad59
Improved the exception handling of artifact / collection specific operations. Warning dialog are displayed after such an exception.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
101
diff
changeset
|
89 throw new ServerException(ERROR_DESCRIBE_COLLECTION); |
99
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
90 } |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
91 |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
92 |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
93 /** |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
94 * This method takes the DESCRIBE document of the Collections describe() |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
95 * operation and extracts the information about the collection itself and |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
96 * the collection items. |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
97 * |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
98 * @param description The DESCRIBE document of the Collections describe() |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
99 * operation. |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
100 * |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
101 * @return a Collection with CollectionItems. |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
102 */ |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
103 protected Collection parseCollection(Document description) { |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
104 System.out.println("AddArtifactServiceImpl.parseCollection"); |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
105 |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
106 if (description == null) { |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
107 System.err.println("The DESCRIBE of the Collection is null!"); |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
108 return null; |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
109 } |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
110 |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
111 String uuid = XMLUtils.xpathString( |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
112 description, |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
113 "art:artifact-collection/@art:uuid", |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
114 ArtifactNamespaceContext.INSTANCE); |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
115 |
581
210339fd1a34
Removed more expensive XPath.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
575
diff
changeset
|
116 if (uuid == null || uuid.length() == 0) { |
99
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
117 System.err.println("Found an invalid Collection!"); |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
118 return null; |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
119 } |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
120 |
524
ba238f917b94
The theme list information stored in the attribute of a collection is read and added in form of Themes and ThemeLists to the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
270
diff
changeset
|
121 Map<String, ThemeList> themeList = parseThemeLists(description); |
ba238f917b94
The theme list information stored in the attribute of a collection is read and added in form of Themes and ThemeLists to the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
270
diff
changeset
|
122 |
581
210339fd1a34
Removed more expensive XPath.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
575
diff
changeset
|
123 Collection c = !themeList.isEmpty() |
210339fd1a34
Removed more expensive XPath.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
575
diff
changeset
|
124 ? new DefaultCollection(uuid, themeList) |
210339fd1a34
Removed more expensive XPath.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
575
diff
changeset
|
125 : new DefaultCollection(uuid); |
99
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
126 |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
127 NodeList items = (NodeList) XMLUtils.xpath( |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
128 description, |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
129 "art:artifact-collection/art:artifacts/art:artifact", |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
130 XPathConstants.NODESET, |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
131 ArtifactNamespaceContext.INSTANCE); |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
132 |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
133 if (items == null || items.getLength() == 0) { |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
134 System.out.println("No collection item found for this collection."); |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
135 |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
136 return c; |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
137 } |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
138 |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
139 int size = items.getLength(); |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
140 |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
141 for (int i = 0; i < size; i++) { |
581
210339fd1a34
Removed more expensive XPath.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
575
diff
changeset
|
142 CollectionItem item = parseCollectionItem((Element)items.item(i)); |
99
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
143 |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
144 if (item != null) { |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
145 c.addItem(item); |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
146 } |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
147 } |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
148 |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
149 System.out.println( |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
150 "Found " + c.getItemLength() + " collection items " + |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
151 "for the Collection '" + c.identifier() + "'."); |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
152 |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
153 return c; |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
154 } |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
155 |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
156 |
524
ba238f917b94
The theme list information stored in the attribute of a collection is read and added in form of Themes and ThemeLists to the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
270
diff
changeset
|
157 protected Map<String, ThemeList> parseThemeLists(Document description) { |
ba238f917b94
The theme list information stored in the attribute of a collection is read and added in form of Themes and ThemeLists to the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
270
diff
changeset
|
158 System.out.println("DescribeCollectionServiceImpl.parseThemeLists"); |
ba238f917b94
The theme list information stored in the attribute of a collection is read and added in form of Themes and ThemeLists to the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
270
diff
changeset
|
159 |
ba238f917b94
The theme list information stored in the attribute of a collection is read and added in form of Themes and ThemeLists to the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
270
diff
changeset
|
160 NodeList lists = (NodeList) XMLUtils.xpath( |
ba238f917b94
The theme list information stored in the attribute of a collection is read and added in form of Themes and ThemeLists to the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
270
diff
changeset
|
161 description, |
ba238f917b94
The theme list information stored in the attribute of a collection is read and added in form of Themes and ThemeLists to the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
270
diff
changeset
|
162 "/art:artifact-collection/art:attribute/art:outputs/art:output", |
ba238f917b94
The theme list information stored in the attribute of a collection is read and added in form of Themes and ThemeLists to the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
270
diff
changeset
|
163 XPathConstants.NODESET, |
ba238f917b94
The theme list information stored in the attribute of a collection is read and added in form of Themes and ThemeLists to the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
270
diff
changeset
|
164 ArtifactNamespaceContext.INSTANCE); |
ba238f917b94
The theme list information stored in the attribute of a collection is read and added in form of Themes and ThemeLists to the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
270
diff
changeset
|
165 |
ba238f917b94
The theme list information stored in the attribute of a collection is read and added in form of Themes and ThemeLists to the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
270
diff
changeset
|
166 int num = lists != null ? lists.getLength() : 0; |
ba238f917b94
The theme list information stored in the attribute of a collection is read and added in form of Themes and ThemeLists to the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
270
diff
changeset
|
167 |
ba238f917b94
The theme list information stored in the attribute of a collection is read and added in form of Themes and ThemeLists to the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
270
diff
changeset
|
168 Map<String, ThemeList> themeList = new HashMap<String, ThemeList>(num); |
ba238f917b94
The theme list information stored in the attribute of a collection is read and added in form of Themes and ThemeLists to the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
270
diff
changeset
|
169 |
581
210339fd1a34
Removed more expensive XPath.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
575
diff
changeset
|
170 String uri = ArtifactNamespaceContext.NAMESPACE_URI; |
524
ba238f917b94
The theme list information stored in the attribute of a collection is read and added in form of Themes and ThemeLists to the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
270
diff
changeset
|
171 |
581
210339fd1a34
Removed more expensive XPath.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
575
diff
changeset
|
172 for (int i = 0; i < num; i++) { |
210339fd1a34
Removed more expensive XPath.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
575
diff
changeset
|
173 Element node = (Element)lists.item(i); |
524
ba238f917b94
The theme list information stored in the attribute of a collection is read and added in form of Themes and ThemeLists to the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
270
diff
changeset
|
174 |
581
210339fd1a34
Removed more expensive XPath.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
575
diff
changeset
|
175 String outName = node.getAttribute("name"); |
524
ba238f917b94
The theme list information stored in the attribute of a collection is read and added in form of Themes and ThemeLists to the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
270
diff
changeset
|
176 |
581
210339fd1a34
Removed more expensive XPath.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
575
diff
changeset
|
177 if (outName.length() > 0) { |
210339fd1a34
Removed more expensive XPath.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
575
diff
changeset
|
178 ThemeList list = parseThemeList(node); |
210339fd1a34
Removed more expensive XPath.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
575
diff
changeset
|
179 if (list.getThemeCount() > 0) { |
210339fd1a34
Removed more expensive XPath.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
575
diff
changeset
|
180 themeList.put(outName, list); |
210339fd1a34
Removed more expensive XPath.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
575
diff
changeset
|
181 } |
524
ba238f917b94
The theme list information stored in the attribute of a collection is read and added in form of Themes and ThemeLists to the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
270
diff
changeset
|
182 } |
ba238f917b94
The theme list information stored in the attribute of a collection is read and added in form of Themes and ThemeLists to the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
270
diff
changeset
|
183 } |
ba238f917b94
The theme list information stored in the attribute of a collection is read and added in form of Themes and ThemeLists to the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
270
diff
changeset
|
184 |
ba238f917b94
The theme list information stored in the attribute of a collection is read and added in form of Themes and ThemeLists to the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
270
diff
changeset
|
185 return themeList; |
ba238f917b94
The theme list information stored in the attribute of a collection is read and added in form of Themes and ThemeLists to the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
270
diff
changeset
|
186 } |
ba238f917b94
The theme list information stored in the attribute of a collection is read and added in form of Themes and ThemeLists to the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
270
diff
changeset
|
187 |
ba238f917b94
The theme list information stored in the attribute of a collection is read and added in form of Themes and ThemeLists to the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
270
diff
changeset
|
188 |
581
210339fd1a34
Removed more expensive XPath.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
575
diff
changeset
|
189 protected ThemeList parseThemeList(Element node) { |
524
ba238f917b94
The theme list information stored in the attribute of a collection is read and added in form of Themes and ThemeLists to the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
270
diff
changeset
|
190 System.out.println("DescribeCollectionServiceImpl.parseThemeList"); |
ba238f917b94
The theme list information stored in the attribute of a collection is read and added in form of Themes and ThemeLists to the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
270
diff
changeset
|
191 |
581
210339fd1a34
Removed more expensive XPath.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
575
diff
changeset
|
192 NodeList themes = node.getElementsByTagNameNS( |
210339fd1a34
Removed more expensive XPath.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
575
diff
changeset
|
193 ArtifactNamespaceContext.NAMESPACE_URI, |
210339fd1a34
Removed more expensive XPath.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
575
diff
changeset
|
194 "theme"); |
524
ba238f917b94
The theme list information stored in the attribute of a collection is read and added in form of Themes and ThemeLists to the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
270
diff
changeset
|
195 |
ba238f917b94
The theme list information stored in the attribute of a collection is read and added in form of Themes and ThemeLists to the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
270
diff
changeset
|
196 int num = themes != null ? themes.getLength() : 0; |
ba238f917b94
The theme list information stored in the attribute of a collection is read and added in form of Themes and ThemeLists to the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
270
diff
changeset
|
197 |
ba238f917b94
The theme list information stored in the attribute of a collection is read and added in form of Themes and ThemeLists to the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
270
diff
changeset
|
198 List<Theme> themeList = new ArrayList<Theme>(num); |
ba238f917b94
The theme list information stored in the attribute of a collection is read and added in form of Themes and ThemeLists to the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
270
diff
changeset
|
199 |
ba238f917b94
The theme list information stored in the attribute of a collection is read and added in form of Themes and ThemeLists to the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
270
diff
changeset
|
200 for (int i = 0; i < num; i++) { |
581
210339fd1a34
Removed more expensive XPath.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
575
diff
changeset
|
201 Theme theme = parseTheme((Element)themes.item(i)); |
524
ba238f917b94
The theme list information stored in the attribute of a collection is read and added in form of Themes and ThemeLists to the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
270
diff
changeset
|
202 |
ba238f917b94
The theme list information stored in the attribute of a collection is read and added in form of Themes and ThemeLists to the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
270
diff
changeset
|
203 if (theme != null) { |
ba238f917b94
The theme list information stored in the attribute of a collection is read and added in form of Themes and ThemeLists to the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
270
diff
changeset
|
204 themeList.add(theme); |
ba238f917b94
The theme list information stored in the attribute of a collection is read and added in form of Themes and ThemeLists to the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
270
diff
changeset
|
205 } |
ba238f917b94
The theme list information stored in the attribute of a collection is read and added in form of Themes and ThemeLists to the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
270
diff
changeset
|
206 } |
ba238f917b94
The theme list information stored in the attribute of a collection is read and added in form of Themes and ThemeLists to the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
270
diff
changeset
|
207 |
ba238f917b94
The theme list information stored in the attribute of a collection is read and added in form of Themes and ThemeLists to the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
270
diff
changeset
|
208 return new ThemeList(themeList); |
ba238f917b94
The theme list information stored in the attribute of a collection is read and added in form of Themes and ThemeLists to the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
270
diff
changeset
|
209 } |
ba238f917b94
The theme list information stored in the attribute of a collection is read and added in form of Themes and ThemeLists to the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
270
diff
changeset
|
210 |
ba238f917b94
The theme list information stored in the attribute of a collection is read and added in form of Themes and ThemeLists to the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
270
diff
changeset
|
211 |
575
5277f46a63c2
The description of a facet is now displayed in the ChartThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
524
diff
changeset
|
212 protected Theme parseTheme(Element ele) { |
524
ba238f917b94
The theme list information stored in the attribute of a collection is read and added in form of Themes and ThemeLists to the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
270
diff
changeset
|
213 System.out.println("DescribeCollectionServiceImpl.parseTheme"); |
ba238f917b94
The theme list information stored in the attribute of a collection is read and added in form of Themes and ThemeLists to the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
270
diff
changeset
|
214 |
575
5277f46a63c2
The description of a facet is now displayed in the ChartThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
524
diff
changeset
|
215 String uri = ArtifactNamespaceContext.NAMESPACE_URI; |
524
ba238f917b94
The theme list information stored in the attribute of a collection is read and added in form of Themes and ThemeLists to the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
270
diff
changeset
|
216 |
575
5277f46a63c2
The description of a facet is now displayed in the ChartThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
524
diff
changeset
|
217 String strAct = ele.getAttributeNS(uri, "active"); |
5277f46a63c2
The description of a facet is now displayed in the ChartThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
524
diff
changeset
|
218 String art = ele.getAttributeNS(uri, "artifact"); |
5277f46a63c2
The description of a facet is now displayed in the ChartThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
524
diff
changeset
|
219 String fac = ele.getAttributeNS(uri, "facet"); |
5277f46a63c2
The description of a facet is now displayed in the ChartThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
524
diff
changeset
|
220 String strPos = ele.getAttributeNS(uri, "pos"); |
5277f46a63c2
The description of a facet is now displayed in the ChartThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
524
diff
changeset
|
221 String desc = ele.getAttributeNS(uri, "description"); |
5277f46a63c2
The description of a facet is now displayed in the ChartThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
524
diff
changeset
|
222 String strIdx = ele.getAttributeNS(uri, "index"); |
524
ba238f917b94
The theme list information stored in the attribute of a collection is read and added in form of Themes and ThemeLists to the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
270
diff
changeset
|
223 |
581
210339fd1a34
Removed more expensive XPath.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
575
diff
changeset
|
224 if (strAct.length() > 0 && art.length() > 0 && fac.length() > 0 |
210339fd1a34
Removed more expensive XPath.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
575
diff
changeset
|
225 && strPos.length() > 0 && strIdx.length() > 0) |
575
5277f46a63c2
The description of a facet is now displayed in the ChartThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
524
diff
changeset
|
226 { |
524
ba238f917b94
The theme list information stored in the attribute of a collection is read and added in form of Themes and ThemeLists to the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
270
diff
changeset
|
227 try { |
ba238f917b94
The theme list information stored in the attribute of a collection is read and added in form of Themes and ThemeLists to the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
270
diff
changeset
|
228 int pos = Integer.valueOf(strPos); |
ba238f917b94
The theme list information stored in the attribute of a collection is read and added in form of Themes and ThemeLists to the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
270
diff
changeset
|
229 int active = Integer.valueOf(strAct); |
575
5277f46a63c2
The description of a facet is now displayed in the ChartThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
524
diff
changeset
|
230 int idx = Integer.valueOf(strIdx); |
524
ba238f917b94
The theme list information stored in the attribute of a collection is read and added in form of Themes and ThemeLists to the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
270
diff
changeset
|
231 |
575
5277f46a63c2
The description of a facet is now displayed in the ChartThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
524
diff
changeset
|
232 return new DefaultTheme(pos, idx, active > 0, art, fac, desc); |
524
ba238f917b94
The theme list information stored in the attribute of a collection is read and added in form of Themes and ThemeLists to the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
270
diff
changeset
|
233 } |
ba238f917b94
The theme list information stored in the attribute of a collection is read and added in form of Themes and ThemeLists to the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
270
diff
changeset
|
234 catch (NumberFormatException nfe) { |
ba238f917b94
The theme list information stored in the attribute of a collection is read and added in form of Themes and ThemeLists to the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
270
diff
changeset
|
235 nfe.printStackTrace(); |
ba238f917b94
The theme list information stored in the attribute of a collection is read and added in form of Themes and ThemeLists to the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
270
diff
changeset
|
236 } |
ba238f917b94
The theme list information stored in the attribute of a collection is read and added in form of Themes and ThemeLists to the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
270
diff
changeset
|
237 } |
ba238f917b94
The theme list information stored in the attribute of a collection is read and added in form of Themes and ThemeLists to the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
270
diff
changeset
|
238 |
ba238f917b94
The theme list information stored in the attribute of a collection is read and added in form of Themes and ThemeLists to the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
270
diff
changeset
|
239 return null; |
ba238f917b94
The theme list information stored in the attribute of a collection is read and added in form of Themes and ThemeLists to the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
270
diff
changeset
|
240 } |
ba238f917b94
The theme list information stored in the attribute of a collection is read and added in form of Themes and ThemeLists to the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
270
diff
changeset
|
241 |
ba238f917b94
The theme list information stored in the attribute of a collection is read and added in form of Themes and ThemeLists to the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
270
diff
changeset
|
242 |
99
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
243 /** |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
244 * This method extracts the CollectionItem from <i>node</i> with its output |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
245 * modes. The output modes are parsed using the parseOutputModes() method. |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
246 * |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
247 * @param node A node that contains information about a CollectionItem. |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
248 * |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
249 * @return a CollectionItem. |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
250 */ |
581
210339fd1a34
Removed more expensive XPath.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
575
diff
changeset
|
251 protected CollectionItem parseCollectionItem(Element node) { |
99
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
252 System.out.println("AddArtifactServiceImpl.parseCollectionItem"); |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
253 |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
254 if (node == null) { |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
255 System.err.println("The node for parsing CollectionItem is null!"); |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
256 return null; |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
257 } |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
258 |
581
210339fd1a34
Removed more expensive XPath.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
575
diff
changeset
|
259 String uri = ArtifactNamespaceContext.NAMESPACE_URI; |
99
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
260 |
581
210339fd1a34
Removed more expensive XPath.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
575
diff
changeset
|
261 String uuid = node.getAttributeNS(uri, "uuid"); |
210339fd1a34
Removed more expensive XPath.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
575
diff
changeset
|
262 String hash = node.getAttributeNS(uri, "hash"); |
99
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
263 |
581
210339fd1a34
Removed more expensive XPath.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
575
diff
changeset
|
264 if (uuid.length() == 0) { |
99
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
265 System.err.println("Found an invalid CollectionItem!"); |
581
210339fd1a34
Removed more expensive XPath.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
575
diff
changeset
|
266 return null; |
99
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
267 } |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
268 |
581
210339fd1a34
Removed more expensive XPath.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
575
diff
changeset
|
269 NodeList outputmodes = node.getElementsByTagNameNS(uri, "outputmodes"); |
99
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
270 |
581
210339fd1a34
Removed more expensive XPath.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
575
diff
changeset
|
271 if (outputmodes.getLength() < 1) { |
210339fd1a34
Removed more expensive XPath.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
575
diff
changeset
|
272 return null; |
210339fd1a34
Removed more expensive XPath.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
575
diff
changeset
|
273 } |
210339fd1a34
Removed more expensive XPath.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
575
diff
changeset
|
274 |
210339fd1a34
Removed more expensive XPath.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
575
diff
changeset
|
275 Element om = (Element)outputmodes.item(0); |
210339fd1a34
Removed more expensive XPath.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
575
diff
changeset
|
276 |
210339fd1a34
Removed more expensive XPath.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
575
diff
changeset
|
277 List<OutputMode> modes = parseOutputModes(om); |
99
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
278 |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
279 return new DefaultCollectionItem(uuid, hash, modes); |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
280 } |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
281 |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
282 |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
283 /** |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
284 * This method extracts the OutputModes available for a specific |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
285 * CollectionItem and returns them as list. |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
286 * |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
287 * @param node The root node of the outputmodes list. |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
288 * |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
289 * @return a list of OutputModes. |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
290 */ |
581
210339fd1a34
Removed more expensive XPath.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
575
diff
changeset
|
291 protected List<OutputMode> parseOutputModes(Element node) { |
99
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
292 System.out.println("AddArtifactServiceImpl.parseOutputModes"); |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
293 |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
294 if (node == null) { |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
295 System.err.println("The node for parsing OutputModes is null!"); |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
296 return null; |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
297 } |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
298 |
581
210339fd1a34
Removed more expensive XPath.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
575
diff
changeset
|
299 String uri = ArtifactNamespaceContext.NAMESPACE_URI; |
99
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
300 |
581
210339fd1a34
Removed more expensive XPath.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
575
diff
changeset
|
301 NodeList list = node.getElementsByTagNameNS(uri, "output"); |
210339fd1a34
Removed more expensive XPath.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
575
diff
changeset
|
302 |
210339fd1a34
Removed more expensive XPath.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
575
diff
changeset
|
303 int size = list.getLength(); |
210339fd1a34
Removed more expensive XPath.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
575
diff
changeset
|
304 |
210339fd1a34
Removed more expensive XPath.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
575
diff
changeset
|
305 if (size == 0) { |
99
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
306 System.err.println("No outputmode nodes found!"); |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
307 return null; |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
308 } |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
309 |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
310 List<OutputMode> modes = new ArrayList<OutputMode>(size); |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
311 |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
312 for (int i = 0; i < size; i++) { |
581
210339fd1a34
Removed more expensive XPath.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
575
diff
changeset
|
313 Element tmp = (Element)list.item(i); |
99
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
314 |
581
210339fd1a34
Removed more expensive XPath.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
575
diff
changeset
|
315 String name = tmp.getAttributeNS(uri, "name"); |
210339fd1a34
Removed more expensive XPath.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
575
diff
changeset
|
316 String desc = tmp.getAttributeNS(uri, "description"); |
210339fd1a34
Removed more expensive XPath.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
575
diff
changeset
|
317 String mime = tmp.getAttributeNS(uri, "mime-type"); |
210339fd1a34
Removed more expensive XPath.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
575
diff
changeset
|
318 |
210339fd1a34
Removed more expensive XPath.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
575
diff
changeset
|
319 if (name.length() == 0) { |
99
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
320 System.err.println("Found an invalid output mode."); |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
321 continue; |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
322 } |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
323 |
270
d01b0d81b92a
Parse the facets of a Collection and distinguish between an ordinary OutputMode and an ExportMode (new).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
229
diff
changeset
|
324 OutputMode outmode = null; |
d01b0d81b92a
Parse the facets of a Collection and distinguish between an ordinary OutputMode and an ExportMode (new).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
229
diff
changeset
|
325 List<Facet> fs = extractFacets(tmp); |
99
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
326 |
270
d01b0d81b92a
Parse the facets of a Collection and distinguish between an ordinary OutputMode and an ExportMode (new).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
229
diff
changeset
|
327 if (name.indexOf("export") > -1) { |
d01b0d81b92a
Parse the facets of a Collection and distinguish between an ordinary OutputMode and an ExportMode (new).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
229
diff
changeset
|
328 outmode = new ExportMode(name, desc, mime, fs); |
d01b0d81b92a
Parse the facets of a Collection and distinguish between an ordinary OutputMode and an ExportMode (new).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
229
diff
changeset
|
329 } |
d01b0d81b92a
Parse the facets of a Collection and distinguish between an ordinary OutputMode and an ExportMode (new).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
229
diff
changeset
|
330 else { |
d01b0d81b92a
Parse the facets of a Collection and distinguish between an ordinary OutputMode and an ExportMode (new).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
229
diff
changeset
|
331 outmode = new DefaultOutputMode(name, desc, mime, fs); |
d01b0d81b92a
Parse the facets of a Collection and distinguish between an ordinary OutputMode and an ExportMode (new).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
229
diff
changeset
|
332 } |
d01b0d81b92a
Parse the facets of a Collection and distinguish between an ordinary OutputMode and an ExportMode (new).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
229
diff
changeset
|
333 |
d01b0d81b92a
Parse the facets of a Collection and distinguish between an ordinary OutputMode and an ExportMode (new).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
229
diff
changeset
|
334 modes.add(outmode); |
99
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
335 } |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
336 |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
337 return modes; |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
338 } |
270
d01b0d81b92a
Parse the facets of a Collection and distinguish between an ordinary OutputMode and an ExportMode (new).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
229
diff
changeset
|
339 |
d01b0d81b92a
Parse the facets of a Collection and distinguish between an ordinary OutputMode and an ExportMode (new).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
229
diff
changeset
|
340 |
581
210339fd1a34
Removed more expensive XPath.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
575
diff
changeset
|
341 protected static List<Facet> extractFacets(Element outmode) { |
270
d01b0d81b92a
Parse the facets of a Collection and distinguish between an ordinary OutputMode and an ExportMode (new).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
229
diff
changeset
|
342 System.out.println("ArtifactDescriptionFactory - extractFacets()"); |
d01b0d81b92a
Parse the facets of a Collection and distinguish between an ordinary OutputMode and an ExportMode (new).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
229
diff
changeset
|
343 |
d01b0d81b92a
Parse the facets of a Collection and distinguish between an ordinary OutputMode and an ExportMode (new).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
229
diff
changeset
|
344 NodeList facetList = (NodeList) XMLUtils.xpath( |
d01b0d81b92a
Parse the facets of a Collection and distinguish between an ordinary OutputMode and an ExportMode (new).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
229
diff
changeset
|
345 outmode, |
d01b0d81b92a
Parse the facets of a Collection and distinguish between an ordinary OutputMode and an ExportMode (new).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
229
diff
changeset
|
346 XPATH_FACETS, |
d01b0d81b92a
Parse the facets of a Collection and distinguish between an ordinary OutputMode and an ExportMode (new).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
229
diff
changeset
|
347 XPathConstants.NODESET, |
d01b0d81b92a
Parse the facets of a Collection and distinguish between an ordinary OutputMode and an ExportMode (new).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
229
diff
changeset
|
348 ArtifactNamespaceContext.INSTANCE); |
d01b0d81b92a
Parse the facets of a Collection and distinguish between an ordinary OutputMode and an ExportMode (new).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
229
diff
changeset
|
349 |
d01b0d81b92a
Parse the facets of a Collection and distinguish between an ordinary OutputMode and an ExportMode (new).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
229
diff
changeset
|
350 int num = facetList != null ? facetList.getLength() : 0; |
d01b0d81b92a
Parse the facets of a Collection and distinguish between an ordinary OutputMode and an ExportMode (new).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
229
diff
changeset
|
351 |
d01b0d81b92a
Parse the facets of a Collection and distinguish between an ordinary OutputMode and an ExportMode (new).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
229
diff
changeset
|
352 List<Facet> facets = new ArrayList<Facet>(num); |
d01b0d81b92a
Parse the facets of a Collection and distinguish between an ordinary OutputMode and an ExportMode (new).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
229
diff
changeset
|
353 |
575
5277f46a63c2
The description of a facet is now displayed in the ChartThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
524
diff
changeset
|
354 String uri = ArtifactNamespaceContext.NAMESPACE_URI; |
270
d01b0d81b92a
Parse the facets of a Collection and distinguish between an ordinary OutputMode and an ExportMode (new).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
229
diff
changeset
|
355 |
575
5277f46a63c2
The description of a facet is now displayed in the ChartThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
524
diff
changeset
|
356 for (int i = 0; i < num; i++) { |
5277f46a63c2
The description of a facet is now displayed in the ChartThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
524
diff
changeset
|
357 Element facetEl = (Element) facetList.item(i); |
270
d01b0d81b92a
Parse the facets of a Collection and distinguish between an ordinary OutputMode and an ExportMode (new).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
229
diff
changeset
|
358 |
575
5277f46a63c2
The description of a facet is now displayed in the ChartThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
524
diff
changeset
|
359 String name = facetEl.getAttributeNS(uri, "name"); |
5277f46a63c2
The description of a facet is now displayed in the ChartThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
524
diff
changeset
|
360 String desc = facetEl.getAttributeNS(uri, "description"); |
5277f46a63c2
The description of a facet is now displayed in the ChartThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
524
diff
changeset
|
361 String index = facetEl.getAttributeNS(uri, "index"); |
5277f46a63c2
The description of a facet is now displayed in the ChartThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
524
diff
changeset
|
362 |
5277f46a63c2
The description of a facet is now displayed in the ChartThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
524
diff
changeset
|
363 if (name != null && name.length() > 0 && index != null) { |
5277f46a63c2
The description of a facet is now displayed in the ChartThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
524
diff
changeset
|
364 facets.add(new DefaultFacet(name, Integer.valueOf(index),desc)); |
270
d01b0d81b92a
Parse the facets of a Collection and distinguish between an ordinary OutputMode and an ExportMode (new).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
229
diff
changeset
|
365 } |
d01b0d81b92a
Parse the facets of a Collection and distinguish between an ordinary OutputMode and an ExportMode (new).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
229
diff
changeset
|
366 } |
d01b0d81b92a
Parse the facets of a Collection and distinguish between an ordinary OutputMode and an ExportMode (new).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
229
diff
changeset
|
367 |
d01b0d81b92a
Parse the facets of a Collection and distinguish between an ordinary OutputMode and an ExportMode (new).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
229
diff
changeset
|
368 return facets; |
d01b0d81b92a
Parse the facets of a Collection and distinguish between an ordinary OutputMode and an ExportMode (new).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
229
diff
changeset
|
369 } |
99
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
370 } |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
371 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |