Mercurial > dive4elements > river
annotate flys-client/src/main/java/de/intevation/flys/client/server/DescribeCollectionServiceImpl.java @ 844:ac70261bb3f8
Allow passing no master artifact to RPC service when creating new artifact.
flys-client/trunk@2566 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Wed, 24 Aug 2011 14:31:13 +0000 |
parents | 6a1cd38e6e18 |
children | ec5c75da5c7a |
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 |
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
|
128 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
|
129 System.err.println("Found an invalid Collection!"); |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
130 return null; |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
131 } |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
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 |
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
|
134 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
|
135 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
|
136 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
|
137 } |
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 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
|
139 // 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
|
140 } |
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 |
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
|
142 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
|
143 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
|
144 |
581
210339fd1a34
Removed more expensive XPath.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
575
diff
changeset
|
145 Collection c = !themeList.isEmpty() |
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
|
146 ? new DefaultCollection(uuid, ttl, recommended, themeList) |
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
|
147 : new DefaultCollection(uuid, ttl, recommended); |
99
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 NodeList items = (NodeList) XMLUtils.xpath( |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
150 description, |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
151 "art:artifact-collection/art:artifacts/art:artifact", |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
152 XPathConstants.NODESET, |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
153 ArtifactNamespaceContext.INSTANCE); |
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 if (items == null || items.getLength() == 0) { |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
156 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
|
157 |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
158 return c; |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
159 } |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
160 |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
161 int size = items.getLength(); |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
162 |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
163 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
|
164 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
|
165 (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
|
166 i == 0); |
99
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 if (item != null) { |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
169 c.addItem(item); |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
170 } |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
171 } |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
172 |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
173 System.out.println( |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
174 "Found " + c.getItemLength() + " collection items " + |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
175 "for the Collection '" + c.identifier() + "'."); |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
176 |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
177 return c; |
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 |
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
|
181 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
|
182 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
|
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 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
|
185 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
|
186 "/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
|
187 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
|
188 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
|
189 |
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 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
|
191 |
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 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
|
193 |
581
210339fd1a34
Removed more expensive XPath.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
575
diff
changeset
|
194 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
|
195 |
581
210339fd1a34
Removed more expensive XPath.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
575
diff
changeset
|
196 for (int i = 0; i < num; i++) { |
210339fd1a34
Removed more expensive XPath.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
575
diff
changeset
|
197 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
|
198 |
581
210339fd1a34
Removed more expensive XPath.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
575
diff
changeset
|
199 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
|
200 |
581
210339fd1a34
Removed more expensive XPath.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
575
diff
changeset
|
201 if (outName.length() > 0) { |
210339fd1a34
Removed more expensive XPath.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
575
diff
changeset
|
202 ThemeList list = parseThemeList(node); |
210339fd1a34
Removed more expensive XPath.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
575
diff
changeset
|
203 if (list.getThemeCount() > 0) { |
210339fd1a34
Removed more expensive XPath.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
575
diff
changeset
|
204 themeList.put(outName, list); |
210339fd1a34
Removed more expensive XPath.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
575
diff
changeset
|
205 } |
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
|
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 |
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 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
|
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 |
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
|
212 |
581
210339fd1a34
Removed more expensive XPath.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
575
diff
changeset
|
213 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
|
214 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
|
215 |
581
210339fd1a34
Removed more expensive XPath.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
575
diff
changeset
|
216 NodeList themes = node.getElementsByTagNameNS( |
210339fd1a34
Removed more expensive XPath.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
575
diff
changeset
|
217 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
|
218 "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
|
219 |
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
|
220 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
|
221 |
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 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
|
223 |
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
|
224 for (int i = 0; i < num; i++) { |
581
210339fd1a34
Removed more expensive XPath.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
575
diff
changeset
|
225 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
|
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 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
|
228 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
|
229 } |
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 |
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
|
232 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
|
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 |
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 |
575
5277f46a63c2
The description of a facet is now displayed in the ChartThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
524
diff
changeset
|
236 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
|
237 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
|
238 |
575
5277f46a63c2
The description of a facet is now displayed in the ChartThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
524
diff
changeset
|
239 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
|
240 |
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
|
241 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
|
242 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
|
243 |
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
|
244 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
|
245 |
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
|
246 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
|
247 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
|
248 |
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 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
|
250 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
|
251 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
|
252 |
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 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
|
254 } |
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
|
255 |
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
|
256 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
|
257 } |
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
|
258 |
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
|
259 |
99
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
260 /** |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
261 * 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
|
262 * 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
|
263 * |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
264 * @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
|
265 * |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
266 * @return a CollectionItem. |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
267 */ |
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
|
268 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
|
269 System.out.println("AddArtifactServiceImpl.parseCollectionItem"); |
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 if (node == null) { |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
272 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
|
273 return null; |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
274 } |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
275 |
581
210339fd1a34
Removed more expensive XPath.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
575
diff
changeset
|
276 String uri = ArtifactNamespaceContext.NAMESPACE_URI; |
99
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
277 |
581
210339fd1a34
Removed more expensive XPath.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
575
diff
changeset
|
278 String uuid = node.getAttributeNS(uri, "uuid"); |
210339fd1a34
Removed more expensive XPath.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
575
diff
changeset
|
279 String hash = node.getAttributeNS(uri, "hash"); |
99
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
280 |
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
|
281 if (uuid == null || uuid.length() == 0) { |
99
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
282 System.err.println("Found an invalid CollectionItem!"); |
581
210339fd1a34
Removed more expensive XPath.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
575
diff
changeset
|
283 return null; |
99
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
284 } |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
285 |
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
|
286 List<OutputMode> modes = new ArrayList<OutputMode>(); |
99
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
287 |
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
|
288 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
|
289 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
|
290 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
|
291 |
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
|
292 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
|
293 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
|
294 } |
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 |
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 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
|
297 |
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 modes = parseOutputModes(om); |
581
210339fd1a34
Removed more expensive XPath.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
575
diff
changeset
|
299 } |
210339fd1a34
Removed more expensive XPath.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
575
diff
changeset
|
300 |
99
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
301 return new DefaultCollectionItem(uuid, hash, modes); |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
302 } |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
303 |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
304 |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
305 /** |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
306 * 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
|
307 * CollectionItem and returns them as list. |
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 * @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
|
310 * |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
311 * @return a list of OutputModes. |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
312 */ |
581
210339fd1a34
Removed more expensive XPath.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
575
diff
changeset
|
313 protected List<OutputMode> parseOutputModes(Element node) { |
99
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
314 System.out.println("AddArtifactServiceImpl.parseOutputModes"); |
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 if (node == null) { |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
317 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
|
318 return null; |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
319 } |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
320 |
581
210339fd1a34
Removed more expensive XPath.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
575
diff
changeset
|
321 String uri = ArtifactNamespaceContext.NAMESPACE_URI; |
99
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
322 |
581
210339fd1a34
Removed more expensive XPath.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
575
diff
changeset
|
323 NodeList list = node.getElementsByTagNameNS(uri, "output"); |
210339fd1a34
Removed more expensive XPath.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
575
diff
changeset
|
324 |
210339fd1a34
Removed more expensive XPath.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
575
diff
changeset
|
325 int size = list.getLength(); |
210339fd1a34
Removed more expensive XPath.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
575
diff
changeset
|
326 |
210339fd1a34
Removed more expensive XPath.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
575
diff
changeset
|
327 if (size == 0) { |
99
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
328 System.err.println("No outputmode nodes found!"); |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
329 return null; |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
330 } |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
331 |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
332 List<OutputMode> modes = new ArrayList<OutputMode>(size); |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
333 |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
334 for (int i = 0; i < size; i++) { |
581
210339fd1a34
Removed more expensive XPath.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
575
diff
changeset
|
335 Element tmp = (Element)list.item(i); |
99
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
336 |
581
210339fd1a34
Removed more expensive XPath.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
575
diff
changeset
|
337 String name = tmp.getAttributeNS(uri, "name"); |
210339fd1a34
Removed more expensive XPath.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
575
diff
changeset
|
338 String desc = tmp.getAttributeNS(uri, "description"); |
210339fd1a34
Removed more expensive XPath.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
575
diff
changeset
|
339 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
|
340 String type = tmp.getAttributeNS(uri, "type"); |
581
210339fd1a34
Removed more expensive XPath.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
575
diff
changeset
|
341 |
210339fd1a34
Removed more expensive XPath.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
575
diff
changeset
|
342 if (name.length() == 0) { |
99
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
343 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
|
344 continue; |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
345 } |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
346 |
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
|
347 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
|
348 List<Facet> fs = extractFacets(tmp); |
99
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
349 |
796
cd8603aaa730
Improved the process of creating OutputTabs. Added support for map output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
589
diff
changeset
|
350 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
|
351 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
|
352 } |
796
cd8603aaa730
Improved the process of creating OutputTabs. Added support for map output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
589
diff
changeset
|
353 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
|
354 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
|
355 } |
796
cd8603aaa730
Improved the process of creating OutputTabs. Added support for map output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
589
diff
changeset
|
356 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
|
357 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
|
358 } |
cd8603aaa730
Improved the process of creating OutputTabs. Added support for map output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
589
diff
changeset
|
359 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
|
360 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
|
361 } |
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
|
362 else { |
796
cd8603aaa730
Improved the process of creating OutputTabs. Added support for map output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
589
diff
changeset
|
363 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
|
364 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
|
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 modes.add(outmode); |
99
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
368 } |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
369 |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
370 return modes; |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
371 } |
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 |
581
210339fd1a34
Removed more expensive XPath.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
575
diff
changeset
|
374 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
|
375 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
|
376 |
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
|
377 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
|
378 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
|
379 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
|
380 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
|
381 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
|
382 |
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 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
|
384 |
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 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
|
386 |
575
5277f46a63c2
The description of a facet is now displayed in the ChartThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
524
diff
changeset
|
387 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
|
388 |
575
5277f46a63c2
The description of a facet is now displayed in the ChartThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
524
diff
changeset
|
389 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
|
390 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
|
391 |
575
5277f46a63c2
The description of a facet is now displayed in the ChartThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
524
diff
changeset
|
392 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
|
393 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
|
394 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
|
395 |
5277f46a63c2
The description of a facet is now displayed in the ChartThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
524
diff
changeset
|
396 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
|
397 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
|
398 } |
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
|
399 } |
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
|
400 |
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
|
401 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
|
402 } |
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
|
403 |
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
|
404 |
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
|
405 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
|
406 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
|
407 |
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
|
408 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
|
409 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
|
410 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
|
411 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
|
412 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
|
413 |
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 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
|
415 |
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 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
|
417 |
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 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
|
419 |
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 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
|
421 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
|
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 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
|
424 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
|
425 |
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 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
|
427 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
|
428 } |
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 |
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
|
431 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
|
432 } |
99
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
433 } |
5c3d685546a6
Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
434 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |