Mercurial > dive4elements > river
annotate flys-client/src/main/java/de/intevation/flys/client/server/DescribeCollectionServiceImpl.java @ 904:1e08a5b0add9
Changed table header string and set the column width to percental value.
(Issue194)
flys-client/trunk@2754 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Raimund Renkert <raimund.renkert@intevation.de> |
---|---|
date | Thu, 15 Sep 2011 08:39:07 +0000 |
parents | ec5c75da5c7a |
children | 478a571f1f94 |
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; |
804
374712890b94
Facets read from Collection's DESCRIBE document keep all their attributes after the Collection's attribute has been modified.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
796
diff
changeset
|
12 import org.w3c.dom.NamedNodeMap; |
374712890b94
Facets read from Collection's DESCRIBE document keep all their attributes after the Collection's attribute has been modified.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
796
diff
changeset
|
13 import org.w3c.dom.Node; |
99
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
14 import org.w3c.dom.NodeList; |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
15 |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
16 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
|
17 |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
18 import de.intevation.artifacts.common.ArtifactNamespaceContext; |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
19 import de.intevation.artifacts.common.utils.ClientProtocolUtils; |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
20 import de.intevation.artifacts.common.utils.XMLUtils; |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
21 |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
22 import de.intevation.artifacts.httpclient.exceptions.ConnectionException; |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
23 import de.intevation.artifacts.httpclient.http.HttpClient; |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
24 import de.intevation.artifacts.httpclient.http.HttpClientImpl; |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
25 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
|
26 |
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
|
27 import de.intevation.flys.client.shared.exceptions.ServerException; |
804
374712890b94
Facets read from Collection's DESCRIBE document keep all their attributes after the Collection's attribute has been modified.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
796
diff
changeset
|
28 import de.intevation.flys.client.shared.model.AttributedTheme; |
99
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.Collection; |
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.CollectionItem; |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
31 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
|
32 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
|
33 import de.intevation.flys.client.shared.model.DefaultFacet; |
796
cd8603aaa730
Improved the process of creating OutputTabs. Added support for map output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
589
diff
changeset
|
34 import de.intevation.flys.client.shared.model.ChartMode; |
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
|
35 import de.intevation.flys.client.shared.model.ExportMode; |
796
cd8603aaa730
Improved the process of creating OutputTabs. Added support for map output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
589
diff
changeset
|
36 import de.intevation.flys.client.shared.model.MapMode; |
589
942bd0e7e332
Filter reports and dispatch them to updateReports().
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
587
diff
changeset
|
37 import de.intevation.flys.client.shared.model.ReportMode; |
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
|
38 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
|
39 import de.intevation.flys.client.shared.model.OutputMode; |
809
e9337488bac3
The Collection now knows its already loaded recommendations - the CollectionView will not load recommendations that have already been loaded before.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
804
diff
changeset
|
40 import de.intevation.flys.client.shared.model.Recommendation; |
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
|
41 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
|
42 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
|
43 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
|
44 |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
45 |
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 * 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
|
48 * 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
|
49 * the document. |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
50 * |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
51 * @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
|
52 */ |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
53 public class DescribeCollectionServiceImpl |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
54 extends RemoteServiceServlet |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
55 implements DescribeCollectionService |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
56 { |
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
|
57 /** 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
|
58 * 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
|
59 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
|
60 "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
|
61 |
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
|
62 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
|
63 |
809
e9337488bac3
The Collection now knows its already loaded recommendations - the CollectionView will not load recommendations that have already been loaded before.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
804
diff
changeset
|
64 public static final String XPATH_LOADED_RECOMMENDATIONS = |
e9337488bac3
The Collection now knows its already loaded recommendations - the CollectionView will not load recommendations that have already been loaded before.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
804
diff
changeset
|
65 "/art:artifact-collection/art:attribute/art:loaded-recommendations/art:recommendation"; |
e9337488bac3
The Collection now knows its already loaded recommendations - the CollectionView will not load recommendations that have already been loaded before.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
804
diff
changeset
|
66 |
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
|
67 |
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
|
68 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
|
69 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
|
70 { |
99
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
71 System.out.println("DescribeCollectionServiceImpl.describe"); |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
72 |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
73 Document describe = ClientProtocolUtils.newDescribeCollectionDocument( |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
74 uuid); |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
75 |
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
|
76 HttpClient client = new HttpClientImpl(serverUrl, locale); |
99
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
77 |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
78 try { |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
79 Document response = (Document) client.doCollectionAction( |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
80 describe, uuid, new DocumentResponseHandler()); |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
81 |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
82 Collection c = parseCollection(response); |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
83 |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
84 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
|
85 throw new ServerException(ERROR_DESCRIBE_COLLECTION); |
99
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
86 } |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
87 |
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
|
88 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
|
89 |
99
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
90 return c; |
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 catch (ConnectionException ce) { |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
93 System.err.println(ce.getLocalizedMessage()); |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
94 } |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
95 |
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
|
96 throw new ServerException(ERROR_DESCRIBE_COLLECTION); |
99
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 |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
99 |
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 * 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
|
102 * 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
|
103 * the collection items. |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
104 * |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
105 * @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
|
106 * operation. |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
107 * |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
108 * @return a Collection with CollectionItems. |
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 protected Collection parseCollection(Document description) { |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
111 System.out.println("AddArtifactServiceImpl.parseCollection"); |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
112 |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
113 if (description == null) { |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
114 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
|
115 return null; |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
116 } |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
117 |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
118 String uuid = XMLUtils.xpathString( |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
119 description, |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
120 "art:artifact-collection/@art:uuid", |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
121 ArtifactNamespaceContext.INSTANCE); |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
122 |
587
53ad6dd2cb2b
The project list displays the favorite state of a collection now. A gold star means, that a collection is a owner's favorite project and will never die. A silver star means, that the project is a common project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
582
diff
changeset
|
123 String ttlStr = XMLUtils.xpathString( |
53ad6dd2cb2b
The project list displays the favorite state of a collection now. A gold star means, that a collection is a owner's favorite project and will never die. A silver star means, that the project is a common project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
582
diff
changeset
|
124 description, |
53ad6dd2cb2b
The project list displays the favorite state of a collection now. A gold star means, that a collection is a owner's favorite project and will never die. A silver star means, that the project is a common project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
582
diff
changeset
|
125 "art:artifact-collection/@art:ttl", |
53ad6dd2cb2b
The project list displays the favorite state of a collection now. A gold star means, that a collection is a owner's favorite project and will never die. A silver star means, that the project is a common project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
582
diff
changeset
|
126 ArtifactNamespaceContext.INSTANCE); |
53ad6dd2cb2b
The project list displays the favorite state of a collection now. A gold star means, that a collection is a owner's favorite project and will never die. A silver star means, that the project is a common project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
582
diff
changeset
|
127 |
856
ec5c75da5c7a
Bugfix flys/issue166: Parse Collection names from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
839
diff
changeset
|
128 String name = XMLUtils.xpathString( |
ec5c75da5c7a
Bugfix flys/issue166: Parse Collection names from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
839
diff
changeset
|
129 description, |
ec5c75da5c7a
Bugfix flys/issue166: Parse Collection names from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
839
diff
changeset
|
130 "art:artifact-collection/@art:name", |
ec5c75da5c7a
Bugfix flys/issue166: Parse Collection names from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
839
diff
changeset
|
131 ArtifactNamespaceContext.INSTANCE); |
ec5c75da5c7a
Bugfix flys/issue166: Parse Collection names from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
839
diff
changeset
|
132 |
587
53ad6dd2cb2b
The project list displays the favorite state of a collection now. A gold star means, that a collection is a owner's favorite project and will never die. A silver star means, that the project is a common project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
582
diff
changeset
|
133 if (uuid.length() == 0 || ttlStr.length() == 0) { |
99
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
134 System.err.println("Found an invalid Collection!"); |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
135 return null; |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
136 } |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
137 |
587
53ad6dd2cb2b
The project list displays the favorite state of a collection now. A gold star means, that a collection is a owner's favorite project and will never die. A silver star means, that the project is a common project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
582
diff
changeset
|
138 |
53ad6dd2cb2b
The project list displays the favorite state of a collection now. A gold star means, that a collection is a owner's favorite project and will never die. A silver star means, that the project is a common project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
582
diff
changeset
|
139 long ttl = -1; |
53ad6dd2cb2b
The project list displays the favorite state of a collection now. A gold star means, that a collection is a owner's favorite project and will never die. A silver star means, that the project is a common project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
582
diff
changeset
|
140 try { |
53ad6dd2cb2b
The project list displays the favorite state of a collection now. A gold star means, that a collection is a owner's favorite project and will never die. A silver star means, that the project is a common project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
582
diff
changeset
|
141 ttl = Long.valueOf(ttlStr); |
53ad6dd2cb2b
The project list displays the favorite state of a collection now. A gold star means, that a collection is a owner's favorite project and will never die. A silver star means, that the project is a common project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
582
diff
changeset
|
142 } |
53ad6dd2cb2b
The project list displays the favorite state of a collection now. A gold star means, that a collection is a owner's favorite project and will never die. A silver star means, that the project is a common project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
582
diff
changeset
|
143 catch (NumberFormatException nfe) { |
53ad6dd2cb2b
The project list displays the favorite state of a collection now. A gold star means, that a collection is a owner's favorite project and will never die. A silver star means, that the project is a common project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
582
diff
changeset
|
144 // do nothing |
53ad6dd2cb2b
The project list displays the favorite state of a collection now. A gold star means, that a collection is a owner's favorite project and will never die. A silver star means, that the project is a common project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
582
diff
changeset
|
145 } |
53ad6dd2cb2b
The project list displays the favorite state of a collection now. A gold star means, that a collection is a owner's favorite project and will never die. A silver star means, that the project is a common project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
582
diff
changeset
|
146 |
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
|
147 Map<String, ThemeList> themeList = parseThemeLists(description); |
809
e9337488bac3
The Collection now knows its already loaded recommendations - the CollectionView will not load recommendations that have already been loaded before.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
804
diff
changeset
|
148 List<Recommendation> recommended = parseRecommendations(description); |
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
|
149 |
856
ec5c75da5c7a
Bugfix flys/issue166: Parse Collection names from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
839
diff
changeset
|
150 name = (name != null && name.length() > 0) ? name : uuid; |
ec5c75da5c7a
Bugfix flys/issue166: Parse Collection names from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
839
diff
changeset
|
151 |
581
210339fd1a34
Removed more expensive XPath.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
575
diff
changeset
|
152 Collection c = !themeList.isEmpty() |
856
ec5c75da5c7a
Bugfix flys/issue166: Parse Collection names from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
839
diff
changeset
|
153 ? new DefaultCollection(uuid, ttl, name, recommended, themeList) |
ec5c75da5c7a
Bugfix flys/issue166: Parse Collection names from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
839
diff
changeset
|
154 : new DefaultCollection(uuid, ttl, name, recommended); |
99
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 NodeList items = (NodeList) XMLUtils.xpath( |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
157 description, |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
158 "art:artifact-collection/art:artifacts/art:artifact", |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
159 XPathConstants.NODESET, |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
160 ArtifactNamespaceContext.INSTANCE); |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
161 |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
162 if (items == null || items.getLength() == 0) { |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
163 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
|
164 |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
165 return c; |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
166 } |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
167 |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
168 int size = items.getLength(); |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
169 |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
170 for (int i = 0; i < size; i++) { |
829
f14cefeed243
Display the output modes of the master artifact only - all other artifact's output modes are NOT visible to the user.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
815
diff
changeset
|
171 CollectionItem item = parseCollectionItem( |
f14cefeed243
Display the output modes of the master artifact only - all other artifact's output modes are NOT visible to the user.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
815
diff
changeset
|
172 (Element)items.item(i), |
f14cefeed243
Display the output modes of the master artifact only - all other artifact's output modes are NOT visible to the user.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
815
diff
changeset
|
173 i == 0); |
99
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
174 |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
175 if (item != null) { |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
176 c.addItem(item); |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
177 } |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
178 } |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
179 |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
180 System.out.println( |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
181 "Found " + c.getItemLength() + " collection items " + |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
182 "for the Collection '" + c.identifier() + "'."); |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
183 |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
184 return c; |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
185 } |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
186 |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
187 |
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
|
188 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
|
189 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
|
190 |
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 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
|
192 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
|
193 "/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
|
194 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
|
195 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
|
196 |
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 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
|
198 |
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 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
|
200 |
581
210339fd1a34
Removed more expensive XPath.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
575
diff
changeset
|
201 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
|
202 |
581
210339fd1a34
Removed more expensive XPath.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
575
diff
changeset
|
203 for (int i = 0; i < num; i++) { |
210339fd1a34
Removed more expensive XPath.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
575
diff
changeset
|
204 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
|
205 |
581
210339fd1a34
Removed more expensive XPath.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
575
diff
changeset
|
206 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
|
207 |
581
210339fd1a34
Removed more expensive XPath.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
575
diff
changeset
|
208 if (outName.length() > 0) { |
210339fd1a34
Removed more expensive XPath.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
575
diff
changeset
|
209 ThemeList list = parseThemeList(node); |
210339fd1a34
Removed more expensive XPath.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
575
diff
changeset
|
210 if (list.getThemeCount() > 0) { |
210339fd1a34
Removed more expensive XPath.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
575
diff
changeset
|
211 themeList.put(outName, list); |
210339fd1a34
Removed more expensive XPath.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
575
diff
changeset
|
212 } |
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 } |
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 } |
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
|
215 |
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 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
|
217 } |
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
|
218 |
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
|
219 |
581
210339fd1a34
Removed more expensive XPath.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
575
diff
changeset
|
220 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
|
221 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
|
222 |
581
210339fd1a34
Removed more expensive XPath.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
575
diff
changeset
|
223 NodeList themes = node.getElementsByTagNameNS( |
210339fd1a34
Removed more expensive XPath.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
575
diff
changeset
|
224 ArtifactNamespaceContext.NAMESPACE_URI, |
804
374712890b94
Facets read from Collection's DESCRIBE document keep all their attributes after the Collection's attribute has been modified.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
796
diff
changeset
|
225 "facet"); |
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
|
226 |
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 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
|
228 |
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 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
|
230 |
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 for (int i = 0; i < num; i++) { |
581
210339fd1a34
Removed more expensive XPath.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
575
diff
changeset
|
232 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
|
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 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
|
235 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
|
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 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
|
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 |
575
5277f46a63c2
The description of a facet is now displayed in the ChartThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
524
diff
changeset
|
243 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
|
244 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
|
245 |
575
5277f46a63c2
The description of a facet is now displayed in the ChartThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
524
diff
changeset
|
246 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
|
247 |
804
374712890b94
Facets read from Collection's DESCRIBE document keep all their attributes after the Collection's attribute has been modified.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
796
diff
changeset
|
248 NamedNodeMap attrMap = ele.getAttributes(); |
374712890b94
Facets read from Collection's DESCRIBE document keep all their attributes after the Collection's attribute has been modified.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
796
diff
changeset
|
249 int attrNum = attrMap != null ? attrMap.getLength() : 0; |
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
|
250 |
804
374712890b94
Facets read from Collection's DESCRIBE document keep all their attributes after the Collection's attribute has been modified.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
796
diff
changeset
|
251 AttributedTheme t = new AttributedTheme(); |
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
|
252 |
804
374712890b94
Facets read from Collection's DESCRIBE document keep all their attributes after the Collection's attribute has been modified.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
796
diff
changeset
|
253 for (int i = 0; i < attrNum; i++) { |
374712890b94
Facets read from Collection's DESCRIBE document keep all their attributes after the Collection's attribute has been modified.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
796
diff
changeset
|
254 Node attr = attrMap.item(i); |
374712890b94
Facets read from Collection's DESCRIBE document keep all their attributes after the Collection's attribute has been modified.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
796
diff
changeset
|
255 |
374712890b94
Facets read from Collection's DESCRIBE document keep all their attributes after the Collection's attribute has been modified.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
796
diff
changeset
|
256 String prefix = attr.getPrefix(); |
374712890b94
Facets read from Collection's DESCRIBE document keep all their attributes after the Collection's attribute has been modified.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
796
diff
changeset
|
257 String name = attr.getNodeName().replace(prefix + ":", ""); |
374712890b94
Facets read from Collection's DESCRIBE document keep all their attributes after the Collection's attribute has been modified.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
796
diff
changeset
|
258 String value = attr.getNodeValue(); |
374712890b94
Facets read from Collection's DESCRIBE document keep all their attributes after the Collection's attribute has been modified.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
796
diff
changeset
|
259 |
374712890b94
Facets read from Collection's DESCRIBE document keep all their attributes after the Collection's attribute has been modified.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
796
diff
changeset
|
260 t.addAttr(name, value); |
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
|
261 } |
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
|
262 |
804
374712890b94
Facets read from Collection's DESCRIBE document keep all their attributes after the Collection's attribute has been modified.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
796
diff
changeset
|
263 return t; |
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
|
264 } |
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
|
265 |
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
|
266 |
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 * 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
|
269 * 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
|
270 * |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
271 * @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
|
272 * |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
273 * @return a CollectionItem. |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
274 */ |
829
f14cefeed243
Display the output modes of the master artifact only - all other artifact's output modes are NOT visible to the user.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
815
diff
changeset
|
275 protected CollectionItem parseCollectionItem(Element node, boolean outs) { |
99
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
276 System.out.println("AddArtifactServiceImpl.parseCollectionItem"); |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
277 |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
278 if (node == null) { |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
279 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
|
280 return null; |
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 |
581
210339fd1a34
Removed more expensive XPath.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
575
diff
changeset
|
283 String uri = ArtifactNamespaceContext.NAMESPACE_URI; |
99
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
284 |
581
210339fd1a34
Removed more expensive XPath.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
575
diff
changeset
|
285 String uuid = node.getAttributeNS(uri, "uuid"); |
210339fd1a34
Removed more expensive XPath.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
575
diff
changeset
|
286 String hash = node.getAttributeNS(uri, "hash"); |
99
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
287 |
587
53ad6dd2cb2b
The project list displays the favorite state of a collection now. A gold star means, that a collection is a owner's favorite project and will never die. A silver star means, that the project is a common project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
582
diff
changeset
|
288 if (uuid == null || uuid.length() == 0) { |
99
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
289 System.err.println("Found an invalid CollectionItem!"); |
581
210339fd1a34
Removed more expensive XPath.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
575
diff
changeset
|
290 return null; |
99
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
291 } |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
292 |
829
f14cefeed243
Display the output modes of the master artifact only - all other artifact's output modes are NOT visible to the user.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
815
diff
changeset
|
293 List<OutputMode> modes = new ArrayList<OutputMode>(); |
99
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
294 |
829
f14cefeed243
Display the output modes of the master artifact only - all other artifact's output modes are NOT visible to the user.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
815
diff
changeset
|
295 if (outs) { |
f14cefeed243
Display the output modes of the master artifact only - all other artifact's output modes are NOT visible to the user.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
815
diff
changeset
|
296 NodeList outputmodes = node.getElementsByTagNameNS( |
f14cefeed243
Display the output modes of the master artifact only - all other artifact's output modes are NOT visible to the user.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
815
diff
changeset
|
297 uri, "outputmodes"); |
f14cefeed243
Display the output modes of the master artifact only - all other artifact's output modes are NOT visible to the user.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
815
diff
changeset
|
298 |
f14cefeed243
Display the output modes of the master artifact only - all other artifact's output modes are NOT visible to the user.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
815
diff
changeset
|
299 if (outputmodes.getLength() < 1) { |
f14cefeed243
Display the output modes of the master artifact only - all other artifact's output modes are NOT visible to the user.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
815
diff
changeset
|
300 return null; |
f14cefeed243
Display the output modes of the master artifact only - all other artifact's output modes are NOT visible to the user.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
815
diff
changeset
|
301 } |
f14cefeed243
Display the output modes of the master artifact only - all other artifact's output modes are NOT visible to the user.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
815
diff
changeset
|
302 |
f14cefeed243
Display the output modes of the master artifact only - all other artifact's output modes are NOT visible to the user.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
815
diff
changeset
|
303 Element om = (Element)outputmodes.item(0); |
f14cefeed243
Display the output modes of the master artifact only - all other artifact's output modes are NOT visible to the user.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
815
diff
changeset
|
304 |
f14cefeed243
Display the output modes of the master artifact only - all other artifact's output modes are NOT visible to the user.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
815
diff
changeset
|
305 modes = parseOutputModes(om); |
581
210339fd1a34
Removed more expensive XPath.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
575
diff
changeset
|
306 } |
210339fd1a34
Removed more expensive XPath.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
575
diff
changeset
|
307 |
99
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
308 return new DefaultCollectionItem(uuid, hash, modes); |
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 |
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 /** |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
313 * 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
|
314 * CollectionItem and returns them as list. |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
315 * |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
316 * @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
|
317 * |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
318 * @return a list of OutputModes. |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
319 */ |
581
210339fd1a34
Removed more expensive XPath.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
575
diff
changeset
|
320 protected List<OutputMode> parseOutputModes(Element node) { |
99
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
321 System.out.println("AddArtifactServiceImpl.parseOutputModes"); |
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 if (node == null) { |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
324 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
|
325 return null; |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
326 } |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
327 |
581
210339fd1a34
Removed more expensive XPath.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
575
diff
changeset
|
328 String uri = ArtifactNamespaceContext.NAMESPACE_URI; |
99
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
329 |
581
210339fd1a34
Removed more expensive XPath.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
575
diff
changeset
|
330 NodeList list = node.getElementsByTagNameNS(uri, "output"); |
210339fd1a34
Removed more expensive XPath.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
575
diff
changeset
|
331 |
210339fd1a34
Removed more expensive XPath.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
575
diff
changeset
|
332 int size = list.getLength(); |
210339fd1a34
Removed more expensive XPath.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
575
diff
changeset
|
333 |
210339fd1a34
Removed more expensive XPath.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
575
diff
changeset
|
334 if (size == 0) { |
99
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
335 System.err.println("No outputmode nodes found!"); |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
336 return null; |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
337 } |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
338 |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
339 List<OutputMode> modes = new ArrayList<OutputMode>(size); |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
340 |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
341 for (int i = 0; i < size; i++) { |
581
210339fd1a34
Removed more expensive XPath.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
575
diff
changeset
|
342 Element tmp = (Element)list.item(i); |
99
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
343 |
581
210339fd1a34
Removed more expensive XPath.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
575
diff
changeset
|
344 String name = tmp.getAttributeNS(uri, "name"); |
210339fd1a34
Removed more expensive XPath.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
575
diff
changeset
|
345 String desc = tmp.getAttributeNS(uri, "description"); |
210339fd1a34
Removed more expensive XPath.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
575
diff
changeset
|
346 String mime = tmp.getAttributeNS(uri, "mime-type"); |
796
cd8603aaa730
Improved the process of creating OutputTabs. Added support for map output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
589
diff
changeset
|
347 String type = tmp.getAttributeNS(uri, "type"); |
581
210339fd1a34
Removed more expensive XPath.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
575
diff
changeset
|
348 |
210339fd1a34
Removed more expensive XPath.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
575
diff
changeset
|
349 if (name.length() == 0) { |
99
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
350 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
|
351 continue; |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
352 } |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
353 |
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
|
354 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
|
355 List<Facet> fs = extractFacets(tmp); |
99
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
356 |
796
cd8603aaa730
Improved the process of creating OutputTabs. Added support for map output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
589
diff
changeset
|
357 if (type.equals("export")) { |
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 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
|
359 } |
796
cd8603aaa730
Improved the process of creating OutputTabs. Added support for map output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
589
diff
changeset
|
360 else if (type.equals("report")) { |
589
942bd0e7e332
Filter reports and dispatch them to updateReports().
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
587
diff
changeset
|
361 outmode = new ReportMode(name, desc, mime, fs); |
942bd0e7e332
Filter reports and dispatch them to updateReports().
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
587
diff
changeset
|
362 } |
796
cd8603aaa730
Improved the process of creating OutputTabs. Added support for map output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
589
diff
changeset
|
363 else if (type.equals("chart")){ |
cd8603aaa730
Improved the process of creating OutputTabs. Added support for map output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
589
diff
changeset
|
364 outmode = new ChartMode(name, desc, mime, fs); |
cd8603aaa730
Improved the process of creating OutputTabs. Added support for map output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
589
diff
changeset
|
365 } |
cd8603aaa730
Improved the process of creating OutputTabs. Added support for map output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
589
diff
changeset
|
366 else if (type.equals("map")){ |
cd8603aaa730
Improved the process of creating OutputTabs. Added support for map output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
589
diff
changeset
|
367 outmode = new MapMode(name, desc, mime, fs); |
cd8603aaa730
Improved the process of creating OutputTabs. Added support for map output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
589
diff
changeset
|
368 } |
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
|
369 else { |
796
cd8603aaa730
Improved the process of creating OutputTabs. Added support for map output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
589
diff
changeset
|
370 System.err.println("Broken Output mode without type found."); |
cd8603aaa730
Improved the process of creating OutputTabs. Added support for map output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
589
diff
changeset
|
371 continue; |
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
|
372 } |
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
|
373 |
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
|
374 modes.add(outmode); |
99
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
375 } |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
376 |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
377 return modes; |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
378 } |
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
|
379 |
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
|
380 |
581
210339fd1a34
Removed more expensive XPath.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
575
diff
changeset
|
381 protected static List<Facet> extractFacets(Element outmode) { |
809
e9337488bac3
The Collection now knows its already loaded recommendations - the CollectionView will not load recommendations that have already been loaded before.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
804
diff
changeset
|
382 System.out.println("DescribeCollectionServiceImpl - extractFacets()"); |
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
|
383 |
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
|
384 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
|
385 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
|
386 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
|
387 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
|
388 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
|
389 |
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
|
390 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
|
391 |
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
|
392 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
|
393 |
575
5277f46a63c2
The description of a facet is now displayed in the ChartThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
524
diff
changeset
|
394 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
|
395 |
575
5277f46a63c2
The description of a facet is now displayed in the ChartThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
524
diff
changeset
|
396 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
|
397 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
|
398 |
575
5277f46a63c2
The description of a facet is now displayed in the ChartThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
524
diff
changeset
|
399 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
|
400 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
|
401 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
|
402 |
5277f46a63c2
The description of a facet is now displayed in the ChartThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
524
diff
changeset
|
403 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
|
404 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
|
405 } |
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
|
406 } |
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
|
407 |
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
|
408 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
|
409 } |
809
e9337488bac3
The Collection now knows its already loaded recommendations - the CollectionView will not load recommendations that have already been loaded before.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
804
diff
changeset
|
410 |
e9337488bac3
The Collection now knows its already loaded recommendations - the CollectionView will not load recommendations that have already been loaded before.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
804
diff
changeset
|
411 |
e9337488bac3
The Collection now knows its already loaded recommendations - the CollectionView will not load recommendations that have already been loaded before.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
804
diff
changeset
|
412 public static List<Recommendation> parseRecommendations(Document doc) { |
e9337488bac3
The Collection now knows its already loaded recommendations - the CollectionView will not load recommendations that have already been loaded before.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
804
diff
changeset
|
413 System.out.println("DescribeCollectionServiceImpl.parseRecommendations"); |
e9337488bac3
The Collection now knows its already loaded recommendations - the CollectionView will not load recommendations that have already been loaded before.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
804
diff
changeset
|
414 |
e9337488bac3
The Collection now knows its already loaded recommendations - the CollectionView will not load recommendations that have already been loaded before.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
804
diff
changeset
|
415 NodeList list = (NodeList) XMLUtils.xpath( |
e9337488bac3
The Collection now knows its already loaded recommendations - the CollectionView will not load recommendations that have already been loaded before.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
804
diff
changeset
|
416 doc, |
e9337488bac3
The Collection now knows its already loaded recommendations - the CollectionView will not load recommendations that have already been loaded before.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
804
diff
changeset
|
417 XPATH_LOADED_RECOMMENDATIONS, |
e9337488bac3
The Collection now knows its already loaded recommendations - the CollectionView will not load recommendations that have already been loaded before.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
804
diff
changeset
|
418 XPathConstants.NODESET, |
e9337488bac3
The Collection now knows its already loaded recommendations - the CollectionView will not load recommendations that have already been loaded before.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
804
diff
changeset
|
419 ArtifactNamespaceContext.INSTANCE); |
e9337488bac3
The Collection now knows its already loaded recommendations - the CollectionView will not load recommendations that have already been loaded before.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
804
diff
changeset
|
420 |
e9337488bac3
The Collection now knows its already loaded recommendations - the CollectionView will not load recommendations that have already been loaded before.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
804
diff
changeset
|
421 int num = list != null ? list.getLength() : 0; |
e9337488bac3
The Collection now knows its already loaded recommendations - the CollectionView will not load recommendations that have already been loaded before.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
804
diff
changeset
|
422 |
e9337488bac3
The Collection now knows its already loaded recommendations - the CollectionView will not load recommendations that have already been loaded before.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
804
diff
changeset
|
423 List<Recommendation> recs = new ArrayList<Recommendation>(num); |
e9337488bac3
The Collection now knows its already loaded recommendations - the CollectionView will not load recommendations that have already been loaded before.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
804
diff
changeset
|
424 |
e9337488bac3
The Collection now knows its already loaded recommendations - the CollectionView will not load recommendations that have already been loaded before.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
804
diff
changeset
|
425 String uri = ArtifactNamespaceContext.NAMESPACE_URI; |
e9337488bac3
The Collection now knows its already loaded recommendations - the CollectionView will not load recommendations that have already been loaded before.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
804
diff
changeset
|
426 |
e9337488bac3
The Collection now knows its already loaded recommendations - the CollectionView will not load recommendations that have already been loaded before.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
804
diff
changeset
|
427 for (int i = 0; i < num; i++) { |
e9337488bac3
The Collection now knows its already loaded recommendations - the CollectionView will not load recommendations that have already been loaded before.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
804
diff
changeset
|
428 Element rec = (Element) list.item(i); |
e9337488bac3
The Collection now knows its already loaded recommendations - the CollectionView will not load recommendations that have already been loaded before.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
804
diff
changeset
|
429 |
e9337488bac3
The Collection now knows its already loaded recommendations - the CollectionView will not load recommendations that have already been loaded before.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
804
diff
changeset
|
430 String factory = rec.getAttributeNS(uri, "factory"); |
836
0fe456332785
Datacage: s/db-ids/ids/g to unify system and user specific loading.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
829
diff
changeset
|
431 String dbids = rec.getAttributeNS(uri, "ids"); |
809
e9337488bac3
The Collection now knows its already loaded recommendations - the CollectionView will not load recommendations that have already been loaded before.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
804
diff
changeset
|
432 |
e9337488bac3
The Collection now knows its already loaded recommendations - the CollectionView will not load recommendations that have already been loaded before.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
804
diff
changeset
|
433 if (factory != null && factory.length() > 0) { |
839
6a1cd38e6e18
Made Recommendation a class for direct use.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
836
diff
changeset
|
434 recs.add(new Recommendation(factory, dbids)); |
809
e9337488bac3
The Collection now knows its already loaded recommendations - the CollectionView will not load recommendations that have already been loaded before.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
804
diff
changeset
|
435 } |
e9337488bac3
The Collection now knows its already loaded recommendations - the CollectionView will not load recommendations that have already been loaded before.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
804
diff
changeset
|
436 } |
e9337488bac3
The Collection now knows its already loaded recommendations - the CollectionView will not load recommendations that have already been loaded before.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
804
diff
changeset
|
437 |
e9337488bac3
The Collection now knows its already loaded recommendations - the CollectionView will not load recommendations that have already been loaded before.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
804
diff
changeset
|
438 return recs; |
e9337488bac3
The Collection now knows its already loaded recommendations - the CollectionView will not load recommendations that have already been loaded before.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
804
diff
changeset
|
439 } |
99
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
440 } |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
441 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |