annotate gwt-client/src/main/java/org/dive4elements/river/client/server/ArtifactServiceImpl.java @ 5861:172338b1407f

GWT client: Added copyright header.
author Sascha L. Teichmann <teichmann@intevation.de>
date Sun, 28 Apr 2013 14:30:15 +0200
parents 5aa05a7a34b7
children ea9eef426962
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 *
172338b1407f GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
4 * This file is Free Software under the GNU AGPL (>=v3)
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
172338b1407f GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
6 * documentation coming with Dive4Elements River for details.
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;
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
10
1367
ab8eb2f544f2 Replaced stdout and stderr logging with log4j loggers in server classes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 905
diff changeset
11 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
12
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 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
14
5835
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
15 import org.dive4elements.river.client.shared.exceptions.ServerException;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
16 import org.dive4elements.river.client.shared.model.Artifact;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
17 import org.dive4elements.river.client.client.services.ArtifactService;
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
18
5835
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
19 import org.dive4elements.river.client.shared.model.Collection;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
20 import org.dive4elements.river.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
21
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 /**
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 * 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
24 * 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
25 *
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
26 * @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
27 */
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
28 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
29 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
30 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
31 {
2890
fba76f4afca9 Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
32 /** 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
33 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
34 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
35
ab8eb2f544f2 Replaced stdout and stderr logging with log4j loggers in server classes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 905
diff changeset
36
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
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: 845
diff changeset
38 * 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
39 * <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
40 *
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and 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
41 * @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
42 * @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
43 * @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
44 *
478a571f1f94 Refactored server code - HTTP related code moved to ArtifactsHelper and 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
45 * @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
46 */
803
653ae84533e7 Read/create recommended Artifacts and add them to the current Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 229
diff changeset
47 public Artifact create(
843
78ef14dc1877 Forward recommendations as a structure to RPC service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 807
diff changeset
48 String locale,
78ef14dc1877 Forward recommendations as a structure to RPC service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 807
diff changeset
49 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
50 Recommendation recom
843
78ef14dc1877 Forward recommendations as a structure to RPC service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 807
diff changeset
51 )
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
52 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
53 {
1367
ab8eb2f544f2 Replaced stdout and stderr logging with log4j loggers in server classes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 905
diff changeset
54 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
55
1425
bc06a671ef60 Removed the URL parameter from service calls. The service
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1367
diff changeset
56 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
57
bc06a671ef60 Removed the URL parameter from service calls. The service
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1367
diff changeset
58 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
59 }
3865
436eec3be6ff Allow to create a discharge curve from a gauge info
Bjoern Ricks <bjoern.ricks@intevation.de>
parents: 2890
diff changeset
60
436eec3be6ff Allow to create a discharge curve from a gauge info
Bjoern Ricks <bjoern.ricks@intevation.de>
parents: 2890
diff changeset
61 /**
436eec3be6ff Allow to create a discharge curve from a gauge info
Bjoern Ricks <bjoern.ricks@intevation.de>
parents: 2890
diff changeset
62 * 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
63 *
436eec3be6ff Allow to create a discharge curve from a gauge info
Bjoern Ricks <bjoern.ricks@intevation.de>
parents: 2890
diff changeset
64 * @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
65 * @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
66 */
436eec3be6ff Allow to create a discharge curve from a gauge info
Bjoern Ricks <bjoern.ricks@intevation.de>
parents: 2890
diff changeset
67 public Artifact createGaugeDischargeCurveArtifact(
436eec3be6ff Allow to create a discharge curve from a gauge info
Bjoern Ricks <bjoern.ricks@intevation.de>
parents: 2890
diff changeset
68 Collection collection,
436eec3be6ff Allow to create a discharge curve from a gauge info
Bjoern Ricks <bjoern.ricks@intevation.de>
parents: 2890
diff changeset
69 String locale,
436eec3be6ff Allow to create a discharge curve from a gauge info
Bjoern Ricks <bjoern.ricks@intevation.de>
parents: 2890
diff changeset
70 String river,
436eec3be6ff Allow to create a discharge curve from a gauge info
Bjoern Ricks <bjoern.ricks@intevation.de>
parents: 2890
diff changeset
71 Long gaugeref)
436eec3be6ff Allow to create a discharge curve from a gauge info
Bjoern Ricks <bjoern.ricks@intevation.de>
parents: 2890
diff changeset
72 throws ServerException
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("ArtifactServiceImpl.createGaugeDischargeCurverArtifact");
436eec3be6ff Allow to create a discharge curve from a gauge info
Bjoern Ricks <bjoern.ricks@intevation.de>
parents: 2890
diff changeset
75 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
76
436eec3be6ff Allow to create a discharge curve from a gauge info
Bjoern Ricks <bjoern.ricks@intevation.de>
parents: 2890
diff changeset
77 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
78 locale, river, gaugeref);
436eec3be6ff Allow to create a discharge curve from a gauge info
Bjoern Ricks <bjoern.ricks@intevation.de>
parents: 2890
diff changeset
79 if (artifact == null) {
436eec3be6ff Allow to create a discharge curve from a gauge info
Bjoern Ricks <bjoern.ricks@intevation.de>
parents: 2890
diff changeset
80 return null;
436eec3be6ff Allow to create a discharge curve from a gauge info
Bjoern Ricks <bjoern.ricks@intevation.de>
parents: 2890
diff changeset
81 }
436eec3be6ff Allow to create a discharge curve from a gauge info
Bjoern Ricks <bjoern.ricks@intevation.de>
parents: 2890
diff changeset
82 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
83
436eec3be6ff Allow to create a discharge curve from a gauge info
Bjoern Ricks <bjoern.ricks@intevation.de>
parents: 2890
diff changeset
84 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
85
436eec3be6ff Allow to create a discharge curve from a gauge info
Bjoern Ricks <bjoern.ricks@intevation.de>
parents: 2890
diff changeset
86 return artifact;
436eec3be6ff Allow to create a discharge curve from a gauge info
Bjoern Ricks <bjoern.ricks@intevation.de>
parents: 2890
diff changeset
87 }
436eec3be6ff Allow to create a discharge curve from a gauge info
Bjoern Ricks <bjoern.ricks@intevation.de>
parents: 2890
diff changeset
88
5503
b660090b417d Create a new sq relation project on measurement station record click.
Raimund Renkert <rrenkert@intevation.de>
parents: 3865
diff changeset
89 @Override
b660090b417d Create a new sq relation project on measurement station record click.
Raimund Renkert <rrenkert@intevation.de>
parents: 3865
diff changeset
90 public Artifact createSQRelationArtifact(
b660090b417d Create a new sq relation project on measurement station record click.
Raimund Renkert <rrenkert@intevation.de>
parents: 3865
diff changeset
91 Collection collection,
b660090b417d Create a new sq relation project on measurement station record click.
Raimund Renkert <rrenkert@intevation.de>
parents: 3865
diff changeset
92 String locale,
b660090b417d Create a new sq relation project on measurement station record click.
Raimund Renkert <rrenkert@intevation.de>
parents: 3865
diff changeset
93 String river,
b660090b417d Create a new sq relation project on measurement station record click.
Raimund Renkert <rrenkert@intevation.de>
parents: 3865
diff changeset
94 int measurementStation)
b660090b417d Create a new sq relation project on measurement station record click.
Raimund Renkert <rrenkert@intevation.de>
parents: 3865
diff changeset
95 throws ServerException
b660090b417d Create a new sq relation project on measurement station record click.
Raimund Renkert <rrenkert@intevation.de>
parents: 3865
diff changeset
96 {
b660090b417d Create a new sq relation project on measurement station record click.
Raimund Renkert <rrenkert@intevation.de>
parents: 3865
diff changeset
97 logger.info("ArtifactServiceImpl.createSQRelationArtifact");
b660090b417d Create a new sq relation project on measurement station record click.
Raimund Renkert <rrenkert@intevation.de>
parents: 3865
diff changeset
98 String url = getServletContext().getInitParameter("server-url");
b660090b417d Create a new sq relation project on measurement station record click.
Raimund Renkert <rrenkert@intevation.de>
parents: 3865
diff changeset
99
b660090b417d Create a new sq relation project on measurement station record click.
Raimund Renkert <rrenkert@intevation.de>
parents: 3865
diff changeset
100 Artifact artifact = ArtifactHelper.createSQRelationArtifact(url,
b660090b417d Create a new sq relation project on measurement station record click.
Raimund Renkert <rrenkert@intevation.de>
parents: 3865
diff changeset
101 locale, river, measurementStation);
b660090b417d Create a new sq relation project on measurement station record click.
Raimund Renkert <rrenkert@intevation.de>
parents: 3865
diff changeset
102 if (artifact == null) {
b660090b417d Create a new sq relation project on measurement station record click.
Raimund Renkert <rrenkert@intevation.de>
parents: 3865
diff changeset
103 return null;
b660090b417d Create a new sq relation project on measurement station record click.
Raimund Renkert <rrenkert@intevation.de>
parents: 3865
diff changeset
104 }
b660090b417d Create a new sq relation project on measurement station record click.
Raimund Renkert <rrenkert@intevation.de>
parents: 3865
diff changeset
105 logger.info("SQRelationArtifact created successfully");
b660090b417d Create a new sq relation project on measurement station record click.
Raimund Renkert <rrenkert@intevation.de>
parents: 3865
diff changeset
106
b660090b417d Create a new sq relation project on measurement station record click.
Raimund Renkert <rrenkert@intevation.de>
parents: 3865
diff changeset
107 CollectionHelper.addArtifact(collection, artifact, url, locale);
b660090b417d Create a new sq relation project on measurement station record click.
Raimund Renkert <rrenkert@intevation.de>
parents: 3865
diff changeset
108
b660090b417d Create a new sq relation project on measurement station record click.
Raimund Renkert <rrenkert@intevation.de>
parents: 3865
diff changeset
109 return artifact;
b660090b417d Create a new sq relation project on measurement station record click.
Raimund Renkert <rrenkert@intevation.de>
parents: 3865
diff changeset
110 }
b660090b417d Create a new sq relation project on measurement station record click.
Raimund Renkert <rrenkert@intevation.de>
parents: 3865
diff changeset
111
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
112 }
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
113 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org