Mercurial > dive4elements > river
comparison gwt-client/src/main/java/org/dive4elements/river/client/server/LoadArtifactServiceImpl.java @ 8203:238fc722f87a
sed 's/logger/log/g' src/**/*.java
author | Sascha L. Teichmann <teichmann@intevation.de> |
---|---|
date | Fri, 05 Sep 2014 13:19:22 +0200 |
parents | ea9eef426962 |
children | 0a5239a1e46e |
comparison
equal
deleted
inserted
replaced
8202:e4606eae8ea5 | 8203:238fc722f87a |
---|---|
28 */ | 28 */ |
29 public class LoadArtifactServiceImpl | 29 public class LoadArtifactServiceImpl |
30 extends ArtifactServiceImpl | 30 extends ArtifactServiceImpl |
31 implements LoadArtifactService | 31 implements LoadArtifactService |
32 { | 32 { |
33 private static final Logger logger = | 33 private static final Logger log = |
34 Logger.getLogger(LoadArtifactServiceImpl.class); | 34 Logger.getLogger(LoadArtifactServiceImpl.class); |
35 | 35 |
36 /** Error. */ | 36 /** Error. */ |
37 public static final String ERROR_LOAD_ARTIFACT = "error_load_artifact"; | 37 public static final String ERROR_LOAD_ARTIFACT = "error_load_artifact"; |
38 | 38 |
53 Recommendation recom, | 53 Recommendation recom, |
54 String factory, | 54 String factory, |
55 String locale | 55 String locale |
56 ) | 56 ) |
57 throws ServerException { | 57 throws ServerException { |
58 logger.info( | 58 log.info( |
59 "LoadArtifactServiceImpl.load: " + recom.getMasterArtifact()); | 59 "LoadArtifactServiceImpl.load: " + recom.getMasterArtifact()); |
60 | 60 |
61 String url = getServletContext().getInitParameter("server-url"); | 61 String url = getServletContext().getInitParameter("server-url"); |
62 | 62 |
63 // 1) Clone the Artifact specified in >>recom<< | 63 // 1) Clone the Artifact specified in >>recom<< |
64 Artifact clone = ArtifactHelper.createArtifact( | 64 Artifact clone = ArtifactHelper.createArtifact( |
65 url, locale, factory, recom); | 65 url, locale, factory, recom); |
66 | 66 |
67 if (clone != null) { | 67 if (clone != null) { |
68 logger.debug("Successfully create Artifact Clone. Add now!"); | 68 log.debug("Successfully create Artifact Clone. Add now!"); |
69 Collection c = CollectionHelper.addArtifact( | 69 Collection c = CollectionHelper.addArtifact( |
70 parent, clone, url, locale); | 70 parent, clone, url, locale); |
71 | 71 |
72 if (c != null) { | 72 if (c != null) { |
73 logger.debug("Successfully added Clone to Collection."); | 73 log.debug("Successfully added Clone to Collection."); |
74 | 74 |
75 return clone; | 75 return clone; |
76 } | 76 } |
77 } | 77 } |
78 | 78 |
99 Recommendation[] recoms, | 99 Recommendation[] recoms, |
100 String factory, | 100 String factory, |
101 String locale | 101 String locale |
102 ) | 102 ) |
103 throws ServerException { | 103 throws ServerException { |
104 logger.debug("LoadArtifactServiceImpl.loadMany"); | 104 log.debug("LoadArtifactServiceImpl.loadMany"); |
105 | 105 |
106 String url = getServletContext().getInitParameter("server-url"); | 106 String url = getServletContext().getInitParameter("server-url"); |
107 | 107 |
108 ArrayList<Artifact> artifacts = new ArrayList<Artifact>(); | 108 ArrayList<Artifact> artifacts = new ArrayList<Artifact>(); |
109 HashMap<Recommendation, Artifact> cloneMap = | 109 HashMap<Recommendation, Artifact> cloneMap = |
115 for (Recommendation recom : recoms) { | 115 for (Recommendation recom : recoms) { |
116 // Do not do two clones of two identical recommendations. | 116 // Do not do two clones of two identical recommendations. |
117 Artifact prevClone = cloneMap.get(recom); | 117 Artifact prevClone = cloneMap.get(recom); |
118 if (prevClone != null) { | 118 if (prevClone != null) { |
119 // Already cloned a recommendation like this. | 119 // Already cloned a recommendation like this. |
120 logger.debug("LoadArtifactServiceImpl: Avoid reclones, " | 120 log.debug("LoadArtifactServiceImpl: Avoid reclones, " |
121 + "clone already exists."); | 121 + "clone already exists."); |
122 artifacts.add(prevClone); | 122 artifacts.add(prevClone); |
123 } | 123 } |
124 else { | 124 else { |
125 // Not already cloned. | 125 // Not already cloned. |
126 String realFactory = factory != null | 126 String realFactory = factory != null |
127 ? factory | 127 ? factory |
128 : recom.getFactory(); | 128 : recom.getFactory(); |
129 | 129 |
130 logger.debug("One will be cloned with : " + realFactory); | 130 log.debug("One will be cloned with : " + realFactory); |
131 | 131 |
132 Artifact clone = ArtifactHelper.createArtifact( | 132 Artifact clone = ArtifactHelper.createArtifact( |
133 url, locale, realFactory, recom); | 133 url, locale, realFactory, recom); |
134 | 134 |
135 if (clone != null) { | 135 if (clone != null) { |
136 logger.debug("LoadArtifactServiceImple: Successfully " | 136 log.debug("LoadArtifactServiceImple: Successfully " |
137 + "loaded Artifact Clone."); | 137 + "loaded Artifact Clone."); |
138 Collection c = CollectionHelper.addArtifact( | 138 Collection c = CollectionHelper.addArtifact( |
139 parent, clone, url, locale); | 139 parent, clone, url, locale); |
140 | 140 |
141 if (c != null) { | 141 if (c != null) { |