Mercurial > dive4elements > river
annotate gwt-client/src/main/java/org/dive4elements/river/client/server/LoadArtifactServiceImpl.java @ 8710:093146703b98
Improve ArtifactHelper creation debug output
author | Andre Heinecke <andre.heinecke@intevation.de> |
---|---|
date | Fri, 24 Apr 2015 15:57:49 +0200 |
parents | 238fc722f87a |
children | 0a5239a1e46e |
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 * |
5993
ea9eef426962
Removed trailing whitespace.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5861
diff
changeset
|
4 * This file is Free Software under the GNU AGPL (>=v3) |
5861
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 |
5993
ea9eef426962
Removed trailing whitespace.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5861
diff
changeset
|
6 * documentation coming with Dive4Elements River for details. |
5861
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; |
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
|
10 |
913
9976d99aea34
Added loadMany-function to LoadArtifactService.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
905
diff
changeset
|
11 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
|
12 import java.util.HashMap; |
913
9976d99aea34
Added loadMany-function to LoadArtifactService.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
905
diff
changeset
|
13 |
1367
ab8eb2f544f2
Replaced stdout and stderr logging with log4j loggers in server classes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1346
diff
changeset
|
14 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
|
15 |
5835
821a02bbfb4e
Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5834
diff
changeset
|
16 import org.dive4elements.river.client.shared.exceptions.ServerException; |
821a02bbfb4e
Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5834
diff
changeset
|
17 import org.dive4elements.river.client.shared.model.Artifact; |
821a02bbfb4e
Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5834
diff
changeset
|
18 import org.dive4elements.river.client.shared.model.Collection; |
821a02bbfb4e
Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5834
diff
changeset
|
19 import org.dive4elements.river.client.shared.model.Recommendation; |
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
|
20 |
5835
821a02bbfb4e
Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5834
diff
changeset
|
21 import org.dive4elements.river.client.client.services.LoadArtifactService; |
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
|
22 |
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 * 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
|
25 * 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
|
26 * |
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 * @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
|
28 */ |
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 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
|
30 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
|
31 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
|
32 { |
8203
238fc722f87a
sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5993
diff
changeset
|
33 private static final Logger log = |
1367
ab8eb2f544f2
Replaced stdout and stderr logging with log4j loggers in server classes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1346
diff
changeset
|
34 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
|
35 |
1442
4a6814be92ba
Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
36 /** 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
|
37 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
|
38 |
1346
a3c04eb326f3
Allowed to load Artifacts with different factories in one go.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1307
diff
changeset
|
39 |
a3c04eb326f3
Allowed to load Artifacts with different factories in one go.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1307
diff
changeset
|
40 /** |
a3c04eb326f3
Allowed to load Artifacts with different factories in one go.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1307
diff
changeset
|
41 * 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
|
42 * |
a3c04eb326f3
Allowed to load Artifacts with different factories in one go.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1307
diff
changeset
|
43 * 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
|
44 * 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
|
45 * |
a3c04eb326f3
Allowed to load Artifacts with different factories in one go.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1307
diff
changeset
|
46 * @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
|
47 * @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
|
48 * @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
|
49 * @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
|
50 */ |
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 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
|
52 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
|
53 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
|
54 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
|
55 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
|
56 ) |
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 throws ServerException { |
8203
238fc722f87a
sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5993
diff
changeset
|
58 log.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
|
59 "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
|
60 |
1425
bc06a671ef60
Removed the URL parameter from service calls. The service
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1413
diff
changeset
|
61 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
|
62 |
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
|
63 // 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
|
64 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
|
65 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
|
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 if (clone != null) { |
8203
238fc722f87a
sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5993
diff
changeset
|
68 log.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
|
69 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
|
70 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
|
71 |
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 if (c != null) { |
8203
238fc722f87a
sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5993
diff
changeset
|
73 log.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
|
74 |
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
|
75 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
|
76 } |
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
|
77 } |
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
|
78 |
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
|
79 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
|
80 } |
913
9976d99aea34
Added loadMany-function to LoadArtifactService.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
905
diff
changeset
|
81 |
1272
2ce5d7ac9e60
Cosmetics, documentation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
913
diff
changeset
|
82 |
2ce5d7ac9e60
Cosmetics, documentation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
913
diff
changeset
|
83 /** |
1346
a3c04eb326f3
Allowed to load Artifacts with different factories in one go.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1307
diff
changeset
|
84 * 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
|
85 * duplicates. |
1272
2ce5d7ac9e60
Cosmetics, documentation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
913
diff
changeset
|
86 * |
1346
a3c04eb326f3
Allowed to load Artifacts with different factories in one go.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1307
diff
changeset
|
87 * @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
|
88 * @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
|
89 * @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
|
90 * 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
|
91 * be used. |
a3c04eb326f3
Allowed to load Artifacts with different factories in one go.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1307
diff
changeset
|
92 * @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
|
93 * |
1307
489e6a82fe84
Partial fix for flys/issue304 (Erweiterte Funktionen W-Differenzen).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1272
diff
changeset
|
94 * @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
|
95 * times). |
1272
2ce5d7ac9e60
Cosmetics, documentation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
913
diff
changeset
|
96 */ |
913
9976d99aea34
Added loadMany-function to LoadArtifactService.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
905
diff
changeset
|
97 public Artifact[] loadMany( |
1272
2ce5d7ac9e60
Cosmetics, documentation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
913
diff
changeset
|
98 Collection parent, |
913
9976d99aea34
Added loadMany-function to LoadArtifactService.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
905
diff
changeset
|
99 Recommendation[] recoms, |
1272
2ce5d7ac9e60
Cosmetics, documentation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
913
diff
changeset
|
100 String factory, |
2ce5d7ac9e60
Cosmetics, documentation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
913
diff
changeset
|
101 String locale |
913
9976d99aea34
Added loadMany-function to LoadArtifactService.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
905
diff
changeset
|
102 ) |
9976d99aea34
Added loadMany-function to LoadArtifactService.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
905
diff
changeset
|
103 throws ServerException { |
8203
238fc722f87a
sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5993
diff
changeset
|
104 log.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
|
105 |
1413
0d3bbe4240b1
Refactored the LoadArtifactService a bit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1367
diff
changeset
|
106 String url = getServletContext().getInitParameter("server-url"); |
0d3bbe4240b1
Refactored the LoadArtifactService a bit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1367
diff
changeset
|
107 |
913
9976d99aea34
Added loadMany-function to LoadArtifactService.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
905
diff
changeset
|
108 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
|
109 HashMap<Recommendation, Artifact> cloneMap = |
489e6a82fe84
Partial fix for flys/issue304 (Erweiterte Funktionen W-Differenzen).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1272
diff
changeset
|
110 new HashMap<Recommendation, Artifact>(); |
913
9976d99aea34
Added loadMany-function to LoadArtifactService.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
905
diff
changeset
|
111 |
1272
2ce5d7ac9e60
Cosmetics, documentation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
913
diff
changeset
|
112 // TODO Respect the index of what to clone. |
2ce5d7ac9e60
Cosmetics, documentation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
913
diff
changeset
|
113 |
1307
489e6a82fe84
Partial fix for flys/issue304 (Erweiterte Funktionen W-Differenzen).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1272
diff
changeset
|
114 // 1) Clone the Artifacts specified in >>recoms<< |
913
9976d99aea34
Added loadMany-function to LoadArtifactService.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
905
diff
changeset
|
115 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
|
116 // 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
|
117 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
|
118 if (prevClone != null) { |
489e6a82fe84
Partial fix for flys/issue304 (Erweiterte Funktionen W-Differenzen).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1272
diff
changeset
|
119 // Already cloned a recommendation like this. |
8203
238fc722f87a
sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5993
diff
changeset
|
120 log.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
|
121 + "clone already exists."); |
489e6a82fe84
Partial fix for flys/issue304 (Erweiterte Funktionen W-Differenzen).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1272
diff
changeset
|
122 artifacts.add(prevClone); |
489e6a82fe84
Partial fix for flys/issue304 (Erweiterte Funktionen W-Differenzen).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1272
diff
changeset
|
123 } |
489e6a82fe84
Partial fix for flys/issue304 (Erweiterte Funktionen W-Differenzen).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1272
diff
changeset
|
124 else { |
489e6a82fe84
Partial fix for flys/issue304 (Erweiterte Funktionen W-Differenzen).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1272
diff
changeset
|
125 // 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
|
126 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
|
127 ? factory |
a3c04eb326f3
Allowed to load Artifacts with different factories in one go.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1307
diff
changeset
|
128 : recom.getFactory(); |
a3c04eb326f3
Allowed to load Artifacts with different factories in one go.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1307
diff
changeset
|
129 |
8203
238fc722f87a
sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5993
diff
changeset
|
130 log.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
|
131 |
1307
489e6a82fe84
Partial fix for flys/issue304 (Erweiterte Funktionen W-Differenzen).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1272
diff
changeset
|
132 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
|
133 url, locale, realFactory, recom); |
2905
51ed89b754ae
FLYS client: Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1442
diff
changeset
|
134 |
1307
489e6a82fe84
Partial fix for flys/issue304 (Erweiterte Funktionen W-Differenzen).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1272
diff
changeset
|
135 if (clone != null) { |
8203
238fc722f87a
sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5993
diff
changeset
|
136 log.debug("LoadArtifactServiceImple: Successfully " |
1307
489e6a82fe84
Partial fix for flys/issue304 (Erweiterte Funktionen W-Differenzen).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1272
diff
changeset
|
137 + "loaded Artifact Clone."); |
489e6a82fe84
Partial fix for flys/issue304 (Erweiterte Funktionen W-Differenzen).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1272
diff
changeset
|
138 Collection c = CollectionHelper.addArtifact( |
489e6a82fe84
Partial fix for flys/issue304 (Erweiterte Funktionen W-Differenzen).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1272
diff
changeset
|
139 parent, clone, url, locale); |
2905
51ed89b754ae
FLYS client: Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1442
diff
changeset
|
140 |
1307
489e6a82fe84
Partial fix for flys/issue304 (Erweiterte Funktionen W-Differenzen).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1272
diff
changeset
|
141 if (c != null) { |
489e6a82fe84
Partial fix for flys/issue304 (Erweiterte Funktionen W-Differenzen).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1272
diff
changeset
|
142 artifacts.add(clone); |
489e6a82fe84
Partial fix for flys/issue304 (Erweiterte Funktionen W-Differenzen).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1272
diff
changeset
|
143 // 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
|
144 cloneMap.put(recom, clone); |
489e6a82fe84
Partial fix for flys/issue304 (Erweiterte Funktionen W-Differenzen).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1272
diff
changeset
|
145 } |
489e6a82fe84
Partial fix for flys/issue304 (Erweiterte Funktionen W-Differenzen).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1272
diff
changeset
|
146 else { |
489e6a82fe84
Partial fix for flys/issue304 (Erweiterte Funktionen W-Differenzen).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1272
diff
changeset
|
147 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
|
148 } |
913
9976d99aea34
Added loadMany-function to LoadArtifactService.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
905
diff
changeset
|
149 } |
9976d99aea34
Added loadMany-function to LoadArtifactService.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
905
diff
changeset
|
150 } |
9976d99aea34
Added loadMany-function to LoadArtifactService.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
905
diff
changeset
|
151 } |
9976d99aea34
Added loadMany-function to LoadArtifactService.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
905
diff
changeset
|
152 return artifacts.toArray(new Artifact[artifacts.size()]); |
9976d99aea34
Added loadMany-function to LoadArtifactService.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
905
diff
changeset
|
153 } |
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
|
154 } |
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
|
155 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |