comparison gwt-client/src/main/java/org/dive4elements/river/client/server/SetCollectionTTLServiceImpl.java @ 5838:5aa05a7a34b7

Rename modules to more fitting names.
author Sascha L. Teichmann <teichmann@intevation.de>
date Thu, 25 Apr 2013 15:23:37 +0200
parents flys-client/src/main/java/org/dive4elements/river/client/server/SetCollectionTTLServiceImpl.java@821a02bbfb4e
children 172338b1407f
comparison
equal deleted inserted replaced
5837:d9901a08d0a6 5838:5aa05a7a34b7
1 package org.dive4elements.river.client.server;
2
3 import org.w3c.dom.Document;
4
5 import org.apache.log4j.Logger;
6
7 import org.dive4elements.artifacts.common.utils.ClientProtocolUtils;
8
9 import org.dive4elements.river.client.shared.exceptions.ServerException;
10 import org.dive4elements.river.client.shared.model.Collection;
11 import org.dive4elements.river.client.client.services.SetCollectionTTLService;
12
13
14 /**
15 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
16 */
17 public class SetCollectionTTLServiceImpl
18 extends DoCollectionAction
19 implements SetCollectionTTLService
20 {
21 private static final Logger logger =
22 Logger.getLogger(SetCollectionTTLServiceImpl.class);
23
24
25 public static final String XPATH_RESULT = "/art:result/text()";
26 public static final String OPERATION_FAILURE = "FAILED";
27
28 public void setTTL(Collection c)
29 throws ServerException
30 {
31 logger.info("Set ttl of collection: " + c.identifier());
32
33 String url = getServletContext().getInitParameter("server-url");
34
35 long ttl = c.getTTL();
36 String value = null;
37
38 if (ttl == 0) {
39 value = "INF";
40 }
41 else if (ttl < 0) {
42 value = "DEFAULT";
43 }
44 else {
45 value = String.valueOf(ttl);
46 }
47
48 Document set = ClientProtocolUtils.newSetCollectionTTLDocument(value);
49
50 doAction(c, set, url);
51 }
52 }
53 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org