annotate flys-client/src/main/java/de/intevation/flys/client/server/DescribeCollectionServiceImpl.java @ 829:f14cefeed243

Display the output modes of the master artifact only - all other artifact's output modes are NOT visible to the user. flys-client/trunk@2535 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Tue, 23 Aug 2011 13:57:54 +0000
parents 112f95d7b286
children 0fe456332785
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;
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
34 import de.intevation.flys.client.shared.model.DefaultRecommendation;
796
cd8603aaa730 Improved the process of creating OutputTabs. Added support for map output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 589
diff changeset
35 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
36 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
37 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
38 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
39 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
40 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
41 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
42 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
43 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
44 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
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 /**
5c3d685546a6 Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
48 * 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
49 * 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
50 * the document.
5c3d685546a6 Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
51 *
5c3d685546a6 Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
52 * @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
53 */
5c3d685546a6 Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
54 public class DescribeCollectionServiceImpl
5c3d685546a6 Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
55 extends RemoteServiceServlet
5c3d685546a6 Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
56 implements DescribeCollectionService
5c3d685546a6 Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
57 {
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
58 /** 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
59 * 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
60 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
61 "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
62
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
63 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
64
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
65 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
66 "/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
67
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
68
229
924da6695800 Each service is now called with the name of the current locale to set the request object's locale manually in the HttpClient.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 215
diff changeset
69 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
70 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
71 {
99
5c3d685546a6 Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
72 System.out.println("DescribeCollectionServiceImpl.describe");
5c3d685546a6 Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
73
5c3d685546a6 Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
74 Document describe = ClientProtocolUtils.newDescribeCollectionDocument(
5c3d685546a6 Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
75 uuid);
5c3d685546a6 Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
76
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
77 HttpClient client = new HttpClientImpl(serverUrl, locale);
99
5c3d685546a6 Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
78
5c3d685546a6 Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
79 try {
5c3d685546a6 Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
80 Document response = (Document) client.doCollectionAction(
5c3d685546a6 Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
81 describe, uuid, new DocumentResponseHandler());
5c3d685546a6 Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
82
5c3d685546a6 Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
83 Collection c = parseCollection(response);
5c3d685546a6 Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
84
5c3d685546a6 Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
85 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
86 throw new ServerException(ERROR_DESCRIBE_COLLECTION);
99
5c3d685546a6 Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
87 }
5c3d685546a6 Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
88
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
89 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
90
99
5c3d685546a6 Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
91 return c;
5c3d685546a6 Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
92 }
5c3d685546a6 Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
93 catch (ConnectionException ce) {
5c3d685546a6 Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
94 System.err.println(ce.getLocalizedMessage());
5c3d685546a6 Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
95 }
5c3d685546a6 Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
96
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
97 throw new ServerException(ERROR_DESCRIBE_COLLECTION);
99
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 /**
5c3d685546a6 Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
102 * 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
103 * 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
104 * the collection items.
5c3d685546a6 Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
105 *
5c3d685546a6 Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
106 * @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
107 * operation.
5c3d685546a6 Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
108 *
5c3d685546a6 Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
109 * @return a Collection with CollectionItems.
5c3d685546a6 Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
110 */
5c3d685546a6 Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
111 protected Collection parseCollection(Document description) {
5c3d685546a6 Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
112 System.out.println("AddArtifactServiceImpl.parseCollection");
5c3d685546a6 Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
113
5c3d685546a6 Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
114 if (description == null) {
5c3d685546a6 Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
115 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
116 return null;
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
5c3d685546a6 Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
119 String uuid = XMLUtils.xpathString(
5c3d685546a6 Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
120 description,
5c3d685546a6 Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
121 "art:artifact-collection/@art:uuid",
5c3d685546a6 Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
122 ArtifactNamespaceContext.INSTANCE);
5c3d685546a6 Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
123
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
124 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
125 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
126 "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
127 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
128
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
129 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
130 System.err.println("Found an invalid Collection!");
5c3d685546a6 Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
131 return null;
5c3d685546a6 Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
132 }
5c3d685546a6 Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
133
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
134
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 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
136 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
137 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
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 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
140 // 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
141 }
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
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
143 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
144 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
145
581
210339fd1a34 Removed more expensive XPath.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 575
diff changeset
146 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
147 ? 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
148 : new DefaultCollection(uuid, ttl, recommended);
99
5c3d685546a6 Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
149
5c3d685546a6 Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
150 NodeList items = (NodeList) XMLUtils.xpath(
5c3d685546a6 Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
151 description,
5c3d685546a6 Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
152 "art:artifact-collection/art:artifacts/art:artifact",
5c3d685546a6 Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
153 XPathConstants.NODESET,
5c3d685546a6 Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
154 ArtifactNamespaceContext.INSTANCE);
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 if (items == null || items.getLength() == 0) {
5c3d685546a6 Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
157 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
158
5c3d685546a6 Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
159 return c;
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
5c3d685546a6 Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
162 int size = items.getLength();
5c3d685546a6 Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
163
5c3d685546a6 Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
164 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
165 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
166 (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
167 i == 0);
99
5c3d685546a6 Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
168
5c3d685546a6 Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
169 if (item != null) {
5c3d685546a6 Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
170 c.addItem(item);
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
5c3d685546a6 Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
174 System.out.println(
5c3d685546a6 Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
175 "Found " + c.getItemLength() + " collection items " +
5c3d685546a6 Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
176 "for the Collection '" + c.identifier() + "'.");
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 return c;
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
5c3d685546a6 Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
181
524
ba238f917b94 The theme list information stored in the attribute of a collection is read and added in form of Themes and ThemeLists to the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 270
diff changeset
182 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
183 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
184
ba238f917b94 The theme list information stored in the attribute of a collection is read and added in form of Themes and ThemeLists to the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 270
diff changeset
185 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
186 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
187 "/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
188 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
189 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
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 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
192
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 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
194
581
210339fd1a34 Removed more expensive XPath.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 575
diff changeset
195 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
196
581
210339fd1a34 Removed more expensive XPath.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 575
diff changeset
197 for (int i = 0; i < num; i++) {
210339fd1a34 Removed more expensive XPath.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 575
diff changeset
198 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
199
581
210339fd1a34 Removed more expensive XPath.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 575
diff changeset
200 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
201
581
210339fd1a34 Removed more expensive XPath.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 575
diff changeset
202 if (outName.length() > 0) {
210339fd1a34 Removed more expensive XPath.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 575
diff changeset
203 ThemeList list = parseThemeList(node);
210339fd1a34 Removed more expensive XPath.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 575
diff changeset
204 if (list.getThemeCount() > 0) {
210339fd1a34 Removed more expensive XPath.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 575
diff changeset
205 themeList.put(outName, list);
210339fd1a34 Removed more expensive XPath.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 575
diff changeset
206 }
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 }
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
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 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
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
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
581
210339fd1a34 Removed more expensive XPath.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 575
diff changeset
214 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
215 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
216
581
210339fd1a34 Removed more expensive XPath.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 575
diff changeset
217 NodeList themes = node.getElementsByTagNameNS(
210339fd1a34 Removed more expensive XPath.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 575
diff changeset
218 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
219 "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
220
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 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
222
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 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
224
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
225 for (int i = 0; i < num; i++) {
581
210339fd1a34 Removed more expensive XPath.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 575
diff changeset
226 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
227
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 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
229 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
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
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 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
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
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
575
5277f46a63c2 The description of a facet is now displayed in the ChartThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 524
diff changeset
237 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
238 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
239
575
5277f46a63c2 The description of a facet is now displayed in the ChartThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 524
diff changeset
240 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
241
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
242 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
243 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
244
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
245 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
246
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
247 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
248 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
249
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 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
251 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
252 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
253
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 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
255 }
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
256
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
257 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
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
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
260
99
5c3d685546a6 Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
261 /**
5c3d685546a6 Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
262 * 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
263 * 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
264 *
5c3d685546a6 Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
265 * @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
266 *
5c3d685546a6 Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
267 * @return a CollectionItem.
5c3d685546a6 Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
268 */
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
269 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
270 System.out.println("AddArtifactServiceImpl.parseCollectionItem");
5c3d685546a6 Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
271
5c3d685546a6 Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
272 if (node == null) {
5c3d685546a6 Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
273 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
274 return null;
5c3d685546a6 Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
275 }
5c3d685546a6 Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
276
581
210339fd1a34 Removed more expensive XPath.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 575
diff changeset
277 String uri = ArtifactNamespaceContext.NAMESPACE_URI;
99
5c3d685546a6 Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
278
581
210339fd1a34 Removed more expensive XPath.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 575
diff changeset
279 String uuid = node.getAttributeNS(uri, "uuid");
210339fd1a34 Removed more expensive XPath.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 575
diff changeset
280 String hash = node.getAttributeNS(uri, "hash");
99
5c3d685546a6 Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
281
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
282 if (uuid == null || uuid.length() == 0) {
99
5c3d685546a6 Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
283 System.err.println("Found an invalid CollectionItem!");
581
210339fd1a34 Removed more expensive XPath.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 575
diff changeset
284 return null;
99
5c3d685546a6 Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
285 }
5c3d685546a6 Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
286
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
287 List<OutputMode> modes = new ArrayList<OutputMode>();
99
5c3d685546a6 Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
288
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
289 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
290 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
291 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
292
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 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
294 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
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
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 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
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 modes = parseOutputModes(om);
581
210339fd1a34 Removed more expensive XPath.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 575
diff changeset
300 }
210339fd1a34 Removed more expensive XPath.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 575
diff changeset
301
99
5c3d685546a6 Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
302 return new DefaultCollectionItem(uuid, hash, modes);
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 /**
5c3d685546a6 Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
307 * 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
308 * CollectionItem and returns them as list.
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 * @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
311 *
5c3d685546a6 Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
312 * @return a list of OutputModes.
5c3d685546a6 Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
313 */
581
210339fd1a34 Removed more expensive XPath.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 575
diff changeset
314 protected List<OutputMode> parseOutputModes(Element node) {
99
5c3d685546a6 Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
315 System.out.println("AddArtifactServiceImpl.parseOutputModes");
5c3d685546a6 Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
316
5c3d685546a6 Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
317 if (node == null) {
5c3d685546a6 Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
318 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
319 return null;
5c3d685546a6 Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
320 }
5c3d685546a6 Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
321
581
210339fd1a34 Removed more expensive XPath.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 575
diff changeset
322 String uri = ArtifactNamespaceContext.NAMESPACE_URI;
99
5c3d685546a6 Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
323
581
210339fd1a34 Removed more expensive XPath.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 575
diff changeset
324 NodeList list = node.getElementsByTagNameNS(uri, "output");
210339fd1a34 Removed more expensive XPath.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 575
diff changeset
325
210339fd1a34 Removed more expensive XPath.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 575
diff changeset
326 int size = list.getLength();
210339fd1a34 Removed more expensive XPath.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 575
diff changeset
327
210339fd1a34 Removed more expensive XPath.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 575
diff changeset
328 if (size == 0) {
99
5c3d685546a6 Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
329 System.err.println("No outputmode nodes found!");
5c3d685546a6 Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
330 return null;
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
5c3d685546a6 Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
333 List<OutputMode> modes = new ArrayList<OutputMode>(size);
5c3d685546a6 Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
334
5c3d685546a6 Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
335 for (int i = 0; i < size; i++) {
581
210339fd1a34 Removed more expensive XPath.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 575
diff changeset
336 Element tmp = (Element)list.item(i);
99
5c3d685546a6 Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
337
581
210339fd1a34 Removed more expensive XPath.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 575
diff changeset
338 String name = tmp.getAttributeNS(uri, "name");
210339fd1a34 Removed more expensive XPath.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 575
diff changeset
339 String desc = tmp.getAttributeNS(uri, "description");
210339fd1a34 Removed more expensive XPath.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 575
diff changeset
340 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
341 String type = tmp.getAttributeNS(uri, "type");
581
210339fd1a34 Removed more expensive XPath.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 575
diff changeset
342
210339fd1a34 Removed more expensive XPath.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 575
diff changeset
343 if (name.length() == 0) {
99
5c3d685546a6 Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
344 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
345 continue;
5c3d685546a6 Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
346 }
5c3d685546a6 Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
347
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
348 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
349 List<Facet> fs = extractFacets(tmp);
99
5c3d685546a6 Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
350
796
cd8603aaa730 Improved the process of creating OutputTabs. Added support for map output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 589
diff changeset
351 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
352 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
353 }
796
cd8603aaa730 Improved the process of creating OutputTabs. Added support for map output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 589
diff changeset
354 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
355 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
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 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
358 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
359 }
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("map")){
cd8603aaa730 Improved the process of creating OutputTabs. Added support for map output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 589
diff changeset
361 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
362 }
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
363 else {
796
cd8603aaa730 Improved the process of creating OutputTabs. Added support for map output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 589
diff changeset
364 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
365 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
366 }
d01b0d81b92a Parse the facets of a Collection and distinguish between an ordinary OutputMode and an ExportMode (new).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 229
diff changeset
367
d01b0d81b92a Parse the facets of a Collection and distinguish between an ordinary OutputMode and an ExportMode (new).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 229
diff changeset
368 modes.add(outmode);
99
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
5c3d685546a6 Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
371 return modes;
5c3d685546a6 Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
372 }
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
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
581
210339fd1a34 Removed more expensive XPath.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 575
diff changeset
375 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
376 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
377
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 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
379 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
380 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
381 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
382 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
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 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
385
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 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
387
575
5277f46a63c2 The description of a facet is now displayed in the ChartThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 524
diff changeset
388 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
389
575
5277f46a63c2 The description of a facet is now displayed in the ChartThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 524
diff changeset
390 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
391 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
392
575
5277f46a63c2 The description of a facet is now displayed in the ChartThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 524
diff changeset
393 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
394 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
395 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
396
5277f46a63c2 The description of a facet is now displayed in the ChartThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 524
diff changeset
397 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
398 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
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
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 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
403 }
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
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
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 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
407 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
408
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 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
410 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
411 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
412 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
413 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
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 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
416
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 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
418
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 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
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 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
422 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
423
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 String factory = rec.getAttributeNS(uri, "factory");
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 dbids = rec.getAttributeNS(uri, "db-ids");
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 if (factory != null && factory.length() > 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
428 recs.add(new DefaultRecommendation(factory, dbids));
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
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 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
433 }
99
5c3d685546a6 Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
434 }
5c3d685546a6 Added a new service to describe collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
435 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org