annotate gwt-client/src/main/java/org/dive4elements/river/client/server/CollectionHelper.java @ 8856:5e38e2924c07 3.2.x

Fix code style.
author Tom Gottfried <tom@intevation.de>
date Thu, 18 Jan 2018 20:12:01 +0100
parents 238fc722f87a
children 853f2dafc16e 0a5239a1e46e
rev   line source
5861
172338b1407f GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
1 /* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde
172338b1407f GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
2 * Software engineering by Intevation GmbH
172338b1407f GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
3 *
5993
ea9eef426962 Removed trailing whitespace.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5861
diff changeset
4 * This file is Free Software under the GNU AGPL (>=v3)
5861
172338b1407f GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
5 * and comes with ABSOLUTELY NO WARRANTY! Check out the
5993
ea9eef426962 Removed trailing whitespace.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5861
diff changeset
6 * documentation coming with Dive4Elements River for details.
5861
172338b1407f GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
7 */
172338b1407f GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
8
5835
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
9 package org.dive4elements.river.client.server;
530
26e38b79658d Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
10
905
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
11 import java.util.ArrayList;
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
12 import java.util.HashMap;
530
26e38b79658d Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
13 import java.util.List;
26e38b79658d Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
14 import java.util.Map;
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: 576
diff changeset
15 import java.util.Set;
530
26e38b79658d Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
16
905
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
17 import javax.xml.xpath.XPathConstants;
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
18
530
26e38b79658d Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
19 import org.w3c.dom.Document;
26e38b79658d Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
20 import org.w3c.dom.Element;
905
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
21 import org.w3c.dom.NamedNodeMap;
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
22 import org.w3c.dom.Node;
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
23 import org.w3c.dom.NodeList;
530
26e38b79658d Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
24
1367
ab8eb2f544f2 Replaced stdout and stderr logging with log4j loggers in server classes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1342
diff changeset
25 import org.apache.log4j.Logger;
ab8eb2f544f2 Replaced stdout and stderr logging with log4j loggers in server classes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1342
diff changeset
26
5835
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
27 import org.dive4elements.artifacts.common.ArtifactNamespaceContext;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
28 import org.dive4elements.artifacts.common.utils.ClientProtocolUtils;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
29 import org.dive4elements.artifacts.common.utils.XMLUtils;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
30 import org.dive4elements.artifacts.common.utils.XMLUtils.ElementCreator;
905
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
31
5835
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
32 import org.dive4elements.artifacts.httpclient.exceptions.ConnectionException;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
33 import org.dive4elements.artifacts.httpclient.http.HttpClient;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
34 import org.dive4elements.artifacts.httpclient.http.HttpClientImpl;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
35 import org.dive4elements.artifacts.httpclient.http.response.DocumentResponseHandler;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
36
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
37 import org.dive4elements.river.client.shared.exceptions.ServerException;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
38 import org.dive4elements.river.client.shared.model.Artifact;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
39 import org.dive4elements.river.client.shared.model.AttributedTheme;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
40 import org.dive4elements.river.client.shared.model.ChartMode;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
41 import org.dive4elements.river.client.shared.model.Collection;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
42 import org.dive4elements.river.client.shared.model.CollectionItem;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
43 import org.dive4elements.river.client.shared.model.DefaultCollection;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
44 import org.dive4elements.river.client.shared.model.DefaultCollectionItem;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
45 import org.dive4elements.river.client.shared.model.DefaultFacet;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
46 import org.dive4elements.river.client.shared.model.ExportMode;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
47 import org.dive4elements.river.client.shared.model.Facet;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
48 import org.dive4elements.river.client.shared.model.MapMode;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
49 import org.dive4elements.river.client.shared.model.OutputMode;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
50 import org.dive4elements.river.client.shared.model.OverviewMode;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
51 import org.dive4elements.river.client.shared.model.ReportMode;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
52 import org.dive4elements.river.client.shared.model.Recommendation;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
53 import org.dive4elements.river.client.shared.model.Theme;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
54 import org.dive4elements.river.client.shared.model.ThemeList;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
55 import org.dive4elements.river.client.shared.model.Settings;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
56 import org.dive4elements.river.client.shared.model.Property;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
57 import org.dive4elements.river.client.shared.model.PropertyGroup;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
58 import org.dive4elements.river.client.shared.model.PropertySetting;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
59 import org.dive4elements.river.client.shared.model.StringProperty;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
60 import org.dive4elements.river.client.shared.model.DoubleProperty;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
61 import org.dive4elements.river.client.shared.model.IntegerProperty;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
62 import org.dive4elements.river.client.shared.model.BooleanProperty;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
63 import org.dive4elements.river.client.shared.model.OutputSettings;
530
26e38b79658d Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
64
1439
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
65 //temporary
530
26e38b79658d Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
66
26e38b79658d Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
67 /**
26e38b79658d Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
68 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
26e38b79658d Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
69 */
26e38b79658d Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
70 public class CollectionHelper {
26e38b79658d Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
71
8203
238fc722f87a sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6141
diff changeset
72 private static final Logger log =
1367
ab8eb2f544f2 Replaced stdout and stderr logging with log4j loggers in server classes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1342
diff changeset
73 Logger.getLogger(CollectionHelper.class);
ab8eb2f544f2 Replaced stdout and stderr logging with log4j loggers in server classes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1342
diff changeset
74
905
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
75 public static final String ERROR_ADD_ARTIFACT = "error_add_artifact";
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
76
1332
ab2b1a4a9ead Donate own error for failcase of remove-artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1320
diff changeset
77 public static final String ERROR_REMOVE_ARTIFACT = "error_remove_artifact";
ab2b1a4a9ead Donate own error for failcase of remove-artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1320
diff changeset
78
905
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
79 public static final String XPATH_FACETS = "art:facets/art:facet";
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
80
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
81 public static final String XPATH_LOADED_RECOMMENDATIONS =
8856
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8203
diff changeset
82 "/art:artifact-collection/art:attribute/"
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8203
diff changeset
83 + "art:loaded-recommendations/art:recommendation";
905
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
84
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
85
530
26e38b79658d Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
86 public static Document createAttribute(Collection collection) {
8203
238fc722f87a sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6141
diff changeset
87 log.debug("CollectionHelper.createAttribute");
530
26e38b79658d Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
88
26e38b79658d Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
89 Document doc = XMLUtils.newDocument();
26e38b79658d Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
90
26e38b79658d Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
91 ElementCreator cr = new ElementCreator(
26e38b79658d Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
92 doc,
26e38b79658d Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
93 ArtifactNamespaceContext.NAMESPACE_URI,
26e38b79658d Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
94 ArtifactNamespaceContext.NAMESPACE_PREFIX);
26e38b79658d Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
95
26e38b79658d Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
96 Element attr = cr.create("attribute");
26e38b79658d Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
97
26e38b79658d Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
98 doc.appendChild(attr);
26e38b79658d Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
99
26e38b79658d Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
100 Map<String, OutputMode> tmpOuts = collection.getOutputModes();
26e38b79658d Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
101
26e38b79658d Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
102 Element outs = createOutputElements(cr, collection, tmpOuts);
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
103 Element recs = createRecommendationsElements(cr, collection);
530
26e38b79658d Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
104
26e38b79658d Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
105 if (outs != null) {
26e38b79658d Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
106 attr.appendChild(outs);
26e38b79658d Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
107 }
26e38b79658d Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
108
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
109 if (recs != null) {
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
110 attr.appendChild(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
111 }
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
112
530
26e38b79658d Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
113 return doc;
26e38b79658d Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
114 }
26e38b79658d Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
115
26e38b79658d Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
116
26e38b79658d Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
117 /**
26e38b79658d Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
118 * Creates a whole block with art:output nodes.
26e38b79658d Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
119 *
26e38b79658d Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
120 * @param cr The ElementCreator used to create new elements.
26e38b79658d Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
121 * @param c The collection.
26e38b79658d Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
122 * @param modes The OutputModes that should be included.
26e38b79658d Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
123 *
26e38b79658d Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
124 * @return an element with output modes.
26e38b79658d Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
125 */
26e38b79658d Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
126 protected static Element createOutputElements(
26e38b79658d Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
127 ElementCreator cr,
26e38b79658d Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
128 Collection c,
26e38b79658d Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
129 Map<String, OutputMode> mmodes)
26e38b79658d Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
130 {
8203
238fc722f87a sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6141
diff changeset
131 log.debug("CollectionHelper.createOutputElements");
530
26e38b79658d Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
132
26e38b79658d Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
133 java.util.Collection<OutputMode> modes = mmodes != null
26e38b79658d Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
134 ? mmodes.values()
26e38b79658d Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
135 : null;
26e38b79658d Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
136
26e38b79658d Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
137 if (modes == null || modes.size() == 0) {
8203
238fc722f87a sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6141
diff changeset
138 log.debug("Collection has no modes: " + c.identifier());
530
26e38b79658d Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
139 return null;
26e38b79658d Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
140 }
26e38b79658d Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
141
26e38b79658d Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
142 Element outs = cr.create("outputs");
26e38b79658d Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
143
26e38b79658d Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
144 for (OutputMode mode: modes) {
26e38b79658d Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
145 Element out = createOutputElement(cr, c, mode);
26e38b79658d Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
146
26e38b79658d Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
147 if (out != null) {
26e38b79658d Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
148 outs.appendChild(out);
26e38b79658d Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
149 }
26e38b79658d Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
150 }
26e38b79658d Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
151
26e38b79658d Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
152 return outs;
26e38b79658d Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
153 }
26e38b79658d Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
154
26e38b79658d Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
155
26e38b79658d Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
156 /**
26e38b79658d Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
157 * Create a node art:output that further consist of art:theme nodes.
26e38b79658d Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
158 *
26e38b79658d Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
159 * @param cr The ElementCreator used to create new elements.
26e38b79658d Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
160 * @param c The collection.
26e38b79658d Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
161 * @param mode The OutputMode.
26e38b79658d Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
162 *
26e38b79658d Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
163 * @return an element that represents an output mode with its themes.
26e38b79658d Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
164 */
26e38b79658d Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
165 protected static Element createOutputElement(
26e38b79658d Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
166 ElementCreator cr,
26e38b79658d Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
167 Collection collection,
26e38b79658d Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
168 OutputMode mode)
26e38b79658d Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
169 {
8203
238fc722f87a sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6141
diff changeset
170 log.debug("CollectionHelper.createOutputElement");
530
26e38b79658d Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
171
26e38b79658d Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
172 Element out = cr.create("output");
26e38b79658d Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
173 cr.addAttr(out, "name", mode.getName(), false);
26e38b79658d Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
174
26e38b79658d Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
175 ThemeList themeList = collection.getThemeList(mode.getName());
26e38b79658d Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
176 List<Theme> themes = themeList != null ? themeList.getThemes() : null;
26e38b79658d Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
177
26e38b79658d Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
178 if (themes == null || themes.size() == 0) {
8203
238fc722f87a sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6141
diff changeset
179 log.debug("No themes for output mode: " + mode.getName());
530
26e38b79658d Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
180 return null;
26e38b79658d Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
181 }
26e38b79658d Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
182
26e38b79658d Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
183 for (Theme theme: themes) {
26e38b79658d Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
184 Element t = createThemeElement(cr, collection, theme);
26e38b79658d Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
185
26e38b79658d Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
186 if (t != null) {
26e38b79658d Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
187 out.appendChild(t);
26e38b79658d Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
188 }
26e38b79658d Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
189 }
26e38b79658d Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
190
1478
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
191 Document doc = out.getOwnerDocument();
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
192
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
193 ElementCreator settingscr = new ElementCreator(doc, "", "");
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
194
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
195 Settings settings = collection.getSettings(mode.getName());
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
196 if (settings == null ||
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
197 settings.getCategories().size() == 0)
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
198 {
8203
238fc722f87a sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6141
diff changeset
199 log.debug("No settings for output mode: " + mode.getName());
1478
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
200 }
2434
e8b38b5e4cf9 Fixed Issue 498.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1507
diff changeset
201 else {
e8b38b5e4cf9 Fixed Issue 498.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1507
diff changeset
202 Element s = createSettingsElement(settingscr, collection, settings);
e8b38b5e4cf9 Fixed Issue 498.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1507
diff changeset
203 if (s != null) {
e8b38b5e4cf9 Fixed Issue 498.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1507
diff changeset
204 out.appendChild(s);
e8b38b5e4cf9 Fixed Issue 498.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1507
diff changeset
205 }
1478
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
206 }
8203
238fc722f87a sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6141
diff changeset
207 log.info(XMLUtils.toString(out));
530
26e38b79658d Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
208 return out;
26e38b79658d Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
209 }
26e38b79658d Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
210
26e38b79658d Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
211
26e38b79658d Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
212 /**
26e38b79658d Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
213 * Creates a theme node art:theme that represents a curve in a chart or map.
26e38b79658d Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
214 *
26e38b79658d Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
215 * @param cr The ElementCreator used to create new elements.
26e38b79658d Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
216 * @param collection The collection.
26e38b79658d Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
217 * @param theme The theme whose attributes should be written to an element.
26e38b79658d Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
218 *
26e38b79658d Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
219 * @return an element that contains the informtion of the given theme.
26e38b79658d Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
220 */
26e38b79658d Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
221 protected static Element createThemeElement(
26e38b79658d Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
222 ElementCreator cr,
26e38b79658d Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
223 Collection collection,
26e38b79658d Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
224 Theme theme)
26e38b79658d Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
225 {
26e38b79658d Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
226 if (theme == null) {
26e38b79658d Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
227 return null;
26e38b79658d Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
228 }
26e38b79658d Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
229
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: 576
diff changeset
230 Element t = cr.create("facet");
530
26e38b79658d Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
231
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: 576
diff changeset
232 if (theme instanceof AttributedTheme) {
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: 576
diff changeset
233 AttributedTheme at = (AttributedTheme) theme;
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: 576
diff changeset
234 Set<String> keys = at.getKeys();
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: 576
diff changeset
235
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: 576
diff changeset
236 for (String key: keys) {
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: 576
diff changeset
237 cr.addAttr(t, key, at.getAttr(key), true);
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: 576
diff changeset
238 }
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: 576
diff changeset
239 }
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: 576
diff changeset
240 else {
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: 576
diff changeset
241 cr.addAttr(t, "active", Integer.toString(theme.getActive()), true);
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: 576
diff changeset
242 cr.addAttr(t, "artifact", theme.getArtifact(), true);
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: 576
diff changeset
243 cr.addAttr(t, "facet", theme.getFacet(), true);
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: 576
diff changeset
244 cr.addAttr(t, "pos", Integer.toString(theme.getPosition()), true);
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: 576
diff changeset
245 cr.addAttr(t, "index", Integer.toString(theme.getIndex()), true);
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: 576
diff changeset
246 cr.addAttr(t, "description", theme.getDescription(), true);
8856
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8203
diff changeset
247 cr.addAttr(t, "visible", Integer.toString(theme.getVisible()),
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8203
diff changeset
248 true);
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: 576
diff changeset
249 }
530
26e38b79658d Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
250
26e38b79658d Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
251 return t;
26e38b79658d Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
252 }
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
253
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
254
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
255 /**
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
256 * Creates a whole block with art:loaded-recommendations nodes.
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
257 *
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
258 * @param cr The ElementCreator used to create new elements.
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
259 * @param c The collection.
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
260 *
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
261 * @return an element with 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
262 */
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
263 protected static Element createRecommendationsElements(
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
264 ElementCreator cr,
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
265 Collection c)
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
266 {
8203
238fc722f87a sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6141
diff changeset
267 log.debug("CollectionHelper.createRecommendationsElements");
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
268
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
269 List<Recommendation> rs = c.getRecommendations();
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
270
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
271 if (rs == null || rs.size() == 0) {
8203
238fc722f87a sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6141
diff changeset
272 log.debug("Collection did not load recommendations: " +
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
273 c.identifier());
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
274 return null;
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
275 }
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
276
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
277 Element loaded = cr.create("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
278
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
279 for (Recommendation r: rs) {
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
280 Element recommendation = createRecommendationElement(cr, c, r);
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
281
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
282 if (recommendation != null) {
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
283 loaded.appendChild(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
284 }
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
285 }
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
286
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
287 return loaded;
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
288 }
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
289
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
290
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
291 /**
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
292 * Create a node art:recommended.
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
293 *
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
294 * @param cr The ElementCreator used to create new elements.
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
295 * @param c The collection.
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
296 * @param r The 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
297 *
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
298 * @return an element that represents an output mode with its themes.
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
299 */
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
300 protected static Element createRecommendationElement(
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
301 ElementCreator cr,
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
302 Collection c,
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
303 Recommendation r)
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
304 {
8203
238fc722f87a sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6141
diff changeset
305 log.debug("CollectionHelper.createRecommendationElement");
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
306
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
307 Element recommendation = cr.create("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
308 cr.addAttr(recommendation, "factory", r.getFactory(), true);
836
0fe456332785 Datacage: s/db-ids/ids/g to unify system and user specific loading.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 809
diff changeset
309 cr.addAttr(recommendation, "ids", r.getIDs(), true);
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
310
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
311 return 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
312 }
905
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
313
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
314
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
315 /**
1478
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
316 *
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
317 */
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
318 protected static Element createSettingsElement(
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
319 ElementCreator cr,
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
320 Collection c,
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
321 Settings s)
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
322 {
8203
238fc722f87a sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6141
diff changeset
323 log.debug("CollectionHelper.createSettingsElement");
1478
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
324 Element settings = cr.create("settings");
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
325
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
326 List<String> categories = s.getCategories();
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
327
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
328 for (String category: categories) {
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
329 Element cat =cr.create(category);
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
330 settings.appendChild(cat);
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
331 List<Property> props = s.getSettings(category);
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
332 for (Property p: props) {
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
333 if (p instanceof PropertyGroup) {
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
334 Element prop = createPropertyGroupElement(cr,
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
335 (PropertyGroup)p);
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
336 cat.appendChild(prop);
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
337 }
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
338 else if (p instanceof PropertySetting) {
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
339 Element prop = createPropertyElement (cr,
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
340 (PropertySetting)p);
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
341 cat.appendChild(prop);
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
342 }
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
343 }
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
344 }
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
345 return settings;
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
346 }
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
347
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
348
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
349 /**
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
350 *
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
351 */
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
352 protected static Element createPropertyGroupElement(
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
353 ElementCreator cr,
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
354 PropertyGroup pg)
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
355 {
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
356 Element e = cr.create(pg.getName());
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
357
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
358 List<Property> list = pg.getProperties();
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
359 for (Property p: list) {
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
360 Element pe = createPropertyElement(cr, (PropertySetting)p);
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
361 e.appendChild(pe);
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
362 }
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
363 return e;
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
364 }
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
365
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
366
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
367 /**
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
368 *
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
369 */
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
370 protected static Element createPropertyElement(
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
371 ElementCreator cr,
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
372 PropertySetting p)
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
373 {
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
374 Element e = cr.create(p.getName());
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
375
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
376 if(p instanceof BooleanProperty) {
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
377 cr.addAttr(e, "type", "boolean", false);
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
378 }
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
379 else if(p instanceof DoubleProperty) {
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
380 cr.addAttr(e, "type", "double", false);
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
381 }
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
382 else if(p instanceof IntegerProperty) {
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
383 cr.addAttr(e, "type", "integer", false);
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
384 }
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
385 else if(p instanceof StringProperty) {
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
386 cr.addAttr(e, "type", "string", false);
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
387 }
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
388
1507
c21d14e48040 Improved validation and property handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1478
diff changeset
389 e.setTextContent(p.getValue().toString());
1478
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
390 cr.addAttr(e, "display", p.getAttribute("display"), false);
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
391 return e;
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
392 }
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
393
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
394
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
395 /**
1318
ecd0243bc09e Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 905
diff changeset
396 * Take the DESCRIBE document of the Collections describe()
905
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
397 * operation and extracts the information about the collection itself and
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
398 * the collection items.
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
399 *
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
400 * @param description The DESCRIBE document of the Collections describe()
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
401 * operation.
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
402 *
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
403 * @return a Collection with CollectionItems.
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
404 */
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
405 public static Collection parseCollection(Document description) {
8203
238fc722f87a sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6141
diff changeset
406 log.debug("CollectionHelper.parseCollection");
905
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
407
8203
238fc722f87a sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6141
diff changeset
408 if (log.isDebugEnabled()) {
238fc722f87a sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6141
diff changeset
409 log.debug(XMLUtils.toString(description));
6141
63975955ec61 Guard the collection describe debug output
Andre Heinecke <aheinecke@intevation.de>
parents: 6135
diff changeset
410 }
6135
804e50149d6a Print the complete collection in parseCollection
Andre Heinecke <aheinecke@intevation.de>
parents: 5993
diff changeset
411
905
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
412 if (description == null) {
8203
238fc722f87a sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6141
diff changeset
413 log.warn("The DESCRIBE of the Collection is null!");
905
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
414 return null;
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
415 }
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
416
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
417 String uuid = XMLUtils.xpathString(
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
418 description,
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
419 "art:artifact-collection/@art:uuid",
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
420 ArtifactNamespaceContext.INSTANCE);
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
421
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
422 String ttlStr = XMLUtils.xpathString(
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
423 description,
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
424 "art:artifact-collection/@art:ttl",
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
425 ArtifactNamespaceContext.INSTANCE);
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
426
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
427 String name = XMLUtils.xpathString(
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
428 description,
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
429 "art:artifact-collection/@art:name",
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
430 ArtifactNamespaceContext.INSTANCE);
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
431
1318
ecd0243bc09e Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 905
diff changeset
432 if (uuid.length() == 0) {
8203
238fc722f87a sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6141
diff changeset
433 log.warn("Found an invalid (zero length uuid) Collection!");
1318
ecd0243bc09e Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 905
diff changeset
434 return null;
ecd0243bc09e Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 905
diff changeset
435 }
ecd0243bc09e Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 905
diff changeset
436
ecd0243bc09e Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 905
diff changeset
437 if (ttlStr.length() == 0) {
8203
238fc722f87a sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6141
diff changeset
438 log.warn("Found an invalid Collection (zero length ttl)!");
905
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
439 return null;
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
440 }
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
441
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
442
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
443 long ttl = -1;
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
444 try {
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
445 ttl = Long.valueOf(ttlStr);
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
446 }
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
447 catch (NumberFormatException nfe) {
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
448 // do nothing
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
449 }
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
450
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
451 List<Recommendation> recommended = parseRecommendations(description);
1435
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
452 Map<String, CollectionItem> collectionItems =
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
453 new HashMap<String, CollectionItem>();
905
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
454
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
455 name = (name != null && name.length() > 0) ? name : uuid;
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
456
1435
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
457 Collection c = new DefaultCollection(uuid, ttl, name, recommended);
905
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
458
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
459 NodeList items = (NodeList) XMLUtils.xpath(
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
460 description,
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
461 "art:artifact-collection/art:artifacts/art:artifact",
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
462 XPathConstants.NODESET,
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
463 ArtifactNamespaceContext.INSTANCE);
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
464
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
465 if (items == null || items.getLength() == 0) {
8203
238fc722f87a sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6141
diff changeset
466 log.debug("No collection item found for this collection.");
905
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
467
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
468 return c;
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
469 }
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
470
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
471 int size = items.getLength();
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
472
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
473 for (int i = 0; i < size; i++) {
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
474 CollectionItem item = parseCollectionItem(
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
475 (Element)items.item(i),
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
476 i == 0);
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
477
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
478 if (item != null) {
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
479 c.addItem(item);
1435
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
480 collectionItems.put(item.identifier() ,item);
905
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
481 }
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
482 }
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
483
8856
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8203
diff changeset
484 Map<String, ThemeList> themeLists = parseThemeLists(
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8203
diff changeset
485 description, collectionItems);
1435
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
486 c.setThemeLists(themeLists);
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
487
1464
c899a7ffdc8f Extract and parse the output settings from describe document and add settings
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1449
diff changeset
488 Map<String, Settings> outSettings = parseSettings(description);
c899a7ffdc8f Extract and parse the output settings from describe document and add settings
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1449
diff changeset
489 c.setSettings(outSettings);
8203
238fc722f87a sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6141
diff changeset
490 log.debug(
905
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
491 "Found " + c.getItemLength() + " collection items " +
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
492 "for the Collection '" + c.identifier() + "'.");
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
493
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
494 return c;
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
495 }
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
496
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
497
1435
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
498 /**
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
499 * @param collectionItems map to look up collection item mapping a themes
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
500 * (artifact) uuid.
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
501 */
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
502 protected static Map<String, ThemeList> parseThemeLists(
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
503 Document desc, Map<String, CollectionItem> collectionItems
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
504 ) {
8203
238fc722f87a sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6141
diff changeset
505 log.debug("CollectionHelper.parseThemeLists");
905
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
506
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
507 NodeList lists = (NodeList) XMLUtils.xpath(
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
508 desc,
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
509 "/art:artifact-collection/art:attribute/art:outputs/art:output",
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
510 XPathConstants.NODESET,
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
511 ArtifactNamespaceContext.INSTANCE);
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
512
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
513 int num = lists != null ? lists.getLength() : 0;
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
514
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
515 Map<String, ThemeList> themeList = new HashMap<String, ThemeList>(num);
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
516
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
517 String uri = ArtifactNamespaceContext.NAMESPACE_URI;
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
518
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
519 for (int i = 0; i < num; i++) {
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
520 Element node = (Element)lists.item(i);
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
521
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
522 String outName = node.getAttribute("name");
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
523
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
524 if (outName.length() > 0) {
1435
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
525 ThemeList list = parseThemeList(node, collectionItems);
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
526
905
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
527 if (list.getThemeCount() > 0) {
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
528 themeList.put(outName, list);
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
529 }
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
530 }
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
531 }
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
532
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
533 return themeList;
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
534 }
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
535
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
536
1435
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
537 /**
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
538 * @param collectionItems map to look up collection item mapping a themes
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
539 * (artifact) uuid.
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
540 */
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
541 protected static ThemeList parseThemeList(
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
542 Element node, Map<String, CollectionItem> collectionItems
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
543 ) {
8203
238fc722f87a sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6141
diff changeset
544 log.debug("CollectionHelper.parseThemeList");
905
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
545
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
546 NodeList themes = node.getElementsByTagNameNS(
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
547 ArtifactNamespaceContext.NAMESPACE_URI,
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
548 "facet");
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
549
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
550 int num = themes != null ? themes.getLength() : 0;
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
551
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
552 List<Theme> themeList = new ArrayList<Theme>(num);
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
553
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
554 for (int i = 0; i < num; i++) {
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
555 Theme theme = parseTheme((Element)themes.item(i));
1435
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
556 theme.setCollectionItem(collectionItems.get(theme.getArtifact()));
905
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
557
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
558 if (theme != null) {
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
559 themeList.add(theme);
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
560 }
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
561 }
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
562
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
563 return new ThemeList(themeList);
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
564 }
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
565
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
566
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
567 protected static Theme parseTheme(Element ele) {
8203
238fc722f87a sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6141
diff changeset
568 log.debug("CollectionHelper.parseTheme");
905
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
569
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
570 String uri = ArtifactNamespaceContext.NAMESPACE_URI;
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
571
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
572 NamedNodeMap attrMap = ele.getAttributes();
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
573 int attrNum = attrMap != null ? attrMap.getLength() : 0;
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
574
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
575 AttributedTheme t = new AttributedTheme();
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
576
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
577 for (int i = 0; i < attrNum; i++) {
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
578 Node attr = attrMap.item(i);
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
579
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
580 String prefix = attr.getPrefix();
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
581 String name = attr.getNodeName().replace(prefix + ":", "");
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
582 String value = attr.getNodeValue();
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
583
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
584 t.addAttr(name, value);
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
585 }
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
586
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
587 return t;
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
588 }
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
589
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
590
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
591 /**
1439
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
592 * Parse Settings elements.
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
593 *
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
594 * @param description The collection description.
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
595 *
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
596 * @return Map containing the settings.
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
597 */
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
598 protected static Map<String, Settings> parseSettings(Document description) {
8203
238fc722f87a sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6141
diff changeset
599 log.info("parseSettings");
1464
c899a7ffdc8f Extract and parse the output settings from describe document and add settings
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1449
diff changeset
600
c899a7ffdc8f Extract and parse the output settings from describe document and add settings
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1449
diff changeset
601 NodeList lists = (NodeList) XMLUtils.xpath(
c899a7ffdc8f Extract and parse the output settings from describe document and add settings
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1449
diff changeset
602 description,
c899a7ffdc8f Extract and parse the output settings from describe document and add settings
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1449
diff changeset
603 "/art:artifact-collection/art:attribute/art:outputs/art:output",
c899a7ffdc8f Extract and parse the output settings from describe document and add settings
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1449
diff changeset
604 XPathConstants.NODESET,
c899a7ffdc8f Extract and parse the output settings from describe document and add settings
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1449
diff changeset
605 ArtifactNamespaceContext.INSTANCE);
c899a7ffdc8f Extract and parse the output settings from describe document and add settings
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1449
diff changeset
606
c899a7ffdc8f Extract and parse the output settings from describe document and add settings
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1449
diff changeset
607 int num = lists != null ? lists.getLength() : 0;
c899a7ffdc8f Extract and parse the output settings from describe document and add settings
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1449
diff changeset
608
c899a7ffdc8f Extract and parse the output settings from describe document and add settings
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1449
diff changeset
609 Map<String, Settings> list = new HashMap<String, Settings>(num);
c899a7ffdc8f Extract and parse the output settings from describe document and add settings
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1449
diff changeset
610
c899a7ffdc8f Extract and parse the output settings from describe document and add settings
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1449
diff changeset
611 String uri = ArtifactNamespaceContext.NAMESPACE_URI;
c899a7ffdc8f Extract and parse the output settings from describe document and add settings
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1449
diff changeset
612
c899a7ffdc8f Extract and parse the output settings from describe document and add settings
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1449
diff changeset
613 for (int i = 0; i < num; i++) {
c899a7ffdc8f Extract and parse the output settings from describe document and add settings
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1449
diff changeset
614 Element node = (Element)lists.item(i);
c899a7ffdc8f Extract and parse the output settings from describe document and add settings
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1449
diff changeset
615 String outName = node.getAttribute("name");
c899a7ffdc8f Extract and parse the output settings from describe document and add settings
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1449
diff changeset
616 Settings s = parseSettings(outName, node);
c899a7ffdc8f Extract and parse the output settings from describe document and add settings
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1449
diff changeset
617 list.put(outName, s);
c899a7ffdc8f Extract and parse the output settings from describe document and add settings
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1449
diff changeset
618 }
1439
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
619
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
620 return list;
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
621 }
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
622
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
623
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
624 /**
3509
bb5edff31866 Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2977
diff changeset
625 * From a document, parse the settings for an output and create an
bb5edff31866 Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2977
diff changeset
626 * OutputSettings object.
1439
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
627 */
1464
c899a7ffdc8f Extract and parse the output settings from describe document and add settings
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1449
diff changeset
628 protected static Settings parseSettings(String outName, Element node) {
1439
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
629 OutputSettings set = new OutputSettings(outName);
1464
c899a7ffdc8f Extract and parse the output settings from describe document and add settings
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1449
diff changeset
630
c899a7ffdc8f Extract and parse the output settings from describe document and add settings
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1449
diff changeset
631 NodeList elements = node.getElementsByTagName("settings");
c899a7ffdc8f Extract and parse the output settings from describe document and add settings
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1449
diff changeset
632
c899a7ffdc8f Extract and parse the output settings from describe document and add settings
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1449
diff changeset
633 if (elements.getLength() == 0 || elements.getLength() > 1) {
c899a7ffdc8f Extract and parse the output settings from describe document and add settings
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1449
diff changeset
634 return set;
c899a7ffdc8f Extract and parse the output settings from describe document and add settings
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1449
diff changeset
635 }
c899a7ffdc8f Extract and parse the output settings from describe document and add settings
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1449
diff changeset
636
c899a7ffdc8f Extract and parse the output settings from describe document and add settings
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1449
diff changeset
637 Element settings = (Element)elements.item(0);
c899a7ffdc8f Extract and parse the output settings from describe document and add settings
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1449
diff changeset
638
3509
bb5edff31866 Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2977
diff changeset
639 // Get the categories
1439
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
640 NodeList catNodes = settings.getChildNodes();
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
641 for (int i = 0; i < catNodes.getLength(); i++) {
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
642 Element catNode = (Element)catNodes.item(i);
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
643
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
644 // The category name
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
645 String category = catNode.getTagName();
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
646
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
647 // list of properties or groups (groups have child nodes).
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
648 NodeList list = catNode.getChildNodes();
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
649
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
650 // iterate through all properties or groups.
1464
c899a7ffdc8f Extract and parse the output settings from describe document and add settings
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1449
diff changeset
651 List<Property> props = new ArrayList<Property> ();
1439
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
652 for (int j = 0; j < list.getLength(); j++) {
3509
bb5edff31866 Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2977
diff changeset
653 Property p;
1439
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
654 Element e = (Element)list.item(j);
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
655 if (e.hasChildNodes() &&
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
656 e.getFirstChild().getNodeType() != Node.TEXT_NODE) {
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
657 p = parseSettingsGroup(e);
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
658 }
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
659 else {
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
660 p = parseSetting(e);
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
661 }
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
662 props.add(p);
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
663 }
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
664 set.setSettings(category, props);
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
665 }
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
666 return set;
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
667 }
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
668
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
669
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
670 /**
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
671 *
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
672 */
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
673 protected static Property parseSettingsGroup(Element group) {
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
674 PropertyGroup p = new PropertyGroup();
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
675 p.setName(group.getTagName());
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
676
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
677 NodeList list = group.getChildNodes();
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
678 ArrayList<Property> props = new ArrayList<Property>();
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
679 for (int i = 0; i < list.getLength(); i++) {
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
680 props.add(parseSetting((Element)list.item(i)));
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
681 }
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
682 p.setProperties(props);
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
683 return p;
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
684 }
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
685
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
686
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
687 /**
3509
bb5edff31866 Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2977
diff changeset
688 * From a property element create a Property object.
1439
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
689 */
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
690 protected static Property parseSetting(Element property){
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
691 NamedNodeMap attrMap = property.getAttributes();
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
692 int attrNum = attrMap != null ? attrMap.getLength() : 0;
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
693
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
694 Node type = attrMap.getNamedItem("type");
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
695 String t = type.getNodeValue();
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
696 PropertySetting ps = new PropertySetting();
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
697
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
698 if(t.equals("string")) {
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
699 ps = new StringProperty();
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
700 }
1464
c899a7ffdc8f Extract and parse the output settings from describe document and add settings
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1449
diff changeset
701 else if (t.equals("integer")) {
c899a7ffdc8f Extract and parse the output settings from describe document and add settings
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1449
diff changeset
702 ps = new IntegerProperty();
c899a7ffdc8f Extract and parse the output settings from describe document and add settings
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1449
diff changeset
703 }
c899a7ffdc8f Extract and parse the output settings from describe document and add settings
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1449
diff changeset
704 else if (t.equals("double")) {
c899a7ffdc8f Extract and parse the output settings from describe document and add settings
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1449
diff changeset
705 ps = new DoubleProperty();
c899a7ffdc8f Extract and parse the output settings from describe document and add settings
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1449
diff changeset
706 }
c899a7ffdc8f Extract and parse the output settings from describe document and add settings
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1449
diff changeset
707 else if (t.equals("boolean")) {
c899a7ffdc8f Extract and parse the output settings from describe document and add settings
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1449
diff changeset
708 ps = new BooleanProperty();
c899a7ffdc8f Extract and parse the output settings from describe document and add settings
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1449
diff changeset
709 }
1439
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
710 ps.setName(property.getTagName());
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
711 ps.setValue(property.getTextContent());
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
712
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
713 for (int i = 0; i < attrNum; i++) {
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
714 Node attr = attrMap.item(i);
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
715
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
716 String name = attr.getNodeName();
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
717 String value = attr.getNodeValue();
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
718 if(name.equals("type")) {
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
719 continue;
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
720 }
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
721 ps.setAttribute(name, value);
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
722 }
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
723 return ps;
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
724 }
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
725
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
726
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
727 /**
905
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
728 * This method extracts the CollectionItem from <i>node</i> with its output
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
729 * modes. The output modes are parsed using the parseOutputModes() method.
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
730 *
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
731 * @param node A node that contains information about a CollectionItem.
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
732 *
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
733 * @return a CollectionItem.
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
734 */
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
735 protected static CollectionItem parseCollectionItem(
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
736 Element node,
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
737 boolean outs
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
738 ) {
8203
238fc722f87a sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6141
diff changeset
739 log.debug("CollectionHelper.parseCollectionItem");
905
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
740
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
741 if (node == null) {
8203
238fc722f87a sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6141
diff changeset
742 log.debug("The node for parsing CollectionItem is null!");
905
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
743 return null;
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
744 }
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
745
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
746 String uri = ArtifactNamespaceContext.NAMESPACE_URI;
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
747
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
748 String uuid = node.getAttributeNS(uri, "uuid");
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
749 String hash = node.getAttributeNS(uri, "hash");
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
750
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
751 if (uuid == null || uuid.length() == 0) {
8203
238fc722f87a sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6141
diff changeset
752 log.warn("Found an invalid CollectionItem!");
905
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
753 return null;
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
754 }
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
755
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
756 List<OutputMode> modes = new ArrayList<OutputMode>();
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
757
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
758 if (outs) {
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
759 NodeList outputmodes = node.getElementsByTagNameNS(
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
760 uri, "outputmodes");
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
761
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
762 if (outputmodes.getLength() < 1) {
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
763 return null;
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
764 }
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
765
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
766 Element om = (Element)outputmodes.item(0);
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
767
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
768 modes = parseOutputModes(om);
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
769 }
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
770
1435
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
771 HashMap<String, String> dataItems = new HashMap<String, String>();
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
772
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
773 NodeList dataItemNodes = node.getElementsByTagNameNS(
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
774 uri, "data-items");
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
775
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
776 Element di = (Element)dataItemNodes.item(0);
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
777 dataItems = parseDataItems(di);
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
778
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
779 return new DefaultCollectionItem(uuid, hash, modes, dataItems);
905
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
780 }
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
781
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
782
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
783 /**
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
784 * This method extracts the OutputModes available for a specific
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
785 * CollectionItem and returns them as list.
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
786 *
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
787 * @param node The root node of the outputmodes list.
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
788 *
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
789 * @return a list of OutputModes.
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
790 */
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
791 protected static List<OutputMode> parseOutputModes(Element node) {
8203
238fc722f87a sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6141
diff changeset
792 log.debug("CollectionHelper.parseOutputModes");
905
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
793
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
794 if (node == null) {
8203
238fc722f87a sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6141
diff changeset
795 log.debug("The node for parsing OutputModes is null!");
905
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
796 return null;
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
797 }
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
798
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
799 String uri = ArtifactNamespaceContext.NAMESPACE_URI;
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
800
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
801 NodeList list = node.getElementsByTagNameNS(uri, "output");
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
802
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
803 int size = list.getLength();
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
804
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
805 if (size == 0) {
8203
238fc722f87a sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6141
diff changeset
806 log.debug("No outputmode nodes found!");
905
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
807 return null;
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
808 }
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
809
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
810 List<OutputMode> modes = new ArrayList<OutputMode>(size);
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
811
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
812 for (int i = 0; i < size; i++) {
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
813 Element tmp = (Element)list.item(i);
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
814
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
815 String name = tmp.getAttributeNS(uri, "name");
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
816 String desc = tmp.getAttributeNS(uri, "description");
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
817 String mime = tmp.getAttributeNS(uri, "mime-type");
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
818 String type = tmp.getAttributeNS(uri, "type");
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
819
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
820 if (name.length() == 0) {
8203
238fc722f87a sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6141
diff changeset
821 log.warn("Found an invalid output mode.");
905
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
822 continue;
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
823 }
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
824
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
825 OutputMode outmode = null;
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
826 List<Facet> fs = extractFacets(tmp);
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
827
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
828 if (type.equals("export")) {
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
829 outmode = new ExportMode(name, desc, mime, fs);
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
830 }
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
831 else if (type.equals("report")) {
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
832 outmode = new ReportMode(name, desc, mime, fs);
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
833 }
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
834 else if (type.equals("chart")){
2977
5161e25392ea Added chart overview to sq relation in minfo module.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2434
diff changeset
835 outmode = new ChartMode(name, desc, mime, fs, type);
905
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
836 }
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
837 else if (type.equals("map")){
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
838 outmode = new MapMode(name, desc, mime, fs);
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
839 }
2977
5161e25392ea Added chart overview to sq relation in minfo module.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2434
diff changeset
840 else if (type.equals("overview")) {
5161e25392ea Added chart overview to sq relation in minfo module.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2434
diff changeset
841 outmode = new OverviewMode(name, desc, mime, fs, type);
5161e25392ea Added chart overview to sq relation in minfo module.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2434
diff changeset
842 }
905
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
843 else {
8203
238fc722f87a sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6141
diff changeset
844 log.warn("Broken Output mode without type found.");
905
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
845 continue;
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
846 }
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
847
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
848 modes.add(outmode);
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
849 }
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
850
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
851 return modes;
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
852 }
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
853
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
854
1435
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
855 /**
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
856 * Create a Key/Value map for data nodes of artifact/collectionitem.
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
857 */
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
858 protected static HashMap<String, String> parseDataItems(Element node) {
8203
238fc722f87a sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6141
diff changeset
859 log.debug("CollectionHelper.parseDataItems");
1435
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
860
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
861 if (node == null) {
8203
238fc722f87a sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6141
diff changeset
862 log.debug("The node for parsing DataItems is null!");
1435
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
863 return null;
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
864 }
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
865
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
866 String uri = ArtifactNamespaceContext.NAMESPACE_URI;
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
867
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
868 NodeList list = node.getElementsByTagNameNS(uri, "data");
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
869
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
870 int size = list.getLength();
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
871
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
872 if (size == 0) {
8203
238fc722f87a sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6141
diff changeset
873 log.debug("No static data-item nodes found!");
1435
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
874 }
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
875
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
876 HashMap<String, String> data = new HashMap<String, String>(size*2);
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
877
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
878 for (int i = 0; i < size; i++) {
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
879 Element tmp = (Element)list.item(i);
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
880
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
881 String key = tmp.getAttributeNS(uri, "name");
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
882
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
883 if (key.length() == 0) {
8203
238fc722f87a sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6141
diff changeset
884 log.warn("Found an invalid data item mode.");
1435
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
885 continue;
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
886 }
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
887
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
888 // XXX We are restricted on 1/1 key/values in the data map here.
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
889 NodeList valueNodes = tmp.getElementsByTagName("art:item");
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
890
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
891 Element item = (Element) valueNodes.item(0);
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
892 String value = item.getAttributeNS(uri, "value");
8203
238fc722f87a sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6141
diff changeset
893 log.debug("Found a data item " + key + " : " + value);
1435
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
894
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
895 data.put(key, value);
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
896 }
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
897
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
898
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
899 // Dynamic data.
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
900 list = node.getElementsByTagNameNS(uri, "select");
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
901
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
902 size = list.getLength();
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
903
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
904 if (size == 0) {
8203
238fc722f87a sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6141
diff changeset
905 log.debug("No dynamic data-item nodes found!");
1435
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
906 }
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
907
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
908 for (int i = 0; i < size; i++) {
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
909 Element tmp = (Element)list.item(i);
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
910
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
911 String key = tmp.getAttributeNS(uri, "name");
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
912
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
913 if (key.length() == 0) {
8203
238fc722f87a sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6141
diff changeset
914 log.warn("Found an invalid data item node (missing key).");
1435
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
915 continue;
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
916 }
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
917
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
918 String value = tmp.getAttributeNS(uri, "defaultValue");
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
919
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
920 if (value.length() == 0) {
8203
238fc722f87a sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6141
diff changeset
921 log.warn("Found an invalid data item node (missing value).");
1435
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
922 continue;
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
923 }
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
924
8203
238fc722f87a sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6141
diff changeset
925 log.debug("Found a (dyn) data item " + key + " : " + value);
1435
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
926
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
927 data.put(key, value);
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
928 }
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
929
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
930 return data;
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
931 }
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
932
905
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
933 protected static List<Facet> extractFacets(Element outmode) {
8203
238fc722f87a sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6141
diff changeset
934 log.debug("CollectionHelper - extractFacets()");
905
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
935
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
936 NodeList facetList = (NodeList) XMLUtils.xpath(
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
937 outmode,
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
938 XPATH_FACETS,
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
939 XPathConstants.NODESET,
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
940 ArtifactNamespaceContext.INSTANCE);
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
941
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
942 int num = facetList != null ? facetList.getLength() : 0;
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
943
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
944 List<Facet> facets = new ArrayList<Facet>(num);
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
945
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
946 String uri = ArtifactNamespaceContext.NAMESPACE_URI;
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
947
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
948 for (int i = 0; i < num; i++) {
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
949 Element facetEl = (Element) facetList.item(i);
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
950
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
951 String name = facetEl.getAttributeNS(uri, "name");
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
952 String desc = facetEl.getAttributeNS(uri, "description");
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
953 String index = facetEl.getAttributeNS(uri, "index");
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
954
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
955 if (name != null && name.length() > 0 && index != null) {
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
956 facets.add(new DefaultFacet(name, Integer.valueOf(index),desc));
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
957 }
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
958 }
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
959
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
960 return facets;
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
961 }
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
962
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
963
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
964 public static List<Recommendation> parseRecommendations(Document doc) {
8203
238fc722f87a sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6141
diff changeset
965 log.debug("CollectionHelper.parseRecommendations");
905
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
966
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
967 NodeList list = (NodeList) XMLUtils.xpath(
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
968 doc,
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
969 XPATH_LOADED_RECOMMENDATIONS,
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
970 XPathConstants.NODESET,
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
971 ArtifactNamespaceContext.INSTANCE);
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
972
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
973 int num = list != null ? list.getLength() : 0;
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
974
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
975 List<Recommendation> recs = new ArrayList<Recommendation>(num);
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
976
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
977 String uri = ArtifactNamespaceContext.NAMESPACE_URI;
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
978
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
979 for (int i = 0; i < num; i++) {
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
980 Element rec = (Element) list.item(i);
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
981
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
982 String factory = rec.getAttributeNS(uri, "factory");
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
983 String dbids = rec.getAttributeNS(uri, "ids");
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
984
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
985 if (factory != null && factory.length() > 0) {
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
986 recs.add(new Recommendation(factory, dbids));
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
987 }
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
988 }
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
989
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
990 return recs;
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
991 }
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
992
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
993
1318
ecd0243bc09e Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 905
diff changeset
994 /**
ecd0243bc09e Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 905
diff changeset
995 * Add an artifact to a collection.
ecd0243bc09e Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 905
diff changeset
996 * @param collection Collection to add artifact to.
ecd0243bc09e Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 905
diff changeset
997 * @param artifact Artifact to add to collection
ecd0243bc09e Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 905
diff changeset
998 */
905
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
999 public static Collection addArtifact(
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
1000 Collection collection,
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
1001 Artifact artifact,
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
1002 String url,
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
1003 String locale)
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
1004 throws ServerException
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
1005 {
8203
238fc722f87a sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6141
diff changeset
1006 log.debug("CollectionHelper.addArtifact");
905
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
1007
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
1008 if (collection == null) {
8203
238fc722f87a sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6141
diff changeset
1009 log.warn("The given Collection is null!");
905
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
1010 return null;
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
1011 }
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
1012
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
1013 Document add = ClientProtocolUtils.newAddArtifactDocument(
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
1014 artifact.getUuid(), null);
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
1015
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
1016 HttpClient client = new HttpClientImpl(url, locale);
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
1017
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
1018 try {
8203
238fc722f87a sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6141
diff changeset
1019 log.debug("Do HTTP request now.");
905
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
1020
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
1021 Document response = (Document) client.doCollectionAction(
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
1022 add, collection.identifier(), new DocumentResponseHandler());
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
1023
8203
238fc722f87a sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6141
diff changeset
1024 log.debug(
905
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
1025 "Finished HTTP request successfully. Parse Collection now.");
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
1026
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
1027 Collection c = CollectionHelper.parseCollection(response);
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
1028
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
1029 if (c == null) {
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
1030 throw new ServerException(ERROR_ADD_ARTIFACT);
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
1031 }
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
1032
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
1033 return c;
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
1034 }
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
1035 catch (ConnectionException ce) {
8203
238fc722f87a sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6141
diff changeset
1036 log.error(ce, ce);
905
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
1037 }
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
1038 catch (Exception e) {
8203
238fc722f87a sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6141
diff changeset
1039 log.error(e, e);
905
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
1040 }
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
1041
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
1042 throw new ServerException(ERROR_ADD_ARTIFACT);
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
1043 }
1320
5733c05ce24c Added removeArtifact CollectionHelper method.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1318
diff changeset
1044
5733c05ce24c Added removeArtifact CollectionHelper method.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1318
diff changeset
1045
5733c05ce24c Added removeArtifact CollectionHelper method.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1318
diff changeset
1046 /**
5733c05ce24c Added removeArtifact CollectionHelper method.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1318
diff changeset
1047 * Remove an artifact from a collection.
5733c05ce24c Added removeArtifact CollectionHelper method.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1318
diff changeset
1048 * @param collection Collection to remove artifact to.
5733c05ce24c Added removeArtifact CollectionHelper method.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1318
diff changeset
1049 * @param artifact Artifact to add to collection
5733c05ce24c Added removeArtifact CollectionHelper method.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1318
diff changeset
1050 */
5733c05ce24c Added removeArtifact CollectionHelper method.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1318
diff changeset
1051 public static Collection removeArtifact(
5733c05ce24c Added removeArtifact CollectionHelper method.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1318
diff changeset
1052 Collection collection,
5733c05ce24c Added removeArtifact CollectionHelper method.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1318
diff changeset
1053 String artifactId,
5733c05ce24c Added removeArtifact CollectionHelper method.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1318
diff changeset
1054 String url,
5733c05ce24c Added removeArtifact CollectionHelper method.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1318
diff changeset
1055 String locale)
5733c05ce24c Added removeArtifact CollectionHelper method.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1318
diff changeset
1056 throws ServerException
5733c05ce24c Added removeArtifact CollectionHelper method.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1318
diff changeset
1057 {
8203
238fc722f87a sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6141
diff changeset
1058 log.debug("CollectionHelper.removeArtifact");
1320
5733c05ce24c Added removeArtifact CollectionHelper method.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1318
diff changeset
1059
5733c05ce24c Added removeArtifact CollectionHelper method.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1318
diff changeset
1060 if (collection == null) {
8203
238fc722f87a sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6141
diff changeset
1061 log.warn("The given Collection is null!");
1320
5733c05ce24c Added removeArtifact CollectionHelper method.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1318
diff changeset
1062 return null;
5733c05ce24c Added removeArtifact CollectionHelper method.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1318
diff changeset
1063 }
5733c05ce24c Added removeArtifact CollectionHelper method.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1318
diff changeset
1064
5733c05ce24c Added removeArtifact CollectionHelper method.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1318
diff changeset
1065 Document remove = ClientProtocolUtils.newRemoveArtifactDocument(
5733c05ce24c Added removeArtifact CollectionHelper method.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1318
diff changeset
1066 artifactId);
5733c05ce24c Added removeArtifact CollectionHelper method.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1318
diff changeset
1067
5733c05ce24c Added removeArtifact CollectionHelper method.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1318
diff changeset
1068 HttpClient client = new HttpClientImpl(url, locale);
5733c05ce24c Added removeArtifact CollectionHelper method.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1318
diff changeset
1069
5733c05ce24c Added removeArtifact CollectionHelper method.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1318
diff changeset
1070 try {
8203
238fc722f87a sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6141
diff changeset
1071 log.debug("Do HTTP request now.");
1320
5733c05ce24c Added removeArtifact CollectionHelper method.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1318
diff changeset
1072
5733c05ce24c Added removeArtifact CollectionHelper method.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1318
diff changeset
1073 Document response = (Document) client.doCollectionAction(
5733c05ce24c Added removeArtifact CollectionHelper method.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1318
diff changeset
1074 remove, collection.identifier(), new DocumentResponseHandler());
5733c05ce24c Added removeArtifact CollectionHelper method.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1318
diff changeset
1075
8203
238fc722f87a sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6141
diff changeset
1076 log.debug(
1320
5733c05ce24c Added removeArtifact CollectionHelper method.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1318
diff changeset
1077 "Finished HTTP request successfully. Parse Collection now.");
8203
238fc722f87a sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6141
diff changeset
1078 log.debug(XMLUtils.toString(response));
1320
5733c05ce24c Added removeArtifact CollectionHelper method.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1318
diff changeset
1079
5733c05ce24c Added removeArtifact CollectionHelper method.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1318
diff changeset
1080 Collection c = CollectionHelper.parseCollection(response);
5733c05ce24c Added removeArtifact CollectionHelper method.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1318
diff changeset
1081
5733c05ce24c Added removeArtifact CollectionHelper method.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1318
diff changeset
1082 if (c == null) {
1332
ab2b1a4a9ead Donate own error for failcase of remove-artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1320
diff changeset
1083 throw new ServerException(ERROR_REMOVE_ARTIFACT);
1320
5733c05ce24c Added removeArtifact CollectionHelper method.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1318
diff changeset
1084 }
5733c05ce24c Added removeArtifact CollectionHelper method.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1318
diff changeset
1085
5733c05ce24c Added removeArtifact CollectionHelper method.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1318
diff changeset
1086 return c;
5733c05ce24c Added removeArtifact CollectionHelper method.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1318
diff changeset
1087 }
5733c05ce24c Added removeArtifact CollectionHelper method.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1318
diff changeset
1088 catch (ConnectionException ce) {
8203
238fc722f87a sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6141
diff changeset
1089 log.error(ce, ce);
1320
5733c05ce24c Added removeArtifact CollectionHelper method.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1318
diff changeset
1090 }
5733c05ce24c Added removeArtifact CollectionHelper method.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1318
diff changeset
1091 catch (Exception e) {
8203
238fc722f87a sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6141
diff changeset
1092 log.error(e, e);
1320
5733c05ce24c Added removeArtifact CollectionHelper method.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1318
diff changeset
1093 }
1332
ab2b1a4a9ead Donate own error for failcase of remove-artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1320
diff changeset
1094 throw new ServerException(ERROR_REMOVE_ARTIFACT);
1320
5733c05ce24c Added removeArtifact CollectionHelper method.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1318
diff changeset
1095 }
530
26e38b79658d Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
1096 }
26e38b79658d Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
1097 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org