Mercurial > dive4elements > river
changeset 6040:cbdf839008a7
Add a new function to create a GaugeDischarge+MainValueArtifact collection.
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Thu, 16 May 2013 16:31:09 +0200 |
parents | b6dab05553e2 |
children | 5da11bf372be |
files | gwt-client/src/main/java/org/dive4elements/river/client/client/services/ArtifactService.java gwt-client/src/main/java/org/dive4elements/river/client/client/services/ArtifactServiceAsync.java gwt-client/src/main/java/org/dive4elements/river/client/server/ArtifactServiceImpl.java |
diffstat | 3 files changed, 58 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/services/ArtifactService.java Thu May 16 16:30:36 2013 +0200 +++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/services/ArtifactService.java Thu May 16 16:31:09 2013 +0200 @@ -68,5 +68,19 @@ String river, int measurementStation ) throws ServerException; + + /** + * Create a new GaugeDischageCurveArtifact and also a Mainvalueartifact. + * + * @param collection the collection to add the artifacts to. + * @param river the river. + * @param gaugeref reference id of the gauge. + */ + public Artifact createGaugeDischargeView( + Collection collection, + String locale, + String river, + Long gaugeRef) + throws ServerException; } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/services/ArtifactServiceAsync.java Thu May 16 16:30:36 2013 +0200 +++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/services/ArtifactServiceAsync.java Thu May 16 16:31:09 2013 +0200 @@ -44,5 +44,12 @@ int measurementStation, AsyncCallback<Artifact> callback ); + + public void createGaugeDischargeView( + Collection collection, + String locale, + String river, + Long gaugeRef, + AsyncCallback<Artifact> callback); } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/gwt-client/src/main/java/org/dive4elements/river/client/server/ArtifactServiceImpl.java Thu May 16 16:30:36 2013 +0200 +++ b/gwt-client/src/main/java/org/dive4elements/river/client/server/ArtifactServiceImpl.java Thu May 16 16:31:09 2013 +0200 @@ -58,6 +58,43 @@ return ArtifactHelper.createArtifact(url, locale, factory, recom); } + + /** + * Create a new GaugeDischageCurveArtifact and MainValueArtifact, stuff + * them into a collection. + * + * @param river the river. + * @param gaugeref reference id of the gauge. + */ + public Artifact createGaugeDischargeView( + Collection collection, + String locale, + String river, + Long gaugeRef) + throws ServerException + { + logger.info("ArtifactServiceImpl.createGaugeDischargeCurveView"); + String url = getServletContext().getInitParameter("server-url"); + + Artifact artifact = ArtifactHelper.createGaugeDischargeCurveArtifact(url, + locale, river, gaugeRef); + if (artifact == null) { + return null; + } + logger.info("GaugeDischargeCurveArtifact created successfully"); + + CollectionHelper.addArtifact(collection, artifact, url, locale); + Artifact mainVArtifact = ArtifactHelper.createMainvalueArtifact(url, + locale, river, gaugeRef); + if (mainVArtifact == null) { + logger.info("Failed to create MainValueArtifact"); + return null; + } + CollectionHelper.addArtifact(collection, mainVArtifact, url, locale); + + return artifact; + } + /** * Create a new GaugeDischageCurveArtifact *