ingo@598: package de.intevation.flys.client.server; ingo@598: ingo@598: import org.w3c.dom.Document; ingo@598: ingo@1367: import org.apache.log4j.Logger; ingo@1367: ingo@598: import de.intevation.artifacts.common.utils.ClientProtocolUtils; ingo@598: ingo@598: import de.intevation.flys.client.shared.exceptions.ServerException; ingo@598: import de.intevation.flys.client.shared.model.Collection; ingo@598: import de.intevation.flys.client.client.services.SetCollectionTTLService; ingo@598: ingo@598: ingo@598: /** ingo@598: * @author Ingo Weinzierl ingo@598: */ ingo@598: public class SetCollectionTTLServiceImpl ingo@599: extends DoCollectionAction ingo@598: implements SetCollectionTTLService ingo@598: { ingo@1367: private static final Logger logger = ingo@1367: Logger.getLogger(SetCollectionTTLServiceImpl.class); ingo@1367: ingo@1367: ingo@599: public static final String XPATH_RESULT = "/art:result/text()"; ingo@599: public static final String OPERATION_FAILURE = "FAILED"; ingo@599: ingo@598: public void setTTL(Collection c, String url) ingo@598: throws ServerException ingo@598: { ingo@1367: logger.info("Set ttl of collection: " + c.identifier()); ingo@599: ingo@599: long ttl = c.getTTL(); ingo@599: String value = null; ingo@599: ingo@599: if (ttl == 0) { ingo@599: value = "INF"; ingo@599: } ingo@599: else if (ttl < 0) { ingo@599: value = "DEFAULT"; ingo@599: } ingo@599: else { ingo@599: value = String.valueOf(ttl); ingo@599: } ingo@599: ingo@599: Document set = ClientProtocolUtils.newSetCollectionTTLDocument(value); ingo@599: ingo@599: doAction(c, set, url); ingo@598: } ingo@598: } ingo@598: // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :