Mercurial > dive4elements > river
annotate flys-client/src/main/java/de/intevation/flys/client/server/CollectionAttributeServiceImpl.java @ 4394:94c6715430de
minfo.xml: Add annotations to compat list of flow-velocity outs.
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Mon, 05 Nov 2012 09:21:02 +0100 |
parents | bc06a671ef60 |
children |
rev | line source |
---|---|
526
96e60e0a4345
Added a service stub to update/modify the attribute of a collection (used in the theme control panel).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.flys.client.server; |
96e60e0a4345
Added a service stub to update/modify the attribute of a collection (used in the theme control panel).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
2 |
530
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
526
diff
changeset
|
3 import org.w3c.dom.Document; |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
526
diff
changeset
|
4 |
1367
ab8eb2f544f2
Replaced stdout and stderr logging with log4j loggers in server classes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
530
diff
changeset
|
5 import org.apache.log4j.Logger; |
ab8eb2f544f2
Replaced stdout and stderr logging with log4j loggers in server classes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
530
diff
changeset
|
6 |
530
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
526
diff
changeset
|
7 import de.intevation.artifacts.common.utils.ClientProtocolUtils; |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
526
diff
changeset
|
8 |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
526
diff
changeset
|
9 import de.intevation.artifacts.httpclient.exceptions.ConnectionException; |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
526
diff
changeset
|
10 import de.intevation.artifacts.httpclient.http.HttpClient; |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
526
diff
changeset
|
11 import de.intevation.artifacts.httpclient.http.HttpClientImpl; |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
526
diff
changeset
|
12 import de.intevation.artifacts.httpclient.http.response.DocumentResponseHandler; |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
526
diff
changeset
|
13 |
526
96e60e0a4345
Added a service stub to update/modify the attribute of a collection (used in the theme control panel).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
14 import de.intevation.flys.client.shared.exceptions.ServerException; |
96e60e0a4345
Added a service stub to update/modify the attribute of a collection (used in the theme control panel).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
15 import de.intevation.flys.client.shared.model.Collection; |
96e60e0a4345
Added a service stub to update/modify the attribute of a collection (used in the theme control panel).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
16 |
96e60e0a4345
Added a service stub to update/modify the attribute of a collection (used in the theme control panel).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
17 import de.intevation.flys.client.client.services.CollectionAttributeService; |
96e60e0a4345
Added a service stub to update/modify the attribute of a collection (used in the theme control panel).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
18 |
96e60e0a4345
Added a service stub to update/modify the attribute of a collection (used in the theme control panel).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
19 |
96e60e0a4345
Added a service stub to update/modify the attribute of a collection (used in the theme control panel).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
20 /** |
96e60e0a4345
Added a service stub to update/modify the attribute of a collection (used in the theme control panel).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
21 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> |
96e60e0a4345
Added a service stub to update/modify the attribute of a collection (used in the theme control panel).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
22 */ |
96e60e0a4345
Added a service stub to update/modify the attribute of a collection (used in the theme control panel).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
23 public class CollectionAttributeServiceImpl |
96e60e0a4345
Added a service stub to update/modify the attribute of a collection (used in the theme control panel).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
24 extends DescribeCollectionServiceImpl |
96e60e0a4345
Added a service stub to update/modify the attribute of a collection (used in the theme control panel).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
25 implements CollectionAttributeService |
96e60e0a4345
Added a service stub to update/modify the attribute of a collection (used in the theme control panel).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
26 { |
1367
ab8eb2f544f2
Replaced stdout and stderr logging with log4j loggers in server classes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
530
diff
changeset
|
27 private static final Logger logger = |
ab8eb2f544f2
Replaced stdout and stderr logging with log4j loggers in server classes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
530
diff
changeset
|
28 Logger.getLogger(CollectionAttributeServiceImpl.class); |
ab8eb2f544f2
Replaced stdout and stderr logging with log4j loggers in server classes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
530
diff
changeset
|
29 |
ab8eb2f544f2
Replaced stdout and stderr logging with log4j loggers in server classes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
530
diff
changeset
|
30 |
530
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
526
diff
changeset
|
31 public static final String ERROR_UPDATING_COLLECTION_ATTRIBUTE = |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
526
diff
changeset
|
32 "error_update_collection_attribute"; |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
526
diff
changeset
|
33 |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
526
diff
changeset
|
34 |
1425
bc06a671ef60
Removed the URL parameter from service calls. The service
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1367
diff
changeset
|
35 public Collection update(Collection collection, String locale) |
526
96e60e0a4345
Added a service stub to update/modify the attribute of a collection (used in the theme control panel).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
36 throws ServerException |
96e60e0a4345
Added a service stub to update/modify the attribute of a collection (used in the theme control panel).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
37 { |
1367
ab8eb2f544f2
Replaced stdout and stderr logging with log4j loggers in server classes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
530
diff
changeset
|
38 logger.info("CollectionAttributeServiceImpl.update"); |
526
96e60e0a4345
Added a service stub to update/modify the attribute of a collection (used in the theme control panel).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
39 |
1425
bc06a671ef60
Removed the URL parameter from service calls. The service
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1367
diff
changeset
|
40 String url = getServletContext().getInitParameter("server-url"); |
bc06a671ef60
Removed the URL parameter from service calls. The service
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1367
diff
changeset
|
41 |
530
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
526
diff
changeset
|
42 Document attribute = CollectionHelper.createAttribute(collection); |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
526
diff
changeset
|
43 Document action = ClientProtocolUtils.newSetAttributeDocument( |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
526
diff
changeset
|
44 collection.identifier(), |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
526
diff
changeset
|
45 attribute); |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
526
diff
changeset
|
46 |
526
96e60e0a4345
Added a service stub to update/modify the attribute of a collection (used in the theme control panel).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
47 try { |
530
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
526
diff
changeset
|
48 HttpClient http = new HttpClientImpl(url, locale); |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
526
diff
changeset
|
49 Document res = (Document) http.doCollectionAction( |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
526
diff
changeset
|
50 action, |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
526
diff
changeset
|
51 collection.identifier(), |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
526
diff
changeset
|
52 new DocumentResponseHandler()); |
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
526
diff
changeset
|
53 |
1367
ab8eb2f544f2
Replaced stdout and stderr logging with log4j loggers in server classes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
530
diff
changeset
|
54 logger.debug("Collection attribute successfully set."); |
530
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
526
diff
changeset
|
55 |
1425
bc06a671ef60
Removed the URL parameter from service calls. The service
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1367
diff
changeset
|
56 return describe(collection.identifier(), locale); |
526
96e60e0a4345
Added a service stub to update/modify the attribute of a collection (used in the theme control panel).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
57 } |
530
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
526
diff
changeset
|
58 catch (ConnectionException ce) { |
1367
ab8eb2f544f2
Replaced stdout and stderr logging with log4j loggers in server classes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
530
diff
changeset
|
59 logger.error(ce, ce); |
526
96e60e0a4345
Added a service stub to update/modify the attribute of a collection (used in the theme control panel).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
60 } |
96e60e0a4345
Added a service stub to update/modify the attribute of a collection (used in the theme control panel).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
61 |
530
26e38b79658d
Connected the CollectionAttributeService with the artifact server - Collection modifications will now be stored in the artifact databae.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
526
diff
changeset
|
62 throw new ServerException(ERROR_UPDATING_COLLECTION_ATTRIBUTE); |
526
96e60e0a4345
Added a service stub to update/modify the attribute of a collection (used in the theme control panel).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
63 } |
96e60e0a4345
Added a service stub to update/modify the attribute of a collection (used in the theme control panel).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
64 } |
96e60e0a4345
Added a service stub to update/modify the attribute of a collection (used in the theme control panel).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
65 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |