Mercurial > dive4elements > river
view flys-client/src/main/java/de/intevation/flys/client/server/AddArtifactServiceImpl.java @ 208:7e300d2ed1f6
Tagged RELEASE 0.1 of FLYS Client.
flys-client/trunk@1625 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Wed, 30 Mar 2011 13:49:28 +0000 |
parents | f7967d12ce6e |
children | e02f50a3ad59 |
line wrap: on
line source
package de.intevation.flys.client.server; import org.w3c.dom.Document; import de.intevation.artifacts.common.utils.ClientProtocolUtils; import de.intevation.artifacts.httpclient.exceptions.ConnectionException; import de.intevation.artifacts.httpclient.http.HttpClient; import de.intevation.artifacts.httpclient.http.HttpClientImpl; import de.intevation.artifacts.httpclient.http.response.DocumentResponseHandler; import de.intevation.flys.client.shared.model.Artifact; import de.intevation.flys.client.shared.model.Collection; import de.intevation.flys.client.client.services.AddArtifactService; /** * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> */ public class AddArtifactServiceImpl extends DescribeCollectionServiceImpl implements AddArtifactService { public Collection add(Collection collection, Artifact artifact, String url) { System.out.println("AddArtifactServiceImpl.add"); Document add = ClientProtocolUtils.newAddArtifactDocument( artifact.getUuid(), null); HttpClient client = new HttpClientImpl(url); try { Document response = (Document) client.doCollectionAction( add, collection.identifier(), new DocumentResponseHandler()); Collection c = parseCollection(response); if (c == null) { throw new NullPointerException("No collection returned."); } return c; } catch (ConnectionException ce) { System.err.println(ce.getLocalizedMessage()); } return null; } } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :