annotate flys-client/src/main/java/de/intevation/flys/client/server/CollectionHelper.java @ 1507:c21d14e48040

Improved validation and property handling. flys-client/trunk@3645 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Raimund Renkert <raimund.renkert@intevation.de>
date Wed, 11 Jan 2012 10:21:22 +0000
parents 237e7450ae2e
children e8b38b5e4cf9
rev   line source
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
1 package de.intevation.flys.client.server;
26e38b79658d Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
2
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
3 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
4 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
5 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
6 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
7 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
8
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
9 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
10
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
11 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
12 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
13 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
14 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
15 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
16
1367
ab8eb2f544f2 Replaced stdout and stderr logging with log4j loggers in server classes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1342
diff changeset
17 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
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 de.intevation.artifacts.common.ArtifactNamespaceContext;
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
20 import de.intevation.artifacts.common.utils.ClientProtocolUtils;
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
21 import de.intevation.artifacts.common.utils.XMLUtils;
26e38b79658d Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
22 import de.intevation.artifacts.common.utils.XMLUtils.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
23
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
24 import de.intevation.artifacts.httpclient.exceptions.ConnectionException;
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
25 import de.intevation.artifacts.httpclient.http.HttpClient;
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
26 import de.intevation.artifacts.httpclient.http.HttpClientImpl;
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
27 import de.intevation.artifacts.httpclient.http.response.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
28
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
29 import de.intevation.flys.client.shared.exceptions.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
30 import de.intevation.flys.client.shared.model.Artifact;
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
31 import de.intevation.flys.client.shared.model.AttributedTheme;
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
32 import de.intevation.flys.client.shared.model.ChartMode;
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
33 import de.intevation.flys.client.shared.model.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
34 import de.intevation.flys.client.shared.model.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
35 import de.intevation.flys.client.shared.model.DefaultCollection;
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
36 import de.intevation.flys.client.shared.model.DefaultCollectionItem;
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
37 import de.intevation.flys.client.shared.model.DefaultFacet;
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
38 import de.intevation.flys.client.shared.model.ExportMode;
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
39 import de.intevation.flys.client.shared.model.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
40 import de.intevation.flys.client.shared.model.MapMode;
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
41 import de.intevation.flys.client.shared.model.OutputMode;
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
42 import de.intevation.flys.client.shared.model.ReportMode;
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
43 import de.intevation.flys.client.shared.model.Recommendation;
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
44 import de.intevation.flys.client.shared.model.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
45 import de.intevation.flys.client.shared.model.ThemeList;
1439
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
46 import de.intevation.flys.client.shared.model.Settings;
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
47 import de.intevation.flys.client.shared.model.Property;
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
48 import de.intevation.flys.client.shared.model.PropertyGroup;
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
49 import de.intevation.flys.client.shared.model.PropertySetting;
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
50 import de.intevation.flys.client.shared.model.StringProperty;
1464
c899a7ffdc8f Extract and parse the output settings from describe document and add settings
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1449
diff changeset
51 import de.intevation.flys.client.shared.model.DoubleProperty;
c899a7ffdc8f Extract and parse the output settings from describe document and add settings
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1449
diff changeset
52 import de.intevation.flys.client.shared.model.IntegerProperty;
c899a7ffdc8f Extract and parse the output settings from describe document and add settings
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1449
diff changeset
53 import de.intevation.flys.client.shared.model.BooleanProperty;
1439
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
54 import de.intevation.flys.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
55
1439
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
56 //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
57
26e38b79658d Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
58 /**
26e38b79658d Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
59 * @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
60 */
26e38b79658d Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
61 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
62
1367
ab8eb2f544f2 Replaced stdout and stderr logging with log4j loggers in server classes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1342
diff changeset
63 private static final Logger logger =
ab8eb2f544f2 Replaced stdout and stderr logging with log4j loggers in server classes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1342
diff changeset
64 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
65
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
66 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
67
1332
ab2b1a4a9ead Donate own error for failcase of remove-artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1320
diff changeset
68 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
69
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
70 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
71
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
72 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
73 "/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
74
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes 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
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
76 public static Document createAttribute(Collection collection) {
1367
ab8eb2f544f2 Replaced stdout and stderr logging with log4j loggers in server classes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1342
diff changeset
77 logger.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
78
26e38b79658d Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
79 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
80
26e38b79658d Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
81 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
82 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
83 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
84 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
85
26e38b79658d Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
86 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
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 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
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 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
91
26e38b79658d Connected the 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 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
93 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
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 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
96 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
97 }
26e38b79658d Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
98
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
99 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
100 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
101 }
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
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 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
104 }
26e38b79658d Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
105
26e38b79658d Connected the 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 /**
26e38b79658d Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
108 * 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
109 *
26e38b79658d Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
110 * @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
111 * @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
112 * @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
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 * @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
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 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
117 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
118 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
119 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
120 {
1367
ab8eb2f544f2 Replaced stdout and stderr logging with log4j loggers in server classes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1342
diff changeset
121 logger.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
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 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
124 ? 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
125 : 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
126
26e38b79658d Connected the 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 if (modes == null || modes.size() == 0) {
1367
ab8eb2f544f2 Replaced stdout and stderr logging with log4j loggers in server classes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1342
diff changeset
128 logger.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
129 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
130 }
26e38b79658d Connected the 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 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
133
26e38b79658d Connected the 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 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
135 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
136
26e38b79658d Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
137 if (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
138 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
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
26e38b79658d Connected the 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 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
143 }
26e38b79658d Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
144
26e38b79658d Connected the 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 /**
26e38b79658d Connected the 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 * 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
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 * @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
150 * @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
151 * @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
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 * @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
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 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
156 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
157 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
158 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
159 {
1367
ab8eb2f544f2 Replaced stdout and stderr logging with log4j loggers in server classes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1342
diff changeset
160 logger.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
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 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
163 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
164
26e38b79658d Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
165 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
166 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
167
26e38b79658d Connected the 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 if (themes == null || themes.size() == 0) {
1367
ab8eb2f544f2 Replaced stdout and stderr logging with log4j loggers in server classes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1342
diff changeset
169 logger.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
170 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
171 }
26e38b79658d Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
172
26e38b79658d Connected the 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 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
174 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
175
26e38b79658d Connected the 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 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
177 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
178 }
26e38b79658d Connected the 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 }
26e38b79658d Connected the 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
1478
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
181 Document doc = out.getOwnerDocument();
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
182
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
183 ElementCreator settingscr = new ElementCreator(doc, "", "");
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
184
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
185 Settings settings = collection.getSettings(mode.getName());
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
186 if (settings == null ||
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
187 settings.getCategories().size() == 0)
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
188 {
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
189 logger.debug("No settings for output mode: " + mode.getName());
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
190 return null;
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 Element s = createSettingsElement(settingscr, collection, settings);
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
193 if (s != null) {
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
194 out.appendChild(s);
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
195 }
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
196 logger.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
197 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
198 }
26e38b79658d Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
199
26e38b79658d Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
200
26e38b79658d Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
201 /**
26e38b79658d Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
202 * 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
203 *
26e38b79658d Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
204 * @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
205 * @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
206 * @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
207 *
26e38b79658d Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
208 * @return 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
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 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
211 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
212 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
213 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
214 {
26e38b79658d Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
215 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
216 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
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
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
219 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
220
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
221 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
222 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
223 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
224
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
225 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
226 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
227 }
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
228 }
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 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
230 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
231 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
232 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
233 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
234 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
235 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
236 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
237 }
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
238
26e38b79658d Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
239 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
240 }
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
241
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
242
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
243 /**
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
244 * 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
245 *
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
246 * @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
247 * @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
248 *
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
249 * @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
250 */
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 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
252 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
253 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
254 {
1367
ab8eb2f544f2 Replaced stdout and stderr logging with log4j loggers in server classes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1342
diff changeset
255 logger.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
256
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 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
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 if (rs == null || rs.size() == 0) {
1367
ab8eb2f544f2 Replaced stdout and stderr logging with log4j loggers in server classes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1342
diff changeset
260 logger.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
261 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
262 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
263 }
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
e9337488bac3 The Collection now knows its already loaded recommendations - the CollectionView will not load recommendations that have already been loaded before.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 804
diff changeset
265 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
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 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
268 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
269
e9337488bac3 The Collection now knows its already loaded recommendations - the CollectionView will not load recommendations that have already been loaded before.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 804
diff changeset
270 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
271 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
272 }
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 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
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
e9337488bac3 The Collection now knows its already loaded recommendations - the CollectionView will not load recommendations that have already been loaded before.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 804
diff changeset
278
e9337488bac3 The Collection now knows its already loaded recommendations - the CollectionView will not load recommendations that have already been loaded before.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 804
diff changeset
279 /**
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 * 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
281 *
e9337488bac3 The Collection now knows its already loaded recommendations - the CollectionView will not load recommendations that have already been loaded before.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 804
diff changeset
282 * @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
283 * @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
284 * @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
285 *
e9337488bac3 The Collection now knows its already loaded recommendations - the CollectionView will not load recommendations that have already been loaded before.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 804
diff changeset
286 * @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
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 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
289 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
290 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
291 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
292 {
1367
ab8eb2f544f2 Replaced stdout and stderr logging with log4j loggers in server classes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1342
diff changeset
293 logger.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
294
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 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
296 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
297 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
298
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 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
300 }
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
301
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
302
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
303 /**
1478
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
304 *
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
305 */
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
306 protected static Element createSettingsElement(
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
307 ElementCreator cr,
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
308 Collection c,
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
309 Settings s)
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
310 {
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
311 logger.debug("CollectionHelper.createSettingsElement");
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
312 Element settings = cr.create("settings");
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
313
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
314 List<String> categories = s.getCategories();
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 for (String category: categories) {
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
317 Element cat =cr.create(category);
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
318 settings.appendChild(cat);
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
319 List<Property> props = s.getSettings(category);
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
320 for (Property p: props) {
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
321 if (p instanceof PropertyGroup) {
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
322 Element prop = createPropertyGroupElement(cr,
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
323 (PropertyGroup)p);
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
324 cat.appendChild(prop);
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 else if (p instanceof PropertySetting) {
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
327 Element prop = createPropertyElement (cr,
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
328 (PropertySetting)p);
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
329 cat.appendChild(prop);
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
330 }
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
331 }
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
332 }
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
333 return settings;
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
334 }
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
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
337 /**
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
338 *
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
339 */
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
340 protected static Element createPropertyGroupElement(
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
341 ElementCreator cr,
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
342 PropertyGroup pg)
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
343 {
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
344 Element e = cr.create(pg.getName());
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 List<Property> list = pg.getProperties();
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
347 for (Property p: list) {
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
348 Element pe = createPropertyElement(cr, (PropertySetting)p);
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
349 e.appendChild(pe);
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
350 }
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
351 return e;
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
352 }
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
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 *
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
357 */
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
358 protected static Element createPropertyElement(
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
359 ElementCreator cr,
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
360 PropertySetting p)
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
361 {
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
362 Element e = cr.create(p.getName());
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 if(p instanceof BooleanProperty) {
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
365 cr.addAttr(e, "type", "boolean", false);
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 else if(p instanceof DoubleProperty) {
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
368 cr.addAttr(e, "type", "double", false);
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
369 }
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
370 else if(p instanceof IntegerProperty) {
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
371 cr.addAttr(e, "type", "integer", false);
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
372 }
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
373 else if(p instanceof StringProperty) {
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
374 cr.addAttr(e, "type", "string", false);
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
375 }
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
376
1507
c21d14e48040 Improved validation and property handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1478
diff changeset
377 e.setTextContent(p.getValue().toString());
1478
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
378 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
379 return e;
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
380 }
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
381
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
382
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1464
diff changeset
383 /**
1318
ecd0243bc09e Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 905
diff changeset
384 * 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
385 * 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
386 * 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
387 *
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
388 * @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
389 * 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
390 *
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
391 * @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
392 */
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
393 public static Collection parseCollection(Document description) {
1367
ab8eb2f544f2 Replaced stdout and stderr logging with log4j loggers in server classes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1342
diff changeset
394 logger.debug("AddArtifactServiceImpl.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
395
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes 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 if (description == null) {
1367
ab8eb2f544f2 Replaced stdout and stderr logging with log4j loggers in server classes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1342
diff changeset
397 logger.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
398 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
399 }
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
400
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes 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 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
402 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
403 "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
404 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
405
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
406 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
407 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
408 "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
409 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
410
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
411 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
412 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
413 "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
414 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
415
1318
ecd0243bc09e Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 905
diff changeset
416 if (uuid.length() == 0) {
1367
ab8eb2f544f2 Replaced stdout and stderr logging with log4j loggers in server classes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1342
diff changeset
417 logger.warn("Found an invalid (zero length uuid) Collection!");
1318
ecd0243bc09e Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 905
diff changeset
418 return null;
ecd0243bc09e Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 905
diff changeset
419 }
ecd0243bc09e Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 905
diff changeset
420
ecd0243bc09e Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 905
diff changeset
421 if (ttlStr.length() == 0) {
1367
ab8eb2f544f2 Replaced stdout and stderr logging with log4j loggers in server classes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1342
diff changeset
422 logger.warn("Found an invalid Collectioni (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
423 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
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
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
426
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
427 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
428 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
429 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
430 }
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
431 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
432 // 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
433 }
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
434
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
435 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
436 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
437 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
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 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
440
1435
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
441 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
442
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
443 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
444 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
445 "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
446 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
447 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
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 if (items == null || items.getLength() == 0) {
1367
ab8eb2f544f2 Replaced stdout and stderr logging with log4j loggers in server classes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1342
diff changeset
450 logger.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
451
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes 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 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
453 }
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
454
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
455 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
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 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
458 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
459 (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
460 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
461
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes 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 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
463 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
464 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
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 }
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes 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
1435
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
468 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
469 c.setThemeLists(themeLists);
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
470
1464
c899a7ffdc8f Extract and parse the output settings from describe document and add settings
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1449
diff changeset
471 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
472 c.setSettings(outSettings);
1367
ab8eb2f544f2 Replaced stdout and stderr logging with log4j loggers in server classes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1342
diff changeset
473 logger.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
474 "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
475 "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
476
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes 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 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
478 }
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes 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
1435
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
481 /**
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
482 * @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
483 * (artifact) uuid.
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
484 */
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
485 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
486 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
487 ) {
1367
ab8eb2f544f2 Replaced stdout and stderr logging with log4j loggers in server classes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1342
diff changeset
488 logger.debug("DescribeCollectionServiceImpl.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
489
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes 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 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
491 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
492 "/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
493 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
494 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
495
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
496 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
497
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
498 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
499
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
500 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
501
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
502 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
503 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
504
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes 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 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
506
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
507 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
508 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
509
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
510 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
511 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
512 }
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
513 }
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
514 }
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
515
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes 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 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
517 }
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes 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
1435
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
520 /**
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
521 * @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
522 * (artifact) uuid.
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
523 */
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
524 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
525 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
526 ) {
1367
ab8eb2f544f2 Replaced stdout and stderr logging with log4j loggers in server classes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1342
diff changeset
527 logger.debug("DescribeCollectionServiceImpl.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
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 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
530 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
531 "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
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 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
534
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
535 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
536
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
537 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
538 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
539 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
540
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
541 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
542 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
543 }
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes 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 }
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
545
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
546 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
547 }
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes 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
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes 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 protected static Theme parseTheme(Element ele) {
1367
ab8eb2f544f2 Replaced stdout and stderr logging with log4j loggers in server classes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1342
diff changeset
551 logger.debug("DescribeCollectionServiceImpl.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
552
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
553 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
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 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
556 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
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 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
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 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
561 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
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 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
564 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
565 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
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 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
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
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes 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 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
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
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes 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 /**
1439
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
575 * Parse Settings elements.
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
576 *
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
577 * @param description The collection description.
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
578 *
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
579 * @return Map containing the settings.
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
580 */
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
581 protected static Map<String, Settings> parseSettings(Document description) {
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
582 logger.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
583
c899a7ffdc8f Extract and parse the output settings from describe document and add settings
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1449
diff changeset
584 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
585 description,
c899a7ffdc8f Extract and parse the output settings from describe document and add settings
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1449
diff changeset
586 "/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
587 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
588 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
589
c899a7ffdc8f Extract and parse the output settings from describe document and add settings
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1449
diff changeset
590 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
591
c899a7ffdc8f Extract and parse the output settings from describe document and add settings
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1449
diff changeset
592 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
593
c899a7ffdc8f Extract and parse the output settings from describe document and add settings
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1449
diff changeset
594 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
595
c899a7ffdc8f Extract and parse the output settings from describe document and add settings
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1449
diff changeset
596 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
597 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
598 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
599 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
600 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
601 }
1439
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
602
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
603 return list;
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
604 }
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
605
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
606
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
607 /**
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
608 *
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
609 */
1464
c899a7ffdc8f Extract and parse the output settings from describe document and add settings
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1449
diff changeset
610 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
611 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
612
c899a7ffdc8f Extract and parse the output settings from describe document and add settings
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1449
diff changeset
613 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
614
c899a7ffdc8f Extract and parse the output settings from describe document and add settings
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1449
diff changeset
615 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
616 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
617 }
c899a7ffdc8f Extract and parse the output settings from describe document and add settings
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1449
diff changeset
618
c899a7ffdc8f Extract and parse the output settings from describe document and add settings
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1449
diff changeset
619 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
620
1439
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
621 // get the categories
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
622 NodeList catNodes = settings.getChildNodes();
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
623 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
624 Element catNode = (Element)catNodes.item(i);
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
625
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
626 // The category name
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
627 String category = catNode.getTagName();
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
628
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
629 // 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
630 NodeList list = catNode.getChildNodes();
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
631
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
632 // 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
633 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
634 for (int j = 0; j < list.getLength(); j++) {
1464
c899a7ffdc8f Extract and parse the output settings from describe document and add settings
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1449
diff changeset
635 Property p = new PropertySetting();
1439
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
636 Element e = (Element)list.item(j);
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
637 if (e.hasChildNodes() &&
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
638 e.getFirstChild().getNodeType() != Node.TEXT_NODE) {
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
639 p = parseSettingsGroup(e);
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 else {
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
642 p = parseSetting(e);
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 props.add(p);
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
645 }
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
646 set.setSettings(category, props);
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
647 }
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
648 return set;
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
649 }
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
650
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
651
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
652 /**
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
653 *
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
654 */
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
655 protected static Property parseSettingsGroup(Element group) {
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
656 PropertyGroup p = new PropertyGroup();
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
657 p.setName(group.getTagName());
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 NodeList list = group.getChildNodes();
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
660 ArrayList<Property> props = new ArrayList<Property>();
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
661 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
662 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
663 }
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
664 p.setProperties(props);
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
665 return p;
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 *
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
671 */
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
672 protected static Property parseSetting(Element property){
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
673 NamedNodeMap attrMap = property.getAttributes();
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
674 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
675
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
676 Node type = attrMap.getNamedItem("type");
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
677 String t = type.getNodeValue();
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
678 PropertySetting ps = new PropertySetting();
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
679
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
680 if(t.equals("string")) {
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
681 ps = new StringProperty();
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
682 }
1464
c899a7ffdc8f Extract and parse the output settings from describe document and add settings
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1449
diff changeset
683 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
684 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
685 }
c899a7ffdc8f Extract and parse the output settings from describe document and add settings
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1449
diff changeset
686 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
687 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
688 }
c899a7ffdc8f Extract and parse the output settings from describe document and add settings
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1449
diff changeset
689 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
690 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
691 }
1439
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
692 ps.setName(property.getTagName());
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
693 ps.setValue(property.getTextContent());
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 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
696 Node attr = attrMap.item(i);
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
697
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
698 String name = attr.getNodeName();
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
699 String value = attr.getNodeValue();
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
700 if(name.equals("type")) {
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
701 continue;
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
702 }
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
703 ps.setAttribute(name, value);
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
704 }
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
705 return ps;
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
706 }
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
707
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
708
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
709 /**
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
710 * 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
711 * 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
712 *
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
713 * @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
714 *
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
715 * @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
716 */
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
717 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
718 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
719 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
720 ) {
1367
ab8eb2f544f2 Replaced stdout and stderr logging with log4j loggers in server classes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1342
diff changeset
721 logger.debug("AddArtifactServiceImpl.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
722
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
723 if (node == null) {
1367
ab8eb2f544f2 Replaced stdout and stderr logging with log4j loggers in server classes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1342
diff changeset
724 logger.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
725 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
726 }
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes 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 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
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 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
731 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
732
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
733 if (uuid == null || uuid.length() == 0) {
1367
ab8eb2f544f2 Replaced stdout and stderr logging with log4j loggers in server classes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1342
diff changeset
734 logger.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
735 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
736 }
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes 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 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
739
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes 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 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
741 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
742 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
743
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes 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 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
745 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
746 }
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes 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 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
749
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes 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 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
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
1435
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
753 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
754
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
755 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
756 uri, "data-items");
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
757
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
758 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
759 dataItems = parseDataItems(di);
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
760
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
761 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
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
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
764
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
765 /**
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
766 * 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
767 * 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
768 *
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
769 * @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
770 *
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
771 * @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
772 */
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
773 protected static List<OutputMode> parseOutputModes(Element node) {
1367
ab8eb2f544f2 Replaced stdout and stderr logging with log4j loggers in server classes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1342
diff changeset
774 logger.debug("AddArtifactServiceImpl.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
775
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
776 if (node == null) {
1367
ab8eb2f544f2 Replaced stdout and stderr logging with log4j loggers in server classes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1342
diff changeset
777 logger.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
778 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
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 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
782
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
783 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
784
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes 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 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
786
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
787 if (size == 0) {
1367
ab8eb2f544f2 Replaced stdout and stderr logging with log4j loggers in server classes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1342
diff changeset
788 logger.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
789 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
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
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
792 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
793
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
794 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
795 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
796
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes 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 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
798 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
799 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
800 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
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 (name.length() == 0) {
1367
ab8eb2f544f2 Replaced stdout and stderr logging with log4j loggers in server classes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1342
diff changeset
803 logger.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
804 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
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 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
808 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
809
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
810 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
811 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
812 }
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes 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 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
814 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
815 }
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes 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 else if (type.equals("chart")){
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes 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 outmode = new ChartMode(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
818 }
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes 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 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
820 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
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 else {
1367
ab8eb2f544f2 Replaced stdout and stderr logging with log4j loggers in server classes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1342
diff changeset
823 logger.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
824 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
825 }
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes 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
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes 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 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
828 }
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes 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
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes 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 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
831 }
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
832
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes 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
1435
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
834 /**
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
835 * 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
836 */
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
837 protected static HashMap<String, String> parseDataItems(Element node) {
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
838 logger.debug("AddArtifactServiceImpl.parseDataItems");
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
839
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
840 if (node == null) {
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
841 logger.debug("The node for parsing DataItems is null!");
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
842 return null;
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
843 }
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
844
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
845 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
846
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
847 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
848
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
849 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
850
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
851 if (size == 0) {
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
852 logger.debug("No static data-item nodes found!");
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
853 }
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 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
856
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
857 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
858 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
859
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
860 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
861
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
862 if (key.length() == 0) {
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
863 logger.warn("Found an invalid data item mode.");
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
864 continue;
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
865 }
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
866
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
867 // 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
868 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
869
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
870 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
871 String value = item.getAttributeNS(uri, "value");
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
872 logger.debug("Found a data item " + key + " : " + value);
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
873
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
874 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
875 }
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
876
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 // Dynamic data.
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
879 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
880
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
881 size = list.getLength();
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
882
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
883 if (size == 0) {
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
884 logger.debug("No dynamic data-item nodes found!");
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
885 }
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
886
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
887 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
888 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
889
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
890 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
891
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
892 if (key.length() == 0) {
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
893 logger.warn("Found an invalid data item node (missing key).");
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
894 continue;
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
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
897 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
898
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
899 if (value.length() == 0) {
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
900 logger.warn("Found an invalid data item node (missing value).");
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
901 continue;
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
902 }
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 logger.debug("Found a (dyn) data item " + key + " : " + value);
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
905
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
906 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
907 }
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
908
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
909 return data;
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
910 }
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1367
diff changeset
911
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
912 protected static List<Facet> extractFacets(Element outmode) {
1367
ab8eb2f544f2 Replaced stdout and stderr logging with log4j loggers in server classes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1342
diff changeset
913 logger.debug("DescribeCollectionServiceImpl - 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
914
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
915 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
916 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
917 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
918 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
919 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
920
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
921 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
922
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
923 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
924
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
925 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
926
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
927 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
928 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
929
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes 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 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
931 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
932 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
933
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes 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 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
935 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
936 }
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes 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 }
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes 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 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
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
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes 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 public static List<Recommendation> parseRecommendations(Document doc) {
1367
ab8eb2f544f2 Replaced stdout and stderr logging with log4j loggers in server classes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1342
diff changeset
944 logger.debug("DescribeCollectionServiceImpl.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
945
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
946 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
947 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
948 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
949 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
950 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
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 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
953
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes 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 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
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 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
957
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
958 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
959 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
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 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
962 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
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 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
965 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
966 }
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
967 }
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes 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
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes 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 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
970 }
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes 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
1318
ecd0243bc09e Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 905
diff changeset
973 /**
ecd0243bc09e Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 905
diff changeset
974 * Add an artifact to a collection.
ecd0243bc09e Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 905
diff changeset
975 * @param collection Collection to add artifact to.
ecd0243bc09e Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 905
diff changeset
976 * @param artifact Artifact to add to collection
ecd0243bc09e Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 905
diff changeset
977 */
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
978 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
979 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
980 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
981 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
982 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
983 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
984 {
1367
ab8eb2f544f2 Replaced stdout and stderr logging with log4j loggers in server classes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1342
diff changeset
985 logger.debug("Collection.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
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 if (collection == null) {
1367
ab8eb2f544f2 Replaced stdout and stderr logging with log4j loggers in server classes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1342
diff changeset
988 logger.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
989 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
990 }
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
991
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
992 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
993 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
994
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
995 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
996
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes 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 try {
1367
ab8eb2f544f2 Replaced stdout and stderr logging with log4j loggers in server classes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1342
diff changeset
998 logger.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
999
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes 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 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
1001 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
1002
1367
ab8eb2f544f2 Replaced stdout and stderr logging with log4j loggers in server classes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1342
diff changeset
1003 logger.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
1004 "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
1005
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
1006 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
1007
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
1008 if (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
1009 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
1010 }
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
1011
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
1012 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
1013 }
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes 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 catch (ConnectionException ce) {
1367
ab8eb2f544f2 Replaced stdout and stderr logging with log4j loggers in server classes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1342
diff changeset
1015 logger.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
1016 }
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes 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 catch (Exception e) {
1367
ab8eb2f544f2 Replaced stdout and stderr logging with log4j loggers in server classes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1342
diff changeset
1018 logger.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
1019 }
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
1020
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
1021 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
1022 }
1320
5733c05ce24c Added removeArtifact CollectionHelper method.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1318
diff changeset
1023
5733c05ce24c Added removeArtifact CollectionHelper method.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1318
diff changeset
1024
5733c05ce24c Added removeArtifact CollectionHelper method.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1318
diff changeset
1025 /**
5733c05ce24c Added removeArtifact CollectionHelper method.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1318
diff changeset
1026 * Remove an artifact from a collection.
5733c05ce24c Added removeArtifact CollectionHelper method.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1318
diff changeset
1027 * @param collection Collection to remove artifact to.
5733c05ce24c Added removeArtifact CollectionHelper method.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1318
diff changeset
1028 * @param artifact Artifact to add to collection
5733c05ce24c Added removeArtifact CollectionHelper method.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1318
diff changeset
1029 */
5733c05ce24c Added removeArtifact CollectionHelper method.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1318
diff changeset
1030 public static Collection removeArtifact(
5733c05ce24c Added removeArtifact CollectionHelper method.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1318
diff changeset
1031 Collection collection,
5733c05ce24c Added removeArtifact CollectionHelper method.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1318
diff changeset
1032 String artifactId,
5733c05ce24c Added removeArtifact CollectionHelper method.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1318
diff changeset
1033 String url,
5733c05ce24c Added removeArtifact CollectionHelper method.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1318
diff changeset
1034 String locale)
5733c05ce24c Added removeArtifact CollectionHelper method.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1318
diff changeset
1035 throws ServerException
5733c05ce24c Added removeArtifact CollectionHelper method.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1318
diff changeset
1036 {
1367
ab8eb2f544f2 Replaced stdout and stderr logging with log4j loggers in server classes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1342
diff changeset
1037 logger.debug("Collection.removeArtifact");
1320
5733c05ce24c Added removeArtifact CollectionHelper method.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1318
diff changeset
1038
5733c05ce24c Added removeArtifact CollectionHelper method.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1318
diff changeset
1039 if (collection == null) {
1367
ab8eb2f544f2 Replaced stdout and stderr logging with log4j loggers in server classes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1342
diff changeset
1040 logger.warn("The given Collection is null!");
1320
5733c05ce24c Added removeArtifact CollectionHelper method.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1318
diff changeset
1041 return null;
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 Document remove = ClientProtocolUtils.newRemoveArtifactDocument(
5733c05ce24c Added removeArtifact CollectionHelper method.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1318
diff changeset
1045 artifactId);
5733c05ce24c Added removeArtifact CollectionHelper method.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1318
diff changeset
1046
5733c05ce24c Added removeArtifact CollectionHelper method.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1318
diff changeset
1047 HttpClient client = new HttpClientImpl(url, locale);
5733c05ce24c Added removeArtifact CollectionHelper method.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1318
diff changeset
1048
5733c05ce24c Added removeArtifact CollectionHelper method.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1318
diff changeset
1049 try {
1367
ab8eb2f544f2 Replaced stdout and stderr logging with log4j loggers in server classes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1342
diff changeset
1050 logger.debug("Do HTTP request now.");
1320
5733c05ce24c Added removeArtifact CollectionHelper method.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1318
diff changeset
1051
5733c05ce24c Added removeArtifact CollectionHelper method.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1318
diff changeset
1052 Document response = (Document) client.doCollectionAction(
5733c05ce24c Added removeArtifact CollectionHelper method.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1318
diff changeset
1053 remove, collection.identifier(), new DocumentResponseHandler());
5733c05ce24c Added removeArtifact CollectionHelper method.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1318
diff changeset
1054
1367
ab8eb2f544f2 Replaced stdout and stderr logging with log4j loggers in server classes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1342
diff changeset
1055 logger.debug(
1320
5733c05ce24c Added removeArtifact CollectionHelper method.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1318
diff changeset
1056 "Finished HTTP request successfully. Parse Collection now.");
1367
ab8eb2f544f2 Replaced stdout and stderr logging with log4j loggers in server classes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1342
diff changeset
1057 logger.debug(XMLUtils.toString(response));
1320
5733c05ce24c Added removeArtifact CollectionHelper method.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1318
diff changeset
1058
5733c05ce24c Added removeArtifact CollectionHelper method.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1318
diff changeset
1059 Collection c = CollectionHelper.parseCollection(response);
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 if (c == null) {
1332
ab2b1a4a9ead Donate own error for failcase of remove-artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1320
diff changeset
1062 throw new ServerException(ERROR_REMOVE_ARTIFACT);
1320
5733c05ce24c Added removeArtifact CollectionHelper method.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1318
diff changeset
1063 }
5733c05ce24c Added removeArtifact CollectionHelper method.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1318
diff changeset
1064
5733c05ce24c Added removeArtifact CollectionHelper method.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1318
diff changeset
1065 return c;
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 catch (ConnectionException ce) {
1367
ab8eb2f544f2 Replaced stdout and stderr logging with log4j loggers in server classes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1342
diff changeset
1068 logger.error(ce, ce);
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 catch (Exception e) {
1367
ab8eb2f544f2 Replaced stdout and stderr logging with log4j loggers in server classes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1342
diff changeset
1071 logger.error(e, e);
1320
5733c05ce24c Added removeArtifact CollectionHelper method.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1318
diff changeset
1072 }
1332
ab2b1a4a9ead Donate own error for failcase of remove-artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1320
diff changeset
1073 throw new ServerException(ERROR_REMOVE_ARTIFACT);
1320
5733c05ce24c Added removeArtifact CollectionHelper method.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1318
diff changeset
1074 }
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
1075 }
26e38b79658d Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
1076 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org