Mercurial > dive4elements > river
diff flys-client/src/main/java/de/intevation/flys/client/client/ui/CollectionView.java @ 26:c19985f75118
Implemented a service that triggers the artifact-collection creation in the artifact server.
flys-client/trunk@1413 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Mon, 07 Mar 2011 13:47:55 +0000 |
parents | dc086030e6a3 |
children | 5709bd8f4d7c |
line wrap: on
line diff
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/CollectionView.java Mon Mar 07 13:40:37 2011 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/CollectionView.java Mon Mar 07 13:47:55 2011 +0000 @@ -36,6 +36,8 @@ import de.intevation.flys.client.client.event.CollectionChangeHandler; import de.intevation.flys.client.client.services.ArtifactService; import de.intevation.flys.client.client.services.ArtifactServiceAsync; +import de.intevation.flys.client.client.services.CreateCollectionService; +import de.intevation.flys.client.client.services.CreateCollectionServiceAsync; /** @@ -50,6 +52,10 @@ protected ArtifactServiceAsync artifactService = GWT.create(ArtifactService.class); + /** The ArtifactService used to communicate with the Artifact server. */ + protected CreateCollectionServiceAsync createCollectionService = + GWT.create(CreateCollectionService.class); + /** The message class that provides i18n strings.*/ FLYSMessages messages = GWT.create(FLYSMessages.class); @@ -127,6 +133,38 @@ /** + * This method triggers the CreateCollectionService to create a new + * collection in the artifact server. + * + * @param ownerId The uuid of the user that should own the new collection. + */ + protected void createNewCollection(String ownerId) { + Config config = Config.getInstance(); + String serverUrl = config.getServerUrl(); + + createCollectionService.create( + serverUrl, ownerId, + new AsyncCallback<String>() { + public void onFailure(Throwable caught) { + GWT.log("Could not create the new collection."); + GWT.log(caught.getMessage()); + } + + public void onSuccess(String uuid) { + GWT.log("Successfully created a new collection."); + GWT.log("NEW collection uuid: " + uuid); + } + }); + } + + + protected FLYS getFlys() { + return flys; + } + + + + /** * This method registers a new ValueChangeHandler. * * @param handler The new ValueChangeHandler.