comparison flys-client/src/main/java/de/intevation/flys/client/server/SetCollectionTTLServiceImpl.java @ 599:1dbffe4c6d12

Implemented the RPC stubs to set the TTL and name of a collection and to delete an existing collection. flys-client/trunk@2203 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Wed, 22 Jun 2011 12:50:20 +0000
parents 031357c3e23e
children ab8eb2f544f2
comparison
equal deleted inserted replaced
598:031357c3e23e 599:1dbffe4c6d12
1 package de.intevation.flys.client.server; 1 package de.intevation.flys.client.server;
2 2
3 import org.w3c.dom.Document; 3 import org.w3c.dom.Document;
4 4
5 import com.google.gwt.user.server.rpc.RemoteServiceServlet;
6
7 import de.intevation.artifacts.common.utils.ClientProtocolUtils; 5 import de.intevation.artifacts.common.utils.ClientProtocolUtils;
8
9 import de.intevation.artifacts.httpclient.exceptions.ConnectionException;
10 import de.intevation.artifacts.httpclient.http.HttpClient;
11 import de.intevation.artifacts.httpclient.http.HttpClientImpl;
12 import de.intevation.artifacts.httpclient.http.response.DocumentResponseHandler;
13 6
14 import de.intevation.flys.client.shared.exceptions.ServerException; 7 import de.intevation.flys.client.shared.exceptions.ServerException;
15 import de.intevation.flys.client.shared.model.Collection; 8 import de.intevation.flys.client.shared.model.Collection;
16 import de.intevation.flys.client.client.services.SetCollectionTTLService; 9 import de.intevation.flys.client.client.services.SetCollectionTTLService;
17 10
18 11
19 /** 12 /**
20 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> 13 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
21 */ 14 */
22 public class SetCollectionTTLServiceImpl 15 public class SetCollectionTTLServiceImpl
23 extends RemoteServiceServlet 16 extends DoCollectionAction
24 implements SetCollectionTTLService 17 implements SetCollectionTTLService
25 { 18 {
19 public static final String XPATH_RESULT = "/art:result/text()";
20 public static final String OPERATION_FAILURE = "FAILED";
21
26 public void setTTL(Collection c, String url) 22 public void setTTL(Collection c, String url)
27 throws ServerException 23 throws ServerException
28 { 24 {
29 // TODO IMPLEMENT ME 25 System.out.println("Set ttl of collection: " + c.identifier());
30 throw new ServerException("TTL Service NOT IMPLEMENTED"); 26
27 long ttl = c.getTTL();
28 String value = null;
29
30 if (ttl == 0) {
31 value = "INF";
32 }
33 else if (ttl < 0) {
34 value = "DEFAULT";
35 }
36 else {
37 value = String.valueOf(ttl);
38 }
39
40 Document set = ClientProtocolUtils.newSetCollectionTTLDocument(value);
41
42 doAction(c, set, url);
31 } 43 }
32 } 44 }
33 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : 45 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org