1 | |
package org.apache.maven.project.injection; |
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
|
17 | |
|
18 | |
|
19 | |
|
20 | |
|
21 | |
|
22 | |
import org.apache.maven.model.Build; |
23 | |
import org.apache.maven.model.BuildBase; |
24 | |
import org.apache.maven.model.ConfigurationContainer; |
25 | |
import org.apache.maven.model.Dependency; |
26 | |
import org.apache.maven.model.DependencyManagement; |
27 | |
import org.apache.maven.model.DistributionManagement; |
28 | |
import org.apache.maven.model.Model; |
29 | |
import org.apache.maven.model.Plugin; |
30 | |
import org.apache.maven.model.PluginContainer; |
31 | |
import org.apache.maven.model.PluginExecution; |
32 | |
import org.apache.maven.model.PluginManagement; |
33 | |
import org.apache.maven.model.Profile; |
34 | |
import org.apache.maven.model.ReportPlugin; |
35 | |
import org.apache.maven.model.ReportSet; |
36 | |
import org.apache.maven.model.Reporting; |
37 | |
import org.apache.maven.project.ModelUtils; |
38 | |
import org.codehaus.plexus.util.StringUtils; |
39 | |
import org.codehaus.plexus.util.xml.Xpp3Dom; |
40 | |
|
41 | |
import java.util.ArrayList; |
42 | |
import java.util.Iterator; |
43 | |
import java.util.LinkedHashMap; |
44 | |
import java.util.List; |
45 | |
import java.util.Map; |
46 | |
import java.util.Properties; |
47 | |
|
48 | |
|
49 | |
|
50 | |
|
51 | |
|
52 | |
|
53 | |
|
54 | |
|
55 | |
|
56 | |
|
57 | |
|
58 | |
|
59 | |
|
60 | |
|
61 | |
|
62 | 0 | public class DefaultProfileInjector |
63 | |
implements ProfileInjector |
64 | |
{ |
65 | |
|
66 | |
public void inject( Profile profile, Model model ) |
67 | |
{ |
68 | |
|
69 | 0 | model.setDependencies( injectDependencies( profile.getDependencies(), model.getDependencies() ) ); |
70 | |
|
71 | 0 | injectModules( profile, model ); |
72 | |
|
73 | 0 | model.setRepositories( ModelUtils.mergeRepositoryLists( profile.getRepositories(), model.getRepositories() ) ); |
74 | 0 | model.setPluginRepositories( ModelUtils.mergeRepositoryLists( profile.getPluginRepositories(), model |
75 | |
.getPluginRepositories() ) ); |
76 | |
|
77 | 0 | injectReporting( profile, model ); |
78 | |
|
79 | 0 | injectDependencyManagement( profile, model ); |
80 | |
|
81 | 0 | injectDistributionManagement( profile, model ); |
82 | |
|
83 | 0 | injectBuild( profile, model ); |
84 | |
|
85 | 0 | Properties props = new Properties(); |
86 | 0 | props.putAll( model.getProperties() ); |
87 | 0 | props.putAll( profile.getProperties() ); |
88 | |
|
89 | 0 | model.setProperties( props ); |
90 | 0 | } |
91 | |
|
92 | |
private void injectBuild( Profile profile, Model model ) |
93 | |
{ |
94 | 0 | BuildBase profileBuild = profile.getBuild(); |
95 | 0 | Build modelBuild = model.getBuild(); |
96 | |
|
97 | |
|
98 | 0 | if ( profileBuild != null ) |
99 | |
{ |
100 | 0 | if ( modelBuild == null ) |
101 | |
{ |
102 | 0 | modelBuild = new Build(); |
103 | 0 | model.setBuild( modelBuild ); |
104 | |
} |
105 | |
|
106 | 0 | if ( profileBuild.getDirectory() != null ) |
107 | |
{ |
108 | 0 | modelBuild.setDirectory( profileBuild.getDirectory() ); |
109 | |
} |
110 | |
|
111 | 0 | if ( profileBuild.getDefaultGoal() != null ) |
112 | |
{ |
113 | 0 | modelBuild.setDefaultGoal( profileBuild.getDefaultGoal() ); |
114 | |
} |
115 | |
|
116 | 0 | if ( profileBuild.getFinalName() != null ) |
117 | |
{ |
118 | 0 | modelBuild.setFinalName( profileBuild.getFinalName() ); |
119 | |
} |
120 | |
|
121 | 0 | ModelUtils.mergeFilterLists( modelBuild.getFilters(), profileBuild.getFilters() ); |
122 | 0 | ModelUtils.mergeResourceLists( modelBuild.getResources(), profileBuild.getResources() ); |
123 | 0 | ModelUtils.mergeResourceLists( modelBuild.getTestResources(), profileBuild.getTestResources() ); |
124 | |
|
125 | 0 | injectPlugins( profileBuild, modelBuild ); |
126 | |
|
127 | |
|
128 | 0 | PluginManagement profilePM = profileBuild.getPluginManagement(); |
129 | 0 | PluginManagement modelPM = modelBuild.getPluginManagement(); |
130 | |
|
131 | 0 | if ( modelPM == null ) |
132 | |
{ |
133 | 0 | modelBuild.setPluginManagement( profilePM ); |
134 | |
} |
135 | |
else |
136 | |
{ |
137 | 0 | injectPlugins( profilePM, modelPM ); |
138 | |
} |
139 | |
} |
140 | 0 | } |
141 | |
|
142 | |
|
143 | |
|
144 | |
|
145 | |
|
146 | |
|
147 | |
|
148 | |
|
149 | |
|
150 | |
|
151 | |
|
152 | |
|
153 | |
|
154 | |
protected void injectPlugins( PluginContainer profileContainer, PluginContainer modelContainer ) |
155 | |
{ |
156 | 0 | if ( ( profileContainer == null ) || ( modelContainer == null ) ) |
157 | |
{ |
158 | |
|
159 | 0 | return; |
160 | |
} |
161 | |
|
162 | 0 | List modelPlugins = modelContainer.getPlugins(); |
163 | |
|
164 | 0 | if ( modelPlugins == null ) |
165 | |
{ |
166 | 0 | modelContainer.setPlugins( profileContainer.getPlugins() ); |
167 | |
} |
168 | 0 | else if ( profileContainer.getPlugins() != null ) |
169 | |
{ |
170 | 0 | List mergedPlugins = new ArrayList(); |
171 | |
|
172 | 0 | Map profilePlugins = profileContainer.getPluginsAsMap(); |
173 | |
|
174 | 0 | for ( Iterator it = modelPlugins.iterator(); it.hasNext(); ) |
175 | |
{ |
176 | 0 | Plugin modelPlugin = (Plugin) it.next(); |
177 | |
|
178 | 0 | Plugin profilePlugin = (Plugin) profilePlugins.get( modelPlugin.getKey() ); |
179 | |
|
180 | 0 | if ( ( profilePlugin != null ) && !mergedPlugins.contains( profilePlugin ) ) |
181 | |
{ |
182 | 0 | Plugin mergedPlugin = modelPlugin; |
183 | |
|
184 | 0 | injectPluginDefinition( profilePlugin, modelPlugin ); |
185 | |
|
186 | 0 | mergedPlugins.add( mergedPlugin ); |
187 | |
} |
188 | 0 | } |
189 | |
|
190 | 0 | List results = ModelUtils.orderAfterMerge( mergedPlugins, modelPlugins, profileContainer.getPlugins() ); |
191 | |
|
192 | 0 | modelContainer.setPlugins( results ); |
193 | |
|
194 | 0 | modelContainer.flushPluginMap(); |
195 | |
} |
196 | 0 | } |
197 | |
|
198 | |
private void injectPluginDefinition( Plugin profilePlugin, Plugin modelPlugin ) |
199 | |
{ |
200 | 0 | if ( ( profilePlugin == null ) || ( modelPlugin == null ) ) |
201 | |
{ |
202 | |
|
203 | 0 | return; |
204 | |
} |
205 | |
|
206 | 0 | if ( profilePlugin.isExtensions() ) |
207 | |
{ |
208 | 0 | modelPlugin.setExtensions( true ); |
209 | |
} |
210 | |
|
211 | 0 | if ( profilePlugin.getVersion() != null ) |
212 | |
{ |
213 | 0 | modelPlugin.setVersion( profilePlugin.getVersion() ); |
214 | |
} |
215 | |
|
216 | 0 | modelPlugin.setDependencies( injectDependencies( profilePlugin.getDependencies(), modelPlugin.getDependencies() ) ); |
217 | |
|
218 | |
|
219 | 0 | injectConfigurationContainer( profilePlugin, modelPlugin ); |
220 | |
|
221 | |
|
222 | 0 | List modelExecutions = modelPlugin.getExecutions(); |
223 | |
|
224 | 0 | if ( ( modelExecutions == null ) || modelExecutions.isEmpty() ) |
225 | |
{ |
226 | 0 | modelPlugin.setExecutions( profilePlugin.getExecutions() ); |
227 | |
} |
228 | |
else |
229 | |
{ |
230 | 0 | Map executions = new LinkedHashMap(); |
231 | |
|
232 | 0 | Map profileExecutions = profilePlugin.getExecutionsAsMap(); |
233 | |
|
234 | 0 | for ( Iterator it = modelExecutions.iterator(); it.hasNext(); ) |
235 | |
{ |
236 | 0 | PluginExecution modelExecution = (PluginExecution) it.next(); |
237 | |
|
238 | 0 | PluginExecution profileExecution = (PluginExecution) profileExecutions.get( modelExecution.getId() ); |
239 | |
|
240 | 0 | if ( profileExecution != null ) |
241 | |
{ |
242 | 0 | injectConfigurationContainer( profileExecution, modelExecution ); |
243 | |
|
244 | 0 | if ( profileExecution.getPhase() != null ) |
245 | |
{ |
246 | 0 | modelExecution.setPhase( profileExecution.getPhase() ); |
247 | |
} |
248 | |
|
249 | 0 | List profileGoals = profileExecution.getGoals(); |
250 | 0 | List modelGoals = modelExecution.getGoals(); |
251 | |
|
252 | 0 | List goals = new ArrayList(); |
253 | |
|
254 | 0 | if ( ( modelGoals != null ) && !modelGoals.isEmpty() ) |
255 | |
{ |
256 | 0 | goals.addAll( modelGoals ); |
257 | |
} |
258 | |
|
259 | 0 | if ( profileGoals != null ) |
260 | |
{ |
261 | 0 | for ( Iterator goalIterator = profileGoals.iterator(); goalIterator.hasNext(); ) |
262 | |
{ |
263 | 0 | String goal = (String) goalIterator.next(); |
264 | |
|
265 | 0 | if ( !goals.contains( goal ) ) |
266 | |
{ |
267 | 0 | goals.add( goal ); |
268 | |
} |
269 | 0 | } |
270 | |
} |
271 | |
|
272 | 0 | modelExecution.setGoals( goals ); |
273 | |
} |
274 | |
|
275 | 0 | executions.put( modelExecution.getId(), modelExecution ); |
276 | 0 | } |
277 | |
|
278 | 0 | for ( Iterator it = profileExecutions.entrySet().iterator(); it.hasNext(); ) |
279 | |
{ |
280 | 0 | Map.Entry entry = (Map.Entry) it.next(); |
281 | |
|
282 | 0 | String id = (String) entry.getKey(); |
283 | |
|
284 | 0 | if ( !executions.containsKey( id ) ) |
285 | |
{ |
286 | 0 | executions.put( id, entry.getValue() ); |
287 | |
} |
288 | 0 | } |
289 | |
|
290 | 0 | modelPlugin.setExecutions( new ArrayList( executions.values() ) ); |
291 | |
|
292 | 0 | modelPlugin.flushExecutionMap(); |
293 | |
} |
294 | |
|
295 | 0 | } |
296 | |
|
297 | |
|
298 | |
|
299 | |
|
300 | |
|
301 | |
|
302 | |
|
303 | |
|
304 | |
|
305 | |
|
306 | |
|
307 | |
|
308 | |
|
309 | |
private Xpp3Dom merge( Xpp3Dom dominant, Xpp3Dom recessive ) |
310 | |
{ |
311 | 0 | Xpp3Dom dominantCopy = ( dominant == null ) ? null : new Xpp3Dom( dominant ); |
312 | 0 | return Xpp3Dom.mergeXpp3Dom( dominantCopy, recessive ); |
313 | |
} |
314 | |
|
315 | |
private void injectConfigurationContainer( ConfigurationContainer profileContainer, |
316 | |
ConfigurationContainer modelContainer ) |
317 | |
{ |
318 | 0 | Xpp3Dom configuration = (Xpp3Dom) profileContainer.getConfiguration(); |
319 | 0 | Xpp3Dom parentConfiguration = (Xpp3Dom) modelContainer.getConfiguration(); |
320 | |
|
321 | 0 | configuration = merge( configuration, parentConfiguration ); |
322 | |
|
323 | 0 | modelContainer.setConfiguration( configuration ); |
324 | 0 | } |
325 | |
|
326 | |
|
327 | |
|
328 | |
|
329 | |
|
330 | |
private void injectModules( Profile profile, Model model ) |
331 | |
{ |
332 | 0 | List modules = new ArrayList(); |
333 | |
|
334 | 0 | List modelModules = model.getModules(); |
335 | |
|
336 | 0 | if ( ( modelModules != null ) && !modelModules.isEmpty() ) |
337 | |
{ |
338 | 0 | modules.addAll( modelModules ); |
339 | |
} |
340 | |
|
341 | 0 | List profileModules = profile.getModules(); |
342 | |
|
343 | 0 | if ( profileModules != null ) |
344 | |
{ |
345 | 0 | for ( Iterator it = profileModules.iterator(); it.hasNext(); ) |
346 | |
{ |
347 | 0 | String module = (String) it.next(); |
348 | |
|
349 | 0 | if ( !modules.contains( module ) ) |
350 | |
{ |
351 | 0 | modules.add( module ); |
352 | |
} |
353 | 0 | } |
354 | |
} |
355 | |
|
356 | 0 | model.setModules( modules ); |
357 | 0 | } |
358 | |
|
359 | |
private void injectDistributionManagement( Profile profile, Model model ) |
360 | |
{ |
361 | 0 | DistributionManagement pDistMgmt = profile.getDistributionManagement(); |
362 | 0 | DistributionManagement mDistMgmt = model.getDistributionManagement(); |
363 | |
|
364 | 0 | if ( mDistMgmt == null ) |
365 | |
{ |
366 | 0 | model.setDistributionManagement( pDistMgmt ); |
367 | |
} |
368 | 0 | else if ( pDistMgmt != null ) |
369 | |
{ |
370 | 0 | if ( pDistMgmt.getRepository() != null ) |
371 | |
{ |
372 | 0 | mDistMgmt.setRepository( pDistMgmt.getRepository() ); |
373 | |
} |
374 | |
|
375 | 0 | if ( pDistMgmt.getSnapshotRepository() != null ) |
376 | |
{ |
377 | 0 | mDistMgmt.setSnapshotRepository( pDistMgmt.getSnapshotRepository() ); |
378 | |
} |
379 | |
|
380 | 0 | if ( StringUtils.isNotEmpty( pDistMgmt.getDownloadUrl() ) ) |
381 | |
{ |
382 | 0 | mDistMgmt.setDownloadUrl( pDistMgmt.getDownloadUrl() ); |
383 | |
} |
384 | |
|
385 | 0 | if ( pDistMgmt.getRelocation() != null ) |
386 | |
{ |
387 | 0 | mDistMgmt.setRelocation( pDistMgmt.getRelocation() ); |
388 | |
} |
389 | |
|
390 | 0 | if ( pDistMgmt.getSite() != null ) |
391 | |
{ |
392 | 0 | mDistMgmt.setSite( pDistMgmt.getSite() ); |
393 | |
} |
394 | |
|
395 | |
|
396 | |
} |
397 | 0 | } |
398 | |
|
399 | |
private void injectDependencyManagement( Profile profile, Model model ) |
400 | |
{ |
401 | 0 | DependencyManagement modelDepMgmt = model.getDependencyManagement(); |
402 | |
|
403 | 0 | DependencyManagement profileDepMgmt = profile.getDependencyManagement(); |
404 | |
|
405 | 0 | if ( profileDepMgmt != null ) |
406 | |
{ |
407 | 0 | if ( modelDepMgmt == null ) |
408 | |
{ |
409 | 0 | model.setDependencyManagement( profileDepMgmt ); |
410 | |
} |
411 | |
else |
412 | |
{ |
413 | 0 | Map depsMap = new LinkedHashMap(); |
414 | |
|
415 | 0 | List deps = modelDepMgmt.getDependencies(); |
416 | |
|
417 | 0 | if ( deps != null ) |
418 | |
{ |
419 | 0 | for ( Iterator it = deps.iterator(); it.hasNext(); ) |
420 | |
{ |
421 | 0 | Dependency dependency = (Dependency) it.next(); |
422 | 0 | depsMap.put( dependency.getManagementKey(), dependency ); |
423 | 0 | } |
424 | |
} |
425 | |
|
426 | 0 | deps = profileDepMgmt.getDependencies(); |
427 | |
|
428 | 0 | if ( deps != null ) |
429 | |
{ |
430 | 0 | for ( Iterator it = deps.iterator(); it.hasNext(); ) |
431 | |
{ |
432 | 0 | Dependency dependency = (Dependency) it.next(); |
433 | 0 | depsMap.put( dependency.getManagementKey(), dependency ); |
434 | 0 | } |
435 | |
} |
436 | |
|
437 | 0 | modelDepMgmt.setDependencies( new ArrayList( depsMap.values() ) ); |
438 | |
} |
439 | |
} |
440 | 0 | } |
441 | |
|
442 | |
private void injectReporting( Profile profile, Model model ) |
443 | |
{ |
444 | |
|
445 | 0 | Reporting profileReporting = profile.getReporting(); |
446 | 0 | Reporting modelReporting = model.getReporting(); |
447 | |
|
448 | 0 | if ( profileReporting != null ) |
449 | |
{ |
450 | 0 | if ( modelReporting == null ) |
451 | |
{ |
452 | 0 | model.setReporting( profileReporting ); |
453 | |
} |
454 | |
else |
455 | |
{ |
456 | 0 | if ( StringUtils.isEmpty( modelReporting.getOutputDirectory() ) ) |
457 | |
{ |
458 | 0 | modelReporting.setOutputDirectory( profileReporting.getOutputDirectory() ); |
459 | |
} |
460 | |
|
461 | 0 | Map mergedReportPlugins = new LinkedHashMap(); |
462 | |
|
463 | 0 | Map profileReportersByKey = profileReporting.getReportPluginsAsMap(); |
464 | |
|
465 | 0 | List modelReportPlugins = modelReporting.getPlugins(); |
466 | |
|
467 | 0 | if ( modelReportPlugins != null ) |
468 | |
{ |
469 | 0 | for ( Iterator it = modelReportPlugins.iterator(); it.hasNext(); ) |
470 | |
{ |
471 | 0 | ReportPlugin modelReportPlugin = (ReportPlugin) it.next(); |
472 | |
|
473 | 0 | String inherited = modelReportPlugin.getInherited(); |
474 | |
|
475 | 0 | if ( StringUtils.isEmpty( inherited ) || Boolean.valueOf( inherited ).booleanValue() ) |
476 | |
{ |
477 | 0 | ReportPlugin profileReportPlugin = (ReportPlugin) profileReportersByKey |
478 | |
.get( modelReportPlugin.getKey() ); |
479 | |
|
480 | 0 | ReportPlugin mergedReportPlugin = modelReportPlugin; |
481 | |
|
482 | 0 | if ( profileReportPlugin != null ) |
483 | |
{ |
484 | 0 | mergedReportPlugin = profileReportPlugin; |
485 | |
|
486 | 0 | mergeReportPlugins( profileReportPlugin, modelReportPlugin ); |
487 | |
} |
488 | 0 | else if ( StringUtils.isEmpty( inherited ) ) |
489 | |
{ |
490 | 0 | mergedReportPlugin.unsetInheritanceApplied(); |
491 | |
} |
492 | |
|
493 | 0 | mergedReportPlugins.put( mergedReportPlugin.getKey(), mergedReportPlugin ); |
494 | |
} |
495 | 0 | } |
496 | |
} |
497 | |
|
498 | 0 | for ( Iterator it = profileReportersByKey.entrySet().iterator(); it.hasNext(); ) |
499 | |
{ |
500 | 0 | Map.Entry entry = (Map.Entry) it.next(); |
501 | |
|
502 | 0 | String key = (String) entry.getKey(); |
503 | |
|
504 | 0 | if ( !mergedReportPlugins.containsKey( key ) ) |
505 | |
{ |
506 | 0 | mergedReportPlugins.put( key, entry.getValue() ); |
507 | |
} |
508 | 0 | } |
509 | |
|
510 | 0 | modelReporting.setPlugins( new ArrayList( mergedReportPlugins.values() ) ); |
511 | |
|
512 | 0 | modelReporting.flushReportPluginMap(); |
513 | |
} |
514 | |
} |
515 | 0 | } |
516 | |
|
517 | |
private void mergeReportPlugins( ReportPlugin dominant, ReportPlugin recessive ) |
518 | |
{ |
519 | 0 | if ( StringUtils.isEmpty( recessive.getVersion() ) ) |
520 | |
{ |
521 | 0 | recessive.setVersion( dominant.getVersion() ); |
522 | |
} |
523 | |
|
524 | 0 | Xpp3Dom dominantConfig = (Xpp3Dom) dominant.getConfiguration(); |
525 | 0 | Xpp3Dom recessiveConfig = (Xpp3Dom) recessive.getConfiguration(); |
526 | |
|
527 | 0 | recessive.setConfiguration( merge( dominantConfig, recessiveConfig ) ); |
528 | |
|
529 | 0 | Map mergedReportSets = new LinkedHashMap(); |
530 | |
|
531 | 0 | Map dominantReportSetsById = dominant.getReportSetsAsMap(); |
532 | |
|
533 | 0 | for ( Iterator it = recessive.getReportSets().iterator(); it.hasNext(); ) |
534 | |
{ |
535 | 0 | ReportSet recessiveReportSet = (ReportSet) it.next(); |
536 | |
|
537 | 0 | ReportSet dominantReportSet = (ReportSet) dominantReportSetsById.get( recessiveReportSet.getId() ); |
538 | |
|
539 | 0 | ReportSet merged = recessiveReportSet; |
540 | |
|
541 | 0 | if ( dominantReportSet != null ) |
542 | |
{ |
543 | 0 | merged = recessiveReportSet; |
544 | |
|
545 | 0 | Xpp3Dom dominantRSConfig = (Xpp3Dom) dominantReportSet.getConfiguration(); |
546 | 0 | Xpp3Dom mergedRSConfig = (Xpp3Dom) merged.getConfiguration(); |
547 | |
|
548 | 0 | merged.setConfiguration( merge( dominantRSConfig, mergedRSConfig ) ); |
549 | |
|
550 | 0 | List mergedReports = merged.getReports(); |
551 | |
|
552 | 0 | if ( mergedReports == null ) |
553 | |
{ |
554 | 0 | mergedReports = new ArrayList(); |
555 | |
|
556 | 0 | merged.setReports( mergedReports ); |
557 | |
} |
558 | |
|
559 | 0 | List dominantRSReports = dominantReportSet.getReports(); |
560 | |
|
561 | 0 | if ( dominantRSReports != null ) |
562 | |
{ |
563 | 0 | for ( Iterator reportIterator = dominantRSReports.iterator(); reportIterator.hasNext(); ) |
564 | |
{ |
565 | 0 | String report = (String) reportIterator.next(); |
566 | |
|
567 | 0 | if ( !mergedReports.contains( report ) ) |
568 | |
{ |
569 | 0 | mergedReports.add( report ); |
570 | |
} |
571 | 0 | } |
572 | |
} |
573 | |
|
574 | 0 | mergedReportSets.put( merged.getId(), merged ); |
575 | |
} |
576 | 0 | } |
577 | |
|
578 | 0 | for ( Iterator rsIterator = dominantReportSetsById.entrySet().iterator(); rsIterator.hasNext(); ) |
579 | |
{ |
580 | 0 | Map.Entry entry = (Map.Entry) rsIterator.next(); |
581 | |
|
582 | 0 | String key = (String) entry.getKey(); |
583 | |
|
584 | 0 | if ( !mergedReportSets.containsKey( key ) ) |
585 | |
{ |
586 | 0 | mergedReportSets.put( key, entry.getValue() ); |
587 | |
} |
588 | 0 | } |
589 | |
|
590 | 0 | recessive.setReportSets( new ArrayList( mergedReportSets.values() ) ); |
591 | |
|
592 | 0 | recessive.flushReportSetMap(); |
593 | 0 | } |
594 | |
|
595 | |
private List injectDependencies( List profileDeps, List modelDeps ) |
596 | |
{ |
597 | 0 | Map depsMap = new LinkedHashMap(); |
598 | |
|
599 | 0 | if ( modelDeps != null ) |
600 | |
{ |
601 | 0 | for ( Iterator it = modelDeps.iterator(); it.hasNext(); ) |
602 | |
{ |
603 | 0 | Dependency dependency = (Dependency) it.next(); |
604 | 0 | depsMap.put( dependency.getManagementKey(), dependency ); |
605 | 0 | } |
606 | |
} |
607 | |
|
608 | 0 | if ( profileDeps != null ) |
609 | |
{ |
610 | 0 | for ( Iterator it = profileDeps.iterator(); it.hasNext(); ) |
611 | |
{ |
612 | 0 | Dependency dependency = (Dependency) it.next(); |
613 | 0 | depsMap.put( dependency.getManagementKey(), dependency ); |
614 | 0 | } |
615 | |
} |
616 | |
|
617 | 0 | return new ArrayList( depsMap.values() ); |
618 | |
} |
619 | |
|
620 | |
} |