ingo@11: package de.intevation.flys.client.server; ingo@11: ingo@1367: import org.apache.log4j.Logger; ingo@1367: ingo@11: import com.google.gwt.user.server.rpc.RemoteServiceServlet; ingo@11: ingo@215: import de.intevation.flys.client.shared.exceptions.ServerException; ingo@11: import de.intevation.flys.client.shared.model.Artifact; ingo@11: import de.intevation.flys.client.client.services.ArtifactService; ingo@11: bjoern@3865: import de.intevation.flys.client.shared.model.Collection; sascha@843: import de.intevation.flys.client.shared.model.Recommendation; ingo@11: ingo@11: /** ingo@11: * This interface provides artifact specific services as CREATE, DESCRIBE, FEED, ingo@11: * ADVANCE and OUT. ingo@11: * ingo@11: * @author Ingo Weinzierl ingo@11: */ ingo@11: public class ArtifactServiceImpl ingo@11: extends RemoteServiceServlet ingo@11: implements ArtifactService ingo@11: { felix@2890: /** Private logger. */ ingo@1367: private static final Logger logger = ingo@1367: Logger.getLogger(ArtifactServiceImpl.class); ingo@1367: ingo@1367: ingo@905: /** ingo@905: * Creates new Artifacts based on a given Recommendation and factory. ingo@905: * Note, that all the work is done in ArtifactHelper! ingo@905: * ingo@905: * @param locale The locale used for HTTP request. ingo@905: * @param factory The factory that is used to create the new Artifact. felix@2890: * @param recom Recommendation with details of the artifact to create. ingo@905: * ingo@905: * @return a new Artifact. ingo@905: */ ingo@803: public Artifact create( sascha@843: String locale, sascha@843: String factory, ingo@905: Recommendation recom sascha@843: ) ingo@215: throws ServerException ingo@215: { ingo@1367: logger.info("ArtifactServiceImpl.create"); ingo@229: raimund@1425: String url = getServletContext().getInitParameter("server-url"); raimund@1425: raimund@1425: return ArtifactHelper.createArtifact(url, locale, factory, recom); sascha@845: } bjoern@3865: bjoern@3865: /** bjoern@3865: * Create a new GaugeDischageCurveArtifact bjoern@3865: * bjoern@3865: * @param river the river bjoern@3865: * @param gaugeref reference id of the gauge bjoern@3865: */ bjoern@3865: public Artifact createGaugeDischargeCurveArtifact( bjoern@3865: Collection collection, bjoern@3865: String locale, bjoern@3865: String river, bjoern@3865: Long gaugeref) bjoern@3865: throws ServerException bjoern@3865: { bjoern@3865: logger.info("ArtifactServiceImpl.createGaugeDischargeCurverArtifact"); bjoern@3865: String url = getServletContext().getInitParameter("server-url"); bjoern@3865: bjoern@3865: Artifact artifact = ArtifactHelper.createGaugeDischargeCurveArtifact(url, bjoern@3865: locale, river, gaugeref); bjoern@3865: if (artifact == null) { bjoern@3865: return null; bjoern@3865: } bjoern@3865: logger.info("GaugeDischargeCurveArtifact created successfully"); bjoern@3865: bjoern@3865: CollectionHelper.addArtifact(collection, artifact, url, locale); bjoern@3865: bjoern@3865: return artifact; bjoern@3865: } bjoern@3865: rrenkert@5503: @Override rrenkert@5503: public Artifact createSQRelationArtifact( rrenkert@5503: Collection collection, rrenkert@5503: String locale, rrenkert@5503: String river, rrenkert@5503: int measurementStation) rrenkert@5503: throws ServerException rrenkert@5503: { rrenkert@5503: logger.info("ArtifactServiceImpl.createSQRelationArtifact"); rrenkert@5503: String url = getServletContext().getInitParameter("server-url"); rrenkert@5503: rrenkert@5503: Artifact artifact = ArtifactHelper.createSQRelationArtifact(url, rrenkert@5503: locale, river, measurementStation); rrenkert@5503: if (artifact == null) { rrenkert@5503: return null; rrenkert@5503: } rrenkert@5503: logger.info("SQRelationArtifact created successfully"); rrenkert@5503: rrenkert@5503: CollectionHelper.addArtifact(collection, artifact, url, locale); rrenkert@5503: rrenkert@5503: return artifact; rrenkert@5503: } rrenkert@5503: ingo@11: } ingo@11: // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :