annotate gwt-client/src/main/java/org/dive4elements/river/client/server/CollectionAttributeServiceImpl.java @ 5861:172338b1407f

GWT client: Added copyright header.
author Sascha L. Teichmann <teichmann@intevation.de>
date Sun, 28 Apr 2013 14:30:15 +0200
parents 5aa05a7a34b7
children ea9eef426962
rev   line source
5861
172338b1407f GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
1 /* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde
172338b1407f GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
2 * Software engineering by Intevation GmbH
172338b1407f GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
3 *
172338b1407f GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
4 * This file is Free Software under the GNU AGPL (>=v3)
172338b1407f GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
5 * and comes with ABSOLUTELY NO WARRANTY! Check out the
172338b1407f GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
6 * documentation coming with Dive4Elements River for details.
172338b1407f GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
7 */
172338b1407f GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
8
5835
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
9 package org.dive4elements.river.client.server;
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
10
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
11 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
12
1367
ab8eb2f544f2 Replaced stdout and stderr logging with log4j loggers in server classes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 530
diff changeset
13 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
14
5835
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
15 import org.dive4elements.artifacts.common.utils.ClientProtocolUtils;
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
16
5835
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
17 import org.dive4elements.artifacts.httpclient.exceptions.ConnectionException;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
18 import org.dive4elements.artifacts.httpclient.http.HttpClient;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
19 import org.dive4elements.artifacts.httpclient.http.HttpClientImpl;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
20 import org.dive4elements.artifacts.httpclient.http.response.DocumentResponseHandler;
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
21
5835
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
22 import org.dive4elements.river.client.shared.exceptions.ServerException;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
23 import org.dive4elements.river.client.shared.model.Collection;
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
24
5835
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
25 import org.dive4elements.river.client.client.services.CollectionAttributeService;
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
26
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
27
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
28 /**
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
29 * @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
30 */
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
31 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
32 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
33 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
34 {
1367
ab8eb2f544f2 Replaced stdout and stderr logging with log4j loggers in server classes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 530
diff changeset
35 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
36 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
37
ab8eb2f544f2 Replaced stdout and stderr logging with log4j loggers in server classes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 530
diff changeset
38
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
39 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
40 "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
41
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
1425
bc06a671ef60 Removed the URL parameter from service calls. The service
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1367
diff changeset
43 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
44 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
45 {
1367
ab8eb2f544f2 Replaced stdout and stderr logging with log4j loggers in server classes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 530
diff changeset
46 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
47
1425
bc06a671ef60 Removed the URL parameter from service calls. The service
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1367
diff changeset
48 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
49
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
50 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
51 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
52 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
53 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
54
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
55 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
56 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
57 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
58 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
59 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
60 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
61
1367
ab8eb2f544f2 Replaced stdout and stderr logging with log4j loggers in server classes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 530
diff changeset
62 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
63
1425
bc06a671ef60 Removed the URL parameter from service calls. The service
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1367
diff changeset
64 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
65 }
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
66 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
67 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
68 }
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
69
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
70 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
71 }
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
72 }
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
73 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org