annotate flys-client/src/main/java/de/intevation/flys/client/server/ArtifactServiceImpl.java @ 5818:a4ff4167be1e

Request feature info on all layers and show it as html if the server does not return valid gml. Non queryable layers produce an error message when the request fails. This is good enough
author Andre Heinecke <aheinecke@intevation.de>
date Wed, 24 Apr 2013 17:33:27 +0200
parents b660090b417d
children
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
5503
b660090b417d Create a new sq relation project on measurement station record click.
Raimund Renkert <rrenkert@intevation.de>
parents: 3865
diff changeset
81 @Override
b660090b417d Create a new sq relation project on measurement station record click.
Raimund Renkert <rrenkert@intevation.de>
parents: 3865
diff changeset
82 public Artifact createSQRelationArtifact(
b660090b417d Create a new sq relation project on measurement station record click.
Raimund Renkert <rrenkert@intevation.de>
parents: 3865
diff changeset
83 Collection collection,
b660090b417d Create a new sq relation project on measurement station record click.
Raimund Renkert <rrenkert@intevation.de>
parents: 3865
diff changeset
84 String locale,
b660090b417d Create a new sq relation project on measurement station record click.
Raimund Renkert <rrenkert@intevation.de>
parents: 3865
diff changeset
85 String river,
b660090b417d Create a new sq relation project on measurement station record click.
Raimund Renkert <rrenkert@intevation.de>
parents: 3865
diff changeset
86 int measurementStation)
b660090b417d Create a new sq relation project on measurement station record click.
Raimund Renkert <rrenkert@intevation.de>
parents: 3865
diff changeset
87 throws ServerException
b660090b417d Create a new sq relation project on measurement station record click.
Raimund Renkert <rrenkert@intevation.de>
parents: 3865
diff changeset
88 {
b660090b417d Create a new sq relation project on measurement station record click.
Raimund Renkert <rrenkert@intevation.de>
parents: 3865
diff changeset
89 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
90 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
91
b660090b417d Create a new sq relation project on measurement station record click.
Raimund Renkert <rrenkert@intevation.de>
parents: 3865
diff changeset
92 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
93 locale, river, measurementStation);
b660090b417d Create a new sq relation project on measurement station record click.
Raimund Renkert <rrenkert@intevation.de>
parents: 3865
diff changeset
94 if (artifact == null) {
b660090b417d Create a new sq relation project on measurement station record click.
Raimund Renkert <rrenkert@intevation.de>
parents: 3865
diff changeset
95 return null;
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("SQRelationArtifact created successfully");
b660090b417d Create a new sq relation project on measurement station record click.
Raimund Renkert <rrenkert@intevation.de>
parents: 3865
diff changeset
98
b660090b417d Create a new sq relation project on measurement station record click.
Raimund Renkert <rrenkert@intevation.de>
parents: 3865
diff changeset
99 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
100
b660090b417d Create a new sq relation project on measurement station record click.
Raimund Renkert <rrenkert@intevation.de>
parents: 3865
diff changeset
101 return artifact;
b660090b417d Create a new sq relation project on measurement station record click.
Raimund Renkert <rrenkert@intevation.de>
parents: 3865
diff changeset
102 }
b660090b417d Create a new sq relation project on measurement station record click.
Raimund Renkert <rrenkert@intevation.de>
parents: 3865
diff changeset
103
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
104 }
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
105 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org