annotate gwt-client/src/main/java/org/dive4elements/river/client/server/CollectionHelper.java @ 8203:238fc722f87a

sed 's/logger/log/g' src/**/*.java
author Sascha L. Teichmann <teichmann@intevation.de>
date Fri, 05 Sep 2014 13:19:22 +0200
parents 63975955ec61
children 5e38e2924c07
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 =
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
82 "/art:artifact-collection/art:attribute/art:loaded-recommendations/art:recommendation";
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
83
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes 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
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
85 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
86 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
87
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 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
89
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 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
91 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
92 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
93 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
94
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 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
96
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 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
98
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 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
100
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 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
102 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
103
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 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
105 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
106 }
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
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
108 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
109 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
110 }
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
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
112 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
113 }
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 * 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
118 *
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 * @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
120 * @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
121 * @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
122 *
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 * @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
124 */
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 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
126 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
127 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
128 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
129 {
8203
238fc722f87a sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6141
diff changeset
130 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
131
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 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
133 ? 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
134 : 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
135
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 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
137 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
138 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
139 }
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 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
142
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 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
144 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
145
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 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
147 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
148 }
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 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
152 }
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 * 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
157 *
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 * @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
159 * @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
160 * @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
161 *
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 * @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
163 */
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 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
165 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
166 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
167 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
168 {
8203
238fc722f87a sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6141
diff changeset
169 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
170
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 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
172 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
173
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 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
175 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
176
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 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
178 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
179 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
180 }
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 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
183 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
184
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 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
186 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
187 }
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
1478
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
190 Document doc = out.getOwnerDocument();
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
191
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
192 ElementCreator settingscr = new ElementCreator(doc, "", "");
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
193
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
194 Settings settings = collection.getSettings(mode.getName());
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
195 if (settings == null ||
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
196 settings.getCategories().size() == 0)
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
197 {
8203
238fc722f87a sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6141
diff changeset
198 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
199 }
2434
e8b38b5e4cf9 Fixed Issue 498.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1507
diff changeset
200 else {
e8b38b5e4cf9 Fixed Issue 498.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1507
diff changeset
201 Element s = createSettingsElement(settingscr, collection, settings);
e8b38b5e4cf9 Fixed Issue 498.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1507
diff changeset
202 if (s != null) {
e8b38b5e4cf9 Fixed Issue 498.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1507
diff changeset
203 out.appendChild(s);
e8b38b5e4cf9 Fixed Issue 498.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1507
diff changeset
204 }
1478
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
205 }
8203
238fc722f87a sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6141
diff changeset
206 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
207 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
208 }
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 * 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
213 *
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 * @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
215 * @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
216 * @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
217 *
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 * @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
219 */
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 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
221 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
222 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
223 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
224 {
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 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
226 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
227 }
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
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
229 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
230
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
231 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
232 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
233 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
234
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 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
236 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
237 }
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 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
240 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
241 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
242 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
243 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
244 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
245 cr.addAttr(t, "description", theme.getDescription(), true);
1342
9bf91bce6ca4 Bugfix: adjusted method call which avoided compiling flys-client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1340
diff changeset
246 cr.addAttr(t, "visible", Integer.toString(theme.getVisible()), 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
247 }
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
248
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
249 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
250 }
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
251
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
252
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 * 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
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 * @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
257 * @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
258 *
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 * @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
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 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
262 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
263 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
264 {
8203
238fc722f87a sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6141
diff changeset
265 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
266
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
267 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
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 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
270 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
271 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
272 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
273 }
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
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 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
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 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
278 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
279
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 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
281 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
282 }
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 }
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 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
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
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 * 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
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 * @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
293 * @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
294 * @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
295 *
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 * @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
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 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
299 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
300 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
301 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
302 {
8203
238fc722f87a sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6141
diff changeset
303 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
304
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
305 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
306 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
307 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
308
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
309 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
310 }
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
311
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
312
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes 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 /**
1478
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
314 *
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
315 */
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
316 protected static Element createSettingsElement(
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
317 ElementCreator cr,
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
318 Collection c,
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
319 Settings s)
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
320 {
8203
238fc722f87a sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6141
diff changeset
321 log.debug("CollectionHelper.createSettingsElement");
1478
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
322 Element settings = cr.create("settings");
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
323
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
324 List<String> categories = s.getCategories();
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 for (String category: categories) {
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
327 Element cat =cr.create(category);
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
328 settings.appendChild(cat);
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
329 List<Property> props = s.getSettings(category);
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
330 for (Property p: props) {
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
331 if (p instanceof PropertyGroup) {
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
332 Element prop = createPropertyGroupElement(cr,
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
333 (PropertyGroup)p);
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
334 cat.appendChild(prop);
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
335 }
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
336 else if (p instanceof PropertySetting) {
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
337 Element prop = createPropertyElement (cr,
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
338 (PropertySetting)p);
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
339 cat.appendChild(prop);
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
340 }
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
341 }
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 return settings;
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
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 protected static Element createPropertyGroupElement(
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
351 ElementCreator cr,
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
352 PropertyGroup pg)
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
353 {
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
354 Element e = cr.create(pg.getName());
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 List<Property> list = pg.getProperties();
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
357 for (Property p: list) {
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
358 Element pe = createPropertyElement(cr, (PropertySetting)p);
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
359 e.appendChild(pe);
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
360 }
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
361 return e;
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
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 protected static Element createPropertyElement(
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
369 ElementCreator cr,
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
370 PropertySetting p)
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
371 {
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
372 Element e = cr.create(p.getName());
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 if(p instanceof BooleanProperty) {
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
375 cr.addAttr(e, "type", "boolean", false);
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
376 }
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
377 else if(p instanceof DoubleProperty) {
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
378 cr.addAttr(e, "type", "double", false);
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
379 }
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
380 else if(p instanceof IntegerProperty) {
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
381 cr.addAttr(e, "type", "integer", false);
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
382 }
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
383 else if(p instanceof StringProperty) {
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
384 cr.addAttr(e, "type", "string", false);
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
385 }
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
386
1507
c21d14e48040 Improved validation and property handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1478
diff changeset
387 e.setTextContent(p.getValue().toString());
1478
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
388 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
389 return e;
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
390 }
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
391
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 /**
1318
ecd0243bc09e Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 905
diff changeset
394 * 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
395 * 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
396 * 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
397 *
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes 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 * @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
399 * 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
400 *
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes 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 * @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
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 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
404 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
405
8203
238fc722f87a sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6141
diff changeset
406 if (log.isDebugEnabled()) {
238fc722f87a sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6141
diff changeset
407 log.debug(XMLUtils.toString(description));
6141
63975955ec61 Guard the collection describe debug output
Andre Heinecke <aheinecke@intevation.de>
parents: 6135
diff changeset
408 }
6135
804e50149d6a Print the complete collection in parseCollection
Andre Heinecke <aheinecke@intevation.de>
parents: 5993
diff changeset
409
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
410 if (description == null) {
8203
238fc722f87a sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6141
diff changeset
411 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
412 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
413 }
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes 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
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes 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 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
416 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
417 "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
418 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
419
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes 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 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
421 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
422 "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
423 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
424
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes 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 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
426 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
427 "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
428 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
429
1318
ecd0243bc09e Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 905
diff changeset
430 if (uuid.length() == 0) {
8203
238fc722f87a sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6141
diff changeset
431 log.warn("Found an invalid (zero length uuid) Collection!");
1318
ecd0243bc09e Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 905
diff changeset
432 return null;
ecd0243bc09e Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 905
diff changeset
433 }
ecd0243bc09e Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 905
diff changeset
434
ecd0243bc09e Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 905
diff changeset
435 if (ttlStr.length() == 0) {
8203
238fc722f87a sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6141
diff changeset
436 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
437 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
438 }
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes 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
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes 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 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
442 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
443 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
444 }
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes 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 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
446 // 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
447 }
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes 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
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes 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 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
450 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
451 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
452
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
453 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
454
1435
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
455 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
456
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
457 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
458 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
459 "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
460 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
461 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
462
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes 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 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
464 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
465
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
466 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
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
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes 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 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
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 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
472 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
473 (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
474 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
475
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes 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 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
477 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
478 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
479 }
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
480 }
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes 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
1435
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
482 Map<String, ThemeList> themeLists = parseThemeLists(description, collectionItems);
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
483 c.setThemeLists(themeLists);
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
484
1464
c899a7ffdc8f Extract and parse the output settings from describe document and add settings
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1449
diff changeset
485 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
486 c.setSettings(outSettings);
8203
238fc722f87a sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6141
diff changeset
487 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
488 "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
489 "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
490
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes 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 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
492 }
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes 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
1435
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
495 /**
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
496 * @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
497 * (artifact) uuid.
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 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
500 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
501 ) {
8203
238fc722f87a sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6141
diff changeset
502 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
503
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
504 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
505 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
506 "/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
507 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
508 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
509
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes 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 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
511
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes 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 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
513
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes 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 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
515
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes 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 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
517 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
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 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
520
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes 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 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
522 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
523
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
524 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
525 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
526 }
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes 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 }
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes 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 }
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes 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 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
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
1435
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
534 /**
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
535 * @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
536 * (artifact) uuid.
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 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
539 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
540 ) {
8203
238fc722f87a sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6141
diff changeset
541 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
542
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
543 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
544 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
545 "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
546
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes 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 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
548
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes 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 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
550
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes 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 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
552 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
553 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
554
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes 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 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
556 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
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 }
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes 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
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes 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 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
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
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes 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 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
565 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
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 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
568
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes 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 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
570 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
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 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
573
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes 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 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
575 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
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 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
578 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
579 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
580
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes 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 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
582 }
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes 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 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
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
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes 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 /**
1439
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
589 * Parse Settings elements.
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
590 *
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
591 * @param description The collection description.
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
592 *
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
593 * @return Map containing the settings.
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
594 */
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
595 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
596 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
597
c899a7ffdc8f Extract and parse the output settings from describe document and add settings
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1449
diff changeset
598 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
599 description,
c899a7ffdc8f Extract and parse the output settings from describe document and add settings
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1449
diff changeset
600 "/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
601 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
602 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
603
c899a7ffdc8f Extract and parse the output settings from describe document and add settings
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1449
diff changeset
604 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
605
c899a7ffdc8f Extract and parse the output settings from describe document and add settings
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1449
diff changeset
606 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
607
c899a7ffdc8f Extract and parse the output settings from describe document and add settings
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1449
diff changeset
608 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
609
c899a7ffdc8f Extract and parse the output settings from describe document and add settings
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1449
diff changeset
610 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
611 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
612 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
613 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
614 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
615 }
1439
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
616
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
617 return list;
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
618 }
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
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
621 /**
3509
bb5edff31866 Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2977
diff changeset
622 * From a document, parse the settings for an output and create an
bb5edff31866 Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2977
diff changeset
623 * OutputSettings object.
1439
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
624 */
1464
c899a7ffdc8f Extract and parse the output settings from describe document and add settings
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1449
diff changeset
625 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
626 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
627
c899a7ffdc8f Extract and parse the output settings from describe document and add settings
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1449
diff changeset
628 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
629
c899a7ffdc8f Extract and parse the output settings from describe document and add settings
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1449
diff changeset
630 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
631 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
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
c899a7ffdc8f Extract and parse the output settings from describe document and add settings
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1449
diff changeset
634 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
635
3509
bb5edff31866 Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2977
diff changeset
636 // Get the categories
1439
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
637 NodeList catNodes = settings.getChildNodes();
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
638 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
639 Element catNode = (Element)catNodes.item(i);
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
640
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
641 // The category name
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
642 String category = catNode.getTagName();
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 // 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
645 NodeList list = catNode.getChildNodes();
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 // 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
648 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
649 for (int j = 0; j < list.getLength(); j++) {
3509
bb5edff31866 Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2977
diff changeset
650 Property p;
1439
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
651 Element e = (Element)list.item(j);
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
652 if (e.hasChildNodes() &&
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
653 e.getFirstChild().getNodeType() != Node.TEXT_NODE) {
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
654 p = parseSettingsGroup(e);
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
655 }
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
656 else {
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
657 p = parseSetting(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 props.add(p);
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
660 }
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
661 set.setSettings(category, props);
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
662 }
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
663 return set;
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
664 }
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
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 protected static Property parseSettingsGroup(Element group) {
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
671 PropertyGroup p = new PropertyGroup();
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
672 p.setName(group.getTagName());
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
673
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
674 NodeList list = group.getChildNodes();
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
675 ArrayList<Property> props = new ArrayList<Property>();
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
676 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
677 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
678 }
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
679 p.setProperties(props);
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
680 return p;
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
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
683
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
684 /**
3509
bb5edff31866 Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2977
diff changeset
685 * 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
686 */
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
687 protected static Property parseSetting(Element property){
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
688 NamedNodeMap attrMap = property.getAttributes();
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
689 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
690
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
691 Node type = attrMap.getNamedItem("type");
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
692 String t = type.getNodeValue();
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
693 PropertySetting ps = new PropertySetting();
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
694
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
695 if(t.equals("string")) {
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
696 ps = new StringProperty();
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
697 }
1464
c899a7ffdc8f Extract and parse the output settings from describe document and add settings
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1449
diff changeset
698 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
699 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
700 }
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("double")) {
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 DoubleProperty();
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("boolean")) {
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 BooleanProperty();
c899a7ffdc8f Extract and parse the output settings from describe document and add settings
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1449
diff changeset
706 }
1439
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
707 ps.setName(property.getTagName());
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
708 ps.setValue(property.getTextContent());
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
709
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
710 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
711 Node attr = attrMap.item(i);
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 String name = attr.getNodeName();
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
714 String value = attr.getNodeValue();
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
715 if(name.equals("type")) {
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
716 continue;
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
717 }
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
718 ps.setAttribute(name, value);
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
719 }
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
720 return ps;
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
721 }
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
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
724 /**
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
725 * 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
726 * 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
727 *
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes 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 * @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
729 *
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes 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 * @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
731 */
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes 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 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
733 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
734 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
735 ) {
8203
238fc722f87a sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6141
diff changeset
736 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
737
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes 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 if (node == null) {
8203
238fc722f87a sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6141
diff changeset
739 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
740 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
741 }
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
742
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes 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 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
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 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
746 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
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 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
749 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
750 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
751 }
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
752
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes 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 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
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 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
756 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
757 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
758
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes 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 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
760 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
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
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes 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 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
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 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
766 }
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes 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
1435
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
768 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
769
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
770 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
771 uri, "data-items");
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 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
774 dataItems = parseDataItems(di);
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 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
777 }
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
778
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
779
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes 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 * 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
782 * 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
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 * @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
785 *
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes 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 * @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
787 */
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes 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 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
789 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
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 if (node == null) {
8203
238fc722f87a sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6141
diff changeset
792 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
793 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
794 }
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
795
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes 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 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
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 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
799
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes 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 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
801
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes 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 if (size == 0) {
8203
238fc722f87a sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6141
diff changeset
803 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
804 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
805 }
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
806
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes 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 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
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 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
810 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
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 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
813 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
814 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
815 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
816
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes 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 if (name.length() == 0) {
8203
238fc722f87a sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6141
diff changeset
818 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
819 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
820 }
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
821
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes 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 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
823 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
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 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
826 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
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 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
829 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
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("chart")){
2977
5161e25392ea Added chart overview to sq relation in minfo module.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2434
diff changeset
832 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
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("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
835 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
836 }
2977
5161e25392ea Added chart overview to sq relation in minfo module.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2434
diff changeset
837 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
838 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
839 }
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
840 else {
8203
238fc722f87a sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6141
diff changeset
841 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
842 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
843 }
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
844
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes 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 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
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 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
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
1435
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
852 /**
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
853 * 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
854 */
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
855 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
856 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
857
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
858 if (node == null) {
8203
238fc722f87a sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6141
diff changeset
859 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
860 return null;
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
861 }
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
862
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
863 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
864
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
865 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
866
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
867 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
868
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
869 if (size == 0) {
8203
238fc722f87a sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6141
diff changeset
870 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
871 }
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
872
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
873 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
874
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
875 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
876 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
877
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
878 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
879
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
880 if (key.length() == 0) {
8203
238fc722f87a sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6141
diff changeset
881 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
882 continue;
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
883 }
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
884
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
885 // 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
886 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
887
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
888 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
889 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
890 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
891
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
892 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
893 }
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
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
896 // Dynamic data.
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
897 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
898
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
899 size = list.getLength();
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
900
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
901 if (size == 0) {
8203
238fc722f87a sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6141
diff changeset
902 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
903 }
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
904
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
905 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
906 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
907
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
908 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
909
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
910 if (key.length() == 0) {
8203
238fc722f87a sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6141
diff changeset
911 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
912 continue;
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
913 }
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
914
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
915 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
916
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
917 if (value.length() == 0) {
8203
238fc722f87a sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6141
diff changeset
918 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
919 continue;
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
920 }
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
921
8203
238fc722f87a sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6141
diff changeset
922 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
923
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
924 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
925 }
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 return data;
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
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
930 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
931 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
932
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes 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 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
934 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
935 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
936 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
937 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
938
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes 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 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
940
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes 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 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
942
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes 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 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
944
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes 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 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
946 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
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 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
949 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
950 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
951
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes 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 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
953 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
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 }
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes 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
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes 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 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
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
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes 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 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
962 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
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 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
965 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
966 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
967 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
968 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
969
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes 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 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
971
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes 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 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
973
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes 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 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
975
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes 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 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
977 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
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 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
980 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
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 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
983 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
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 }
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes 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
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes 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 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
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
1318
ecd0243bc09e Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 905
diff changeset
991 /**
ecd0243bc09e Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 905
diff changeset
992 * Add an artifact to a collection.
ecd0243bc09e Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 905
diff changeset
993 * @param collection Collection to add artifact to.
ecd0243bc09e Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 905
diff changeset
994 * @param artifact Artifact to add to collection
ecd0243bc09e Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 905
diff changeset
995 */
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
996 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
997 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
998 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
999 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
1000 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
1001 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
1002 {
8203
238fc722f87a sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6141
diff changeset
1003 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
1004
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes 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 if (collection == null) {
8203
238fc722f87a sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6141
diff changeset
1006 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
1007 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
1008 }
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
1009
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes 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 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
1011 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
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 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
1014
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes 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 try {
8203
238fc722f87a sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6141
diff changeset
1016 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
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 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
1019 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
1020
8203
238fc722f87a sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6141
diff changeset
1021 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
1022 "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
1023
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
1024 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
1025
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes 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 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
1027 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
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
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes 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 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
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 catch (ConnectionException ce) {
8203
238fc722f87a sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6141
diff changeset
1033 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
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 (Exception e) {
8203
238fc722f87a sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6141
diff changeset
1036 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
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
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
1039 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
1040 }
1320
5733c05ce24c Added removeArtifact CollectionHelper method.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1318
diff changeset
1041
5733c05ce24c Added removeArtifact CollectionHelper method.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1318
diff changeset
1042
5733c05ce24c Added removeArtifact CollectionHelper method.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1318
diff changeset
1043 /**
5733c05ce24c Added removeArtifact CollectionHelper method.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1318
diff changeset
1044 * Remove an artifact from a collection.
5733c05ce24c Added removeArtifact CollectionHelper method.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1318
diff changeset
1045 * @param collection Collection to remove artifact to.
5733c05ce24c Added removeArtifact CollectionHelper method.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1318
diff changeset
1046 * @param artifact Artifact to add to collection
5733c05ce24c Added removeArtifact CollectionHelper method.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1318
diff changeset
1047 */
5733c05ce24c Added removeArtifact CollectionHelper method.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1318
diff changeset
1048 public static Collection removeArtifact(
5733c05ce24c Added removeArtifact CollectionHelper method.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1318
diff changeset
1049 Collection collection,
5733c05ce24c Added removeArtifact CollectionHelper method.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1318
diff changeset
1050 String artifactId,
5733c05ce24c Added removeArtifact CollectionHelper method.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1318
diff changeset
1051 String url,
5733c05ce24c Added removeArtifact CollectionHelper method.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1318
diff changeset
1052 String locale)
5733c05ce24c Added removeArtifact CollectionHelper method.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1318
diff changeset
1053 throws ServerException
5733c05ce24c Added removeArtifact CollectionHelper method.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1318
diff changeset
1054 {
8203
238fc722f87a sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6141
diff changeset
1055 log.debug("CollectionHelper.removeArtifact");
1320
5733c05ce24c Added removeArtifact CollectionHelper method.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1318
diff changeset
1056
5733c05ce24c Added removeArtifact CollectionHelper method.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1318
diff changeset
1057 if (collection == null) {
8203
238fc722f87a sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6141
diff changeset
1058 log.warn("The given Collection is null!");
1320
5733c05ce24c Added removeArtifact CollectionHelper method.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1318
diff changeset
1059 return null;
5733c05ce24c Added removeArtifact CollectionHelper method.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1318
diff changeset
1060 }
5733c05ce24c Added removeArtifact CollectionHelper method.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1318
diff changeset
1061
5733c05ce24c Added removeArtifact CollectionHelper method.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1318
diff changeset
1062 Document remove = ClientProtocolUtils.newRemoveArtifactDocument(
5733c05ce24c Added removeArtifact CollectionHelper method.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1318
diff changeset
1063 artifactId);
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 HttpClient client = new HttpClientImpl(url, locale);
5733c05ce24c Added removeArtifact CollectionHelper method.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1318
diff changeset
1066
5733c05ce24c Added removeArtifact CollectionHelper method.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1318
diff changeset
1067 try {
8203
238fc722f87a sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6141
diff changeset
1068 log.debug("Do HTTP request now.");
1320
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 Document response = (Document) client.doCollectionAction(
5733c05ce24c Added removeArtifact CollectionHelper method.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1318
diff changeset
1071 remove, collection.identifier(), new DocumentResponseHandler());
5733c05ce24c Added removeArtifact CollectionHelper method.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1318
diff changeset
1072
8203
238fc722f87a sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6141
diff changeset
1073 log.debug(
1320
5733c05ce24c Added removeArtifact CollectionHelper method.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1318
diff changeset
1074 "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
1075 log.debug(XMLUtils.toString(response));
1320
5733c05ce24c Added removeArtifact CollectionHelper method.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1318
diff changeset
1076
5733c05ce24c Added removeArtifact CollectionHelper method.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1318
diff changeset
1077 Collection c = CollectionHelper.parseCollection(response);
5733c05ce24c Added removeArtifact CollectionHelper method.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1318
diff changeset
1078
5733c05ce24c Added removeArtifact CollectionHelper method.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1318
diff changeset
1079 if (c == null) {
1332
ab2b1a4a9ead Donate own error for failcase of remove-artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1320
diff changeset
1080 throw new ServerException(ERROR_REMOVE_ARTIFACT);
1320
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
5733c05ce24c Added removeArtifact CollectionHelper method.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1318
diff changeset
1083 return c;
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 catch (ConnectionException ce) {
8203
238fc722f87a sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6141
diff changeset
1086 log.error(ce, ce);
1320
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 (Exception e) {
8203
238fc722f87a sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6141
diff changeset
1089 log.error(e, e);
1320
5733c05ce24c Added removeArtifact CollectionHelper method.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1318
diff changeset
1090 }
1332
ab2b1a4a9ead Donate own error for failcase of remove-artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1320
diff changeset
1091 throw new ServerException(ERROR_REMOVE_ARTIFACT);
1320
5733c05ce24c Added removeArtifact CollectionHelper method.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1318
diff changeset
1092 }
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
1093 }
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
1094 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org