Mercurial > dive4elements > river
annotate flys-client/src/main/java/de/intevation/flys/client/server/ArtifactServiceImpl.java @ 5099:f9e2e1c84263
flys/issue1150: Renamed w/q in w/q-diagram.
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Tue, 26 Feb 2013 10:18:24 +0100 |
parents | 436eec3be6ff |
children | b660090b417d |
rev | line source |
---|---|
11
6aeb4072eeb4
Added interfaces and a stub implementation of an artifact service the should provide the methods for communicating with the artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.flys.client.server; |
6aeb4072eeb4
Added interfaces and a stub implementation of an artifact service the should provide the methods for communicating with the artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
2 |
1367
ab8eb2f544f2
Replaced stdout and stderr logging with log4j loggers in server classes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
905
diff
changeset
|
3 import org.apache.log4j.Logger; |
ab8eb2f544f2
Replaced stdout and stderr logging with log4j loggers in server classes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
905
diff
changeset
|
4 |
11
6aeb4072eeb4
Added interfaces and a stub implementation of an artifact service the should provide the methods for communicating with the artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
5 import com.google.gwt.user.server.rpc.RemoteServiceServlet; |
6aeb4072eeb4
Added interfaces and a stub implementation of an artifact service the should provide the methods for communicating with the artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
6 |
215
e02f50a3ad59
Improved the exception handling of artifact / collection specific operations. Warning dialog are displayed after such an exception.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
14
diff
changeset
|
7 import de.intevation.flys.client.shared.exceptions.ServerException; |
11
6aeb4072eeb4
Added interfaces and a stub implementation of an artifact service the should provide the methods for communicating with the artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
8 import de.intevation.flys.client.shared.model.Artifact; |
6aeb4072eeb4
Added interfaces and a stub implementation of an artifact service the should provide the methods for communicating with the artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
9 import de.intevation.flys.client.client.services.ArtifactService; |
6aeb4072eeb4
Added interfaces and a stub implementation of an artifact service the should provide the methods for communicating with the artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
10 |
3865
436eec3be6ff
Allow to create a discharge curve from a gauge info
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
2890
diff
changeset
|
11 import de.intevation.flys.client.shared.model.Collection; |
843
78ef14dc1877
Forward recommendations as a structure to RPC service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
807
diff
changeset
|
12 import de.intevation.flys.client.shared.model.Recommendation; |
11
6aeb4072eeb4
Added interfaces and a stub implementation of an artifact service the should provide the methods for communicating with the artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
13 |
6aeb4072eeb4
Added interfaces and a stub implementation of an artifact service the should provide the methods for communicating with the artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
14 /** |
6aeb4072eeb4
Added interfaces and a stub implementation of an artifact service the should provide the methods for communicating with the artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
15 * This interface provides artifact specific services as CREATE, DESCRIBE, FEED, |
6aeb4072eeb4
Added interfaces and a stub implementation of an artifact service the should provide the methods for communicating with the artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
16 * ADVANCE and OUT. |
6aeb4072eeb4
Added interfaces and a stub implementation of an artifact service the should provide the methods for communicating with the artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
17 * |
6aeb4072eeb4
Added interfaces and a stub implementation of an artifact service the should provide the methods for communicating with the artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
18 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> |
6aeb4072eeb4
Added interfaces and a stub implementation of an artifact service the should provide the methods for communicating with the artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
19 */ |
6aeb4072eeb4
Added interfaces and a stub implementation of an artifact service the should provide the methods for communicating with the artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
20 public class ArtifactServiceImpl |
6aeb4072eeb4
Added interfaces and a stub implementation of an artifact service the should provide the methods for communicating with the artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
21 extends RemoteServiceServlet |
6aeb4072eeb4
Added interfaces and a stub implementation of an artifact service the should provide the methods for communicating with the artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
22 implements ArtifactService |
6aeb4072eeb4
Added interfaces and a stub implementation of an artifact service the should provide the methods for communicating with the artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
23 { |
2890
fba76f4afca9
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
24 /** Private logger. */ |
1367
ab8eb2f544f2
Replaced stdout and stderr logging with log4j loggers in server classes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
905
diff
changeset
|
25 private static final Logger logger = |
ab8eb2f544f2
Replaced stdout and stderr logging with log4j loggers in server classes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
905
diff
changeset
|
26 Logger.getLogger(ArtifactServiceImpl.class); |
ab8eb2f544f2
Replaced stdout and stderr logging with log4j loggers in server classes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
905
diff
changeset
|
27 |
ab8eb2f544f2
Replaced stdout and stderr logging with log4j loggers in server classes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
905
diff
changeset
|
28 |
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:
845
diff
changeset
|
29 /** |
478a571f1f94
Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
845
diff
changeset
|
30 * Creates new Artifacts based on a given Recommendation and 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:
845
diff
changeset
|
31 * <b>Note, that all the work is done in ArtifactHelper!</b> |
478a571f1f94
Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
845
diff
changeset
|
32 * |
478a571f1f94
Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
845
diff
changeset
|
33 * @param locale The locale used for HTTP request. |
478a571f1f94
Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
845
diff
changeset
|
34 * @param factory The factory that is used to create the new Artifact. |
2890
fba76f4afca9
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
35 * @param recom Recommendation with details of the artifact to 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:
845
diff
changeset
|
36 * |
478a571f1f94
Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
845
diff
changeset
|
37 * @return a new 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:
845
diff
changeset
|
38 */ |
803
653ae84533e7
Read/create recommended Artifacts and add them to the current Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
229
diff
changeset
|
39 public Artifact create( |
843
78ef14dc1877
Forward recommendations as a structure to RPC service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
807
diff
changeset
|
40 String locale, |
78ef14dc1877
Forward recommendations as a structure to RPC service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
807
diff
changeset
|
41 String factory, |
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:
845
diff
changeset
|
42 Recommendation recom |
843
78ef14dc1877
Forward recommendations as a structure to RPC service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
807
diff
changeset
|
43 ) |
215
e02f50a3ad59
Improved the exception handling of artifact / collection specific operations. Warning dialog are displayed after such an exception.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
14
diff
changeset
|
44 throws ServerException |
e02f50a3ad59
Improved the exception handling of artifact / collection specific operations. Warning dialog are displayed after such an exception.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
14
diff
changeset
|
45 { |
1367
ab8eb2f544f2
Replaced stdout and stderr logging with log4j loggers in server classes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
905
diff
changeset
|
46 logger.info("ArtifactServiceImpl.create"); |
229
924da6695800
Each service is now called with the name of the current locale to set the request object's locale manually in the HttpClient.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
215
diff
changeset
|
47 |
1425
bc06a671ef60
Removed the URL parameter from service calls. The service
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1367
diff
changeset
|
48 String url = getServletContext().getInitParameter("server-url"); |
bc06a671ef60
Removed the URL parameter from service calls. The service
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1367
diff
changeset
|
49 |
bc06a671ef60
Removed the URL parameter from service calls. The service
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1367
diff
changeset
|
50 return ArtifactHelper.createArtifact(url, locale, factory, recom); |
845
4db672cdacb2
Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
843
diff
changeset
|
51 } |
3865
436eec3be6ff
Allow to create a discharge curve from a gauge info
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
2890
diff
changeset
|
52 |
436eec3be6ff
Allow to create a discharge curve from a gauge info
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
2890
diff
changeset
|
53 /** |
436eec3be6ff
Allow to create a discharge curve from a gauge info
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
2890
diff
changeset
|
54 * Create a new GaugeDischageCurveArtifact |
436eec3be6ff
Allow to create a discharge curve from a gauge info
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
2890
diff
changeset
|
55 * |
436eec3be6ff
Allow to create a discharge curve from a gauge info
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
2890
diff
changeset
|
56 * @param river the river |
436eec3be6ff
Allow to create a discharge curve from a gauge info
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
2890
diff
changeset
|
57 * @param gaugeref reference id of the gauge |
436eec3be6ff
Allow to create a discharge curve from a gauge info
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
2890
diff
changeset
|
58 */ |
436eec3be6ff
Allow to create a discharge curve from a gauge info
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
2890
diff
changeset
|
59 public Artifact createGaugeDischargeCurveArtifact( |
436eec3be6ff
Allow to create a discharge curve from a gauge info
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
2890
diff
changeset
|
60 Collection collection, |
436eec3be6ff
Allow to create a discharge curve from a gauge info
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
2890
diff
changeset
|
61 String locale, |
436eec3be6ff
Allow to create a discharge curve from a gauge info
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
2890
diff
changeset
|
62 String river, |
436eec3be6ff
Allow to create a discharge curve from a gauge info
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
2890
diff
changeset
|
63 Long gaugeref) |
436eec3be6ff
Allow to create a discharge curve from a gauge info
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
2890
diff
changeset
|
64 throws ServerException |
436eec3be6ff
Allow to create a discharge curve from a gauge info
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
2890
diff
changeset
|
65 { |
436eec3be6ff
Allow to create a discharge curve from a gauge info
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
2890
diff
changeset
|
66 logger.info("ArtifactServiceImpl.createGaugeDischargeCurverArtifact"); |
436eec3be6ff
Allow to create a discharge curve from a gauge info
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
2890
diff
changeset
|
67 String url = getServletContext().getInitParameter("server-url"); |
436eec3be6ff
Allow to create a discharge curve from a gauge info
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
2890
diff
changeset
|
68 |
436eec3be6ff
Allow to create a discharge curve from a gauge info
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
2890
diff
changeset
|
69 Artifact artifact = ArtifactHelper.createGaugeDischargeCurveArtifact(url, |
436eec3be6ff
Allow to create a discharge curve from a gauge info
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
2890
diff
changeset
|
70 locale, river, gaugeref); |
436eec3be6ff
Allow to create a discharge curve from a gauge info
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
2890
diff
changeset
|
71 if (artifact == null) { |
436eec3be6ff
Allow to create a discharge curve from a gauge info
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
2890
diff
changeset
|
72 return null; |
436eec3be6ff
Allow to create a discharge curve from a gauge info
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
2890
diff
changeset
|
73 } |
436eec3be6ff
Allow to create a discharge curve from a gauge info
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
2890
diff
changeset
|
74 logger.info("GaugeDischargeCurveArtifact created successfully"); |
436eec3be6ff
Allow to create a discharge curve from a gauge info
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
2890
diff
changeset
|
75 |
436eec3be6ff
Allow to create a discharge curve from a gauge info
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
2890
diff
changeset
|
76 CollectionHelper.addArtifact(collection, artifact, url, locale); |
436eec3be6ff
Allow to create a discharge curve from a gauge info
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
2890
diff
changeset
|
77 |
436eec3be6ff
Allow to create a discharge curve from a gauge info
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
2890
diff
changeset
|
78 return artifact; |
436eec3be6ff
Allow to create a discharge curve from a gauge info
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
2890
diff
changeset
|
79 } |
436eec3be6ff
Allow to create a discharge curve from a gauge info
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
2890
diff
changeset
|
80 |
11
6aeb4072eeb4
Added interfaces and a stub implementation of an artifact service the should provide the methods for communicating with the artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
81 } |
6aeb4072eeb4
Added interfaces and a stub implementation of an artifact service the should provide the methods for communicating with the artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
82 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |