Mercurial > dive4elements > river
annotate flys-client/src/main/java/de/intevation/flys/client/server/LoadArtifactServiceImpl.java @ 1267:07aa1f504491
Bugfix: #323 A double click in the datacage widget triggers the DatacageDoubleClickHandler.onDoubleClick() method of all registered handlers.
flys-client/trunk@2820 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Mon, 26 Sep 2011 09:08:47 +0000 |
parents | 9976d99aea34 |
children | 2ce5d7ac9e60 |
rev | line source |
---|---|
905
478a571f1f94
Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.flys.client.server; |
478a571f1f94
Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
2 |
913
9976d99aea34
Added loadMany-function to LoadArtifactService.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
905
diff
changeset
|
3 import java.util.ArrayList; |
9976d99aea34
Added loadMany-function to LoadArtifactService.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
905
diff
changeset
|
4 |
905
478a571f1f94
Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
5 import de.intevation.flys.client.shared.exceptions.ServerException; |
478a571f1f94
Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
6 import de.intevation.flys.client.shared.model.Artifact; |
478a571f1f94
Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
7 import de.intevation.flys.client.shared.model.Collection; |
478a571f1f94
Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
8 import de.intevation.flys.client.shared.model.Recommendation; |
478a571f1f94
Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
9 |
478a571f1f94
Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
10 import de.intevation.flys.client.client.services.LoadArtifactService; |
478a571f1f94
Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
11 |
478a571f1f94
Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
12 /** |
478a571f1f94
Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
13 * This service creates a new Artifact based on a given Recommendation and puts |
478a571f1f94
Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
14 * this new artifact into a specified Collection. |
478a571f1f94
Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
15 * |
478a571f1f94
Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
16 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> |
478a571f1f94
Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
17 */ |
478a571f1f94
Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
18 public class LoadArtifactServiceImpl |
478a571f1f94
Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
19 extends ArtifactServiceImpl |
478a571f1f94
Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
20 implements LoadArtifactService |
478a571f1f94
Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
21 { |
478a571f1f94
Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
22 public static final String ERROR_LOAD_ARTIFACT = "error_load_artifact"; |
478a571f1f94
Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
23 |
478a571f1f94
Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
24 public Artifact load( |
478a571f1f94
Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
25 Collection parent, |
478a571f1f94
Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
26 Recommendation recom, |
478a571f1f94
Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
27 String factory, |
478a571f1f94
Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
28 String url, |
478a571f1f94
Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
29 String locale |
478a571f1f94
Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
30 ) |
478a571f1f94
Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
31 throws ServerException { |
478a571f1f94
Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
32 System.out.println( |
478a571f1f94
Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
33 "LoadArtifactServiceImpl.load: " + recom.getMasterArtifact()); |
478a571f1f94
Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
34 |
478a571f1f94
Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
35 // 1) Clone the Artifact specified in >>recom<< |
478a571f1f94
Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
36 Artifact clone = ArtifactHelper.createArtifact( |
478a571f1f94
Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
37 url, locale, factory, recom); |
478a571f1f94
Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
38 |
478a571f1f94
Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
39 if (clone != null) { |
478a571f1f94
Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
40 System.out.println("Successfully create Artifact Clone. Add now!"); |
478a571f1f94
Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
41 Collection c = CollectionHelper.addArtifact( |
478a571f1f94
Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
42 parent, clone, url, locale); |
478a571f1f94
Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
43 |
478a571f1f94
Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
44 if (c != null) { |
478a571f1f94
Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
45 System.out.println("Successfully added Clone to Collection."); |
478a571f1f94
Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
46 |
478a571f1f94
Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
47 return clone; |
478a571f1f94
Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
48 } |
478a571f1f94
Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
49 } |
478a571f1f94
Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
50 |
478a571f1f94
Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
51 throw new ServerException(ERROR_LOAD_ARTIFACT); |
478a571f1f94
Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
52 } |
913
9976d99aea34
Added loadMany-function to LoadArtifactService.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
905
diff
changeset
|
53 |
9976d99aea34
Added loadMany-function to LoadArtifactService.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
905
diff
changeset
|
54 public Artifact[] loadMany( |
9976d99aea34
Added loadMany-function to LoadArtifactService.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
905
diff
changeset
|
55 Collection parent, |
9976d99aea34
Added loadMany-function to LoadArtifactService.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
905
diff
changeset
|
56 Recommendation[] recoms, |
9976d99aea34
Added loadMany-function to LoadArtifactService.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
905
diff
changeset
|
57 String factory, |
9976d99aea34
Added loadMany-function to LoadArtifactService.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
905
diff
changeset
|
58 String url, |
9976d99aea34
Added loadMany-function to LoadArtifactService.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
905
diff
changeset
|
59 String locale |
9976d99aea34
Added loadMany-function to LoadArtifactService.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
905
diff
changeset
|
60 ) |
9976d99aea34
Added loadMany-function to LoadArtifactService.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
905
diff
changeset
|
61 throws ServerException { |
9976d99aea34
Added loadMany-function to LoadArtifactService.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
905
diff
changeset
|
62 System.out.println( |
9976d99aea34
Added loadMany-function to LoadArtifactService.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
905
diff
changeset
|
63 "LoadArtifactServiceImpl.loadMany: " + recoms[0].getMasterArtifact()); |
9976d99aea34
Added loadMany-function to LoadArtifactService.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
905
diff
changeset
|
64 ArrayList<Artifact> artifacts = new ArrayList<Artifact>(); |
9976d99aea34
Added loadMany-function to LoadArtifactService.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
905
diff
changeset
|
65 |
9976d99aea34
Added loadMany-function to LoadArtifactService.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
905
diff
changeset
|
66 // 1) Clone the Artifacts specified in >>recom<< |
9976d99aea34
Added loadMany-function to LoadArtifactService.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
905
diff
changeset
|
67 for (Recommendation recom : recoms) { |
9976d99aea34
Added loadMany-function to LoadArtifactService.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
905
diff
changeset
|
68 Artifact clone = ArtifactHelper.createArtifact( |
9976d99aea34
Added loadMany-function to LoadArtifactService.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
905
diff
changeset
|
69 url, locale, factory, recom); |
9976d99aea34
Added loadMany-function to LoadArtifactService.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
905
diff
changeset
|
70 |
9976d99aea34
Added loadMany-function to LoadArtifactService.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
905
diff
changeset
|
71 if (clone != null) { |
9976d99aea34
Added loadMany-function to LoadArtifactService.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
905
diff
changeset
|
72 System.out.println("Successfully create Artifact Clone. Add now!"); |
9976d99aea34
Added loadMany-function to LoadArtifactService.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
905
diff
changeset
|
73 Collection c = CollectionHelper.addArtifact( |
9976d99aea34
Added loadMany-function to LoadArtifactService.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
905
diff
changeset
|
74 parent, clone, url, locale); |
9976d99aea34
Added loadMany-function to LoadArtifactService.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
905
diff
changeset
|
75 |
9976d99aea34
Added loadMany-function to LoadArtifactService.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
905
diff
changeset
|
76 if (c != null) { |
9976d99aea34
Added loadMany-function to LoadArtifactService.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
905
diff
changeset
|
77 System.out.println("Successfully added Clone to Collection."); |
9976d99aea34
Added loadMany-function to LoadArtifactService.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
905
diff
changeset
|
78 |
9976d99aea34
Added loadMany-function to LoadArtifactService.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
905
diff
changeset
|
79 artifacts.add(clone); |
9976d99aea34
Added loadMany-function to LoadArtifactService.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
905
diff
changeset
|
80 } |
9976d99aea34
Added loadMany-function to LoadArtifactService.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
905
diff
changeset
|
81 } |
9976d99aea34
Added loadMany-function to LoadArtifactService.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
905
diff
changeset
|
82 } |
9976d99aea34
Added loadMany-function to LoadArtifactService.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
905
diff
changeset
|
83 return artifacts.toArray(new Artifact[artifacts.size()]); |
9976d99aea34
Added loadMany-function to LoadArtifactService.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
905
diff
changeset
|
84 |
9976d99aea34
Added loadMany-function to LoadArtifactService.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
905
diff
changeset
|
85 //throw new ServerException(ERROR_LOAD_ARTIFACT); |
9976d99aea34
Added loadMany-function to LoadArtifactService.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
905
diff
changeset
|
86 } |
905
478a571f1f94
Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
87 } |
478a571f1f94
Refactored server code - HTTP related code moved to ArtifactsHelper and CollectionHelper which makes us able to combine Artifact and Collection protocol stuff in a single RPC service.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
88 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |