Mercurial > dive4elements > river
comparison flys-client/src/main/java/org/dive4elements/river/client/server/CollectionAttributeServiceImpl.java @ 5834:f507086aa94b
Repaired internal references.
author | Sascha L. Teichmann <teichmann@intevation.de> |
---|---|
date | Thu, 25 Apr 2013 12:31:32 +0200 |
parents | flys-client/src/main/java/de/intevation/flys/client/server/CollectionAttributeServiceImpl.java@bc06a671ef60 |
children | 821a02bbfb4e |
comparison
equal
deleted
inserted
replaced
5833:a2bdc0f524e8 | 5834:f507086aa94b |
---|---|
1 package de.intevation.flys.client.server; | |
2 | |
3 import org.w3c.dom.Document; | |
4 | |
5 import org.apache.log4j.Logger; | |
6 | |
7 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 | |
14 import de.intevation.flys.client.shared.exceptions.ServerException; | |
15 import de.intevation.flys.client.shared.model.Collection; | |
16 | |
17 import de.intevation.flys.client.client.services.CollectionAttributeService; | |
18 | |
19 | |
20 /** | |
21 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> | |
22 */ | |
23 public class CollectionAttributeServiceImpl | |
24 extends DescribeCollectionServiceImpl | |
25 implements CollectionAttributeService | |
26 { | |
27 private static final Logger logger = | |
28 Logger.getLogger(CollectionAttributeServiceImpl.class); | |
29 | |
30 | |
31 public static final String ERROR_UPDATING_COLLECTION_ATTRIBUTE = | |
32 "error_update_collection_attribute"; | |
33 | |
34 | |
35 public Collection update(Collection collection, String locale) | |
36 throws ServerException | |
37 { | |
38 logger.info("CollectionAttributeServiceImpl.update"); | |
39 | |
40 String url = getServletContext().getInitParameter("server-url"); | |
41 | |
42 Document attribute = CollectionHelper.createAttribute(collection); | |
43 Document action = ClientProtocolUtils.newSetAttributeDocument( | |
44 collection.identifier(), | |
45 attribute); | |
46 | |
47 try { | |
48 HttpClient http = new HttpClientImpl(url, locale); | |
49 Document res = (Document) http.doCollectionAction( | |
50 action, | |
51 collection.identifier(), | |
52 new DocumentResponseHandler()); | |
53 | |
54 logger.debug("Collection attribute successfully set."); | |
55 | |
56 return describe(collection.identifier(), locale); | |
57 } | |
58 catch (ConnectionException ce) { | |
59 logger.error(ce, ce); | |
60 } | |
61 | |
62 throw new ServerException(ERROR_UPDATING_COLLECTION_ATTRIBUTE); | |
63 } | |
64 } | |
65 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |