Mercurial > dive4elements > river
annotate flys-client/src/main/java/de/intevation/flys/client/server/ArtifactServiceImpl.java @ 809:e9337488bac3
The Collection now knows its already loaded recommendations - the CollectionView will not load recommendations that have already been loaded before.
flys-client/trunk@2397 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Fri, 22 Jul 2011 12:23:36 +0000 |
parents | 6f65e70fa11d |
children | 78ef14dc1877 |
rev | line source |
---|---|
11
6aeb4072eeb4
Added interfaces and a stub implementation of an artifact service the should provide the methods for communicating with the artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.flys.client.server; |
6aeb4072eeb4
Added interfaces and a stub implementation of an artifact service the should provide the methods for communicating with the artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
2 |
6aeb4072eeb4
Added interfaces and a stub implementation of an artifact service the should provide the methods for communicating with the artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
3 import org.w3c.dom.Document; |
6aeb4072eeb4
Added interfaces and a stub implementation of an artifact service the should provide the methods for communicating with the artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
4 |
6aeb4072eeb4
Added interfaces and a stub implementation of an artifact service the should provide the methods for communicating with the artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
5 import com.google.gwt.user.server.rpc.RemoteServiceServlet; |
6aeb4072eeb4
Added interfaces and a stub implementation of an artifact service the should provide the methods for communicating with the artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
6 |
14
fe2f4d1dd784
Integrated the httpclient for the communication between client and server. It is now possible to create a new WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
11
diff
changeset
|
7 import de.intevation.artifacts.common.utils.ClientProtocolUtils; |
11
6aeb4072eeb4
Added interfaces and a stub implementation of an artifact service the should provide the methods for communicating with the artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
8 |
14
fe2f4d1dd784
Integrated the httpclient for the communication between client and server. It is now possible to create a new WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
11
diff
changeset
|
9 import de.intevation.artifacts.httpclient.exceptions.ConnectionException; |
fe2f4d1dd784
Integrated the httpclient for the communication between client and server. It is now possible to create a new WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
11
diff
changeset
|
10 import de.intevation.artifacts.httpclient.http.HttpClient; |
fe2f4d1dd784
Integrated the httpclient for the communication between client and server. It is now possible to create a new WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
11
diff
changeset
|
11 import de.intevation.artifacts.httpclient.http.HttpClientImpl; |
11
6aeb4072eeb4
Added interfaces and a stub implementation of an artifact service the should provide the methods for communicating with the artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
12 |
215
e02f50a3ad59
Improved the exception handling of artifact / collection specific operations. Warning dialog are displayed after such an exception.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
14
diff
changeset
|
13 import de.intevation.flys.client.shared.exceptions.ServerException; |
11
6aeb4072eeb4
Added interfaces and a stub implementation of an artifact service the should provide the methods for communicating with the artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
14 import de.intevation.flys.client.shared.model.Artifact; |
6aeb4072eeb4
Added interfaces and a stub implementation of an artifact service the should provide the methods for communicating with the artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
15 import de.intevation.flys.client.client.services.ArtifactService; |
6aeb4072eeb4
Added interfaces and a stub implementation of an artifact service the should provide the methods for communicating with the artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
16 |
6aeb4072eeb4
Added interfaces and a stub implementation of an artifact service the should provide the methods for communicating with the artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
17 |
6aeb4072eeb4
Added interfaces and a stub implementation of an artifact service the should provide the methods for communicating with the artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
18 /** |
6aeb4072eeb4
Added interfaces and a stub implementation of an artifact service the should provide the methods for communicating with the artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
19 * This interface provides artifact specific services as CREATE, DESCRIBE, FEED, |
6aeb4072eeb4
Added interfaces and a stub implementation of an artifact service the should provide the methods for communicating with the artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
20 * ADVANCE and OUT. |
6aeb4072eeb4
Added interfaces and a stub implementation of an artifact service the should provide the methods for communicating with the artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
21 * |
6aeb4072eeb4
Added interfaces and a stub implementation of an artifact service the should provide the methods for communicating with the artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
22 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> |
6aeb4072eeb4
Added interfaces and a stub implementation of an artifact service the should provide the methods for communicating with the artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
23 */ |
6aeb4072eeb4
Added interfaces and a stub implementation of an artifact service the should provide the methods for communicating with the artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
24 public class ArtifactServiceImpl |
6aeb4072eeb4
Added interfaces and a stub implementation of an artifact service the should provide the methods for communicating with the artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
25 extends RemoteServiceServlet |
6aeb4072eeb4
Added interfaces and a stub implementation of an artifact service the should provide the methods for communicating with the artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
26 implements ArtifactService |
6aeb4072eeb4
Added interfaces and a stub implementation of an artifact service the should provide the methods for communicating with the artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
27 { |
215
e02f50a3ad59
Improved the exception handling of artifact / collection specific operations. Warning dialog are displayed after such an exception.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
14
diff
changeset
|
28 /** The error message key that is thrown if an error occured while artifact |
e02f50a3ad59
Improved the exception handling of artifact / collection specific operations. Warning dialog are displayed after such an exception.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
14
diff
changeset
|
29 * creation.*/ |
e02f50a3ad59
Improved the exception handling of artifact / collection specific operations. Warning dialog are displayed after such an exception.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
14
diff
changeset
|
30 public static final String ERROR_CREATE_ARTIFACT = "error_create_artifact"; |
e02f50a3ad59
Improved the exception handling of artifact / collection specific operations. Warning dialog are displayed after such an exception.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
14
diff
changeset
|
31 |
e02f50a3ad59
Improved the exception handling of artifact / collection specific operations. Warning dialog are displayed after such an exception.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
14
diff
changeset
|
32 |
803
653ae84533e7
Read/create recommended Artifacts and add them to the current Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
229
diff
changeset
|
33 public Artifact create( |
807
6f65e70fa11d
Repaired broken recommendation parsing from Artifact's DESCRIBE document (which structure has changed).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
803
diff
changeset
|
34 String serverUrl, |
6f65e70fa11d
Repaired broken recommendation parsing from Artifact's DESCRIBE document (which structure has changed).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
803
diff
changeset
|
35 String locale, |
6f65e70fa11d
Repaired broken recommendation parsing from Artifact's DESCRIBE document (which structure has changed).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
803
diff
changeset
|
36 String factory, |
6f65e70fa11d
Repaired broken recommendation parsing from Artifact's DESCRIBE document (which structure has changed).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
803
diff
changeset
|
37 String uuid, |
6f65e70fa11d
Repaired broken recommendation parsing from Artifact's DESCRIBE document (which structure has changed).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
803
diff
changeset
|
38 String ids) |
215
e02f50a3ad59
Improved the exception handling of artifact / collection specific operations. Warning dialog are displayed after such an exception.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
14
diff
changeset
|
39 throws ServerException |
e02f50a3ad59
Improved the exception handling of artifact / collection specific operations. Warning dialog are displayed after such an exception.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
14
diff
changeset
|
40 { |
229
924da6695800
Each service is now called with the name of the current locale to set the request object's locale manually in the HttpClient.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
215
diff
changeset
|
41 System.out.println("ArtifactServiceImpl.create"); |
924da6695800
Each service is now called with the name of the current locale to set the request object's locale manually in the HttpClient.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
215
diff
changeset
|
42 |
803
653ae84533e7
Read/create recommended Artifacts and add them to the current Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
229
diff
changeset
|
43 Document create = null; |
653ae84533e7
Read/create recommended Artifacts and add them to the current Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
229
diff
changeset
|
44 |
653ae84533e7
Read/create recommended Artifacts and add them to the current Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
229
diff
changeset
|
45 if (uuid != null && uuid.length() > 0) { |
807
6f65e70fa11d
Repaired broken recommendation parsing from Artifact's DESCRIBE document (which structure has changed).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
803
diff
changeset
|
46 create = ClientProtocolUtils.newCreateDocument(factory, uuid, ids); |
803
653ae84533e7
Read/create recommended Artifacts and add them to the current Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
229
diff
changeset
|
47 } |
653ae84533e7
Read/create recommended Artifacts and add them to the current Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
229
diff
changeset
|
48 else { |
653ae84533e7
Read/create recommended Artifacts and add them to the current Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
229
diff
changeset
|
49 create = ClientProtocolUtils.newCreateDocument(factory); |
653ae84533e7
Read/create recommended Artifacts and add them to the current Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
229
diff
changeset
|
50 } |
653ae84533e7
Read/create recommended Artifacts and add them to the current Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
229
diff
changeset
|
51 |
229
924da6695800
Each service is now called with the name of the current locale to set the request object's locale manually in the HttpClient.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
215
diff
changeset
|
52 HttpClient client = new HttpClientImpl(serverUrl, locale); |
11
6aeb4072eeb4
Added interfaces and a stub implementation of an artifact service the should provide the methods for communicating with the artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
53 |
14
fe2f4d1dd784
Integrated the httpclient for the communication between client and server. It is now possible to create a new WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
11
diff
changeset
|
54 try { |
fe2f4d1dd784
Integrated the httpclient for the communication between client and server. It is now possible to create a new WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
11
diff
changeset
|
55 return (Artifact) client.create(create, new FLYSArtifactCreator()); |
fe2f4d1dd784
Integrated the httpclient for the communication between client and server. It is now possible to create a new WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
11
diff
changeset
|
56 } |
fe2f4d1dd784
Integrated the httpclient for the communication between client and server. It is now possible to create a new WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
11
diff
changeset
|
57 catch (ConnectionException ce) { |
fe2f4d1dd784
Integrated the httpclient for the communication between client and server. It is now possible to create a new WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
11
diff
changeset
|
58 System.err.println(ce.getLocalizedMessage()); |
fe2f4d1dd784
Integrated the httpclient for the communication between client and server. It is now possible to create a new WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
11
diff
changeset
|
59 } |
fe2f4d1dd784
Integrated the httpclient for the communication between client and server. It is now possible to create a new WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
11
diff
changeset
|
60 |
215
e02f50a3ad59
Improved the exception handling of artifact / collection specific operations. Warning dialog are displayed after such an exception.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
14
diff
changeset
|
61 throw new ServerException(ERROR_CREATE_ARTIFACT); |
11
6aeb4072eeb4
Added interfaces and a stub implementation of an artifact service the should provide the methods for communicating with the artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
62 } |
6aeb4072eeb4
Added interfaces and a stub implementation of an artifact service the should provide the methods for communicating with the artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
63 } |
6aeb4072eeb4
Added interfaces and a stub implementation of an artifact service the should provide the methods for communicating with the artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
64 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |