comparison gwt-client/src/main/java/org/dive4elements/river/client/server/ArtifactServiceImpl.java @ 5838:5aa05a7a34b7

Rename modules to more fitting names.
author Sascha L. Teichmann <teichmann@intevation.de>
date Thu, 25 Apr 2013 15:23:37 +0200
parents flys-client/src/main/java/org/dive4elements/river/client/server/ArtifactServiceImpl.java@821a02bbfb4e
children 172338b1407f
comparison
equal deleted inserted replaced
5837:d9901a08d0a6 5838:5aa05a7a34b7
1 package org.dive4elements.river.client.server;
2
3 import org.apache.log4j.Logger;
4
5 import com.google.gwt.user.server.rpc.RemoteServiceServlet;
6
7 import org.dive4elements.river.client.shared.exceptions.ServerException;
8 import org.dive4elements.river.client.shared.model.Artifact;
9 import org.dive4elements.river.client.client.services.ArtifactService;
10
11 import org.dive4elements.river.client.shared.model.Collection;
12 import org.dive4elements.river.client.shared.model.Recommendation;
13
14 /**
15 * This interface provides artifact specific services as CREATE, DESCRIBE, FEED,
16 * ADVANCE and OUT.
17 *
18 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
19 */
20 public class ArtifactServiceImpl
21 extends RemoteServiceServlet
22 implements ArtifactService
23 {
24 /** Private logger. */
25 private static final Logger logger =
26 Logger.getLogger(ArtifactServiceImpl.class);
27
28
29 /**
30 * Creates new Artifacts based on a given Recommendation and factory.
31 * <b>Note, that all the work is done in ArtifactHelper!</b>
32 *
33 * @param locale The locale used for HTTP request.
34 * @param factory The factory that is used to create the new Artifact.
35 * @param recom Recommendation with details of the artifact to create.
36 *
37 * @return a new Artifact.
38 */
39 public Artifact create(
40 String locale,
41 String factory,
42 Recommendation recom
43 )
44 throws ServerException
45 {
46 logger.info("ArtifactServiceImpl.create");
47
48 String url = getServletContext().getInitParameter("server-url");
49
50 return ArtifactHelper.createArtifact(url, locale, factory, recom);
51 }
52
53 /**
54 * Create a new GaugeDischageCurveArtifact
55 *
56 * @param river the river
57 * @param gaugeref reference id of the gauge
58 */
59 public Artifact createGaugeDischargeCurveArtifact(
60 Collection collection,
61 String locale,
62 String river,
63 Long gaugeref)
64 throws ServerException
65 {
66 logger.info("ArtifactServiceImpl.createGaugeDischargeCurverArtifact");
67 String url = getServletContext().getInitParameter("server-url");
68
69 Artifact artifact = ArtifactHelper.createGaugeDischargeCurveArtifact(url,
70 locale, river, gaugeref);
71 if (artifact == null) {
72 return null;
73 }
74 logger.info("GaugeDischargeCurveArtifact created successfully");
75
76 CollectionHelper.addArtifact(collection, artifact, url, locale);
77
78 return artifact;
79 }
80
81 @Override
82 public Artifact createSQRelationArtifact(
83 Collection collection,
84 String locale,
85 String river,
86 int measurementStation)
87 throws ServerException
88 {
89 logger.info("ArtifactServiceImpl.createSQRelationArtifact");
90 String url = getServletContext().getInitParameter("server-url");
91
92 Artifact artifact = ArtifactHelper.createSQRelationArtifact(url,
93 locale, river, measurementStation);
94 if (artifact == null) {
95 return null;
96 }
97 logger.info("SQRelationArtifact created successfully");
98
99 CollectionHelper.addArtifact(collection, artifact, url, locale);
100
101 return artifact;
102 }
103
104 }
105 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org