Mercurial > dive4elements > river
annotate flys-client/src/main/java/de/intevation/flys/client/server/SetCollectionTTLServiceImpl.java @ 883:cd286de8f2ad
Datacage window in Output tabs fetches information for the current output now.
flys-client/trunk@2717 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Tue, 13 Sep 2011 10:47:28 +0000 |
parents | 1dbffe4c6d12 |
children | ab8eb2f544f2 |
rev | line source |
---|---|
598
031357c3e23e
Added stubs to set the name and ttl of a collection and to delete a collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.flys.client.server; |
031357c3e23e
Added stubs to set the name and ttl of a collection and to delete a collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
2 |
031357c3e23e
Added stubs to set the name and ttl of a collection and to delete a collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
3 import org.w3c.dom.Document; |
031357c3e23e
Added stubs to set the name and ttl of a collection and to delete a collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
4 |
031357c3e23e
Added stubs to set the name and ttl of a collection and to delete a collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
5 import de.intevation.artifacts.common.utils.ClientProtocolUtils; |
031357c3e23e
Added stubs to set the name and ttl of a collection and to delete a collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
6 |
031357c3e23e
Added stubs to set the name and ttl of a collection and to delete a collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
7 import de.intevation.flys.client.shared.exceptions.ServerException; |
031357c3e23e
Added stubs to set the name and ttl of a collection and to delete a collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
8 import de.intevation.flys.client.shared.model.Collection; |
031357c3e23e
Added stubs to set the name and ttl of a collection and to delete a collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
9 import de.intevation.flys.client.client.services.SetCollectionTTLService; |
031357c3e23e
Added stubs to set the name and ttl of a collection and to delete a collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
10 |
031357c3e23e
Added stubs to set the name and ttl of a collection and to delete a collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
11 |
031357c3e23e
Added stubs to set the name and ttl of a collection and to delete a collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
12 /** |
031357c3e23e
Added stubs to set the name and ttl of a collection and to delete a collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
13 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> |
031357c3e23e
Added stubs to set the name and ttl of a collection and to delete a collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
14 */ |
031357c3e23e
Added stubs to set the name and ttl of a collection and to delete a collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
15 public class SetCollectionTTLServiceImpl |
599
1dbffe4c6d12
Implemented the RPC stubs to set the TTL and name of a collection and to delete an existing collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
598
diff
changeset
|
16 extends DoCollectionAction |
598
031357c3e23e
Added stubs to set the name and ttl of a collection and to delete a collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
17 implements SetCollectionTTLService |
031357c3e23e
Added stubs to set the name and ttl of a collection and to delete a collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
18 { |
599
1dbffe4c6d12
Implemented the RPC stubs to set the TTL and name of a collection and to delete an existing collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
598
diff
changeset
|
19 public static final String XPATH_RESULT = "/art:result/text()"; |
1dbffe4c6d12
Implemented the RPC stubs to set the TTL and name of a collection and to delete an existing collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
598
diff
changeset
|
20 public static final String OPERATION_FAILURE = "FAILED"; |
1dbffe4c6d12
Implemented the RPC stubs to set the TTL and name of a collection and to delete an existing collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
598
diff
changeset
|
21 |
598
031357c3e23e
Added stubs to set the name and ttl of a collection and to delete a collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
22 public void setTTL(Collection c, String url) |
031357c3e23e
Added stubs to set the name and ttl of a collection and to delete a collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
23 throws ServerException |
031357c3e23e
Added stubs to set the name and ttl of a collection and to delete a collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
24 { |
599
1dbffe4c6d12
Implemented the RPC stubs to set the TTL and name of a collection and to delete an existing collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
598
diff
changeset
|
25 System.out.println("Set ttl of collection: " + c.identifier()); |
1dbffe4c6d12
Implemented the RPC stubs to set the TTL and name of a collection and to delete an existing collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
598
diff
changeset
|
26 |
1dbffe4c6d12
Implemented the RPC stubs to set the TTL and name of a collection and to delete an existing collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
598
diff
changeset
|
27 long ttl = c.getTTL(); |
1dbffe4c6d12
Implemented the RPC stubs to set the TTL and name of a collection and to delete an existing collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
598
diff
changeset
|
28 String value = null; |
1dbffe4c6d12
Implemented the RPC stubs to set the TTL and name of a collection and to delete an existing collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
598
diff
changeset
|
29 |
1dbffe4c6d12
Implemented the RPC stubs to set the TTL and name of a collection and to delete an existing collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
598
diff
changeset
|
30 if (ttl == 0) { |
1dbffe4c6d12
Implemented the RPC stubs to set the TTL and name of a collection and to delete an existing collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
598
diff
changeset
|
31 value = "INF"; |
1dbffe4c6d12
Implemented the RPC stubs to set the TTL and name of a collection and to delete an existing collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
598
diff
changeset
|
32 } |
1dbffe4c6d12
Implemented the RPC stubs to set the TTL and name of a collection and to delete an existing collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
598
diff
changeset
|
33 else if (ttl < 0) { |
1dbffe4c6d12
Implemented the RPC stubs to set the TTL and name of a collection and to delete an existing collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
598
diff
changeset
|
34 value = "DEFAULT"; |
1dbffe4c6d12
Implemented the RPC stubs to set the TTL and name of a collection and to delete an existing collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
598
diff
changeset
|
35 } |
1dbffe4c6d12
Implemented the RPC stubs to set the TTL and name of a collection and to delete an existing collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
598
diff
changeset
|
36 else { |
1dbffe4c6d12
Implemented the RPC stubs to set the TTL and name of a collection and to delete an existing collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
598
diff
changeset
|
37 value = String.valueOf(ttl); |
1dbffe4c6d12
Implemented the RPC stubs to set the TTL and name of a collection and to delete an existing collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
598
diff
changeset
|
38 } |
1dbffe4c6d12
Implemented the RPC stubs to set the TTL and name of a collection and to delete an existing collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
598
diff
changeset
|
39 |
1dbffe4c6d12
Implemented the RPC stubs to set the TTL and name of a collection and to delete an existing collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
598
diff
changeset
|
40 Document set = ClientProtocolUtils.newSetCollectionTTLDocument(value); |
1dbffe4c6d12
Implemented the RPC stubs to set the TTL and name of a collection and to delete an existing collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
598
diff
changeset
|
41 |
1dbffe4c6d12
Implemented the RPC stubs to set the TTL and name of a collection and to delete an existing collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
598
diff
changeset
|
42 doAction(c, set, url); |
598
031357c3e23e
Added stubs to set the name and ttl of a collection and to delete a collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
43 } |
031357c3e23e
Added stubs to set the name and ttl of a collection and to delete a collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
44 } |
031357c3e23e
Added stubs to set the name and ttl of a collection and to delete a collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
45 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |