Mercurial > dive4elements > river
annotate gwt-client/src/main/java/org/dive4elements/river/client/server/ArtifactHelper.java @ 7611:a11985bb743f
BedQualityExporter: Refactoring.
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Thu, 28 Nov 2013 10:13:53 +0100 |
parents | eb4d0950ae87 |
children | 238fc722f87a |
rev | line source |
---|---|
5861
172338b1407f
GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
1 /* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde |
172338b1407f
GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
2 * Software engineering by Intevation GmbH |
172338b1407f
GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
3 * |
5993
ea9eef426962
Removed trailing whitespace.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5861
diff
changeset
|
4 * This file is Free Software under the GNU AGPL (>=v3) |
5861
172338b1407f
GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
5 * and comes with ABSOLUTELY NO WARRANTY! Check out the |
5993
ea9eef426962
Removed trailing whitespace.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5861
diff
changeset
|
6 * documentation coming with Dive4Elements River for details. |
5861
172338b1407f
GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
7 */ |
172338b1407f
GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
8 |
5835
821a02bbfb4e
Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5834
diff
changeset
|
9 package org.dive4elements.river.client.server; |
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:
diff
changeset
|
10 |
478a571f1f94
Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
11 import org.w3c.dom.Document; |
3865
436eec3be6ff
Allow to create a discharge curve from a gauge info
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
1367
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:
diff
changeset
|
13 |
1367
ab8eb2f544f2
Replaced stdout and stderr logging with log4j loggers in server classes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1318
diff
changeset
|
14 import org.apache.log4j.Logger; |
ab8eb2f544f2
Replaced stdout and stderr logging with log4j loggers in server classes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1318
diff
changeset
|
15 |
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:
diff
changeset
|
16 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:
diff
changeset
|
17 import java.util.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:
diff
changeset
|
18 import java.util.Map; |
6450
eb4d0950ae87
GWT client: prevent too many create artifact calls at the same time by limiting them to 5.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6136
diff
changeset
|
19 import java.util.concurrent.Semaphore; |
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:
diff
changeset
|
20 |
5835
821a02bbfb4e
Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5834
diff
changeset
|
21 import org.dive4elements.artifacts.common.utils.ClientProtocolUtils; |
821a02bbfb4e
Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5834
diff
changeset
|
22 import org.dive4elements.artifacts.common.utils.CreationFilter; |
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:
diff
changeset
|
23 |
5835
821a02bbfb4e
Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5834
diff
changeset
|
24 import org.dive4elements.artifacts.httpclient.exceptions.ConnectionException; |
821a02bbfb4e
Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5834
diff
changeset
|
25 import org.dive4elements.artifacts.httpclient.http.HttpClient; |
821a02bbfb4e
Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5834
diff
changeset
|
26 import org.dive4elements.artifacts.httpclient.http.HttpClientImpl; |
821a02bbfb4e
Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5834
diff
changeset
|
27 import org.dive4elements.artifacts.httpclient.utils.ArtifactNamespaceContext; |
821a02bbfb4e
Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5834
diff
changeset
|
28 import org.dive4elements.artifacts.httpclient.utils.XMLUtils; |
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:
diff
changeset
|
29 |
5835
821a02bbfb4e
Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5834
diff
changeset
|
30 import org.dive4elements.river.client.shared.exceptions.ServerException; |
821a02bbfb4e
Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5834
diff
changeset
|
31 import org.dive4elements.river.client.shared.model.Artifact; |
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:
diff
changeset
|
32 |
5835
821a02bbfb4e
Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5834
diff
changeset
|
33 import org.dive4elements.river.client.shared.model.Recommendation; |
905
478a571f1f94
Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
34 |
478a571f1f94
Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
35 /** |
478a571f1f94
Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
36 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> |
478a571f1f94
Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
37 */ |
478a571f1f94
Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
38 public class ArtifactHelper { |
478a571f1f94
Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
39 |
6043 | 40 /** Private logging instance. */ |
1367
ab8eb2f544f2
Replaced stdout and stderr logging with log4j loggers in server classes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1318
diff
changeset
|
41 private static final Logger logger = Logger.getLogger(ArtifactHelper.class); |
ab8eb2f544f2
Replaced stdout and stderr logging with log4j loggers in server classes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1318
diff
changeset
|
42 |
ab8eb2f544f2
Replaced stdout and stderr logging with log4j loggers in server classes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1318
diff
changeset
|
43 |
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:
diff
changeset
|
44 /** The error message key that is thrown if an error occured while 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:
diff
changeset
|
45 * creation.*/ |
478a571f1f94
Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
46 public static final String ERROR_CREATE_ARTIFACT = "error_create_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:
diff
changeset
|
47 |
6043 | 48 /** Name of the factory to generate a GaugeDischargeCurveArtifact. */ |
3865
436eec3be6ff
Allow to create a discharge curve from a gauge info
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
1367
diff
changeset
|
49 private static final String GAUGE_DISCHARGE_CURVE_ARTIFACT = "gaugedischargecurve"; |
6043 | 50 |
51 /** Name of the factory to generate a MainvaluesArtifact. */ | |
52 private static final String MAINVALUE_ARTIFACT_FACTORY = "mainvalue"; | |
53 | |
5503
b660090b417d
Create a new sq relation project on measurement station record click.
Raimund Renkert <rrenkert@intevation.de>
parents:
3865
diff
changeset
|
54 private static final String SQ_RELATION_ARTIFACT = "staticsqrelation"; |
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:
diff
changeset
|
55 |
6450
eb4d0950ae87
GWT client: prevent too many create artifact calls at the same time by limiting them to 5.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6136
diff
changeset
|
56 // To prevent pile up of create artifact calls only permit a limited |
eb4d0950ae87
GWT client: prevent too many create artifact calls at the same time by limiting them to 5.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6136
diff
changeset
|
57 // number of parallel creates. |
eb4d0950ae87
GWT client: prevent too many create artifact calls at the same time by limiting them to 5.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6136
diff
changeset
|
58 public static final int MAX_CREATE = 5; |
eb4d0950ae87
GWT client: prevent too many create artifact calls at the same time by limiting them to 5.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6136
diff
changeset
|
59 |
eb4d0950ae87
GWT client: prevent too many create artifact calls at the same time by limiting them to 5.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6136
diff
changeset
|
60 private static final Semaphore CREATE_SEMAPHORE = new Semaphore(MAX_CREATE); |
eb4d0950ae87
GWT client: prevent too many create artifact calls at the same time by limiting them to 5.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6136
diff
changeset
|
61 |
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:
diff
changeset
|
62 private ArtifactHelper() { |
478a571f1f94
Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
63 } |
478a571f1f94
Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
64 |
478a571f1f94
Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
65 |
1318
ecd0243bc09e
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
905
diff
changeset
|
66 /** |
ecd0243bc09e
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
905
diff
changeset
|
67 * @param factory ArtifactFactory to use. |
ecd0243bc09e
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
905
diff
changeset
|
68 */ |
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:
diff
changeset
|
69 public static Artifact createArtifact( |
478a571f1f94
Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
70 String serverUrl, |
478a571f1f94
Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
71 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:
diff
changeset
|
72 String 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:
diff
changeset
|
73 Recommendation 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:
diff
changeset
|
74 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:
diff
changeset
|
75 { |
1367
ab8eb2f544f2
Replaced stdout and stderr logging with log4j loggers in server classes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1318
diff
changeset
|
76 logger.debug("ArtifactHelper.create"); |
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:
diff
changeset
|
77 |
478a571f1f94
Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
78 String 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:
diff
changeset
|
79 String 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:
diff
changeset
|
80 CreationFilter filter; |
6136
8d9859d776e5
Handle target_out in the Recommendation / Client datacage code.
Andre Heinecke <aheinecke@intevation.de>
parents:
6044
diff
changeset
|
81 String targetOut; |
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:
diff
changeset
|
82 |
478a571f1f94
Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
83 if (recommendation != null) { |
6136
8d9859d776e5
Handle target_out in the Recommendation / Client datacage code.
Andre Heinecke <aheinecke@intevation.de>
parents:
6044
diff
changeset
|
84 uuid = recommendation.getMasterArtifact(); |
8d9859d776e5
Handle target_out in the Recommendation / Client datacage code.
Andre Heinecke <aheinecke@intevation.de>
parents:
6044
diff
changeset
|
85 ids = recommendation.getIDs(); |
8d9859d776e5
Handle target_out in the Recommendation / Client datacage code.
Andre Heinecke <aheinecke@intevation.de>
parents:
6044
diff
changeset
|
86 filter = convertFilter(recommendation.getFilter()); |
8d9859d776e5
Handle target_out in the Recommendation / Client datacage code.
Andre Heinecke <aheinecke@intevation.de>
parents:
6044
diff
changeset
|
87 targetOut = recommendation.getTargetOut(); |
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:
diff
changeset
|
88 } |
478a571f1f94
Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
89 else { |
6136
8d9859d776e5
Handle target_out in the Recommendation / Client datacage code.
Andre Heinecke <aheinecke@intevation.de>
parents:
6044
diff
changeset
|
90 uuid = null; |
8d9859d776e5
Handle target_out in the Recommendation / Client datacage code.
Andre Heinecke <aheinecke@intevation.de>
parents:
6044
diff
changeset
|
91 ids = null; |
8d9859d776e5
Handle target_out in the Recommendation / Client datacage code.
Andre Heinecke <aheinecke@intevation.de>
parents:
6044
diff
changeset
|
92 filter = null; |
8d9859d776e5
Handle target_out in the Recommendation / Client datacage code.
Andre Heinecke <aheinecke@intevation.de>
parents:
6044
diff
changeset
|
93 targetOut = 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:
diff
changeset
|
94 } |
478a571f1f94
Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
95 |
478a571f1f94
Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
96 Document create = ClientProtocolUtils.newCreateDocument( |
6136
8d9859d776e5
Handle target_out in the Recommendation / Client datacage code.
Andre Heinecke <aheinecke@intevation.de>
parents:
6044
diff
changeset
|
97 factory, uuid, ids, filter, targetOut); |
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:
diff
changeset
|
98 |
3865
436eec3be6ff
Allow to create a discharge curve from a gauge info
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
1367
diff
changeset
|
99 return sendCreate(serverUrl, locale, create); |
436eec3be6ff
Allow to create a discharge curve from a gauge info
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
1367
diff
changeset
|
100 } |
436eec3be6ff
Allow to create a discharge curve from a gauge info
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
1367
diff
changeset
|
101 |
436eec3be6ff
Allow to create a discharge curve from a gauge info
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
1367
diff
changeset
|
102 /** |
6044
477d2d18452e
Implement function to spawn a mainvalueartifact, given gauge and river.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6043
diff
changeset
|
103 * Creates a new MainvaluesArtifact. |
477d2d18452e
Implement function to spawn a mainvalueartifact, given gauge and river.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6043
diff
changeset
|
104 * |
477d2d18452e
Implement function to spawn a mainvalueartifact, given gauge and river.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6043
diff
changeset
|
105 * @param river the name of the river |
477d2d18452e
Implement function to spawn a mainvalueartifact, given gauge and river.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6043
diff
changeset
|
106 */ |
477d2d18452e
Implement function to spawn a mainvalueartifact, given gauge and river.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6043
diff
changeset
|
107 public static Artifact createMainvalueArtifact( |
477d2d18452e
Implement function to spawn a mainvalueartifact, given gauge and river.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6043
diff
changeset
|
108 String serverUrl, |
477d2d18452e
Implement function to spawn a mainvalueartifact, given gauge and river.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6043
diff
changeset
|
109 String locale, |
477d2d18452e
Implement function to spawn a mainvalueartifact, given gauge and river.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6043
diff
changeset
|
110 String river, |
477d2d18452e
Implement function to spawn a mainvalueartifact, given gauge and river.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6043
diff
changeset
|
111 Long gaugeRef) |
477d2d18452e
Implement function to spawn a mainvalueartifact, given gauge and river.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6043
diff
changeset
|
112 throws ServerException |
477d2d18452e
Implement function to spawn a mainvalueartifact, given gauge and river.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6043
diff
changeset
|
113 { |
477d2d18452e
Implement function to spawn a mainvalueartifact, given gauge and river.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6043
diff
changeset
|
114 Document create = ClientProtocolUtils.newCreateDocument( |
477d2d18452e
Implement function to spawn a mainvalueartifact, given gauge and river.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6043
diff
changeset
|
115 MAINVALUE_ARTIFACT_FACTORY); |
477d2d18452e
Implement function to spawn a mainvalueartifact, given gauge and river.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6043
diff
changeset
|
116 |
477d2d18452e
Implement function to spawn a mainvalueartifact, given gauge and river.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6043
diff
changeset
|
117 XMLUtils.ElementCreator ec = new XMLUtils.ElementCreator( |
477d2d18452e
Implement function to spawn a mainvalueartifact, given gauge and river.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6043
diff
changeset
|
118 create, |
477d2d18452e
Implement function to spawn a mainvalueartifact, given gauge and river.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6043
diff
changeset
|
119 ArtifactNamespaceContext.NAMESPACE_URI, |
477d2d18452e
Implement function to spawn a mainvalueartifact, given gauge and river.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6043
diff
changeset
|
120 ArtifactNamespaceContext.NAMESPACE_PREFIX); |
477d2d18452e
Implement function to spawn a mainvalueartifact, given gauge and river.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6043
diff
changeset
|
121 |
477d2d18452e
Implement function to spawn a mainvalueartifact, given gauge and river.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6043
diff
changeset
|
122 Element root = create.getDocumentElement(); |
477d2d18452e
Implement function to spawn a mainvalueartifact, given gauge and river.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6043
diff
changeset
|
123 |
477d2d18452e
Implement function to spawn a mainvalueartifact, given gauge and river.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6043
diff
changeset
|
124 Element eriver = ec.create("river"); |
477d2d18452e
Implement function to spawn a mainvalueartifact, given gauge and river.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6043
diff
changeset
|
125 ec.addAttr(eriver, "name", river); |
477d2d18452e
Implement function to spawn a mainvalueartifact, given gauge and river.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6043
diff
changeset
|
126 |
477d2d18452e
Implement function to spawn a mainvalueartifact, given gauge and river.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6043
diff
changeset
|
127 Element egauge = ec.create("gauge"); |
477d2d18452e
Implement function to spawn a mainvalueartifact, given gauge and river.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6043
diff
changeset
|
128 ec.addAttr(egauge, "reference", gaugeRef.toString()); |
477d2d18452e
Implement function to spawn a mainvalueartifact, given gauge and river.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6043
diff
changeset
|
129 |
477d2d18452e
Implement function to spawn a mainvalueartifact, given gauge and river.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6043
diff
changeset
|
130 root.appendChild(eriver); |
477d2d18452e
Implement function to spawn a mainvalueartifact, given gauge and river.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6043
diff
changeset
|
131 root.appendChild(egauge); |
477d2d18452e
Implement function to spawn a mainvalueartifact, given gauge and river.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6043
diff
changeset
|
132 |
477d2d18452e
Implement function to spawn a mainvalueartifact, given gauge and river.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6043
diff
changeset
|
133 return sendCreate(serverUrl, locale, create); |
477d2d18452e
Implement function to spawn a mainvalueartifact, given gauge and river.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6043
diff
changeset
|
134 } |
477d2d18452e
Implement function to spawn a mainvalueartifact, given gauge and river.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6043
diff
changeset
|
135 /** |
3865
436eec3be6ff
Allow to create a discharge curve from a gauge info
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
1367
diff
changeset
|
136 * Creates a new GaugeDischargeCurverArtifact |
436eec3be6ff
Allow to create a discharge curve from a gauge info
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
1367
diff
changeset
|
137 * |
436eec3be6ff
Allow to create a discharge curve from a gauge info
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
1367
diff
changeset
|
138 * @param river the name of the river |
436eec3be6ff
Allow to create a discharge curve from a gauge info
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
1367
diff
changeset
|
139 * @param reference the reference id of the gauge (official number) |
436eec3be6ff
Allow to create a discharge curve from a gauge info
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
1367
diff
changeset
|
140 */ |
436eec3be6ff
Allow to create a discharge curve from a gauge info
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
1367
diff
changeset
|
141 public static Artifact createGaugeDischargeCurveArtifact( |
436eec3be6ff
Allow to create a discharge curve from a gauge info
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
1367
diff
changeset
|
142 String serverUrl, |
436eec3be6ff
Allow to create a discharge curve from a gauge info
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
1367
diff
changeset
|
143 String locale, |
436eec3be6ff
Allow to create a discharge curve from a gauge info
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
1367
diff
changeset
|
144 String river, |
436eec3be6ff
Allow to create a discharge curve from a gauge info
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
1367
diff
changeset
|
145 Long reference) |
436eec3be6ff
Allow to create a discharge curve from a gauge info
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
1367
diff
changeset
|
146 throws ServerException |
436eec3be6ff
Allow to create a discharge curve from a gauge info
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
1367
diff
changeset
|
147 { |
436eec3be6ff
Allow to create a discharge curve from a gauge info
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
1367
diff
changeset
|
148 Document create = ClientProtocolUtils.newCreateDocument( |
436eec3be6ff
Allow to create a discharge curve from a gauge info
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
1367
diff
changeset
|
149 GAUGE_DISCHARGE_CURVE_ARTIFACT); |
436eec3be6ff
Allow to create a discharge curve from a gauge info
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
1367
diff
changeset
|
150 |
436eec3be6ff
Allow to create a discharge curve from a gauge info
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
1367
diff
changeset
|
151 XMLUtils.ElementCreator ec = new XMLUtils.ElementCreator( |
436eec3be6ff
Allow to create a discharge curve from a gauge info
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
1367
diff
changeset
|
152 create, |
436eec3be6ff
Allow to create a discharge curve from a gauge info
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
1367
diff
changeset
|
153 ArtifactNamespaceContext.NAMESPACE_URI, |
436eec3be6ff
Allow to create a discharge curve from a gauge info
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
1367
diff
changeset
|
154 ArtifactNamespaceContext.NAMESPACE_PREFIX); |
436eec3be6ff
Allow to create a discharge curve from a gauge info
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
1367
diff
changeset
|
155 |
436eec3be6ff
Allow to create a discharge curve from a gauge info
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
1367
diff
changeset
|
156 Element root = create.getDocumentElement(); |
436eec3be6ff
Allow to create a discharge curve from a gauge info
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
1367
diff
changeset
|
157 |
436eec3be6ff
Allow to create a discharge curve from a gauge info
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
1367
diff
changeset
|
158 Element eriver = ec.create("river"); |
436eec3be6ff
Allow to create a discharge curve from a gauge info
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
1367
diff
changeset
|
159 ec.addAttr(eriver, "name", river); |
436eec3be6ff
Allow to create a discharge curve from a gauge info
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
1367
diff
changeset
|
160 |
436eec3be6ff
Allow to create a discharge curve from a gauge info
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
1367
diff
changeset
|
161 Element egauge = ec.create("gauge"); |
436eec3be6ff
Allow to create a discharge curve from a gauge info
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
1367
diff
changeset
|
162 ec.addAttr(egauge, "reference", reference.toString()); |
436eec3be6ff
Allow to create a discharge curve from a gauge info
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
1367
diff
changeset
|
163 |
436eec3be6ff
Allow to create a discharge curve from a gauge info
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
1367
diff
changeset
|
164 root.appendChild(eriver); |
436eec3be6ff
Allow to create a discharge curve from a gauge info
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
1367
diff
changeset
|
165 root.appendChild(egauge); |
436eec3be6ff
Allow to create a discharge curve from a gauge info
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
1367
diff
changeset
|
166 |
436eec3be6ff
Allow to create a discharge curve from a gauge info
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
1367
diff
changeset
|
167 return sendCreate(serverUrl, locale, create); |
436eec3be6ff
Allow to create a discharge curve from a gauge info
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
1367
diff
changeset
|
168 } |
436eec3be6ff
Allow to create a discharge curve from a gauge info
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
1367
diff
changeset
|
169 |
436eec3be6ff
Allow to create a discharge curve from a gauge info
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
1367
diff
changeset
|
170 /** |
6043 | 171 * Sends a create document to the artifact server. |
3865
436eec3be6ff
Allow to create a discharge curve from a gauge info
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
1367
diff
changeset
|
172 */ |
436eec3be6ff
Allow to create a discharge curve from a gauge info
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
1367
diff
changeset
|
173 private static Artifact sendCreate( |
436eec3be6ff
Allow to create a discharge curve from a gauge info
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
1367
diff
changeset
|
174 String serverUrl, |
436eec3be6ff
Allow to create a discharge curve from a gauge info
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
1367
diff
changeset
|
175 String locale, |
436eec3be6ff
Allow to create a discharge curve from a gauge info
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
1367
diff
changeset
|
176 Document doc) |
436eec3be6ff
Allow to create a discharge curve from a gauge info
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
1367
diff
changeset
|
177 throws ServerException |
436eec3be6ff
Allow to create a discharge curve from a gauge info
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
1367
diff
changeset
|
178 { |
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:
diff
changeset
|
179 try { |
6450
eb4d0950ae87
GWT client: prevent too many create artifact calls at the same time by limiting them to 5.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6136
diff
changeset
|
180 CREATE_SEMAPHORE.acquire(); |
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:
diff
changeset
|
181 } |
6450
eb4d0950ae87
GWT client: prevent too many create artifact calls at the same time by limiting them to 5.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6136
diff
changeset
|
182 catch (InterruptedException ie) { |
eb4d0950ae87
GWT client: prevent too many create artifact calls at the same time by limiting them to 5.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6136
diff
changeset
|
183 throw new ServerException(ERROR_CREATE_ARTIFACT); |
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:
diff
changeset
|
184 } |
6450
eb4d0950ae87
GWT client: prevent too many create artifact calls at the same time by limiting them to 5.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6136
diff
changeset
|
185 try { |
eb4d0950ae87
GWT client: prevent too many create artifact calls at the same time by limiting them to 5.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6136
diff
changeset
|
186 HttpClient client = new HttpClientImpl(serverUrl, locale); |
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:
diff
changeset
|
187 |
6450
eb4d0950ae87
GWT client: prevent too many create artifact calls at the same time by limiting them to 5.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6136
diff
changeset
|
188 try { |
eb4d0950ae87
GWT client: prevent too many create artifact calls at the same time by limiting them to 5.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6136
diff
changeset
|
189 return (Artifact) client.create(doc, new FLYSArtifactCreator()); |
eb4d0950ae87
GWT client: prevent too many create artifact calls at the same time by limiting them to 5.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6136
diff
changeset
|
190 } |
eb4d0950ae87
GWT client: prevent too many create artifact calls at the same time by limiting them to 5.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6136
diff
changeset
|
191 catch (ConnectionException ce) { |
eb4d0950ae87
GWT client: prevent too many create artifact calls at the same time by limiting them to 5.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6136
diff
changeset
|
192 logger.error(ce, ce); |
eb4d0950ae87
GWT client: prevent too many create artifact calls at the same time by limiting them to 5.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6136
diff
changeset
|
193 } |
eb4d0950ae87
GWT client: prevent too many create artifact calls at the same time by limiting them to 5.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6136
diff
changeset
|
194 |
eb4d0950ae87
GWT client: prevent too many create artifact calls at the same time by limiting them to 5.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6136
diff
changeset
|
195 throw new ServerException(ERROR_CREATE_ARTIFACT); |
eb4d0950ae87
GWT client: prevent too many create artifact calls at the same time by limiting them to 5.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6136
diff
changeset
|
196 } |
eb4d0950ae87
GWT client: prevent too many create artifact calls at the same time by limiting them to 5.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6136
diff
changeset
|
197 finally { |
eb4d0950ae87
GWT client: prevent too many create artifact calls at the same time by limiting them to 5.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6136
diff
changeset
|
198 CREATE_SEMAPHORE.release(); |
eb4d0950ae87
GWT client: prevent too many create artifact calls at the same time by limiting them to 5.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6136
diff
changeset
|
199 } |
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:
diff
changeset
|
200 } |
478a571f1f94
Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
201 |
478a571f1f94
Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
202 |
1318
ecd0243bc09e
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
905
diff
changeset
|
203 /** |
ecd0243bc09e
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
905
diff
changeset
|
204 * Create CreationFilter from Recommendation.Filter. |
ecd0243bc09e
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
905
diff
changeset
|
205 */ |
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:
diff
changeset
|
206 public static CreationFilter convertFilter(Recommendation.Filter filter) { |
478a571f1f94
Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
207 |
478a571f1f94
Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
208 if (filter == 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:
diff
changeset
|
209 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:
diff
changeset
|
210 } |
478a571f1f94
Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
211 |
478a571f1f94
Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
212 CreationFilter cf = new CreationFilter(); |
478a571f1f94
Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
213 |
478a571f1f94
Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
214 Map<String, List<Recommendation.Facet>> outs = filter.getOuts(); |
478a571f1f94
Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
215 |
478a571f1f94
Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
216 for (Map.Entry<String, List<Recommendation.Facet>> entry: |
478a571f1f94
Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
217 outs.entrySet()) { |
478a571f1f94
Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
218 List<Recommendation.Facet> rfs = entry.getValue(); |
478a571f1f94
Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
219 List<CreationFilter.Facet> cfs = |
478a571f1f94
Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
220 new ArrayList<CreationFilter.Facet>(rfs.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:
diff
changeset
|
221 for (Recommendation.Facet rf: rfs) { |
478a571f1f94
Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
222 cfs.add(new CreationFilter.Facet(rf.getName(), rf.getIndex())); |
478a571f1f94
Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
223 } |
478a571f1f94
Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
224 cf.add(entry.getKey(), cfs); |
478a571f1f94
Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
225 } |
478a571f1f94
Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
226 |
478a571f1f94
Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
227 return cf; |
478a571f1f94
Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
228 } |
5503
b660090b417d
Create a new sq relation project on measurement station record click.
Raimund Renkert <rrenkert@intevation.de>
parents:
3865
diff
changeset
|
229 |
b660090b417d
Create a new sq relation project on measurement station record click.
Raimund Renkert <rrenkert@intevation.de>
parents:
3865
diff
changeset
|
230 |
b660090b417d
Create a new sq relation project on measurement station record click.
Raimund Renkert <rrenkert@intevation.de>
parents:
3865
diff
changeset
|
231 public static Artifact createSQRelationArtifact( |
b660090b417d
Create a new sq relation project on measurement station record click.
Raimund Renkert <rrenkert@intevation.de>
parents:
3865
diff
changeset
|
232 String serverUrl, |
b660090b417d
Create a new sq relation project on measurement station record click.
Raimund Renkert <rrenkert@intevation.de>
parents:
3865
diff
changeset
|
233 String locale, |
b660090b417d
Create a new sq relation project on measurement station record click.
Raimund Renkert <rrenkert@intevation.de>
parents:
3865
diff
changeset
|
234 String river, |
b660090b417d
Create a new sq relation project on measurement station record click.
Raimund Renkert <rrenkert@intevation.de>
parents:
3865
diff
changeset
|
235 int measurementStation) |
b660090b417d
Create a new sq relation project on measurement station record click.
Raimund Renkert <rrenkert@intevation.de>
parents:
3865
diff
changeset
|
236 throws ServerException |
b660090b417d
Create a new sq relation project on measurement station record click.
Raimund Renkert <rrenkert@intevation.de>
parents:
3865
diff
changeset
|
237 { |
b660090b417d
Create a new sq relation project on measurement station record click.
Raimund Renkert <rrenkert@intevation.de>
parents:
3865
diff
changeset
|
238 Document create = ClientProtocolUtils.newCreateDocument( |
b660090b417d
Create a new sq relation project on measurement station record click.
Raimund Renkert <rrenkert@intevation.de>
parents:
3865
diff
changeset
|
239 SQ_RELATION_ARTIFACT); |
b660090b417d
Create a new sq relation project on measurement station record click.
Raimund Renkert <rrenkert@intevation.de>
parents:
3865
diff
changeset
|
240 |
b660090b417d
Create a new sq relation project on measurement station record click.
Raimund Renkert <rrenkert@intevation.de>
parents:
3865
diff
changeset
|
241 XMLUtils.ElementCreator ec = new XMLUtils.ElementCreator( |
b660090b417d
Create a new sq relation project on measurement station record click.
Raimund Renkert <rrenkert@intevation.de>
parents:
3865
diff
changeset
|
242 create, |
b660090b417d
Create a new sq relation project on measurement station record click.
Raimund Renkert <rrenkert@intevation.de>
parents:
3865
diff
changeset
|
243 ArtifactNamespaceContext.NAMESPACE_URI, |
b660090b417d
Create a new sq relation project on measurement station record click.
Raimund Renkert <rrenkert@intevation.de>
parents:
3865
diff
changeset
|
244 ArtifactNamespaceContext.NAMESPACE_PREFIX); |
b660090b417d
Create a new sq relation project on measurement station record click.
Raimund Renkert <rrenkert@intevation.de>
parents:
3865
diff
changeset
|
245 |
b660090b417d
Create a new sq relation project on measurement station record click.
Raimund Renkert <rrenkert@intevation.de>
parents:
3865
diff
changeset
|
246 Element root = create.getDocumentElement(); |
b660090b417d
Create a new sq relation project on measurement station record click.
Raimund Renkert <rrenkert@intevation.de>
parents:
3865
diff
changeset
|
247 |
b660090b417d
Create a new sq relation project on measurement station record click.
Raimund Renkert <rrenkert@intevation.de>
parents:
3865
diff
changeset
|
248 Element eriver = ec.create("river"); |
b660090b417d
Create a new sq relation project on measurement station record click.
Raimund Renkert <rrenkert@intevation.de>
parents:
3865
diff
changeset
|
249 ec.addAttr(eriver, "name", river); |
b660090b417d
Create a new sq relation project on measurement station record click.
Raimund Renkert <rrenkert@intevation.de>
parents:
3865
diff
changeset
|
250 |
b660090b417d
Create a new sq relation project on measurement station record click.
Raimund Renkert <rrenkert@intevation.de>
parents:
3865
diff
changeset
|
251 Element estation = ec.create("measurement_station"); |
b660090b417d
Create a new sq relation project on measurement station record click.
Raimund Renkert <rrenkert@intevation.de>
parents:
3865
diff
changeset
|
252 ec.addAttr(estation, "number", String.valueOf(measurementStation)); |
b660090b417d
Create a new sq relation project on measurement station record click.
Raimund Renkert <rrenkert@intevation.de>
parents:
3865
diff
changeset
|
253 |
b660090b417d
Create a new sq relation project on measurement station record click.
Raimund Renkert <rrenkert@intevation.de>
parents:
3865
diff
changeset
|
254 root.appendChild(eriver); |
b660090b417d
Create a new sq relation project on measurement station record click.
Raimund Renkert <rrenkert@intevation.de>
parents:
3865
diff
changeset
|
255 root.appendChild(estation); |
b660090b417d
Create a new sq relation project on measurement station record click.
Raimund Renkert <rrenkert@intevation.de>
parents:
3865
diff
changeset
|
256 |
b660090b417d
Create a new sq relation project on measurement station record click.
Raimund Renkert <rrenkert@intevation.de>
parents:
3865
diff
changeset
|
257 return sendCreate(serverUrl, locale, create); |
b660090b417d
Create a new sq relation project on measurement station record click.
Raimund Renkert <rrenkert@intevation.de>
parents:
3865
diff
changeset
|
258 } |
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:
diff
changeset
|
259 } |
478a571f1f94
Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
260 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |