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