1 package org.apache.maven.model.merge;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import java.util.ArrayList;
23 import java.util.HashMap;
24 import java.util.LinkedHashMap;
25 import java.util.List;
26 import java.util.Map;
27 import java.util.Objects;
28 import java.util.Properties;
29
30 import org.apache.maven.model.Activation;
31 import org.apache.maven.model.Build;
32 import org.apache.maven.model.BuildBase;
33 import org.apache.maven.model.CiManagement;
34 import org.apache.maven.model.ConfigurationContainer;
35 import org.apache.maven.model.Contributor;
36 import org.apache.maven.model.Dependency;
37 import org.apache.maven.model.DependencyManagement;
38 import org.apache.maven.model.DeploymentRepository;
39 import org.apache.maven.model.Developer;
40 import org.apache.maven.model.DistributionManagement;
41 import org.apache.maven.model.Exclusion;
42 import org.apache.maven.model.Extension;
43 import org.apache.maven.model.FileSet;
44 import org.apache.maven.model.InputLocation;
45 import org.apache.maven.model.IssueManagement;
46 import org.apache.maven.model.License;
47 import org.apache.maven.model.MailingList;
48 import org.apache.maven.model.Model;
49 import org.apache.maven.model.ModelBase;
50 import org.apache.maven.model.Notifier;
51 import org.apache.maven.model.Organization;
52 import org.apache.maven.model.Parent;
53 import org.apache.maven.model.PatternSet;
54 import org.apache.maven.model.Plugin;
55 import org.apache.maven.model.PluginConfiguration;
56 import org.apache.maven.model.PluginContainer;
57 import org.apache.maven.model.PluginExecution;
58 import org.apache.maven.model.PluginManagement;
59 import org.apache.maven.model.Prerequisites;
60 import org.apache.maven.model.Profile;
61 import org.apache.maven.model.Relocation;
62 import org.apache.maven.model.ReportPlugin;
63 import org.apache.maven.model.ReportSet;
64 import org.apache.maven.model.Reporting;
65 import org.apache.maven.model.Repository;
66 import org.apache.maven.model.RepositoryBase;
67 import org.apache.maven.model.RepositoryPolicy;
68 import org.apache.maven.model.Resource;
69 import org.apache.maven.model.Scm;
70 import org.apache.maven.model.Site;
71 import org.codehaus.plexus.util.xml.Xpp3Dom;
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90 @SuppressWarnings( { "checkstyle:methodname" } )
91 public class ModelMerger
92 {
93
94
95
96
97
98
99
100
101
102
103
104
105
106 public void merge( Model target, Model source, boolean sourceDominant, Map<?, ?> hints )
107 {
108 Objects.requireNonNull( target, "target cannot be null" );
109
110 if ( source == null )
111 {
112 return;
113 }
114
115 Map<Object, Object> context = new HashMap<>();
116 if ( hints != null )
117 {
118 context.putAll( hints );
119 }
120
121 mergeModel( target, source, sourceDominant, context );
122 }
123
124 protected void mergeModel( Model target, Model source, boolean sourceDominant, Map<Object, Object> context )
125 {
126 mergeModelBase( target, source, sourceDominant, context );
127
128 mergeModel_ChildProjectUrlInheritAppendPath( target, source, sourceDominant, context );
129 mergeModel_ModelVersion( target, source, sourceDominant, context );
130 mergeModel_Parent( target, source, sourceDominant, context );
131 mergeModel_GroupId( target, source, sourceDominant, context );
132 mergeModel_ArtifactId( target, source, sourceDominant, context );
133 mergeModel_Version( target, source, sourceDominant, context );
134 mergeModel_Packaging( target, source, sourceDominant, context );
135 mergeModel_Name( target, source, sourceDominant, context );
136 mergeModel_Description( target, source, sourceDominant, context );
137 mergeModel_Url( target, source, sourceDominant, context );
138 mergeModel_InceptionYear( target, source, sourceDominant, context );
139 mergeModel_Organization( target, source, sourceDominant, context );
140 mergeModel_Licenses( target, source, sourceDominant, context );
141 mergeModel_MailingLists( target, source, sourceDominant, context );
142 mergeModel_Developers( target, source, sourceDominant, context );
143 mergeModel_Contributors( target, source, sourceDominant, context );
144 mergeModel_IssueManagement( target, source, sourceDominant, context );
145 mergeModel_Scm( target, source, sourceDominant, context );
146 mergeModel_CiManagement( target, source, sourceDominant, context );
147 mergeModel_Prerequisites( target, source, sourceDominant, context );
148 mergeModel_Build( target, source, sourceDominant, context );
149 mergeModel_Profiles( target, source, sourceDominant, context );
150 }
151
152 protected void mergeModel_ModelVersion( Model target, Model source, boolean sourceDominant,
153 Map<Object, Object> context )
154 {
155 String src = source.getModelVersion();
156 if ( src != null )
157 {
158 if ( sourceDominant || target.getModelVersion() == null )
159 {
160 target.setModelVersion( src );
161 target.setLocation( "modelVersion", source.getLocation( "modelVersion" ) );
162 }
163 }
164 }
165
166 protected void mergeModel_Parent( Model target, Model source, boolean sourceDominant, Map<Object, Object> context )
167 {
168 Parent src = source.getParent();
169 if ( src != null )
170 {
171 Parent tgt = target.getParent();
172 if ( tgt == null )
173 {
174 tgt = new Parent();
175 tgt.setRelativePath( null );
176 target.setParent( tgt );
177 }
178 mergeParent( tgt, src, sourceDominant, context );
179 }
180 }
181
182 protected void mergeModel_GroupId( Model target, Model source, boolean sourceDominant,
183 Map<Object, Object> context )
184 {
185 String src = source.getGroupId();
186 if ( src != null )
187 {
188 if ( sourceDominant || target.getGroupId() == null )
189 {
190 target.setGroupId( src );
191 target.setLocation( "groupId", source.getLocation( "groupId" ) );
192 }
193 }
194 }
195
196 protected void mergeModel_ArtifactId( Model target, Model source, boolean sourceDominant,
197 Map<Object, Object> context )
198 {
199 String src = source.getArtifactId();
200 if ( src != null )
201 {
202 if ( sourceDominant || target.getArtifactId() == null )
203 {
204 target.setArtifactId( src );
205 target.setLocation( "artifactId", source.getLocation( "artifactId" ) );
206 }
207 }
208 }
209
210 protected void mergeModel_ChildProjectUrlInheritAppendPath( Model target, Model source, boolean sourceDominant,
211 Map<Object, Object> context )
212 {
213 String src = source.getChildProjectUrlInheritAppendPath();
214 if ( src != null )
215 {
216 if ( sourceDominant || target.getChildProjectUrlInheritAppendPath() == null )
217 {
218 target.setChildProjectUrlInheritAppendPath( src );
219 target.setLocation( "child.project.url.inherit.append.path",
220 source.getLocation( "child.project.url.inherit.append.path" ) );
221 }
222 }
223 }
224
225 protected void mergeModel_Version( Model target, Model source, boolean sourceDominant,
226 Map<Object, Object> context )
227 {
228 String src = source.getVersion();
229 if ( src != null )
230 {
231 if ( sourceDominant || target.getVersion() == null )
232 {
233 target.setVersion( src );
234 target.setLocation( "version", source.getLocation( "version" ) );
235 }
236 }
237 }
238
239 protected void mergeModel_Packaging( Model target, Model source, boolean sourceDominant,
240 Map<Object, Object> context )
241 {
242 String src = source.getPackaging();
243 if ( src != null )
244 {
245 if ( sourceDominant || target.getPackaging() == null )
246 {
247 target.setPackaging( src );
248 target.setLocation( "packaging", source.getLocation( "packaging" ) );
249 }
250 }
251 }
252
253 protected void mergeModel_Name( Model target, Model source, boolean sourceDominant, Map<Object, Object> context )
254 {
255 String src = source.getName();
256 if ( src != null )
257 {
258 if ( sourceDominant || target.getName() == null )
259 {
260 target.setName( src );
261 target.setLocation( "name", source.getLocation( "name" ) );
262 }
263 }
264 }
265
266 protected void mergeModel_Description( Model target, Model source, boolean sourceDominant,
267 Map<Object, Object> context )
268 {
269 String src = source.getDescription();
270 if ( src != null )
271 {
272 if ( sourceDominant || target.getDescription() == null )
273 {
274 target.setDescription( src );
275 target.setLocation( "description", source.getLocation( "description" ) );
276 }
277 }
278 }
279
280 protected void mergeModel_Url( Model target, Model source, boolean sourceDominant, Map<Object, Object> context )
281 {
282 String src = source.getUrl();
283 if ( src != null )
284 {
285 if ( sourceDominant || target.getUrl() == null )
286 {
287 target.setUrl( src );
288 target.setLocation( "url", source.getLocation( "url" ) );
289 }
290 }
291 }
292
293 protected void mergeModel_InceptionYear( Model target, Model source, boolean sourceDominant,
294 Map<Object, Object> context )
295 {
296 String src = source.getInceptionYear();
297 if ( src != null )
298 {
299 if ( sourceDominant || target.getInceptionYear() == null )
300 {
301 target.setInceptionYear( src );
302 target.setLocation( "inceptionYear", source.getLocation( "inceptionYear" ) );
303 }
304 }
305 }
306
307 protected void mergeModel_Organization( Model target, Model source, boolean sourceDominant,
308 Map<Object, Object> context )
309 {
310 Organization src = source.getOrganization();
311 if ( src != null )
312 {
313 Organization tgt = target.getOrganization();
314 if ( tgt == null )
315 {
316 tgt = new Organization();
317 target.setOrganization( tgt );
318 }
319 mergeOrganization( tgt, src, sourceDominant, context );
320 }
321 }
322
323 protected void mergeModel_Licenses( Model target, Model source, boolean sourceDominant,
324 Map<Object, Object> context )
325 {
326 List<License> src = source.getLicenses();
327 if ( !src.isEmpty() )
328 {
329 List<License> tgt = target.getLicenses();
330 Map<Object, License> merged = new LinkedHashMap<>( ( src.size() + tgt.size() ) * 2 );
331
332 for ( License element : tgt )
333 {
334 Object key = getLicenseKey( element );
335 merged.put( key, element );
336 }
337
338 for ( License element : src )
339 {
340 Object key = getLicenseKey( element );
341 if ( sourceDominant || !merged.containsKey( key ) )
342 {
343 merged.put( key, element );
344 }
345 }
346
347 target.setLicenses( new ArrayList<>( merged.values() ) );
348 }
349 }
350
351 protected void mergeModel_MailingLists( Model target, Model source, boolean sourceDominant,
352 Map<Object, Object> context )
353 {
354 List<MailingList> src = source.getMailingLists();
355 if ( !src.isEmpty() )
356 {
357 List<MailingList> tgt = target.getMailingLists();
358 Map<Object, MailingList> merged = new LinkedHashMap<>( ( src.size() + tgt.size() ) * 2 );
359
360 for ( MailingList element : tgt )
361 {
362 Object key = getMailingListKey( element );
363 merged.put( key, element );
364 }
365
366 for ( MailingList element : src )
367 {
368 Object key = getMailingListKey( element );
369 if ( sourceDominant || !merged.containsKey( key ) )
370 {
371 merged.put( key, element );
372 }
373 }
374
375 target.setMailingLists( new ArrayList<>( merged.values() ) );
376 }
377 }
378
379 protected void mergeModel_Developers( Model target, Model source, boolean sourceDominant,
380 Map<Object, Object> context )
381 {
382 List<Developer> src = source.getDevelopers();
383 if ( !src.isEmpty() )
384 {
385 List<Developer> tgt = target.getDevelopers();
386 Map<Object, Developer> merged = new LinkedHashMap<>( ( src.size() + tgt.size() ) * 2 );
387
388 for ( Developer element : tgt )
389 {
390 Object key = getDeveloperKey( element );
391 merged.put( key, element );
392 }
393
394 for ( Developer element : src )
395 {
396 Object key = getDeveloperKey( element );
397 if ( sourceDominant || !merged.containsKey( key ) )
398 {
399 merged.put( key, element );
400 }
401 }
402
403 target.setDevelopers( new ArrayList<>( merged.values() ) );
404 }
405 }
406
407 protected void mergeModel_Contributors( Model target, Model source, boolean sourceDominant,
408 Map<Object, Object> context )
409 {
410 List<Contributor> src = source.getContributors();
411 if ( !src.isEmpty() )
412 {
413 List<Contributor> tgt = target.getContributors();
414 Map<Object, Contributor> merged = new LinkedHashMap<>( ( src.size() + tgt.size() ) * 2 );
415
416 for ( Contributor element : tgt )
417 {
418 Object key = getContributorKey( element );
419 merged.put( key, element );
420 }
421
422 for ( Contributor element : src )
423 {
424 Object key = getContributorKey( element );
425 if ( sourceDominant || !merged.containsKey( key ) )
426 {
427 merged.put( key, element );
428 }
429 }
430
431 target.setContributors( new ArrayList<>( merged.values() ) );
432 }
433 }
434
435 protected void mergeModel_IssueManagement( Model target, Model source, boolean sourceDominant,
436 Map<Object, Object> context )
437 {
438 IssueManagement src = source.getIssueManagement();
439 if ( src != null )
440 {
441 IssueManagement tgt = target.getIssueManagement();
442 if ( tgt == null )
443 {
444 tgt = new IssueManagement();
445 target.setIssueManagement( tgt );
446 }
447 mergeIssueManagement( tgt, src, sourceDominant, context );
448 }
449 }
450
451 protected void mergeModel_Scm( Model target, Model source, boolean sourceDominant, Map<Object, Object> context )
452 {
453 Scm src = source.getScm();
454 if ( src != null )
455 {
456 Scm tgt = target.getScm();
457 if ( tgt == null )
458 {
459 tgt = new Scm();
460 tgt.setTag( null );
461 target.setScm( tgt );
462 }
463 mergeScm( tgt, src, sourceDominant, context );
464 }
465 }
466
467 protected void mergeModel_CiManagement( Model target, Model source, boolean sourceDominant,
468 Map<Object, Object> context )
469 {
470 CiManagement src = source.getCiManagement();
471 if ( src != null )
472 {
473 CiManagement tgt = target.getCiManagement();
474 if ( tgt == null )
475 {
476 tgt = new CiManagement();
477 target.setCiManagement( tgt );
478 }
479 mergeCiManagement( tgt, src, sourceDominant, context );
480 }
481 }
482
483 protected void mergeModel_Prerequisites( Model target, Model source, boolean sourceDominant,
484 Map<Object, Object> context )
485 {
486 Prerequisites src = source.getPrerequisites();
487 if ( src != null )
488 {
489 Prerequisites tgt = target.getPrerequisites();
490 if ( tgt == null )
491 {
492 tgt = new Prerequisites();
493 tgt.setMaven( null );
494 target.setPrerequisites( tgt );
495 }
496 mergePrerequisites( tgt, src, sourceDominant, context );
497 }
498 }
499
500 protected void mergeModel_Build( Model target, Model source, boolean sourceDominant, Map<Object, Object> context )
501 {
502 Build src = source.getBuild();
503 if ( src != null )
504 {
505 Build tgt = target.getBuild();
506 if ( tgt == null )
507 {
508 tgt = new Build();
509 target.setBuild( tgt );
510 }
511 mergeBuild( tgt, src, sourceDominant, context );
512 }
513 }
514
515 protected void mergeModel_Profiles( Model target, Model source, boolean sourceDominant,
516 Map<Object, Object> context )
517 {
518 List<Profile> src = source.getProfiles();
519 if ( !src.isEmpty() )
520 {
521 List<Profile> tgt = target.getProfiles();
522 Map<Object, Profile> merged = new LinkedHashMap<>( ( src.size() + tgt.size() ) * 2 );
523
524 for ( Profile element : tgt )
525 {
526 Object key = getProfileKey( element );
527 merged.put( key, element );
528 }
529
530 for ( Profile element : src )
531 {
532 Object key = getProfileKey( element );
533 if ( sourceDominant || !merged.containsKey( key ) )
534 {
535 merged.put( key, element );
536 }
537 }
538
539 target.setProfiles( new ArrayList<>( merged.values() ) );
540 }
541 }
542
543 protected void mergeModelBase( ModelBase target, ModelBase source, boolean sourceDominant,
544 Map<Object, Object> context )
545 {
546 mergeModelBase_DistributionManagement( target, source, sourceDominant, context );
547 mergeModelBase_Modules( target, source, sourceDominant, context );
548 mergeModelBase_Repositories( target, source, sourceDominant, context );
549 mergeModelBase_PluginRepositories( target, source, sourceDominant, context );
550 mergeModelBase_Dependencies( target, source, sourceDominant, context );
551 mergeModelBase_Reporting( target, source, sourceDominant, context );
552 mergeModelBase_DependencyManagement( target, source, sourceDominant, context );
553 mergeModelBase_Properties( target, source, sourceDominant, context );
554 }
555
556 protected void mergeModelBase_Modules( ModelBase target, ModelBase source, boolean sourceDominant,
557 Map<Object, Object> context )
558 {
559 List<String> src = source.getModules();
560 if ( !src.isEmpty() )
561 {
562 List<String> tgt = target.getModules();
563 List<String> merged = new ArrayList<>( tgt.size() + src.size() );
564 merged.addAll( tgt );
565 merged.addAll( src );
566 target.setModules( merged );
567 }
568 }
569
570 protected void mergeModelBase_Dependencies( ModelBase target, ModelBase source, boolean sourceDominant,
571 Map<Object, Object> context )
572 {
573 List<Dependency> src = source.getDependencies();
574 if ( !src.isEmpty() )
575 {
576 List<Dependency> tgt = target.getDependencies();
577 Map<Object, Dependency> merged = new LinkedHashMap<>( ( src.size() + tgt.size() ) * 2 );
578
579 for ( Dependency element : tgt )
580 {
581 Object key = getDependencyKey( element );
582 merged.put( key, element );
583 }
584
585 for ( Dependency element : src )
586 {
587 Object key = getDependencyKey( element );
588 if ( sourceDominant || !merged.containsKey( key ) )
589 {
590 merged.put( key, element );
591 }
592 }
593
594 target.setDependencies( new ArrayList<>( merged.values() ) );
595 }
596 }
597
598 protected void mergeModelBase_Repositories( ModelBase target, ModelBase source, boolean sourceDominant,
599 Map<Object, Object> context )
600 {
601 List<Repository> src = source.getRepositories();
602 if ( !src.isEmpty() )
603 {
604 List<Repository> tgt = target.getRepositories();
605 Map<Object, Repository> merged = new LinkedHashMap<>( ( src.size() + tgt.size() ) * 2 );
606
607 for ( Repository element : tgt )
608 {
609 Object key = getRepositoryKey( element );
610 merged.put( key, element );
611 }
612
613 for ( Repository element : src )
614 {
615 Object key = getRepositoryKey( element );
616 if ( sourceDominant || !merged.containsKey( key ) )
617 {
618 merged.put( key, element );
619 }
620 }
621
622 target.setRepositories( new ArrayList<>( merged.values() ) );
623 }
624 }
625
626 protected void mergeModelBase_PluginRepositories( ModelBase target, ModelBase source, boolean sourceDominant,
627 Map<Object, Object> context )
628 {
629 List<Repository> src = source.getPluginRepositories();
630 if ( !src.isEmpty() )
631 {
632 List<Repository> tgt = target.getPluginRepositories();
633 Map<Object, Repository> merged = new LinkedHashMap<>( ( src.size() + tgt.size() ) * 2 );
634
635 for ( Repository element : tgt )
636 {
637 Object key = getRepositoryKey( element );
638 merged.put( key, element );
639 }
640
641 for ( Repository element : src )
642 {
643 Object key = getRepositoryKey( element );
644 if ( sourceDominant || !merged.containsKey( key ) )
645 {
646 merged.put( key, element );
647 }
648 }
649
650 target.setPluginRepositories( new ArrayList<>( merged.values() ) );
651 }
652 }
653
654 protected void mergeModelBase_DistributionManagement( ModelBase target, ModelBase source, boolean sourceDominant,
655 Map<Object, Object> context )
656 {
657 DistributionManagement src = source.getDistributionManagement();
658 if ( src != null )
659 {
660 DistributionManagement tgt = target.getDistributionManagement();
661 if ( tgt == null )
662 {
663 tgt = new DistributionManagement();
664 target.setDistributionManagement( tgt );
665 }
666 mergeDistributionManagement( tgt, src, sourceDominant, context );
667 }
668 }
669
670 protected void mergeModelBase_Reporting( ModelBase target, ModelBase source, boolean sourceDominant,
671 Map<Object, Object> context )
672 {
673 Reporting src = source.getReporting();
674 if ( src != null )
675 {
676 Reporting tgt = target.getReporting();
677 if ( tgt == null )
678 {
679 tgt = new Reporting();
680 target.setReporting( tgt );
681 }
682 mergeReporting( tgt, src, sourceDominant, context );
683 }
684 }
685
686 protected void mergeModelBase_DependencyManagement( ModelBase target, ModelBase source, boolean sourceDominant,
687 Map<Object, Object> context )
688 {
689 DependencyManagement src = source.getDependencyManagement();
690 if ( src != null )
691 {
692 DependencyManagement tgt = target.getDependencyManagement();
693 if ( tgt == null )
694 {
695 tgt = new DependencyManagement();
696 target.setDependencyManagement( tgt );
697 }
698 mergeDependencyManagement( tgt, src, sourceDominant, context );
699 }
700 }
701
702 protected void mergeModelBase_Properties( ModelBase target, ModelBase source, boolean sourceDominant,
703 Map<Object, Object> context )
704 {
705 Properties merged = new Properties();
706 if ( sourceDominant )
707 {
708 merged.putAll( target.getProperties() );
709 merged.putAll( source.getProperties() );
710 }
711 else
712 {
713 merged.putAll( source.getProperties() );
714 merged.putAll( target.getProperties() );
715 }
716 target.setProperties( merged );
717 target.setLocation( "properties", InputLocation.merge( target.getLocation( "properties" ),
718 source.getLocation( "properties" ), sourceDominant ) );
719 }
720
721 protected void mergeDistributionManagement( DistributionManagement target, DistributionManagement source,
722 boolean sourceDominant, Map<Object, Object> context )
723 {
724 mergeDistributionManagement_Repository( target, source, sourceDominant, context );
725 mergeDistributionManagement_SnapshotRepository( target, source, sourceDominant, context );
726 mergeDistributionManagement_Site( target, source, sourceDominant, context );
727 mergeDistributionManagement_Status( target, source, sourceDominant, context );
728 mergeDistributionManagement_DownloadUrl( target, source, sourceDominant, context );
729 }
730
731 protected void mergeDistributionManagement_Repository( DistributionManagement target,
732 DistributionManagement source, boolean sourceDominant,
733 Map<Object, Object> context )
734 {
735 DeploymentRepository src = source.getRepository();
736 if ( src != null )
737 {
738 DeploymentRepository tgt = target.getRepository();
739 if ( tgt == null )
740 {
741 tgt = new DeploymentRepository();
742 target.setRepository( tgt );
743 }
744 mergeDeploymentRepository( tgt, src, sourceDominant, context );
745 }
746 }
747
748 protected void mergeDistributionManagement_SnapshotRepository( DistributionManagement target,
749 DistributionManagement source,
750 boolean sourceDominant,
751 Map<Object, Object> context )
752 {
753 DeploymentRepository src = source.getSnapshotRepository();
754 if ( src != null )
755 {
756 DeploymentRepository tgt = target.getSnapshotRepository();
757 if ( tgt == null )
758 {
759 tgt = new DeploymentRepository();
760 target.setSnapshotRepository( tgt );
761 }
762 mergeDeploymentRepository( tgt, src, sourceDominant, context );
763 }
764 }
765
766 protected void mergeDistributionManagement_Site( DistributionManagement target, DistributionManagement source,
767 boolean sourceDominant, Map<Object, Object> context )
768 {
769 Site src = source.getSite();
770 if ( src != null )
771 {
772 Site tgt = target.getSite();
773 if ( tgt == null )
774 {
775 tgt = new Site();
776 target.setSite( tgt );
777 }
778 mergeSite( tgt, src, sourceDominant, context );
779 }
780 }
781
782 protected void mergeDistributionManagement_Status( DistributionManagement target, DistributionManagement source,
783 boolean sourceDominant, Map<Object, Object> context )
784 {
785 String src = source.getStatus();
786 if ( src != null )
787 {
788 if ( sourceDominant || target.getStatus() == null )
789 {
790 target.setStatus( src );
791 target.setLocation( "status", source.getLocation( "status" ) );
792 }
793 }
794 }
795
796 protected void mergeDistributionManagement_DownloadUrl( DistributionManagement target,
797 DistributionManagement source, boolean sourceDominant,
798 Map<Object, Object> context )
799 {
800 String src = source.getDownloadUrl();
801 if ( src != null )
802 {
803 if ( sourceDominant || target.getDownloadUrl() == null )
804 {
805 target.setDownloadUrl( src );
806 target.setLocation( "downloadUrl", source.getLocation( "downloadUrl" ) );
807 }
808 }
809 }
810
811 protected void mergeRelocation( Relocation target, Relocation source, boolean sourceDominant,
812 Map<Object, Object> context )
813 {
814 mergeRelocation_GroupId( target, source, sourceDominant, context );
815 mergeRelocation_ArtifactId( target, source, sourceDominant, context );
816 mergeRelocation_Version( target, source, sourceDominant, context );
817 mergeRelocation_Message( target, source, sourceDominant, context );
818 }
819
820 protected void mergeRelocation_GroupId( Relocation target, Relocation source, boolean sourceDominant,
821 Map<Object, Object> context )
822 {
823 String src = source.getGroupId();
824 if ( src != null )
825 {
826 if ( sourceDominant || target.getGroupId() == null )
827 {
828 target.setGroupId( src );
829 target.setLocation( "groupId", source.getLocation( "groupId" ) );
830 }
831 }
832 }
833
834 protected void mergeRelocation_ArtifactId( Relocation target, Relocation source, boolean sourceDominant,
835 Map<Object, Object> context )
836 {
837 String src = source.getArtifactId();
838 if ( src != null )
839 {
840 if ( sourceDominant || target.getArtifactId() == null )
841 {
842 target.setArtifactId( src );
843 target.setLocation( "artifactId", source.getLocation( "artifactId" ) );
844 }
845 }
846 }
847
848 protected void mergeRelocation_Version( Relocation target, Relocation source, boolean sourceDominant,
849 Map<Object, Object> context )
850 {
851 String src = source.getVersion();
852 if ( src != null )
853 {
854 if ( sourceDominant || target.getVersion() == null )
855 {
856 target.setVersion( src );
857 target.setLocation( "version", source.getLocation( "version" ) );
858 }
859 }
860 }
861
862 protected void mergeRelocation_Message( Relocation target, Relocation source, boolean sourceDominant,
863 Map<Object, Object> context )
864 {
865 String src = source.getMessage();
866 if ( src != null )
867 {
868 if ( sourceDominant || target.getMessage() == null )
869 {
870 target.setMessage( src );
871 target.setLocation( "message", source.getLocation( "message" ) );
872 }
873 }
874 }
875
876 protected void mergeDeploymentRepository( DeploymentRepository target, DeploymentRepository source,
877 boolean sourceDominant, Map<Object, Object> context )
878 {
879 mergeRepository( target, source, sourceDominant, context );
880 mergeDeploymentRepository_UniqueVersion( target, source, sourceDominant, context );
881 }
882
883 protected void mergeDeploymentRepository_UniqueVersion( DeploymentRepository target, DeploymentRepository source,
884 boolean sourceDominant, Map<Object, Object> context )
885 {
886 if ( sourceDominant )
887 {
888 target.setUniqueVersion( source.isUniqueVersion() );
889 target.setLocation( "uniqueVersion", source.getLocation( "uniqueVersion" ) );
890 }
891 }
892
893 protected void mergeSite( Site target, Site source, boolean sourceDominant, Map<Object, Object> context )
894 {
895 mergeSite_ChildSiteUrlInheritAppendPath( target, source, sourceDominant, context );
896 mergeSite_Id( target, source, sourceDominant, context );
897 mergeSite_Name( target, source, sourceDominant, context );
898 mergeSite_Url( target, source, sourceDominant, context );
899 }
900
901 protected void mergeSite_ChildSiteUrlInheritAppendPath( Site target, Site source, boolean sourceDominant,
902 Map<Object, Object> context )
903 {
904 String src = source.getChildSiteUrlInheritAppendPath();
905 if ( src != null )
906 {
907 if ( sourceDominant || target.getChildSiteUrlInheritAppendPath() == null )
908 {
909 target.setChildSiteUrlInheritAppendPath( src );
910 target.setLocation( "child.site.url.inherit.append.path",
911 source.getLocation( "child.site.url.inherit.append.path" ) );
912 }
913 }
914 }
915
916 protected void mergeSite_Id( Site target, Site source, boolean sourceDominant, Map<Object, Object> context )
917 {
918 String src = source.getId();
919 if ( src != null )
920 {
921 if ( sourceDominant || target.getId() == null )
922 {
923 target.setId( src );
924 target.setLocation( "id", source.getLocation( "id" ) );
925 }
926 }
927 }
928
929 protected void mergeSite_Name( Site target, Site source, boolean sourceDominant, Map<Object, Object> context )
930 {
931 String src = source.getName();
932 if ( src != null )
933 {
934 if ( sourceDominant || target.getName() == null )
935 {
936 target.setName( src );
937 target.setLocation( "name", source.getLocation( "name" ) );
938 }
939 }
940 }
941
942 protected void mergeSite_Url( Site target, Site source, boolean sourceDominant, Map<Object, Object> context )
943 {
944 String src = source.getUrl();
945 if ( src != null )
946 {
947 if ( sourceDominant || target.getUrl() == null )
948 {
949 target.setUrl( src );
950 target.setLocation( "url", source.getLocation( "url" ) );
951 }
952 }
953 }
954
955 protected void mergeRepository( Repository target, Repository source, boolean sourceDominant,
956 Map<Object, Object> context )
957 {
958 mergeRepositoryBase( target, source, sourceDominant, context );
959 mergeRepository_Releases( target, source, sourceDominant, context );
960 mergeRepository_Snapshots( target, source, sourceDominant, context );
961 }
962
963 protected void mergeRepository_Releases( Repository target, Repository source, boolean sourceDominant,
964 Map<Object, Object> context )
965 {
966 RepositoryPolicy src = source.getReleases();
967 if ( src != null )
968 {
969 RepositoryPolicy tgt = target.getReleases();
970 if ( tgt == null )
971 {
972 tgt = new RepositoryPolicy();
973 target.setReleases( tgt );
974 }
975 mergeRepositoryPolicy( tgt, src, sourceDominant, context );
976 }
977 }
978
979 protected void mergeRepository_Snapshots( Repository target, Repository source, boolean sourceDominant,
980 Map<Object, Object> context )
981 {
982 RepositoryPolicy src = source.getSnapshots();
983 if ( src != null )
984 {
985 RepositoryPolicy tgt = target.getSnapshots();
986 if ( tgt == null )
987 {
988 tgt = new RepositoryPolicy();
989 target.setSnapshots( tgt );
990 }
991 mergeRepositoryPolicy( tgt, src, sourceDominant, context );
992 }
993 }
994
995 protected void mergeRepositoryBase( RepositoryBase target, RepositoryBase source, boolean sourceDominant,
996 Map<Object, Object> context )
997 {
998 mergeRepositoryBase_Id( target, source, sourceDominant, context );
999 mergeRepositoryBase_Name( target, source, sourceDominant, context );
1000 mergeRepositoryBase_Url( target, source, sourceDominant, context );
1001 mergeRepositoryBase_Layout( target, source, sourceDominant, context );
1002 }
1003
1004 protected void mergeRepositoryBase_Id( RepositoryBase target, RepositoryBase source, boolean sourceDominant,
1005 Map<Object, Object> context )
1006 {
1007 String src = source.getId();
1008 if ( src != null )
1009 {
1010 if ( sourceDominant || target.getId() == null )
1011 {
1012 target.setId( src );
1013 target.setLocation( "id", source.getLocation( "id" ) );
1014 }
1015 }
1016 }
1017
1018 protected void mergeRepositoryBase_Url( RepositoryBase target, RepositoryBase source, boolean sourceDominant,
1019 Map<Object, Object> context )
1020 {
1021 String src = source.getUrl();
1022 if ( src != null )
1023 {
1024 if ( sourceDominant || target.getUrl() == null )
1025 {
1026 target.setUrl( src );
1027 target.setLocation( "url", source.getLocation( "url" ) );
1028 }
1029 }
1030 }
1031
1032 protected void mergeRepositoryBase_Name( RepositoryBase target, RepositoryBase source, boolean sourceDominant,
1033 Map<Object, Object> context )
1034 {
1035 String src = source.getName();
1036 if ( src != null )
1037 {
1038 if ( sourceDominant || target.getName() == null )
1039 {
1040 target.setName( src );
1041 target.setLocation( "name", source.getLocation( "name" ) );
1042 }
1043 }
1044 }
1045
1046 protected void mergeRepositoryBase_Layout( RepositoryBase target, RepositoryBase source, boolean sourceDominant,
1047 Map<Object, Object> context )
1048 {
1049 String src = source.getLayout();
1050 if ( src != null )
1051 {
1052 if ( sourceDominant || target.getLayout() == null )
1053 {
1054 target.setLayout( src );
1055 target.setLocation( "layout", source.getLocation( "layout" ) );
1056 }
1057 }
1058 }
1059
1060 protected void mergeRepositoryPolicy( RepositoryPolicy target, RepositoryPolicy source, boolean sourceDominant,
1061 Map<Object, Object> context )
1062 {
1063 mergeRepositoryPolicy_Enabled( target, source, sourceDominant, context );
1064 mergeRepositoryPolicy_UpdatePolicy( target, source, sourceDominant, context );
1065 mergeRepositoryPolicy_ChecksumPolicy( target, source, sourceDominant, context );
1066 }
1067
1068 protected void mergeRepositoryPolicy_Enabled( RepositoryPolicy target, RepositoryPolicy source,
1069 boolean sourceDominant, Map<Object, Object> context )
1070 {
1071 String src = source.getEnabled();
1072 if ( src != null )
1073 {
1074 if ( sourceDominant || target.getEnabled() == null )
1075 {
1076 target.setEnabled( src );
1077 target.setLocation( "enabled", source.getLocation( "enabled" ) );
1078 }
1079 }
1080 }
1081
1082 protected void mergeRepositoryPolicy_UpdatePolicy( RepositoryPolicy target, RepositoryPolicy source,
1083 boolean sourceDominant, Map<Object, Object> context )
1084 {
1085 String src = source.getUpdatePolicy();
1086 if ( src != null )
1087 {
1088 if ( sourceDominant || target.getUpdatePolicy() == null )
1089 {
1090 target.setUpdatePolicy( src );
1091 target.setLocation( "updatePolicy", source.getLocation( "updatePolicy" ) );
1092 }
1093 }
1094 }
1095
1096 protected void mergeRepositoryPolicy_ChecksumPolicy( RepositoryPolicy target, RepositoryPolicy source,
1097 boolean sourceDominant, Map<Object, Object> context )
1098 {
1099 String src = source.getChecksumPolicy();
1100 if ( src != null )
1101 {
1102 if ( sourceDominant || target.getChecksumPolicy() == null )
1103 {
1104 target.setChecksumPolicy( src );
1105 target.setLocation( "checksumPolicy", source.getLocation( "checksumPolicy" ) );
1106 }
1107 }
1108 }
1109
1110 protected void mergeDependency( Dependency target, Dependency source, boolean sourceDominant,
1111 Map<Object, Object> context )
1112 {
1113 mergeDependency_GroupId( target, source, sourceDominant, context );
1114 mergeDependency_ArtifactId( target, source, sourceDominant, context );
1115 mergeDependency_Version( target, source, sourceDominant, context );
1116 mergeDependency_Type( target, source, sourceDominant, context );
1117 mergeDependency_Classifier( target, source, sourceDominant, context );
1118 mergeDependency_Scope( target, source, sourceDominant, context );
1119 mergeDependency_SystemPath( target, source, sourceDominant, context );
1120 mergeDependency_Optional( target, source, sourceDominant, context );
1121 mergeDependency_Exclusions( target, source, sourceDominant, context );
1122 }
1123
1124 protected void mergeDependency_GroupId( Dependency target, Dependency source, boolean sourceDominant,
1125 Map<Object, Object> context )
1126 {
1127 String src = source.getGroupId();
1128 if ( src != null )
1129 {
1130 if ( sourceDominant || target.getGroupId() == null )
1131 {
1132 target.setGroupId( src );
1133 target.setLocation( "groupId", source.getLocation( "groupId" ) );
1134 }
1135 }
1136 }
1137
1138 protected void mergeDependency_ArtifactId( Dependency target, Dependency source, boolean sourceDominant,
1139 Map<Object, Object> context )
1140 {
1141 String src = source.getArtifactId();
1142 if ( src != null )
1143 {
1144 if ( sourceDominant || target.getArtifactId() == null )
1145 {
1146 target.setArtifactId( src );
1147 target.setLocation( "artifactId", source.getLocation( "artifactId" ) );
1148 }
1149 }
1150 }
1151
1152 protected void mergeDependency_Version( Dependency target, Dependency source, boolean sourceDominant,
1153 Map<Object, Object> context )
1154 {
1155 String src = source.getVersion();
1156 if ( src != null )
1157 {
1158 if ( sourceDominant || target.getVersion() == null )
1159 {
1160 target.setVersion( src );
1161 target.setLocation( "version", source.getLocation( "version" ) );
1162 }
1163 }
1164 }
1165
1166 protected void mergeDependency_Type( Dependency target, Dependency source, boolean sourceDominant,
1167 Map<Object, Object> context )
1168 {
1169 String src = source.getType();
1170 if ( src != null )
1171 {
1172 if ( sourceDominant || target.getType() == null )
1173 {
1174 target.setType( src );
1175 target.setLocation( "type", source.getLocation( "type" ) );
1176 }
1177 }
1178 }
1179
1180 protected void mergeDependency_Classifier( Dependency target, Dependency source, boolean sourceDominant,
1181 Map<Object, Object> context )
1182 {
1183 String src = source.getClassifier();
1184 if ( src != null )
1185 {
1186 if ( sourceDominant || target.getClassifier() == null )
1187 {
1188 target.setClassifier( src );
1189 target.setLocation( "classifier", source.getLocation( "classifier" ) );
1190 }
1191 }
1192 }
1193
1194 protected void mergeDependency_Scope( Dependency target, Dependency source, boolean sourceDominant,
1195 Map<Object, Object> context )
1196 {
1197 String src = source.getScope();
1198 if ( src != null )
1199 {
1200 if ( sourceDominant || target.getScope() == null )
1201 {
1202 target.setScope( src );
1203 target.setLocation( "scope", source.getLocation( "scope" ) );
1204 }
1205 }
1206 }
1207
1208 protected void mergeDependency_SystemPath( Dependency target, Dependency source, boolean sourceDominant,
1209 Map<Object, Object> context )
1210 {
1211 String src = source.getSystemPath();
1212 if ( src != null )
1213 {
1214 if ( sourceDominant || target.getSystemPath() == null )
1215 {
1216 target.setSystemPath( src );
1217 target.setLocation( "systemPath", source.getLocation( "systemPath" ) );
1218 }
1219 }
1220 }
1221
1222 protected void mergeDependency_Optional( Dependency target, Dependency source, boolean sourceDominant,
1223 Map<Object, Object> context )
1224 {
1225 String src = source.getOptional();
1226 if ( src != null )
1227 {
1228 if ( sourceDominant || target.getOptional() == null )
1229 {
1230 target.setOptional( src );
1231 target.setLocation( "optional", source.getLocation( "optional" ) );
1232 }
1233 }
1234 }
1235
1236 protected void mergeDependency_Exclusions( Dependency target, Dependency source, boolean sourceDominant,
1237 Map<Object, Object> context )
1238 {
1239 List<Exclusion> src = source.getExclusions();
1240 if ( !src.isEmpty() )
1241 {
1242 List<Exclusion> tgt = target.getExclusions();
1243
1244 Map<Object, Exclusion> merged = new LinkedHashMap<>( ( src.size() + tgt.size() ) * 2 );
1245
1246 for ( Exclusion element : tgt )
1247 {
1248 Object key = getExclusionKey( element );
1249 merged.put( key, element );
1250 }
1251
1252 for ( Exclusion element : src )
1253 {
1254 Object key = getExclusionKey( element );
1255 if ( sourceDominant || !merged.containsKey( key ) )
1256 {
1257 merged.put( key, element );
1258 }
1259 }
1260
1261 target.setExclusions( new ArrayList<>( merged.values() ) );
1262 }
1263 }
1264
1265 protected void mergeExclusion( Exclusion target, Exclusion source, boolean sourceDominant,
1266 Map<Object, Object> context )
1267 {
1268 mergeExclusion_GroupId( target, source, sourceDominant, context );
1269 mergeExclusion_ArtifactId( target, source, sourceDominant, context );
1270 }
1271
1272 protected void mergeExclusion_GroupId( Exclusion target, Exclusion source, boolean sourceDominant,
1273 Map<Object, Object> context )
1274 {
1275 String src = source.getGroupId();
1276 if ( src != null )
1277 {
1278 if ( sourceDominant || target.getGroupId() == null )
1279 {
1280 target.setGroupId( src );
1281 target.setLocation( "groupId", source.getLocation( "groupId" ) );
1282 }
1283 }
1284 }
1285
1286 protected void mergeExclusion_ArtifactId( Exclusion target, Exclusion source, boolean sourceDominant,
1287 Map<Object, Object> context )
1288 {
1289 String src = source.getArtifactId();
1290 if ( src != null )
1291 {
1292 if ( sourceDominant || target.getArtifactId() == null )
1293 {
1294 target.setArtifactId( src );
1295 target.setLocation( "artifactId", source.getLocation( "artifactId" ) );
1296 }
1297 }
1298 }
1299
1300 protected void mergeReporting( Reporting target, Reporting source, boolean sourceDominant,
1301 Map<Object, Object> context )
1302 {
1303 mergeReporting_OutputDirectory( target, source, sourceDominant, context );
1304 mergeReporting_ExcludeDefaults( target, source, sourceDominant, context );
1305 mergeReporting_Plugins( target, source, sourceDominant, context );
1306 }
1307
1308 protected void mergeReporting_OutputDirectory( Reporting target, Reporting source, boolean sourceDominant,
1309 Map<Object, Object> context )
1310 {
1311 String src = source.getOutputDirectory();
1312 if ( src != null )
1313 {
1314 if ( sourceDominant || target.getOutputDirectory() == null )
1315 {
1316 target.setOutputDirectory( src );
1317 target.setLocation( "outputDirectory", source.getLocation( "outputDirectory" ) );
1318 }
1319 }
1320 }
1321
1322 protected void mergeReporting_ExcludeDefaults( Reporting target, Reporting source, boolean sourceDominant,
1323 Map<Object, Object> context )
1324 {
1325 String src = source.getExcludeDefaults();
1326 if ( src != null )
1327 {
1328 if ( sourceDominant || target.getExcludeDefaults() == null )
1329 {
1330 target.setExcludeDefaults( src );
1331 target.setLocation( "excludeDefaults", source.getLocation( "excludeDefaults" ) );
1332 }
1333 }
1334 }
1335
1336 protected void mergeReporting_Plugins( Reporting target, Reporting source, boolean sourceDominant,
1337 Map<Object, Object> context )
1338 {
1339 List<ReportPlugin> src = source.getPlugins();
1340 if ( !src.isEmpty() )
1341 {
1342 List<ReportPlugin> tgt = target.getPlugins();
1343 Map<Object, ReportPlugin> merged =
1344 new LinkedHashMap<>( ( src.size() + tgt.size() ) * 2 );
1345
1346 for ( ReportPlugin element : tgt )
1347 {
1348 Object key = getReportPluginKey( element );
1349 merged.put( key, element );
1350 }
1351
1352 for ( ReportPlugin element : src )
1353 {
1354 Object key = getReportPluginKey( element );
1355 if ( sourceDominant || !merged.containsKey( key ) )
1356 {
1357 merged.put( key, element );
1358 }
1359 }
1360
1361 target.setPlugins( new ArrayList<>( merged.values() ) );
1362 }
1363 }
1364
1365 protected void mergeReportPlugin( ReportPlugin target, ReportPlugin source, boolean sourceDominant,
1366 Map<Object, Object> context )
1367 {
1368 mergeConfigurationContainer( target, source, sourceDominant, context );
1369 mergeReportPlugin_GroupId( target, source, sourceDominant, context );
1370 mergeReportPlugin_ArtifactId( target, source, sourceDominant, context );
1371 mergeReportPlugin_Version( target, source, sourceDominant, context );
1372 mergeReportPlugin_ReportSets( target, source, sourceDominant, context );
1373 }
1374
1375 protected void mergeReportPlugin_GroupId( ReportPlugin target, ReportPlugin source, boolean sourceDominant,
1376 Map<Object, Object> context )
1377 {
1378 String src = source.getGroupId();
1379 if ( src != null )
1380 {
1381 if ( sourceDominant || target.getGroupId() == null )
1382 {
1383 target.setGroupId( src );
1384 target.setLocation( "groupId", source.getLocation( "groupId" ) );
1385 }
1386 }
1387 }
1388
1389 protected void mergeReportPlugin_ArtifactId( ReportPlugin target, ReportPlugin source, boolean sourceDominant,
1390 Map<Object, Object> context )
1391 {
1392 String src = source.getArtifactId();
1393 if ( src != null )
1394 {
1395 if ( sourceDominant || target.getArtifactId() == null )
1396 {
1397 target.setArtifactId( src );
1398 target.setLocation( "artifactId", source.getLocation( "artifactId" ) );
1399 }
1400 }
1401 }
1402
1403 protected void mergeReportPlugin_Version( ReportPlugin target, ReportPlugin source, boolean sourceDominant,
1404 Map<Object, Object> context )
1405 {
1406 String src = source.getVersion();
1407 if ( src != null )
1408 {
1409 if ( sourceDominant || target.getVersion() == null )
1410 {
1411 target.setVersion( src );
1412 target.setLocation( "version", source.getLocation( "version" ) );
1413 }
1414 }
1415 }
1416
1417 protected void mergeReportPlugin_ReportSets( ReportPlugin target, ReportPlugin source, boolean sourceDominant,
1418 Map<Object, Object> context )
1419 {
1420 List<ReportSet> src = source.getReportSets();
1421 if ( !src.isEmpty() )
1422 {
1423 List<ReportSet> tgt = target.getReportSets();
1424 Map<Object, ReportSet> merged = new LinkedHashMap<>( ( src.size() + tgt.size() ) * 2 );
1425
1426 for ( ReportSet element : tgt )
1427 {
1428 Object key = getReportSetKey( element );
1429 merged.put( key, element );
1430 }
1431
1432 for ( ReportSet element : src )
1433 {
1434 Object key = getReportSetKey( element );
1435 if ( sourceDominant || !merged.containsKey( key ) )
1436 {
1437 merged.put( key, element );
1438 }
1439 }
1440
1441 target.setReportSets( new ArrayList<>( merged.values() ) );
1442 }
1443 }
1444
1445 protected void mergeReportSet( ReportSet target, ReportSet source, boolean sourceDominant,
1446 Map<Object, Object> context )
1447 {
1448 mergeConfigurationContainer( target, source, sourceDominant, context );
1449 mergeReportSet_Id( target, source, sourceDominant, context );
1450 mergeReportSet_Reports( target, source, sourceDominant, context );
1451 }
1452
1453 protected void mergeReportSet_Id( ReportSet target, ReportSet source, boolean sourceDominant,
1454 Map<Object, Object> context )
1455 {
1456 String src = source.getId();
1457 if ( src != null )
1458 {
1459 if ( sourceDominant || target.getId() == null )
1460 {
1461 target.setId( src );
1462 target.setLocation( "id", source.getLocation( "id" ) );
1463 }
1464 }
1465 }
1466
1467 protected void mergeReportSet_Reports( ReportSet target, ReportSet source, boolean sourceDominant,
1468 Map<Object, Object> context )
1469 {
1470 List<String> src = source.getReports();
1471 if ( !src.isEmpty() )
1472 {
1473 List<String> tgt = target.getReports();
1474 List<String> merged = new ArrayList<>( tgt.size() + src.size() );
1475 merged.addAll( tgt );
1476 merged.addAll( src );
1477 target.setReports( merged );
1478 }
1479 }
1480
1481 protected void mergeDependencyManagement( DependencyManagement target, DependencyManagement source,
1482 boolean sourceDominant, Map<Object, Object> context )
1483 {
1484 mergeDependencyManagement_Dependencies( target, source, sourceDominant, context );
1485 }
1486
1487 protected void mergeDependencyManagement_Dependencies( DependencyManagement target, DependencyManagement source,
1488 boolean sourceDominant, Map<Object, Object> context )
1489 {
1490 List<Dependency> src = source.getDependencies();
1491 if ( !src.isEmpty() )
1492 {
1493 List<Dependency> tgt = target.getDependencies();
1494 Map<Object, Dependency> merged = new LinkedHashMap<>( ( src.size() + tgt.size() ) * 2 );
1495
1496 for ( Dependency element : tgt )
1497 {
1498 Object key = getDependencyKey( element );
1499 merged.put( key, element );
1500 }
1501
1502 for ( Dependency element : src )
1503 {
1504 Object key = getDependencyKey( element );
1505 if ( sourceDominant || !merged.containsKey( key ) )
1506 {
1507 merged.put( key, element );
1508 }
1509 }
1510
1511 target.setDependencies( new ArrayList<>( merged.values() ) );
1512 }
1513 }
1514
1515 protected void mergeParent( Parent target, Parent source, boolean sourceDominant, Map<Object, Object> context )
1516 {
1517 mergeParent_GroupId( target, source, sourceDominant, context );
1518 mergeParent_ArtifactId( target, source, sourceDominant, context );
1519 mergeParent_Version( target, source, sourceDominant, context );
1520 mergeParent_RelativePath( target, source, sourceDominant, context );
1521 }
1522
1523 protected void mergeParent_GroupId( Parent target, Parent source, boolean sourceDominant,
1524 Map<Object, Object> context )
1525 {
1526 String src = source.getGroupId();
1527 if ( src != null )
1528 {
1529 if ( sourceDominant || target.getGroupId() == null )
1530 {
1531 target.setGroupId( src );
1532 target.setLocation( "groupId", source.getLocation( "groupId" ) );
1533 }
1534 }
1535 }
1536
1537 protected void mergeParent_ArtifactId( Parent target, Parent source, boolean sourceDominant,
1538 Map<Object, Object> context )
1539 {
1540 String src = source.getArtifactId();
1541 if ( src != null )
1542 {
1543 if ( sourceDominant || target.getArtifactId() == null )
1544 {
1545 target.setArtifactId( src );
1546 target.setLocation( "artifactId", source.getLocation( "artifactId" ) );
1547 }
1548 }
1549 }
1550
1551 protected void mergeParent_Version( Parent target, Parent source, boolean sourceDominant,
1552 Map<Object, Object> context )
1553 {
1554 String src = source.getVersion();
1555 if ( src != null )
1556 {
1557 if ( sourceDominant || target.getVersion() == null )
1558 {
1559 target.setVersion( src );
1560 target.setLocation( "version", source.getLocation( "version" ) );
1561 }
1562 }
1563 }
1564
1565 protected void mergeParent_RelativePath( Parent target, Parent source, boolean sourceDominant,
1566 Map<Object, Object> context )
1567 {
1568 String src = source.getRelativePath();
1569 if ( src != null )
1570 {
1571 if ( sourceDominant || target.getRelativePath() == null )
1572 {
1573 target.setRelativePath( src );
1574 target.setLocation( "relativePath", source.getLocation( "relativePath" ) );
1575 }
1576 }
1577 }
1578
1579 protected void mergeOrganization( Organization target, Organization source, boolean sourceDominant,
1580 Map<Object, Object> context )
1581 {
1582 mergeOrganization_Name( target, source, sourceDominant, context );
1583 mergeOrganization_Url( target, source, sourceDominant, context );
1584 }
1585
1586 protected void mergeOrganization_Name( Organization target, Organization source, boolean sourceDominant,
1587 Map<Object, Object> context )
1588 {
1589 String src = source.getName();
1590 if ( src != null )
1591 {
1592 if ( sourceDominant || target.getName() == null )
1593 {
1594 target.setName( src );
1595 target.setLocation( "name", source.getLocation( "name" ) );
1596 }
1597 }
1598 }
1599
1600 protected void mergeOrganization_Url( Organization target, Organization source, boolean sourceDominant,
1601 Map<Object, Object> context )
1602 {
1603 String src = source.getUrl();
1604 if ( src != null )
1605 {
1606 if ( sourceDominant || target.getUrl() == null )
1607 {
1608 target.setUrl( src );
1609 target.setLocation( "url", source.getLocation( "url" ) );
1610 }
1611 }
1612 }
1613
1614 protected void mergeLicense( License target, License source, boolean sourceDominant, Map<Object, Object> context )
1615 {
1616 mergeLicense_Name( target, source, sourceDominant, context );
1617 mergeLicense_Url( target, source, sourceDominant, context );
1618 mergeLicense_Distribution( target, source, sourceDominant, context );
1619 mergeLicense_Comments( target, source, sourceDominant, context );
1620 }
1621
1622 protected void mergeLicense_Name( License target, License source, boolean sourceDominant,
1623 Map<Object, Object> context )
1624 {
1625 String src = source.getName();
1626 if ( src != null )
1627 {
1628 if ( sourceDominant || target.getName() == null )
1629 {
1630 target.setName( src );
1631 target.setLocation( "name", source.getLocation( "name" ) );
1632 }
1633 }
1634 }
1635
1636 protected void mergeLicense_Url( License target, License source, boolean sourceDominant,
1637 Map<Object, Object> context )
1638 {
1639 String src = source.getUrl();
1640 if ( src != null )
1641 {
1642 if ( sourceDominant || target.getUrl() == null )
1643 {
1644 target.setUrl( src );
1645 target.setLocation( "url", source.getLocation( "url" ) );
1646 }
1647 }
1648 }
1649
1650 protected void mergeLicense_Distribution( License target, License source, boolean sourceDominant,
1651 Map<Object, Object> context )
1652 {
1653 String src = source.getDistribution();
1654 if ( src != null )
1655 {
1656 if ( sourceDominant || target.getDistribution() == null )
1657 {
1658 target.setDistribution( src );
1659 target.setLocation( "distribution", source.getLocation( "distribution" ) );
1660 }
1661 }
1662 }
1663
1664 protected void mergeLicense_Comments( License target, License source, boolean sourceDominant,
1665 Map<Object, Object> context )
1666 {
1667 String src = source.getComments();
1668 if ( src != null )
1669 {
1670 if ( sourceDominant || target.getComments() == null )
1671 {
1672 target.setComments( src );
1673 target.setLocation( "comments", source.getLocation( "comments" ) );
1674 }
1675 }
1676 }
1677
1678 protected void mergeMailingList( MailingList target, MailingList source, boolean sourceDominant,
1679 Map<Object, Object> context )
1680 {
1681 mergeMailingList_Name( target, source, sourceDominant, context );
1682 mergeMailingList_Subscribe( target, source, sourceDominant, context );
1683 mergeMailingList_Unsubscribe( target, source, sourceDominant, context );
1684 mergeMailingList_Post( target, source, sourceDominant, context );
1685 mergeMailingList_OtherArchives( target, source, sourceDominant, context );
1686 }
1687
1688 protected void mergeMailingList_Name( MailingList target, MailingList source, boolean sourceDominant,
1689 Map<Object, Object> context )
1690 {
1691 String src = source.getName();
1692 if ( src != null )
1693 {
1694 if ( sourceDominant || target.getName() == null )
1695 {
1696 target.setName( src );
1697 target.setLocation( "name", source.getLocation( "name" ) );
1698 }
1699 }
1700 }
1701
1702 protected void mergeMailingList_Subscribe( MailingList target, MailingList source, boolean sourceDominant,
1703 Map<Object, Object> context )
1704 {
1705 String src = source.getSubscribe();
1706 if ( src != null )
1707 {
1708 if ( sourceDominant || target.getSubscribe() == null )
1709 {
1710 target.setSubscribe( src );
1711 target.setLocation( "subscribe", source.getLocation( "subscribe" ) );
1712 }
1713 }
1714 }
1715
1716 protected void mergeMailingList_Unsubscribe( MailingList target, MailingList source, boolean sourceDominant,
1717 Map<Object, Object> context )
1718 {
1719 String src = source.getUnsubscribe();
1720 if ( src != null )
1721 {
1722 if ( sourceDominant || target.getUnsubscribe() == null )
1723 {
1724 target.setUnsubscribe( src );
1725 target.setLocation( "unsubscribe", source.getLocation( "unsubscribe" ) );
1726 }
1727 }
1728 }
1729
1730 protected void mergeMailingList_Post( MailingList target, MailingList source, boolean sourceDominant,
1731 Map<Object, Object> context )
1732 {
1733 String src = source.getPost();
1734 if ( src != null )
1735 {
1736 if ( sourceDominant || target.getPost() == null )
1737 {
1738 target.setPost( src );
1739 target.setLocation( "post", source.getLocation( "post" ) );
1740 }
1741 }
1742 }
1743
1744 protected void mergeMailingList_Archive( MailingList target, MailingList source, boolean sourceDominant,
1745 Map<Object, Object> context )
1746 {
1747 String src = source.getArchive();
1748 if ( src != null )
1749 {
1750 if ( sourceDominant || target.getArchive() == null )
1751 {
1752 target.setArchive( src );
1753 target.setLocation( "archive", source.getLocation( "archive" ) );
1754 }
1755 }
1756 }
1757
1758 protected void mergeMailingList_OtherArchives( MailingList target, MailingList source, boolean sourceDominant,
1759 Map<Object, Object> context )
1760 {
1761 List<String> src = source.getOtherArchives();
1762 if ( !src.isEmpty() )
1763 {
1764 List<String> tgt = target.getOtherArchives();
1765 List<String> merged = new ArrayList<>( tgt.size() + src.size() );
1766 merged.addAll( tgt );
1767 merged.addAll( src );
1768 target.setOtherArchives( merged );
1769 }
1770 }
1771
1772 protected void mergeDeveloper( Developer target, Developer source, boolean sourceDominant,
1773 Map<Object, Object> context )
1774 {
1775 mergeContributor( target, source, sourceDominant, context );
1776 mergeDeveloper_Id( target, source, sourceDominant, context );
1777 }
1778
1779 protected void mergeDeveloper_Id( Developer target, Developer source, boolean sourceDominant,
1780 Map<Object, Object> context )
1781 {
1782 String src = source.getId();
1783 if ( src != null )
1784 {
1785 if ( sourceDominant || target.getId() == null )
1786 {
1787 target.setId( src );
1788 target.setLocation( "id", source.getLocation( "id" ) );
1789 }
1790 }
1791 }
1792
1793 protected void mergeContributor( Contributor target, Contributor source, boolean sourceDominant,
1794 Map<Object, Object> context )
1795 {
1796 mergeContributor_Name( target, source, sourceDominant, context );
1797 mergeContributor_Email( target, source, sourceDominant, context );
1798 mergeContributor_Url( target, source, sourceDominant, context );
1799 mergeContributor_Organization( target, source, sourceDominant, context );
1800 mergeContributor_OrganizationUrl( target, source, sourceDominant, context );
1801 mergeContributor_Timezone( target, source, sourceDominant, context );
1802 mergeContributor_Roles( target, source, sourceDominant, context );
1803 mergeContributor_Properties( target, source, sourceDominant, context );
1804 }
1805
1806 protected void mergeContributor_Name( Contributor target, Contributor source, boolean sourceDominant,
1807 Map<Object, Object> context )
1808 {
1809 String src = source.getName();
1810 if ( src != null )
1811 {
1812 if ( sourceDominant || target.getName() == null )
1813 {
1814 target.setName( src );
1815 target.setLocation( "name", source.getLocation( "name" ) );
1816 }
1817 }
1818 }
1819
1820 protected void mergeContributor_Email( Contributor target, Contributor source, boolean sourceDominant,
1821 Map<Object, Object> context )
1822 {
1823 String src = source.getEmail();
1824 if ( src != null )
1825 {
1826 if ( sourceDominant || target.getEmail() == null )
1827 {
1828 target.setEmail( src );
1829 target.setLocation( "email", source.getLocation( "email" ) );
1830 }
1831 }
1832 }
1833
1834 protected void mergeContributor_Url( Contributor target, Contributor source, boolean sourceDominant,
1835 Map<Object, Object> context )
1836 {
1837 String src = source.getUrl();
1838 if ( src != null )
1839 {
1840 if ( sourceDominant || target.getUrl() == null )
1841 {
1842 target.setUrl( src );
1843 target.setLocation( "url", source.getLocation( "url" ) );
1844 }
1845 }
1846 }
1847
1848 protected void mergeContributor_Organization( Contributor target, Contributor source, boolean sourceDominant,
1849 Map<Object, Object> context )
1850 {
1851 String src = source.getOrganization();
1852 if ( src != null )
1853 {
1854 if ( sourceDominant || target.getOrganization() == null )
1855 {
1856 target.setOrganization( src );
1857 target.setLocation( "organization", source.getLocation( "organization" ) );
1858 }
1859 }
1860 }
1861
1862 protected void mergeContributor_OrganizationUrl( Contributor target, Contributor source, boolean sourceDominant,
1863 Map<Object, Object> context )
1864 {
1865 String src = source.getOrganizationUrl();
1866 if ( src != null )
1867 {
1868 if ( sourceDominant || target.getOrganizationUrl() == null )
1869 {
1870 target.setOrganizationUrl( src );
1871 target.setLocation( "organizationUrl", source.getLocation( "organizationUrl" ) );
1872 }
1873 }
1874 }
1875
1876 protected void mergeContributor_Timezone( Contributor target, Contributor source, boolean sourceDominant,
1877 Map<Object, Object> context )
1878 {
1879 String src = source.getTimezone();
1880 if ( src != null )
1881 {
1882 if ( sourceDominant || target.getTimezone() == null )
1883 {
1884 target.setTimezone( src );
1885 target.setLocation( "timezone", source.getLocation( "timezone" ) );
1886 }
1887 }
1888 }
1889
1890 protected void mergeContributor_Roles( Contributor target, Contributor source, boolean sourceDominant,
1891 Map<Object, Object> context )
1892 {
1893 List<String> src = source.getRoles();
1894 if ( !src.isEmpty() )
1895 {
1896 List<String> tgt = target.getRoles();
1897 List<String> merged = new ArrayList<>( tgt.size() + src.size() );
1898 merged.addAll( tgt );
1899 merged.addAll( src );
1900 target.setRoles( merged );
1901 }
1902 }
1903
1904 protected void mergeContributor_Properties( Contributor target, Contributor source, boolean sourceDominant,
1905 Map<Object, Object> context )
1906 {
1907 Properties merged = new Properties();
1908 if ( sourceDominant )
1909 {
1910 merged.putAll( target.getProperties() );
1911 merged.putAll( source.getProperties() );
1912 }
1913 else
1914 {
1915 merged.putAll( source.getProperties() );
1916 merged.putAll( target.getProperties() );
1917 }
1918 target.setProperties( merged );
1919 target.setLocation( "properties", InputLocation.merge( target.getLocation( "properties" ),
1920 source.getLocation( "properties" ), sourceDominant ) );
1921 }
1922
1923 protected void mergeIssueManagement( IssueManagement target, IssueManagement source, boolean sourceDominant,
1924 Map<Object, Object> context )
1925 {
1926 mergeIssueManagement_Url( target, source, sourceDominant, context );
1927 mergeIssueManagement_System( target, source, sourceDominant, context );
1928 }
1929
1930 protected void mergeIssueManagement_System( IssueManagement target, IssueManagement source, boolean sourceDominant,
1931 Map<Object, Object> context )
1932 {
1933 String src = source.getSystem();
1934 if ( src != null )
1935 {
1936 if ( sourceDominant || target.getSystem() == null )
1937 {
1938 target.setSystem( src );
1939 target.setLocation( "system", source.getLocation( "system" ) );
1940 }
1941 }
1942 }
1943
1944 protected void mergeIssueManagement_Url( IssueManagement target, IssueManagement source, boolean sourceDominant,
1945 Map<Object, Object> context )
1946 {
1947 String src = source.getUrl();
1948 if ( src != null )
1949 {
1950 if ( sourceDominant || target.getUrl() == null )
1951 {
1952 target.setUrl( src );
1953 target.setLocation( "url", source.getLocation( "url" ) );
1954 }
1955 }
1956 }
1957
1958 protected void mergeScm( Scm target, Scm source, boolean sourceDominant, Map<Object, Object> context )
1959 {
1960 mergeScm_ChildScmConnectionInheritAppendPath( target, source, sourceDominant, context );
1961 mergeScm_ChildScmDeveloperConnectionInheritAppendPath( target, source, sourceDominant, context );
1962 mergeScm_ChildScmUrlInheritAppendPath( target, source, sourceDominant, context );
1963 mergeScm_Url( target, source, sourceDominant, context );
1964 mergeScm_Connection( target, source, sourceDominant, context );
1965 mergeScm_DeveloperConnection( target, source, sourceDominant, context );
1966 mergeScm_Tag( target, source, sourceDominant, context );
1967 }
1968
1969 protected void mergeScm_ChildScmConnectionInheritAppendPath( Scm target, Scm source, boolean sourceDominant,
1970 Map<Object, Object> context )
1971 {
1972 String src = source.getChildScmConnectionInheritAppendPath();
1973 if ( src != null )
1974 {
1975 if ( sourceDominant || target.getChildScmConnectionInheritAppendPath() == null )
1976 {
1977 target.setChildScmConnectionInheritAppendPath( src );
1978 target.setLocation( "child.scm.connection.inherit.append.path",
1979 source.getLocation( "child.scm.connection.inherit.append.path" ) );
1980 }
1981 }
1982 }
1983
1984 protected void mergeScm_ChildScmDeveloperConnectionInheritAppendPath( Scm target, Scm source,
1985 boolean sourceDominant,
1986 Map<Object, Object> context )
1987 {
1988 String src = source.getChildScmDeveloperConnectionInheritAppendPath();
1989 if ( src != null )
1990 {
1991 if ( sourceDominant || target.getChildScmDeveloperConnectionInheritAppendPath() == null )
1992 {
1993 target.setChildScmDeveloperConnectionInheritAppendPath( src );
1994 target.setLocation( "child.scm.developerConnection.inherit.append.path",
1995 source.getLocation( "child.scm.developerConnection.inherit.append.path" ) );
1996 }
1997 }
1998 }
1999
2000 protected void mergeScm_ChildScmUrlInheritAppendPath( Scm target, Scm source, boolean sourceDominant,
2001 Map<Object, Object> context )
2002 {
2003 String src = source.getChildScmUrlInheritAppendPath();
2004 if ( src != null )
2005 {
2006 if ( sourceDominant || target.getChildScmUrlInheritAppendPath() == null )
2007 {
2008 target.setChildScmUrlInheritAppendPath( src );
2009 target.setLocation( "child.scm.url.inherit.append.path",
2010 source.getLocation( "child.scm.url.inherit.append.path" ) );
2011 }
2012 }
2013 }
2014
2015 protected void mergeScm_Url( Scm target, Scm source, boolean sourceDominant, Map<Object, Object> context )
2016 {
2017 String src = source.getUrl();
2018 if ( src != null )
2019 {
2020 if ( sourceDominant || target.getUrl() == null )
2021 {
2022 target.setUrl( src );
2023 target.setLocation( "url", source.getLocation( "url" ) );
2024 }
2025 }
2026 }
2027
2028 protected void mergeScm_Connection( Scm target, Scm source, boolean sourceDominant, Map<Object, Object> context )
2029 {
2030 String src = source.getConnection();
2031 if ( src != null )
2032 {
2033 if ( sourceDominant || target.getConnection() == null )
2034 {
2035 target.setConnection( src );
2036 target.setLocation( "connection", source.getLocation( "connection" ) );
2037 }
2038 }
2039 }
2040
2041 protected void mergeScm_DeveloperConnection( Scm target, Scm source, boolean sourceDominant,
2042 Map<Object, Object> context )
2043 {
2044 String src = source.getDeveloperConnection();
2045 if ( src != null )
2046 {
2047 if ( sourceDominant || target.getDeveloperConnection() == null )
2048 {
2049 target.setDeveloperConnection( src );
2050 target.setLocation( "developerConnection", source.getLocation( "developerConnection" ) );
2051 }
2052 }
2053 }
2054
2055 protected void mergeScm_Tag( Scm target, Scm source, boolean sourceDominant, Map<Object, Object> context )
2056 {
2057 String src = source.getTag();
2058 if ( src != null )
2059 {
2060 if ( sourceDominant || target.getTag() == null )
2061 {
2062 target.setTag( src );
2063 target.setLocation( "tag", source.getLocation( "tag" ) );
2064 }
2065 }
2066 }
2067
2068 protected void mergeCiManagement( CiManagement target, CiManagement source, boolean sourceDominant,
2069 Map<Object, Object> context )
2070 {
2071 mergeCiManagement_System( target, source, sourceDominant, context );
2072 mergeCiManagement_Url( target, source, sourceDominant, context );
2073 mergeCiManagement_Notifiers( target, source, sourceDominant, context );
2074 }
2075
2076 protected void mergeCiManagement_System( CiManagement target, CiManagement source, boolean sourceDominant,
2077 Map<Object, Object> context )
2078 {
2079 String src = source.getSystem();
2080 if ( src != null )
2081 {
2082 if ( sourceDominant || target.getSystem() == null )
2083 {
2084 target.setSystem( src );
2085 target.setLocation( "system", source.getLocation( "system" ) );
2086 }
2087 }
2088 }
2089
2090 protected void mergeCiManagement_Url( CiManagement target, CiManagement source, boolean sourceDominant,
2091 Map<Object, Object> context )
2092 {
2093 String src = source.getUrl();
2094 if ( src != null )
2095 {
2096 if ( sourceDominant || target.getUrl() == null )
2097 {
2098 target.setUrl( src );
2099 target.setLocation( "url", source.getLocation( "url" ) );
2100 }
2101 }
2102 }
2103
2104 protected void mergeCiManagement_Notifiers( CiManagement target, CiManagement source, boolean sourceDominant,
2105 Map<Object, Object> context )
2106 {
2107 List<Notifier> src = source.getNotifiers();
2108 if ( !src.isEmpty() )
2109 {
2110 List<Notifier> tgt = target.getNotifiers();
2111 Map<Object, Notifier> merged = new LinkedHashMap<>( ( src.size() + tgt.size() ) * 2 );
2112
2113 for ( Notifier element : tgt )
2114 {
2115 Object key = getNotifierKey( element );
2116 merged.put( key, element );
2117 }
2118
2119 for ( Notifier element : src )
2120 {
2121 Object key = getNotifierKey( element );
2122 if ( sourceDominant || !merged.containsKey( key ) )
2123 {
2124 merged.put( key, element );
2125 }
2126 }
2127
2128 target.setNotifiers( new ArrayList<>( merged.values() ) );
2129 }
2130 }
2131
2132 protected void mergeNotifier( Notifier target, Notifier source, boolean sourceDominant,
2133 Map<Object, Object> context )
2134 {
2135 mergeNotifier_Type( target, source, sourceDominant, context );
2136 mergeNotifier_Address( target, source, sourceDominant, context );
2137 mergeNotifier_Configuration( target, source, sourceDominant, context );
2138 mergeNotifier_SendOnError( target, source, sourceDominant, context );
2139 mergeNotifier_SendOnFailure( target, source, sourceDominant, context );
2140 mergeNotifier_SendOnSuccess( target, source, sourceDominant, context );
2141 mergeNotifier_SendOnWarning( target, source, sourceDominant, context );
2142 }
2143
2144 protected void mergeNotifier_Type( Notifier target, Notifier source, boolean sourceDominant,
2145 Map<Object, Object> context )
2146 {
2147 String src = source.getType();
2148 if ( src != null )
2149 {
2150 if ( sourceDominant || target.getType() == null )
2151 {
2152 target.setType( src );
2153 }
2154 }
2155 }
2156
2157 protected void mergeNotifier_Address( Notifier target, Notifier source, boolean sourceDominant,
2158 Map<Object, Object> context )
2159 {
2160 String src = source.getAddress();
2161 if ( src != null )
2162 {
2163 if ( sourceDominant || target.getAddress() == null )
2164 {
2165 target.setAddress( src );
2166 }
2167 }
2168 }
2169
2170 protected void mergeNotifier_Configuration( Notifier target, Notifier source, boolean sourceDominant,
2171 Map<Object, Object> context )
2172 {
2173 Properties merged = new Properties();
2174 if ( sourceDominant )
2175 {
2176 merged.putAll( target.getConfiguration() );
2177 merged.putAll( source.getConfiguration() );
2178 }
2179 else
2180 {
2181 merged.putAll( source.getConfiguration() );
2182 merged.putAll( target.getConfiguration() );
2183 }
2184 target.setConfiguration( merged );
2185 }
2186
2187 protected void mergeNotifier_SendOnError( Notifier target, Notifier source, boolean sourceDominant,
2188 Map<Object, Object> context )
2189 {
2190 if ( sourceDominant )
2191 {
2192 target.setSendOnError( source.isSendOnError() );
2193 }
2194 }
2195
2196 protected void mergeNotifier_SendOnFailure( Notifier target, Notifier source, boolean sourceDominant,
2197 Map<Object, Object> context )
2198 {
2199 if ( sourceDominant )
2200 {
2201 target.setSendOnFailure( source.isSendOnFailure() );
2202 }
2203 }
2204
2205 protected void mergeNotifier_SendOnSuccess( Notifier target, Notifier source, boolean sourceDominant,
2206 Map<Object, Object> context )
2207 {
2208 if ( sourceDominant )
2209 {
2210 target.setSendOnSuccess( source.isSendOnSuccess() );
2211 }
2212 }
2213
2214 protected void mergeNotifier_SendOnWarning( Notifier target, Notifier source, boolean sourceDominant,
2215 Map<Object, Object> context )
2216 {
2217 if ( sourceDominant )
2218 {
2219 target.setSendOnWarning( source.isSendOnWarning() );
2220 }
2221 }
2222
2223 protected void mergePrerequisites( Prerequisites target, Prerequisites source, boolean sourceDominant,
2224 Map<Object, Object> context )
2225 {
2226 mergePrerequisites_Maven( target, source, sourceDominant, context );
2227 }
2228
2229 protected void mergePrerequisites_Maven( Prerequisites target, Prerequisites source, boolean sourceDominant,
2230 Map<Object, Object> context )
2231 {
2232 String src = source.getMaven();
2233 if ( src != null )
2234 {
2235 if ( sourceDominant || target.getMaven() == null )
2236 {
2237 target.setMaven( src );
2238 target.setLocation( "maven", source.getLocation( "maven" ) );
2239 }
2240 }
2241 }
2242
2243 protected void mergeBuild( Build target, Build source, boolean sourceDominant, Map<Object, Object> context )
2244 {
2245 mergeBuildBase( target, source, sourceDominant, context );
2246 mergeBuild_SourceDirectory( target, source, sourceDominant, context );
2247 mergeBuild_ScriptSourceDirectory( target, source, sourceDominant, context );
2248 mergeBuild_TestSourceDirectory( target, source, sourceDominant, context );
2249 mergeBuild_OutputDirectory( target, source, sourceDominant, context );
2250 mergeBuild_TestOutputDirectory( target, source, sourceDominant, context );
2251 mergeBuild_Extensions( target, source, sourceDominant, context );
2252 }
2253
2254 protected void mergeBuild_SourceDirectory( Build target, Build source, boolean sourceDominant,
2255 Map<Object, Object> context )
2256 {
2257 String src = source.getSourceDirectory();
2258 if ( src != null )
2259 {
2260 if ( sourceDominant || target.getSourceDirectory() == null )
2261 {
2262 target.setSourceDirectory( src );
2263 target.setLocation( "sourceDirectory", source.getLocation( "sourceDirectory" ) );
2264 }
2265 }
2266 }
2267
2268 protected void mergeBuild_ScriptSourceDirectory( Build target, Build source, boolean sourceDominant,
2269 Map<Object, Object> context )
2270 {
2271 String src = source.getScriptSourceDirectory();
2272 if ( src != null )
2273 {
2274 if ( sourceDominant || target.getScriptSourceDirectory() == null )
2275 {
2276 target.setScriptSourceDirectory( src );
2277 target.setLocation( "scriptSourceDirectory", source.getLocation( "scriptSourceDirectory" ) );
2278 }
2279 }
2280 }
2281
2282 protected void mergeBuild_TestSourceDirectory( Build target, Build source, boolean sourceDominant,
2283 Map<Object, Object> context )
2284 {
2285 String src = source.getTestSourceDirectory();
2286 if ( src != null )
2287 {
2288 if ( sourceDominant || target.getTestSourceDirectory() == null )
2289 {
2290 target.setTestSourceDirectory( src );
2291 target.setLocation( "testSourceDirectory", source.getLocation( "testSourceDirectory" ) );
2292 }
2293 }
2294 }
2295
2296 protected void mergeBuild_OutputDirectory( Build target, Build source, boolean sourceDominant,
2297 Map<Object, Object> context )
2298 {
2299 String src = source.getOutputDirectory();
2300 if ( src != null )
2301 {
2302 if ( sourceDominant || target.getOutputDirectory() == null )
2303 {
2304 target.setOutputDirectory( src );
2305 target.setLocation( "outputDirectory", source.getLocation( "outputDirectory" ) );
2306 }
2307 }
2308 }
2309
2310 protected void mergeBuild_TestOutputDirectory( Build target, Build source, boolean sourceDominant,
2311 Map<Object, Object> context )
2312 {
2313 String src = source.getTestOutputDirectory();
2314 if ( src != null )
2315 {
2316 if ( sourceDominant || target.getTestOutputDirectory() == null )
2317 {
2318 target.setTestOutputDirectory( src );
2319 target.setLocation( "testOutputDirectory", source.getLocation( "testOutputDirectory" ) );
2320 }
2321 }
2322 }
2323
2324 protected void mergeBuild_Extensions( Build target, Build source, boolean sourceDominant,
2325 Map<Object, Object> context )
2326 {
2327 List<Extension> src = source.getExtensions();
2328 if ( !src.isEmpty() )
2329 {
2330 List<Extension> tgt = target.getExtensions();
2331 Map<Object, Extension> merged = new LinkedHashMap<>( ( src.size() + tgt.size() ) * 2 );
2332
2333 for ( Extension element : tgt )
2334 {
2335 Object key = getExtensionKey( element );
2336 merged.put( key, element );
2337 }
2338
2339 for ( Extension element : src )
2340 {
2341 Object key = getExtensionKey( element );
2342 if ( sourceDominant || !merged.containsKey( key ) )
2343 {
2344 merged.put( key, element );
2345 }
2346 }
2347
2348 target.setExtensions( new ArrayList<>( merged.values() ) );
2349 }
2350 }
2351
2352 protected void mergeExtension( Extension target, Extension source, boolean sourceDominant,
2353 Map<Object, Object> context )
2354 {
2355 mergeExtension_GroupId( target, source, sourceDominant, context );
2356 mergeExtension_ArtifactId( target, source, sourceDominant, context );
2357 mergeExtension_Version( target, source, sourceDominant, context );
2358 }
2359
2360 protected void mergeExtension_GroupId( Extension target, Extension source, boolean sourceDominant,
2361 Map<Object, Object> context )
2362 {
2363 String src = source.getGroupId();
2364 if ( src != null )
2365 {
2366 if ( sourceDominant || target.getGroupId() == null )
2367 {
2368 target.setGroupId( src );
2369 target.setLocation( "groupId", source.getLocation( "groupId" ) );
2370 }
2371 }
2372 }
2373
2374 protected void mergeExtension_ArtifactId( Extension target, Extension source, boolean sourceDominant,
2375 Map<Object, Object> context )
2376 {
2377 String src = source.getArtifactId();
2378 if ( src != null )
2379 {
2380 if ( sourceDominant || target.getArtifactId() == null )
2381 {
2382 target.setArtifactId( src );
2383 target.setLocation( "artifactId", source.getLocation( "artifactId" ) );
2384 }
2385 }
2386 }
2387
2388 protected void mergeExtension_Version( Extension target, Extension source, boolean sourceDominant,
2389 Map<Object, Object> context )
2390 {
2391 String src = source.getVersion();
2392 if ( src != null )
2393 {
2394 if ( sourceDominant || target.getVersion() == null )
2395 {
2396 target.setVersion( src );
2397 target.setLocation( "version", source.getLocation( "version" ) );
2398 }
2399 }
2400 }
2401
2402 protected void mergeBuildBase( BuildBase target, BuildBase source, boolean sourceDominant,
2403 Map<Object, Object> context )
2404 {
2405 mergePluginConfiguration( target, source, sourceDominant, context );
2406 mergeBuildBase_DefaultGoal( target, source, sourceDominant, context );
2407 mergeBuildBase_FinalName( target, source, sourceDominant, context );
2408 mergeBuildBase_Directory( target, source, sourceDominant, context );
2409 mergeBuildBase_Resources( target, source, sourceDominant, context );
2410 mergeBuildBase_TestResources( target, source, sourceDominant, context );
2411 mergeBuildBase_Filters( target, source, sourceDominant, context );
2412 }
2413
2414 protected void mergeBuildBase_DefaultGoal( BuildBase target, BuildBase source, boolean sourceDominant,
2415 Map<Object, Object> context )
2416 {
2417 String src = source.getDefaultGoal();
2418 if ( src != null )
2419 {
2420 if ( sourceDominant || target.getDefaultGoal() == null )
2421 {
2422 target.setDefaultGoal( src );
2423 target.setLocation( "defaultGoal", source.getLocation( "defaultGoal" ) );
2424 }
2425 }
2426 }
2427
2428 protected void mergeBuildBase_Directory( BuildBase target, BuildBase source, boolean sourceDominant,
2429 Map<Object, Object> context )
2430 {
2431 String src = source.getDirectory();
2432 if ( src != null )
2433 {
2434 if ( sourceDominant || target.getDirectory() == null )
2435 {
2436 target.setDirectory( src );
2437 target.setLocation( "directory", source.getLocation( "directory" ) );
2438 }
2439 }
2440 }
2441
2442 protected void mergeBuildBase_FinalName( BuildBase target, BuildBase source, boolean sourceDominant,
2443 Map<Object, Object> context )
2444 {
2445 String src = source.getFinalName();
2446 if ( src != null )
2447 {
2448 if ( sourceDominant || target.getFinalName() == null )
2449 {
2450 target.setFinalName( src );
2451 target.setLocation( "finalName", source.getLocation( "finalName" ) );
2452 }
2453 }
2454 }
2455
2456 protected void mergeBuildBase_Filters( BuildBase target, BuildBase source, boolean sourceDominant,
2457 Map<Object, Object> context )
2458 {
2459 List<String> src = source.getFilters();
2460 if ( !src.isEmpty() )
2461 {
2462 List<String> tgt = target.getFilters();
2463 List<String> merged = new ArrayList<>( tgt.size() + src.size() );
2464 merged.addAll( tgt );
2465 merged.addAll( src );
2466 target.setFilters( merged );
2467 }
2468 }
2469
2470 protected void mergeBuildBase_Resources( BuildBase target, BuildBase source, boolean sourceDominant,
2471 Map<Object, Object> context )
2472 {
2473 List<Resource> src = source.getResources();
2474 if ( !src.isEmpty() )
2475 {
2476 List<Resource> tgt = target.getResources();
2477 Map<Object, Resource> merged = new LinkedHashMap<>( ( src.size() + tgt.size() ) * 2 );
2478
2479 for ( Resource element : tgt )
2480 {
2481 Object key = getResourceKey( element );
2482 merged.put( key, element );
2483 }
2484
2485 for ( Resource element : src )
2486 {
2487 Object key = getResourceKey( element );
2488 if ( sourceDominant || !merged.containsKey( key ) )
2489 {
2490 merged.put( key, element );
2491 }
2492 }
2493
2494 target.setResources( new ArrayList<>( merged.values() ) );
2495 }
2496 }
2497
2498 protected void mergeBuildBase_TestResources( BuildBase target, BuildBase source, boolean sourceDominant,
2499 Map<Object, Object> context )
2500 {
2501 List<Resource> src = source.getTestResources();
2502 if ( !src.isEmpty() )
2503 {
2504 List<Resource> tgt = target.getTestResources();
2505 Map<Object, Resource> merged = new LinkedHashMap<>( ( src.size() + tgt.size() ) * 2 );
2506
2507 for ( Resource element : tgt )
2508 {
2509 Object key = getResourceKey( element );
2510 merged.put( key, element );
2511 }
2512
2513 for ( Resource element : src )
2514 {
2515 Object key = getResourceKey( element );
2516 if ( sourceDominant || !merged.containsKey( key ) )
2517 {
2518 merged.put( key, element );
2519 }
2520 }
2521
2522 target.setTestResources( new ArrayList<>( merged.values() ) );
2523 }
2524 }
2525
2526 protected void mergePluginConfiguration( PluginConfiguration target, PluginConfiguration source,
2527 boolean sourceDominant, Map<Object, Object> context )
2528 {
2529 mergePluginContainer( target, source, sourceDominant, context );
2530 mergePluginConfiguration_PluginManagement( target, source, sourceDominant, context );
2531 }
2532
2533 protected void mergePluginConfiguration_PluginManagement( PluginConfiguration target, PluginConfiguration source,
2534 boolean sourceDominant, Map<Object, Object> context )
2535 {
2536 PluginManagement src = source.getPluginManagement();
2537 if ( src != null )
2538 {
2539 PluginManagement tgt = target.getPluginManagement();
2540 if ( tgt == null )
2541 {
2542 tgt = new PluginManagement();
2543 target.setPluginManagement( tgt );
2544 }
2545 mergePluginManagement( tgt, src, sourceDominant, context );
2546 }
2547 }
2548
2549 protected void mergePluginContainer( PluginContainer target, PluginContainer source, boolean sourceDominant,
2550 Map<Object, Object> context )
2551 {
2552 mergePluginContainer_Plugins( target, source, sourceDominant, context );
2553 }
2554
2555 protected void mergePluginContainer_Plugins( PluginContainer target, PluginContainer source,
2556 boolean sourceDominant, Map<Object, Object> context )
2557 {
2558 List<Plugin> src = source.getPlugins();
2559 if ( !src.isEmpty() )
2560 {
2561 List<Plugin> tgt = target.getPlugins();
2562 Map<Object, Plugin> merged = new LinkedHashMap<>( ( src.size() + tgt.size() ) * 2 );
2563
2564 for ( Plugin element : tgt )
2565 {
2566 Object key = getPluginKey( element );
2567 merged.put( key, element );
2568 }
2569
2570 for ( Plugin element : src )
2571 {
2572 Object key = getPluginKey( element );
2573 if ( sourceDominant || !merged.containsKey( key ) )
2574 {
2575 merged.put( key, element );
2576 }
2577 }
2578
2579 target.setPlugins( new ArrayList<>( merged.values() ) );
2580 }
2581 }
2582
2583 protected void mergePluginManagement( PluginManagement target, PluginManagement source, boolean sourceDominant,
2584 Map<Object, Object> context )
2585 {
2586 mergePluginContainer( target, source, sourceDominant, context );
2587 }
2588
2589 protected void mergePlugin( Plugin target, Plugin source, boolean sourceDominant, Map<Object, Object> context )
2590 {
2591 mergeConfigurationContainer( target, source, sourceDominant, context );
2592 mergePlugin_GroupId( target, source, sourceDominant, context );
2593 mergePlugin_ArtifactId( target, source, sourceDominant, context );
2594 mergePlugin_Version( target, source, sourceDominant, context );
2595 mergePlugin_Extensions( target, source, sourceDominant, context );
2596 mergePlugin_Dependencies( target, source, sourceDominant, context );
2597 mergePlugin_Executions( target, source, sourceDominant, context );
2598 }
2599
2600 protected void mergePlugin_GroupId( Plugin target, Plugin source, boolean sourceDominant,
2601 Map<Object, Object> context )
2602 {
2603 String src = source.getGroupId();
2604 if ( src != null )
2605 {
2606 if ( sourceDominant || target.getGroupId() == null )
2607 {
2608 target.setGroupId( src );
2609 target.setLocation( "groupId", source.getLocation( "groupId" ) );
2610 }
2611 }
2612 }
2613
2614 protected void mergePlugin_ArtifactId( Plugin target, Plugin source, boolean sourceDominant,
2615 Map<Object, Object> context )
2616 {
2617 String src = source.getArtifactId();
2618 if ( src != null )
2619 {
2620 if ( sourceDominant || target.getArtifactId() == null )
2621 {
2622 target.setArtifactId( src );
2623 target.setLocation( "artifactId", source.getLocation( "artifactId" ) );
2624 }
2625 }
2626 }
2627
2628 protected void mergePlugin_Version( Plugin target, Plugin source, boolean sourceDominant,
2629 Map<Object, Object> context )
2630 {
2631 String src = source.getVersion();
2632 if ( src != null )
2633 {
2634 if ( sourceDominant || target.getVersion() == null )
2635 {
2636 target.setVersion( src );
2637 target.setLocation( "version", source.getLocation( "version" ) );
2638 }
2639 }
2640 }
2641
2642 protected void mergePlugin_Extensions( Plugin target, Plugin source, boolean sourceDominant,
2643 Map<Object, Object> context )
2644 {
2645 String src = source.getExtensions();
2646 if ( src != null )
2647 {
2648 if ( sourceDominant || target.getExtensions() == null )
2649 {
2650 target.setExtensions( src );
2651 target.setLocation( "extensions", source.getLocation( "extensions" ) );
2652 }
2653 }
2654 }
2655
2656 protected void mergePlugin_Dependencies( Plugin target, Plugin source, boolean sourceDominant,
2657 Map<Object, Object> context )
2658 {
2659 List<Dependency> src = source.getDependencies();
2660 if ( !src.isEmpty() )
2661 {
2662 List<Dependency> tgt = target.getDependencies();
2663 Map<Object, Dependency> merged = new LinkedHashMap<>( ( src.size() + tgt.size() ) * 2 );
2664
2665 for ( Dependency element : tgt )
2666 {
2667 Object key = getDependencyKey( element );
2668 merged.put( key, element );
2669 }
2670
2671 for ( Dependency element : src )
2672 {
2673 Object key = getDependencyKey( element );
2674 if ( sourceDominant || !merged.containsKey( key ) )
2675 {
2676 merged.put( key, element );
2677 }
2678 }
2679
2680 target.setDependencies( new ArrayList<>( merged.values() ) );
2681 }
2682 }
2683
2684 protected void mergePlugin_Executions( Plugin target, Plugin source, boolean sourceDominant,
2685 Map<Object, Object> context )
2686 {
2687 List<PluginExecution> src = source.getExecutions();
2688 if ( !src.isEmpty() )
2689 {
2690 List<PluginExecution> tgt = target.getExecutions();
2691
2692 Map<Object, PluginExecution> merged =
2693 new LinkedHashMap<>( ( src.size() + tgt.size() ) * 2 );
2694
2695 for ( PluginExecution element : tgt )
2696 {
2697 Object key = getPluginExecutionKey( element );
2698 merged.put( key, element );
2699 }
2700
2701 for ( PluginExecution element : src )
2702 {
2703 Object key = getPluginExecutionKey( element );
2704 if ( sourceDominant || !merged.containsKey( key ) )
2705 {
2706 merged.put( key, element );
2707 }
2708 }
2709
2710 target.setExecutions( new ArrayList<>( merged.values() ) );
2711 }
2712 }
2713
2714 protected void mergeConfigurationContainer( ConfigurationContainer target, ConfigurationContainer source,
2715 boolean sourceDominant, Map<Object, Object> context )
2716 {
2717 mergeConfigurationContainer_Inherited( target, source, sourceDominant, context );
2718 mergeConfigurationContainer_Configuration( target, source, sourceDominant, context );
2719 }
2720
2721 protected void mergeConfigurationContainer_Inherited( ConfigurationContainer target, ConfigurationContainer source,
2722 boolean sourceDominant, Map<Object, Object> context )
2723 {
2724 String src = source.getInherited();
2725 if ( src != null )
2726 {
2727 if ( sourceDominant || target.getInherited() == null )
2728 {
2729 target.setInherited( src );
2730 target.setLocation( "inherited", source.getLocation( "inherited" ) );
2731 }
2732 }
2733 }
2734
2735 protected void mergeConfigurationContainer_Configuration( ConfigurationContainer target,
2736 ConfigurationContainer source, boolean sourceDominant,
2737 Map<Object, Object> context )
2738 {
2739 Xpp3Dom src = (Xpp3Dom) source.getConfiguration();
2740 if ( src != null )
2741 {
2742 Xpp3Dom tgt = (Xpp3Dom) target.getConfiguration();
2743 if ( sourceDominant || tgt == null )
2744 {
2745 tgt = Xpp3Dom.mergeXpp3Dom( new Xpp3Dom( src ), tgt );
2746 }
2747 else
2748 {
2749 tgt = Xpp3Dom.mergeXpp3Dom( tgt, src );
2750 }
2751 target.setConfiguration( tgt );
2752 }
2753 }
2754
2755 protected void mergePluginExecution( PluginExecution target, PluginExecution source, boolean sourceDominant,
2756 Map<Object, Object> context )
2757 {
2758 mergeConfigurationContainer( target, source, sourceDominant, context );
2759 mergePluginExecution_Id( target, source, sourceDominant, context );
2760 mergePluginExecution_Phase( target, source, sourceDominant, context );
2761 mergePluginExecution_Goals( target, source, sourceDominant, context );
2762 }
2763
2764 protected void mergePluginExecution_Id( PluginExecution target, PluginExecution source, boolean sourceDominant,
2765 Map<Object, Object> context )
2766 {
2767 String src = source.getId();
2768 if ( src != null )
2769 {
2770 if ( sourceDominant || target.getId() == null )
2771 {
2772 target.setId( src );
2773 target.setLocation( "id", source.getLocation( "id" ) );
2774 }
2775 }
2776 }
2777
2778 protected void mergePluginExecution_Phase( PluginExecution target, PluginExecution source, boolean sourceDominant,
2779 Map<Object, Object> context )
2780 {
2781 String src = source.getPhase();
2782 if ( src != null )
2783 {
2784 if ( sourceDominant || target.getPhase() == null )
2785 {
2786 target.setPhase( src );
2787 target.setLocation( "phase", source.getLocation( "phase" ) );
2788 }
2789 }
2790 }
2791
2792 protected void mergePluginExecution_Goals( PluginExecution target, PluginExecution source, boolean sourceDominant,
2793 Map<Object, Object> context )
2794 {
2795 List<String> src = source.getGoals();
2796 if ( !src.isEmpty() )
2797 {
2798 List<String> tgt = target.getGoals();
2799 List<String> merged = new ArrayList<>( tgt.size() + src.size() );
2800 merged.addAll( tgt );
2801 merged.addAll( src );
2802 target.setGoals( merged );
2803 }
2804 }
2805
2806 protected void mergeResource( Resource target, Resource source, boolean sourceDominant,
2807 Map<Object, Object> context )
2808 {
2809 mergeFileSet( target, source, sourceDominant, context );
2810 mergeResource_TargetPath( target, source, sourceDominant, context );
2811 mergeResource_Filtering( target, source, sourceDominant, context );
2812 mergeResource_MergeId( target, source, sourceDominant, context );
2813 }
2814
2815 protected void mergeResource_TargetPath( Resource target, Resource source, boolean sourceDominant,
2816 Map<Object, Object> context )
2817 {
2818 String src = source.getTargetPath();
2819 if ( src != null )
2820 {
2821 if ( sourceDominant || target.getTargetPath() == null )
2822 {
2823 target.setTargetPath( src );
2824 target.setLocation( "targetPath", source.getLocation( "targetPath" ) );
2825 }
2826 }
2827 }
2828
2829 protected void mergeResource_Filtering( Resource target, Resource source, boolean sourceDominant,
2830 Map<Object, Object> context )
2831 {
2832 String src = source.getFiltering();
2833 if ( src != null )
2834 {
2835 if ( sourceDominant || target.getFiltering() == null )
2836 {
2837 target.setFiltering( src );
2838 target.setLocation( "filtering", source.getLocation( "filtering" ) );
2839 }
2840 }
2841 }
2842
2843 protected void mergeResource_MergeId( Resource target, Resource source, boolean sourceDominant,
2844 Map<Object, Object> context )
2845 {
2846 String src = source.getMergeId();
2847 if ( src != null )
2848 {
2849 if ( sourceDominant || target.getMergeId() == null )
2850 {
2851 target.setMergeId( src );
2852 }
2853 }
2854 }
2855
2856 protected void mergeFileSet( FileSet target, FileSet source, boolean sourceDominant, Map<Object, Object> context )
2857 {
2858 mergePatternSet( target, source, sourceDominant, context );
2859 mergeFileSet_Directory( target, source, sourceDominant, context );
2860 }
2861
2862 protected void mergeFileSet_Directory( FileSet target, FileSet source, boolean sourceDominant,
2863 Map<Object, Object> context )
2864 {
2865 String src = source.getDirectory();
2866 if ( src != null )
2867 {
2868 if ( sourceDominant || target.getDirectory() == null )
2869 {
2870 target.setDirectory( src );
2871 target.setLocation( "directory", source.getLocation( "directory" ) );
2872 }
2873 }
2874 }
2875
2876 protected void mergePatternSet( PatternSet target, PatternSet source, boolean sourceDominant,
2877 Map<Object, Object> context )
2878 {
2879 mergePatternSet_Includes( target, source, sourceDominant, context );
2880 mergePatternSet_Excludes( target, source, sourceDominant, context );
2881 }
2882
2883 protected void mergePatternSet_Includes( PatternSet target, PatternSet source, boolean sourceDominant,
2884 Map<Object, Object> context )
2885 {
2886 List<String> src = source.getIncludes();
2887 if ( !src.isEmpty() )
2888 {
2889 List<String> tgt = target.getIncludes();
2890 List<String> merged = new ArrayList<>( tgt.size() + src.size() );
2891 merged.addAll( tgt );
2892 merged.addAll( src );
2893 target.setIncludes( merged );
2894 }
2895 }
2896
2897 protected void mergePatternSet_Excludes( PatternSet target, PatternSet source, boolean sourceDominant,
2898 Map<Object, Object> context )
2899 {
2900 List<String> src = source.getExcludes();
2901 if ( !src.isEmpty() )
2902 {
2903 List<String> tgt = target.getExcludes();
2904 List<String> merged = new ArrayList<>( tgt.size() + src.size() );
2905 merged.addAll( tgt );
2906 merged.addAll( src );
2907 target.setExcludes( merged );
2908 }
2909 }
2910
2911 protected void mergeProfile( Profile target, Profile source, boolean sourceDominant, Map<Object, Object> context )
2912 {
2913 mergeModelBase( target, source, sourceDominant, context );
2914
2915 }
2916
2917 protected void mergeActivation( Activation target, Activation source, boolean sourceDominant,
2918 Map<Object, Object> context )
2919 {
2920
2921 }
2922
2923 protected Object getDependencyKey( Dependency dependency )
2924 {
2925 return dependency;
2926 }
2927
2928 protected Object getPluginKey( Plugin plugin )
2929 {
2930 return plugin;
2931 }
2932
2933 protected Object getPluginExecutionKey( PluginExecution pluginExecution )
2934 {
2935 return pluginExecution;
2936 }
2937
2938 protected Object getReportPluginKey( ReportPlugin reportPlugin )
2939 {
2940 return reportPlugin;
2941 }
2942
2943 protected Object getReportSetKey( ReportSet reportSet )
2944 {
2945 return reportSet;
2946 }
2947
2948 protected Object getLicenseKey( License license )
2949 {
2950 return license;
2951 }
2952
2953 protected Object getMailingListKey( MailingList mailingList )
2954 {
2955 return mailingList;
2956 }
2957
2958 protected Object getDeveloperKey( Developer developer )
2959 {
2960 return developer;
2961 }
2962
2963 protected Object getContributorKey( Contributor contributor )
2964 {
2965 return contributor;
2966 }
2967
2968 protected Object getProfileKey( Profile profile )
2969 {
2970 return profile;
2971 }
2972
2973 protected Object getRepositoryKey( Repository repository )
2974 {
2975 return getRepositoryBaseKey( repository );
2976 }
2977
2978 protected Object getRepositoryBaseKey( RepositoryBase repositoryBase )
2979 {
2980 return repositoryBase;
2981 }
2982
2983 protected Object getNotifierKey( Notifier notifier )
2984 {
2985 return notifier;
2986 }
2987
2988 protected Object getResourceKey( Resource resource )
2989 {
2990 return resource;
2991 }
2992
2993 protected Object getExtensionKey( Extension extension )
2994 {
2995 return extension;
2996 }
2997
2998 protected Object getExclusionKey( Exclusion exclusion )
2999 {
3000 return exclusion;
3001 }
3002
3003 }