Mercurial > dive4elements > river
annotate flys-client/src/main/java/de/intevation/flys/client/server/LoadArtifactServiceImpl.java @ 5261:1e403a0efc21
ImportRiver: Light cleaning up, waterlevelimport more parralel to other imports.
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Wed, 13 Mar 2013 09:19:33 +0100 |
parents | 51ed89b754ae |
children |
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; |
1307
489e6a82fe84
Partial fix for flys/issue304 (Erweiterte Funktionen W-Differenzen).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1272
diff
changeset
|
4 import java.util.HashMap; |
913
9976d99aea34
Added loadMany-function to LoadArtifactService.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
905
diff
changeset
|
5 |
1367
ab8eb2f544f2
Replaced stdout and stderr logging with log4j loggers in server classes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1346
diff
changeset
|
6 import org.apache.log4j.Logger; |
ab8eb2f544f2
Replaced stdout and stderr logging with log4j loggers in server classes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1346
diff
changeset
|
7 |
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
|
8 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
|
9 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
|
10 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
|
11 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
|
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 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
|
14 |
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 * 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
|
17 * 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
|
18 * |
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 * @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
|
20 */ |
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 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
|
22 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
|
23 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
|
24 { |
1367
ab8eb2f544f2
Replaced stdout and stderr logging with log4j loggers in server classes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1346
diff
changeset
|
25 private static final Logger logger = |
ab8eb2f544f2
Replaced stdout and stderr logging with log4j loggers in server classes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1346
diff
changeset
|
26 Logger.getLogger(LoadArtifactServiceImpl.class); |
ab8eb2f544f2
Replaced stdout and stderr logging with log4j loggers in server classes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1346
diff
changeset
|
27 |
1442
4a6814be92ba
Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
28 /** Error. */ |
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
|
29 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
|
30 |
1346
a3c04eb326f3
Allowed to load Artifacts with different factories in one go.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1307
diff
changeset
|
31 |
a3c04eb326f3
Allowed to load Artifacts with different factories in one go.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1307
diff
changeset
|
32 /** |
a3c04eb326f3
Allowed to load Artifacts with different factories in one go.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1307
diff
changeset
|
33 * Clones or creates a single artifact and adds it to a collection. |
a3c04eb326f3
Allowed to load Artifacts with different factories in one go.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1307
diff
changeset
|
34 * |
a3c04eb326f3
Allowed to load Artifacts with different factories in one go.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1307
diff
changeset
|
35 * Note that in contrast to loadMany, always the given factory is used |
a3c04eb326f3
Allowed to load Artifacts with different factories in one go.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1307
diff
changeset
|
36 * to clone the artifact. |
a3c04eb326f3
Allowed to load Artifacts with different factories in one go.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1307
diff
changeset
|
37 * |
a3c04eb326f3
Allowed to load Artifacts with different factories in one go.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1307
diff
changeset
|
38 * @param parent collection to add recommendation to. |
a3c04eb326f3
Allowed to load Artifacts with different factories in one go.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1307
diff
changeset
|
39 * @param recom recommendation to create clone for. |
a3c04eb326f3
Allowed to load Artifacts with different factories in one go.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1307
diff
changeset
|
40 * @param factory factory to use. |
a3c04eb326f3
Allowed to load Artifacts with different factories in one go.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1307
diff
changeset
|
41 * @param locale the locale to translate messages. |
a3c04eb326f3
Allowed to load Artifacts with different factories in one go.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1307
diff
changeset
|
42 */ |
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
|
43 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
|
44 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
|
45 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
|
46 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
|
47 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
|
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 throws ServerException { |
1367
ab8eb2f544f2
Replaced stdout and stderr logging with log4j loggers in server classes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1346
diff
changeset
|
50 logger.info( |
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
|
51 "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
|
52 |
1425
bc06a671ef60
Removed the URL parameter from service calls. The service
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1413
diff
changeset
|
53 String url = getServletContext().getInitParameter("server-url"); |
bc06a671ef60
Removed the URL parameter from service calls. The service
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1413
diff
changeset
|
54 |
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
|
55 // 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
|
56 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
|
57 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
|
58 |
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
|
59 if (clone != null) { |
1367
ab8eb2f544f2
Replaced stdout and stderr logging with log4j loggers in server classes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1346
diff
changeset
|
60 logger.debug("Successfully create Artifact Clone. Add now!"); |
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
|
61 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
|
62 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
|
63 |
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
|
64 if (c != null) { |
1367
ab8eb2f544f2
Replaced stdout and stderr logging with log4j loggers in server classes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1346
diff
changeset
|
65 logger.debug("Successfully added Clone to Collection."); |
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
|
66 |
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
|
67 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
|
68 } |
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
|
69 } |
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
|
70 |
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
|
71 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
|
72 } |
913
9976d99aea34
Added loadMany-function to LoadArtifactService.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
905
diff
changeset
|
73 |
1272
2ce5d7ac9e60
Cosmetics, documentation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
913
diff
changeset
|
74 |
2ce5d7ac9e60
Cosmetics, documentation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
913
diff
changeset
|
75 /** |
1346
a3c04eb326f3
Allowed to load Artifacts with different factories in one go.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1307
diff
changeset
|
76 * Clone/create one or more artifacts and add it to a collection, avoiding |
a3c04eb326f3
Allowed to load Artifacts with different factories in one go.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1307
diff
changeset
|
77 * duplicates. |
1272
2ce5d7ac9e60
Cosmetics, documentation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
913
diff
changeset
|
78 * |
1346
a3c04eb326f3
Allowed to load Artifacts with different factories in one go.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1307
diff
changeset
|
79 * @param parent Collection where clones will be added to. |
a3c04eb326f3
Allowed to load Artifacts with different factories in one go.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1307
diff
changeset
|
80 * @param recoms definitions of source of clone. |
a3c04eb326f3
Allowed to load Artifacts with different factories in one go.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1307
diff
changeset
|
81 * @param factory name of factory to use when cloning artifacts (can be |
a3c04eb326f3
Allowed to load Artifacts with different factories in one go.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1307
diff
changeset
|
82 * null in which case the recommendations getFactory() will |
a3c04eb326f3
Allowed to load Artifacts with different factories in one go.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1307
diff
changeset
|
83 * be used. |
a3c04eb326f3
Allowed to load Artifacts with different factories in one go.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1307
diff
changeset
|
84 * @param locale the locale to translate messages. |
a3c04eb326f3
Allowed to load Artifacts with different factories in one go.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1307
diff
changeset
|
85 * |
1307
489e6a82fe84
Partial fix for flys/issue304 (Erweiterte Funktionen W-Differenzen).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1272
diff
changeset
|
86 * @return cloned artifacts (same artifact might be contained multiple |
489e6a82fe84
Partial fix for flys/issue304 (Erweiterte Funktionen W-Differenzen).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1272
diff
changeset
|
87 * times). |
1272
2ce5d7ac9e60
Cosmetics, documentation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
913
diff
changeset
|
88 */ |
913
9976d99aea34
Added loadMany-function to LoadArtifactService.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
905
diff
changeset
|
89 public Artifact[] loadMany( |
1272
2ce5d7ac9e60
Cosmetics, documentation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
913
diff
changeset
|
90 Collection parent, |
913
9976d99aea34
Added loadMany-function to LoadArtifactService.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
905
diff
changeset
|
91 Recommendation[] recoms, |
1272
2ce5d7ac9e60
Cosmetics, documentation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
913
diff
changeset
|
92 String factory, |
2ce5d7ac9e60
Cosmetics, documentation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
913
diff
changeset
|
93 String locale |
913
9976d99aea34
Added loadMany-function to LoadArtifactService.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
905
diff
changeset
|
94 ) |
9976d99aea34
Added loadMany-function to LoadArtifactService.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
905
diff
changeset
|
95 throws ServerException { |
1367
ab8eb2f544f2
Replaced stdout and stderr logging with log4j loggers in server classes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1346
diff
changeset
|
96 logger.debug("LoadArtifactServiceImpl.loadMany"); |
1346
a3c04eb326f3
Allowed to load Artifacts with different factories in one go.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1307
diff
changeset
|
97 |
1413
0d3bbe4240b1
Refactored the LoadArtifactService a bit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1367
diff
changeset
|
98 String url = getServletContext().getInitParameter("server-url"); |
0d3bbe4240b1
Refactored the LoadArtifactService a bit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1367
diff
changeset
|
99 |
913
9976d99aea34
Added loadMany-function to LoadArtifactService.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
905
diff
changeset
|
100 ArrayList<Artifact> artifacts = new ArrayList<Artifact>(); |
1307
489e6a82fe84
Partial fix for flys/issue304 (Erweiterte Funktionen W-Differenzen).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1272
diff
changeset
|
101 HashMap<Recommendation, Artifact> cloneMap = |
489e6a82fe84
Partial fix for flys/issue304 (Erweiterte Funktionen W-Differenzen).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1272
diff
changeset
|
102 new HashMap<Recommendation, Artifact>(); |
913
9976d99aea34
Added loadMany-function to LoadArtifactService.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
905
diff
changeset
|
103 |
1272
2ce5d7ac9e60
Cosmetics, documentation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
913
diff
changeset
|
104 // TODO Respect the index of what to clone. |
2ce5d7ac9e60
Cosmetics, documentation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
913
diff
changeset
|
105 |
1307
489e6a82fe84
Partial fix for flys/issue304 (Erweiterte Funktionen W-Differenzen).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1272
diff
changeset
|
106 // 1) Clone the Artifacts specified in >>recoms<< |
913
9976d99aea34
Added loadMany-function to LoadArtifactService.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
905
diff
changeset
|
107 for (Recommendation recom : recoms) { |
1307
489e6a82fe84
Partial fix for flys/issue304 (Erweiterte Funktionen W-Differenzen).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1272
diff
changeset
|
108 // Do not do two clones of two identical recommendations. |
489e6a82fe84
Partial fix for flys/issue304 (Erweiterte Funktionen W-Differenzen).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1272
diff
changeset
|
109 Artifact prevClone = cloneMap.get(recom); |
489e6a82fe84
Partial fix for flys/issue304 (Erweiterte Funktionen W-Differenzen).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1272
diff
changeset
|
110 if (prevClone != null) { |
489e6a82fe84
Partial fix for flys/issue304 (Erweiterte Funktionen W-Differenzen).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1272
diff
changeset
|
111 // Already cloned a recommendation like this. |
1367
ab8eb2f544f2
Replaced stdout and stderr logging with log4j loggers in server classes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1346
diff
changeset
|
112 logger.debug("LoadArtifactServiceImpl: Avoid reclones, " |
1307
489e6a82fe84
Partial fix for flys/issue304 (Erweiterte Funktionen W-Differenzen).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1272
diff
changeset
|
113 + "clone already exists."); |
489e6a82fe84
Partial fix for flys/issue304 (Erweiterte Funktionen W-Differenzen).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1272
diff
changeset
|
114 artifacts.add(prevClone); |
489e6a82fe84
Partial fix for flys/issue304 (Erweiterte Funktionen W-Differenzen).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1272
diff
changeset
|
115 } |
489e6a82fe84
Partial fix for flys/issue304 (Erweiterte Funktionen W-Differenzen).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1272
diff
changeset
|
116 else { |
489e6a82fe84
Partial fix for flys/issue304 (Erweiterte Funktionen W-Differenzen).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1272
diff
changeset
|
117 // Not already cloned. |
1346
a3c04eb326f3
Allowed to load Artifacts with different factories in one go.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1307
diff
changeset
|
118 String realFactory = factory != null |
a3c04eb326f3
Allowed to load Artifacts with different factories in one go.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1307
diff
changeset
|
119 ? factory |
a3c04eb326f3
Allowed to load Artifacts with different factories in one go.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1307
diff
changeset
|
120 : recom.getFactory(); |
a3c04eb326f3
Allowed to load Artifacts with different factories in one go.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1307
diff
changeset
|
121 |
1367
ab8eb2f544f2
Replaced stdout and stderr logging with log4j loggers in server classes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1346
diff
changeset
|
122 logger.debug("One will be cloned with : " + realFactory); |
1346
a3c04eb326f3
Allowed to load Artifacts with different factories in one go.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1307
diff
changeset
|
123 |
1307
489e6a82fe84
Partial fix for flys/issue304 (Erweiterte Funktionen W-Differenzen).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1272
diff
changeset
|
124 Artifact clone = ArtifactHelper.createArtifact( |
1346
a3c04eb326f3
Allowed to load Artifacts with different factories in one go.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1307
diff
changeset
|
125 url, locale, realFactory, recom); |
2905
51ed89b754ae
FLYS client: Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1442
diff
changeset
|
126 |
1307
489e6a82fe84
Partial fix for flys/issue304 (Erweiterte Funktionen W-Differenzen).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1272
diff
changeset
|
127 if (clone != null) { |
1367
ab8eb2f544f2
Replaced stdout and stderr logging with log4j loggers in server classes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1346
diff
changeset
|
128 logger.debug("LoadArtifactServiceImple: Successfully " |
1307
489e6a82fe84
Partial fix for flys/issue304 (Erweiterte Funktionen W-Differenzen).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1272
diff
changeset
|
129 + "loaded Artifact Clone."); |
489e6a82fe84
Partial fix for flys/issue304 (Erweiterte Funktionen W-Differenzen).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1272
diff
changeset
|
130 Collection c = CollectionHelper.addArtifact( |
489e6a82fe84
Partial fix for flys/issue304 (Erweiterte Funktionen W-Differenzen).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1272
diff
changeset
|
131 parent, clone, url, locale); |
2905
51ed89b754ae
FLYS client: Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1442
diff
changeset
|
132 |
1307
489e6a82fe84
Partial fix for flys/issue304 (Erweiterte Funktionen W-Differenzen).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1272
diff
changeset
|
133 if (c != null) { |
489e6a82fe84
Partial fix for flys/issue304 (Erweiterte Funktionen W-Differenzen).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1272
diff
changeset
|
134 artifacts.add(clone); |
489e6a82fe84
Partial fix for flys/issue304 (Erweiterte Funktionen W-Differenzen).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1272
diff
changeset
|
135 // Remember we cloned a recommendation like this. |
489e6a82fe84
Partial fix for flys/issue304 (Erweiterte Funktionen W-Differenzen).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1272
diff
changeset
|
136 cloneMap.put(recom, clone); |
489e6a82fe84
Partial fix for flys/issue304 (Erweiterte Funktionen W-Differenzen).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1272
diff
changeset
|
137 } |
489e6a82fe84
Partial fix for flys/issue304 (Erweiterte Funktionen W-Differenzen).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1272
diff
changeset
|
138 else { |
489e6a82fe84
Partial fix for flys/issue304 (Erweiterte Funktionen W-Differenzen).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1272
diff
changeset
|
139 throw new ServerException(ERROR_LOAD_ARTIFACT); |
489e6a82fe84
Partial fix for flys/issue304 (Erweiterte Funktionen W-Differenzen).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1272
diff
changeset
|
140 } |
913
9976d99aea34
Added loadMany-function to LoadArtifactService.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
905
diff
changeset
|
141 } |
9976d99aea34
Added loadMany-function to LoadArtifactService.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
905
diff
changeset
|
142 } |
9976d99aea34
Added loadMany-function to LoadArtifactService.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
905
diff
changeset
|
143 } |
9976d99aea34
Added loadMany-function to LoadArtifactService.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
905
diff
changeset
|
144 return artifacts.toArray(new Artifact[artifacts.size()]); |
9976d99aea34
Added loadMany-function to LoadArtifactService.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
905
diff
changeset
|
145 } |
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
|
146 } |
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
|
147 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |