| 1 |  |  package org.apache.maven.project; | 
  | 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.Enumeration; | 
  | 24 |  |  import java.util.Iterator; | 
  | 25 |  |  import java.util.LinkedHashMap; | 
  | 26 |  |  import java.util.List; | 
  | 27 |  |  import java.util.Map; | 
  | 28 |  |  import java.util.Properties; | 
  | 29 |  |  import java.util.TreeMap; | 
  | 30 |  |   | 
  | 31 |  |  import org.apache.maven.model.Activation; | 
  | 32 |  |  import org.apache.maven.model.ActivationFile; | 
  | 33 |  |  import org.apache.maven.model.ActivationOS; | 
  | 34 |  |  import org.apache.maven.model.ActivationProperty; | 
  | 35 |  |  import org.apache.maven.model.Build; | 
  | 36 |  |  import org.apache.maven.model.BuildBase; | 
  | 37 |  |  import org.apache.maven.model.CiManagement; | 
  | 38 |  |  import org.apache.maven.model.Contributor; | 
  | 39 |  |  import org.apache.maven.model.Dependency; | 
  | 40 |  |  import org.apache.maven.model.DependencyManagement; | 
  | 41 |  |  import org.apache.maven.model.DeploymentRepository; | 
  | 42 |  |  import org.apache.maven.model.Developer; | 
  | 43 |  |  import org.apache.maven.model.DistributionManagement; | 
  | 44 |  |  import org.apache.maven.model.Exclusion; | 
  | 45 |  |  import org.apache.maven.model.Extension; | 
  | 46 |  |  import org.apache.maven.model.IssueManagement; | 
  | 47 |  |  import org.apache.maven.model.License; | 
  | 48 |  |  import org.apache.maven.model.MailingList; | 
  | 49 |  |  import org.apache.maven.model.Model; | 
  | 50 |  |  import org.apache.maven.model.ModelBase; | 
  | 51 |  |  import org.apache.maven.model.Notifier; | 
  | 52 |  |  import org.apache.maven.model.Organization; | 
  | 53 |  |  import org.apache.maven.model.Parent; | 
  | 54 |  |  import org.apache.maven.model.Plugin; | 
  | 55 |  |  import org.apache.maven.model.PluginContainer; | 
  | 56 |  |  import org.apache.maven.model.PluginExecution; | 
  | 57 |  |  import org.apache.maven.model.PluginManagement; | 
  | 58 |  |  import org.apache.maven.model.Prerequisites; | 
  | 59 |  |  import org.apache.maven.model.Profile; | 
  | 60 |  |  import org.apache.maven.model.Relocation; | 
  | 61 |  |  import org.apache.maven.model.ReportPlugin; | 
  | 62 |  |  import org.apache.maven.model.ReportSet; | 
  | 63 |  |  import org.apache.maven.model.Reporting; | 
  | 64 |  |  import org.apache.maven.model.Repository; | 
  | 65 |  |  import org.apache.maven.model.RepositoryBase; | 
  | 66 |  |  import org.apache.maven.model.RepositoryPolicy; | 
  | 67 |  |  import org.apache.maven.model.Resource; | 
  | 68 |  |  import org.apache.maven.model.Scm; | 
  | 69 |  |  import org.apache.maven.model.Site; | 
  | 70 |  |  import org.codehaus.plexus.util.xml.Xpp3Dom; | 
  | 71 |  |   | 
  | 72 | 0 |  public final class ModelUtils | 
  | 73 |  |  { | 
  | 74 |  |   | 
  | 75 | 1 |      private static final ModelPartCloner DEPENDENCY_CLONER = new ModelPartCloner() | 
  | 76 |  |      { | 
  | 77 | 1 |          public Object cloneModelPart( Object src ) | 
  | 78 |  |          { | 
  | 79 | 488 |              return ModelUtils.cloneDependency( (Dependency) src ); | 
  | 80 |  |          } | 
  | 81 |  |      }; | 
  | 82 |  |   | 
  | 83 | 1 |      private static final ModelPartCloner PLUGIN_CLONER = new ModelPartCloner() | 
  | 84 |  |      { | 
  | 85 | 1 |          public Object cloneModelPart( Object src ) | 
  | 86 |  |          { | 
  | 87 | 2831 |              return ModelUtils.clonePlugin( (Plugin) src ); | 
  | 88 |  |          } | 
  | 89 |  |      }; | 
  | 90 |  |   | 
  | 91 | 1 |      private static final ModelPartCloner EXTENSION_CLONER = new ModelPartCloner() | 
  | 92 |  |      { | 
  | 93 | 1 |          public Object cloneModelPart( Object src ) | 
  | 94 |  |          { | 
  | 95 | 0 |              return ModelUtils.cloneExtension( (Extension) src ); | 
  | 96 |  |          } | 
  | 97 |  |      }; | 
  | 98 |  |   | 
  | 99 | 1 |      private static final ModelPartCloner RESOURCE_CLONER = new ModelPartCloner() | 
  | 100 |  |      { | 
  | 101 | 1 |          public Object cloneModelPart( Object src ) | 
  | 102 |  |          { | 
  | 103 | 317 |              return ModelUtils.cloneResource( (Resource) src ); | 
  | 104 |  |          } | 
  | 105 |  |      }; | 
  | 106 |  |   | 
  | 107 | 1 |      private static final ModelPartCloner NOTIFIER_CLONER = new ModelPartCloner() | 
  | 108 |  |      { | 
  | 109 | 1 |          public Object cloneModelPart( Object src ) | 
  | 110 |  |          { | 
  | 111 | 0 |              return ModelUtils.cloneNotifier( (Notifier) src ); | 
  | 112 |  |          } | 
  | 113 |  |      }; | 
  | 114 |  |   | 
  | 115 | 1 |      private static final ModelPartCloner CONTRIBUTOR_CLONER = new ModelPartCloner() | 
  | 116 |  |      { | 
  | 117 | 1 |          public Object cloneModelPart( Object src ) | 
  | 118 |  |          { | 
  | 119 | 4 |              return ModelUtils.cloneContributor( (Contributor) src ); | 
  | 120 |  |          } | 
  | 121 |  |      }; | 
  | 122 |  |   | 
  | 123 | 1 |      private static final ModelPartCloner DEVELOPER_CLONER = new ModelPartCloner() | 
  | 124 |  |      { | 
  | 125 | 1 |          public Object cloneModelPart( Object src ) | 
  | 126 |  |          { | 
  | 127 | 4 |              return ModelUtils.cloneDeveloper( (Developer) src ); | 
  | 128 |  |          } | 
  | 129 |  |      }; | 
  | 130 |  |   | 
  | 131 | 1 |      private static final ModelPartCloner LICENSE_CLONER = new ModelPartCloner() | 
  | 132 |  |      { | 
  | 133 | 1 |          public Object cloneModelPart( Object src ) | 
  | 134 |  |          { | 
  | 135 | 0 |              return ModelUtils.cloneLicense( (License) src ); | 
  | 136 |  |          } | 
  | 137 |  |      }; | 
  | 138 |  |   | 
  | 139 | 1 |      private static final ModelPartCloner MAILING_LIST_CLONER = new ModelPartCloner() | 
  | 140 |  |      { | 
  | 141 | 1 |          public Object cloneModelPart( Object src ) | 
  | 142 |  |          { | 
  | 143 | 22 |              return ModelUtils.cloneMailingList( (MailingList) src ); | 
  | 144 |  |          } | 
  | 145 |  |      }; | 
  | 146 |  |   | 
  | 147 | 1 |      private static final ModelPartCloner REPOSITORY_CLONER = new ModelPartCloner() | 
  | 148 |  |      { | 
  | 149 | 1 |          public Object cloneModelPart( Object src ) | 
  | 150 |  |          { | 
  | 151 | 66 |              return ModelUtils.cloneRepository( (Repository) src ); | 
  | 152 |  |          } | 
  | 153 |  |      }; | 
  | 154 |  |   | 
  | 155 | 1 |      private static final ModelPartCloner PROFILE_CLONER = new ModelPartCloner() | 
  | 156 |  |      { | 
  | 157 | 1 |          public Object cloneModelPart( Object src ) | 
  | 158 |  |          { | 
  | 159 | 0 |              return ModelUtils.cloneProfile( (Profile) src ); | 
  | 160 |  |          } | 
  | 161 |  |      }; | 
  | 162 |  |   | 
  | 163 | 1 |      private static final ModelPartCloner REPORT_PLUGIN_CLONER = new ModelPartCloner() | 
  | 164 |  |      { | 
  | 165 | 1 |          public Object cloneModelPart( Object src ) | 
  | 166 |  |          { | 
  | 167 | 0 |              return ModelUtils.cloneReportPlugin( (ReportPlugin) src ); | 
  | 168 |  |          } | 
  | 169 |  |      }; | 
  | 170 |  |   | 
  | 171 | 1 |      private static final ModelPartCloner REPORT_SET_CLONER = new ModelPartCloner() | 
  | 172 |  |      { | 
  | 173 | 1 |          public Object cloneModelPart( Object src ) | 
  | 174 |  |          { | 
  | 175 | 0 |              return ModelUtils.cloneReportSet( (ReportSet) src ); | 
  | 176 |  |          } | 
  | 177 |  |      }; | 
  | 178 |  |   | 
  | 179 | 1 |      private static final ModelPartCloner DEPENDENCY_EXCLUSION_CLONER = new ModelPartCloner() | 
  | 180 |  |      { | 
  | 181 | 1 |          public Object cloneModelPart( Object src ) | 
  | 182 |  |          { | 
  | 183 | 14 |              return ModelUtils.cloneExclusion( (Exclusion) src ); | 
  | 184 |  |          } | 
  | 185 |  |      }; | 
  | 186 |  |   | 
  | 187 | 1 |      private static final ModelPartCloner PLUGIN_EXECUTION_CLONER = new ModelPartCloner() | 
  | 188 |  |      { | 
  | 189 | 1 |          public Object cloneModelPart( Object src ) | 
  | 190 |  |          { | 
  | 191 | 52 |              return ModelUtils.clonePluginExecution( (PluginExecution) src ); | 
  | 192 |  |          } | 
  | 193 |  |      }; | 
  | 194 |  |   | 
  | 195 |  |       | 
  | 196 |  |   | 
  | 197 |  |   | 
  | 198 |  |   | 
  | 199 |  |   | 
  | 200 |  |   | 
  | 201 |  |   | 
  | 202 |  |   | 
  | 203 |  |   | 
  | 204 |  |   | 
  | 205 |  |   | 
  | 206 |  |   | 
  | 207 |  |      public static void mergeDuplicatePluginDefinitions( PluginContainer pluginContainer ) | 
  | 208 |  |      { | 
  | 209 | 98 |          if ( pluginContainer == null ) | 
  | 210 |  |          { | 
  | 211 | 0 |              return; | 
  | 212 |  |          } | 
  | 213 |  |   | 
  | 214 | 98 |          List originalPlugins = pluginContainer.getPlugins(); | 
  | 215 |  |   | 
  | 216 | 98 |          if ( ( originalPlugins == null ) || originalPlugins.isEmpty() ) | 
  | 217 |  |          { | 
  | 218 | 70 |              return; | 
  | 219 |  |          } | 
  | 220 |  |   | 
  | 221 | 28 |          List normalized = new ArrayList( originalPlugins.size() ); | 
  | 222 |  |   | 
  | 223 | 28 |          for ( Iterator it = originalPlugins.iterator(); it.hasNext(); ) | 
  | 224 |  |          { | 
  | 225 | 31 |              Plugin currentPlugin = (Plugin) it.next(); | 
  | 226 |  |   | 
  | 227 | 31 |              if ( normalized.contains( currentPlugin ) ) | 
  | 228 |  |              { | 
  | 229 | 2 |                  int idx = normalized.indexOf( currentPlugin ); | 
  | 230 | 2 |                  Plugin firstPlugin = (Plugin) normalized.get( idx ); | 
  | 231 |  |   | 
  | 232 |  |                   | 
  | 233 |  |                   | 
  | 234 | 2 |                  mergePluginDefinitions( currentPlugin, firstPlugin, false ); | 
  | 235 | 2 |                  normalized.set(idx, currentPlugin); | 
  | 236 | 2 |              } | 
  | 237 |  |              else | 
  | 238 |  |              { | 
  | 239 | 29 |                  normalized.add( currentPlugin ); | 
  | 240 |  |              } | 
  | 241 | 31 |          } | 
  | 242 |  |   | 
  | 243 | 28 |          pluginContainer.setPlugins( normalized ); | 
  | 244 | 28 |      } | 
  | 245 |  |   | 
  | 246 |  |      public static ReportSet cloneReportSet( ReportSet src ) | 
  | 247 |  |      { | 
  | 248 | 0 |          if ( src == null ) | 
  | 249 |  |          { | 
  | 250 | 0 |              return null; | 
  | 251 |  |          } | 
  | 252 |  |           | 
  | 253 | 0 |          ReportSet result = new ReportSet(); | 
  | 254 |  |           | 
  | 255 | 0 |          result.setConfiguration( cloneConfiguration( src.getConfiguration() ) ); | 
  | 256 | 0 |          result.setId( src.getId() ); | 
  | 257 | 0 |          result.setInherited( src.getInherited() ); | 
  | 258 | 0 |          result.setReports( cloneListOfStrings( src.getReports() ) ); | 
  | 259 |  |           | 
  | 260 | 0 |          return result; | 
  | 261 |  |      } | 
  | 262 |  |   | 
  | 263 |  |      public static ReportPlugin cloneReportPlugin( ReportPlugin src ) | 
  | 264 |  |      { | 
  | 265 | 0 |          if ( src == null ) | 
  | 266 |  |          { | 
  | 267 | 0 |              return null; | 
  | 268 |  |          } | 
  | 269 |  |           | 
  | 270 | 0 |          ReportPlugin result = new ReportPlugin(); | 
  | 271 |  |           | 
  | 272 | 0 |          result.setArtifactId( src.getArtifactId() ); | 
  | 273 | 0 |          result.setConfiguration( cloneConfiguration( src.getConfiguration() ) ); | 
  | 274 | 0 |          result.setGroupId( src.getGroupId() ); | 
  | 275 | 0 |          result.setInherited( src.getInherited() ); | 
  | 276 | 0 |          result.setReportSets( cloneList( src.getReportSets(), REPORT_SET_CLONER ) ); | 
  | 277 | 0 |          result.setVersion( src.getVersion() ); | 
  | 278 |  |           | 
  | 279 | 0 |          return result; | 
  | 280 |  |      } | 
  | 281 |  |   | 
  | 282 |  |      public static Profile cloneProfile( Profile src ) | 
  | 283 |  |      { | 
  | 284 | 0 |          if ( src == null ) | 
  | 285 |  |          { | 
  | 286 | 0 |              return null; | 
  | 287 |  |          } | 
  | 288 |  |           | 
  | 289 | 0 |          Profile result = new Profile(); | 
  | 290 |  |           | 
  | 291 | 0 |          cloneModelBaseFields( src, result ); | 
  | 292 |  |           | 
  | 293 | 0 |          result.setActivation( cloneActivation( src.getActivation() ) ); | 
  | 294 |  |           | 
  | 295 | 0 |          BuildBase resultBuild = null; | 
  | 296 | 0 |          if ( src.getBuild() != null ) | 
  | 297 |  |          { | 
  | 298 | 0 |              resultBuild = new BuildBase(); | 
  | 299 | 0 |              cloneBuildBaseFields( src.getBuild(), resultBuild ); | 
  | 300 |  |          } | 
  | 301 | 0 |          result.setBuild( resultBuild ); | 
  | 302 |  |           | 
  | 303 | 0 |          result.setId( src.getId() ); | 
  | 304 | 0 |          result.setSource( src.getSource() ); | 
  | 305 |  |           | 
  | 306 | 0 |          return result; | 
  | 307 |  |      } | 
  | 308 |  |   | 
  | 309 |  |      private static void cloneModelBaseFields( ModelBase src, ModelBase result ) | 
  | 310 |  |      { | 
  | 311 | 494 |          result.setDependencies( cloneList( src.getDependencies(), DEPENDENCY_CLONER ) ); | 
  | 312 | 494 |          result.setDependencyManagement( cloneDependencyManagement( src.getDependencyManagement() ) ); | 
  | 313 | 494 |          result.setDistributionManagement( cloneDistributionManagement( src.getDistributionManagement() ) ); | 
  | 314 |  |           | 
  | 315 | 494 |          result.setModules( cloneListOfStrings( src.getModules() ) ); | 
  | 316 |  |   | 
  | 317 | 494 |          result.setPluginRepositories( cloneList( src.getPluginRepositories(), REPOSITORY_CLONER ) ); | 
  | 318 | 494 |          result.setProperties( cloneProperties( src.getProperties() ) ); | 
  | 319 | 494 |          result.setReporting( cloneReporting( src.getReporting() ) ); | 
  | 320 | 494 |          result.setRepositories( cloneList( src.getRepositories(), REPOSITORY_CLONER ) ); | 
  | 321 | 494 |      } | 
  | 322 |  |   | 
  | 323 |  |      public static Reporting cloneReporting( Reporting src ) | 
  | 324 |  |      { | 
  | 325 | 494 |          if ( src == null ) | 
  | 326 |  |          { | 
  | 327 | 476 |              return null; | 
  | 328 |  |          } | 
  | 329 |  |           | 
  | 330 | 18 |          Reporting result = new Reporting(); | 
  | 331 |  |           | 
  | 332 | 18 |          result.setExcludeDefaults( src.isExcludeDefaults() ); | 
  | 333 | 18 |          result.setOutputDirectory( src.getOutputDirectory() ); | 
  | 334 | 18 |          result.setPlugins( cloneList( src.getPlugins(), REPORT_PLUGIN_CLONER ) ); | 
  | 335 |  |           | 
  | 336 | 18 |          return result; | 
  | 337 |  |      } | 
  | 338 |  |   | 
  | 339 |  |      public static Activation cloneActivation( Activation src ) | 
  | 340 |  |      { | 
  | 341 | 0 |          if ( src == null ) | 
  | 342 |  |          { | 
  | 343 | 0 |              return null; | 
  | 344 |  |          } | 
  | 345 |  |           | 
  | 346 | 0 |          Activation result = new Activation(); | 
  | 347 | 0 |          result.setActiveByDefault( src.isActiveByDefault() ); | 
  | 348 | 0 |          result.setFile( cloneActivationFile( src.getFile() ) ); | 
  | 349 | 0 |          result.setJdk( src.getJdk() ); | 
  | 350 | 0 |          result.setOs( cloneActivationOs( src.getOs() ) ); | 
  | 351 | 0 |          result.setProperty( cloneActivationProperty( src.getProperty() ) ); | 
  | 352 |  |           | 
  | 353 | 0 |          return result; | 
  | 354 |  |      } | 
  | 355 |  |   | 
  | 356 |  |      public static ActivationProperty cloneActivationProperty( ActivationProperty src ) | 
  | 357 |  |      { | 
  | 358 | 0 |          if ( src == null ) | 
  | 359 |  |          { | 
  | 360 | 0 |              return null; | 
  | 361 |  |          } | 
  | 362 |  |           | 
  | 363 | 0 |          ActivationProperty result = new ActivationProperty(); | 
  | 364 |  |           | 
  | 365 | 0 |          result.setName( src.getName() ); | 
  | 366 | 0 |          result.setValue( src.getValue() ); | 
  | 367 |  |           | 
  | 368 | 0 |          return result; | 
  | 369 |  |      } | 
  | 370 |  |   | 
  | 371 |  |      public static ActivationOS cloneActivationOs( ActivationOS src ) | 
  | 372 |  |      { | 
  | 373 | 0 |          if ( src == null ) | 
  | 374 |  |          { | 
  | 375 | 0 |              return null; | 
  | 376 |  |          } | 
  | 377 |  |           | 
  | 378 | 0 |          ActivationOS result = new ActivationOS(); | 
  | 379 |  |           | 
  | 380 | 0 |          result.setArch( src.getArch() ); | 
  | 381 | 0 |          result.setFamily( src.getFamily() ); | 
  | 382 | 0 |          result.setName( src.getName() ); | 
  | 383 | 0 |          result.setVersion( src.getVersion() ); | 
  | 384 |  |           | 
  | 385 | 0 |          return result; | 
  | 386 |  |      } | 
  | 387 |  |   | 
  | 388 |  |      public static ActivationFile cloneActivationFile( ActivationFile src ) | 
  | 389 |  |      { | 
  | 390 | 0 |          if ( src == null ) | 
  | 391 |  |          { | 
  | 392 | 0 |              return null; | 
  | 393 |  |          } | 
  | 394 |  |           | 
  | 395 | 0 |          ActivationFile result = new ActivationFile(); | 
  | 396 |  |           | 
  | 397 | 0 |          result.setExists( src.getExists() ); | 
  | 398 | 0 |          result.setMissing( src.getMissing() ); | 
  | 399 |  |   | 
  | 400 | 0 |          return result; | 
  | 401 |  |      } | 
  | 402 |  |   | 
  | 403 |  |      public static Repository cloneRepository( Repository src ) | 
  | 404 |  |      { | 
  | 405 | 66 |          if ( src == null ) | 
  | 406 |  |          { | 
  | 407 | 0 |              return null; | 
  | 408 |  |          } | 
  | 409 |  |           | 
  | 410 | 66 |          Repository result = new Repository(); | 
  | 411 |  |           | 
  | 412 | 66 |          result.setReleases( cloneRepositoryPolicy( src.getReleases() ) ); | 
  | 413 | 66 |          result.setSnapshots( cloneRepositoryPolicy( src.getSnapshots() ) ); | 
  | 414 |  |           | 
  | 415 | 66 |          cloneRepositoryBaseFields( src, result ); | 
  | 416 |  |           | 
  | 417 | 66 |          return result; | 
  | 418 |  |      } | 
  | 419 |  |   | 
  | 420 |  |      public static RepositoryPolicy cloneRepositoryPolicy( RepositoryPolicy src ) | 
  | 421 |  |      { | 
  | 422 | 132 |          if ( src == null ) | 
  | 423 |  |          { | 
  | 424 | 78 |              return null; | 
  | 425 |  |          } | 
  | 426 |  |           | 
  | 427 | 54 |          RepositoryPolicy result = new RepositoryPolicy(); | 
  | 428 |  |           | 
  | 429 | 54 |          result.setChecksumPolicy( src.getChecksumPolicy() ); | 
  | 430 | 54 |          result.setEnabled( src.isEnabled() ); | 
  | 431 | 54 |          result.setUpdatePolicy( src.getUpdatePolicy() ); | 
  | 432 |  |           | 
  | 433 | 54 |          return result; | 
  | 434 |  |      } | 
  | 435 |  |   | 
  | 436 |  |      public static MailingList cloneMailingList( MailingList src ) | 
  | 437 |  |      { | 
  | 438 | 22 |          if ( src == null ) | 
  | 439 |  |          { | 
  | 440 | 0 |              return null; | 
  | 441 |  |          } | 
  | 442 |  |           | 
  | 443 | 22 |          MailingList result = new MailingList(); | 
  | 444 |  |           | 
  | 445 | 22 |          result.setArchive( src.getArchive() ); | 
  | 446 | 22 |          result.setName( src.getName() ); | 
  | 447 | 22 |          result.setOtherArchives( src.getOtherArchives() ); | 
  | 448 | 22 |          result.setPost( src.getPost() ); | 
  | 449 | 22 |          result.setSubscribe( src.getSubscribe() ); | 
  | 450 | 22 |          result.setUnsubscribe( src.getUnsubscribe() ); | 
  | 451 |  |           | 
  | 452 | 22 |          return result; | 
  | 453 |  |      } | 
  | 454 |  |   | 
  | 455 |  |       | 
  | 456 |  |   | 
  | 457 |  |   | 
  | 458 |  |   | 
  | 459 |  |   | 
  | 460 |  |   | 
  | 461 |  |   | 
  | 462 |  |   | 
  | 463 |  |   | 
  | 464 |  |   | 
  | 465 |  |   | 
  | 466 |  |   | 
  | 467 |  |      public static void mergePluginLists( PluginContainer child, PluginContainer parent, | 
  | 468 |  |                                           boolean handleAsInheritance ) | 
  | 469 |  |      { | 
  | 470 | 161 |          if ( ( child == null ) || ( parent == null ) ) | 
  | 471 |  |          { | 
  | 472 |  |               | 
  | 473 | 6 |              return; | 
  | 474 |  |          } | 
  | 475 |  |   | 
  | 476 | 155 |          List parentPlugins = parent.getPlugins(); | 
  | 477 |  |   | 
  | 478 | 155 |          if ( ( parentPlugins != null ) && !parentPlugins.isEmpty() ) | 
  | 479 |  |          { | 
  | 480 | 20 |              parentPlugins = new ArrayList( parentPlugins ); | 
  | 481 |  |   | 
  | 482 |  |               | 
  | 483 |  |               | 
  | 484 | 20 |              if ( handleAsInheritance ) | 
  | 485 |  |              { | 
  | 486 | 20 |                  for ( Iterator it = parentPlugins.iterator(); it.hasNext(); ) | 
  | 487 |  |                  { | 
  | 488 | 22 |                      Plugin plugin = (Plugin) it.next(); | 
  | 489 |  |   | 
  | 490 | 22 |                      String inherited = plugin.getInherited(); | 
  | 491 |  |   | 
  | 492 | 22 |                      if ( ( inherited != null ) && !Boolean.valueOf( inherited ).booleanValue() ) | 
  | 493 |  |                      { | 
  | 494 | 2 |                          it.remove(); | 
  | 495 |  |                      } | 
  | 496 | 22 |                  } | 
  | 497 |  |              } | 
  | 498 |  |   | 
  | 499 | 20 |              List assembledPlugins = new ArrayList(); | 
  | 500 |  |   | 
  | 501 | 20 |              Map childPlugins = child.getPluginsAsMap(); | 
  | 502 |  |   | 
  | 503 | 20 |              for ( Iterator it = parentPlugins.iterator(); it.hasNext(); ) | 
  | 504 |  |              { | 
  | 505 | 20 |                  Plugin parentPlugin = (Plugin) it.next(); | 
  | 506 |  |   | 
  | 507 | 20 |                  String parentInherited = parentPlugin.getInherited(); | 
  | 508 |  |   | 
  | 509 |  |                   | 
  | 510 |  |                   | 
  | 511 |  |                   | 
  | 512 |  |                   | 
  | 513 |  |                   | 
  | 514 | 20 |                  if ( !handleAsInheritance || ( parentInherited == null ) || | 
  | 515 |  |                      Boolean.valueOf( parentInherited ).booleanValue() ) | 
  | 516 |  |                  { | 
  | 517 | 20 |                      Plugin childPlugin = (Plugin) childPlugins.get( parentPlugin.getKey() ); | 
  | 518 |  |   | 
  | 519 | 20 |                      if ( ( childPlugin != null ) && !assembledPlugins.contains( childPlugin ) ) | 
  | 520 |  |                      { | 
  | 521 | 6 |                          Plugin assembledPlugin = childPlugin; | 
  | 522 |  |   | 
  | 523 | 6 |                          mergePluginDefinitions( childPlugin, parentPlugin, handleAsInheritance ); | 
  | 524 |  |   | 
  | 525 |  |                           | 
  | 526 | 6 |                          assembledPlugins.add( assembledPlugin ); | 
  | 527 |  |                      } | 
  | 528 |  |   | 
  | 529 |  |                       | 
  | 530 |  |                       | 
  | 531 |  |                       | 
  | 532 | 20 |                      if ( handleAsInheritance && ( parentInherited == null ) ) | 
  | 533 |  |                      { | 
  | 534 | 18 |                          parentPlugin.unsetInheritanceApplied(); | 
  | 535 |  |                      } | 
  | 536 |  |                  } | 
  | 537 |  |   | 
  | 538 |  |                   | 
  | 539 |  |                   | 
  | 540 | 20 |                  List results = ModelUtils.orderAfterMerge( assembledPlugins, parentPlugins, | 
  | 541 |  |                                                                          child.getPlugins() ); | 
  | 542 |  |   | 
  | 543 |  |   | 
  | 544 | 20 |                  child.setPlugins( results ); | 
  | 545 |  |   | 
  | 546 | 20 |                  child.flushPluginMap(); | 
  | 547 | 20 |              } | 
  | 548 |  |          } | 
  | 549 | 155 |      } | 
  | 550 |  |   | 
  | 551 |  |      public static List orderAfterMerge( List merged, List highPrioritySource, List lowPrioritySource ) | 
  | 552 |  |      { | 
  | 553 | 29 |          List results = new ArrayList(); | 
  | 554 |  |   | 
  | 555 | 29 |          if ( !merged.isEmpty() ) | 
  | 556 |  |          { | 
  | 557 | 12 |              results.addAll( merged ); | 
  | 558 |  |          } | 
  | 559 |  |   | 
  | 560 | 29 |          List missingFromResults = new ArrayList(); | 
  | 561 |  |   | 
  | 562 | 29 |          List sources = new ArrayList(); | 
  | 563 |  |   | 
  | 564 | 29 |          sources.add( highPrioritySource ); | 
  | 565 | 29 |          sources.add( lowPrioritySource ); | 
  | 566 |  |   | 
  | 567 | 29 |          for ( Iterator sourceIterator = sources.iterator(); sourceIterator.hasNext(); ) | 
  | 568 |  |          { | 
  | 569 | 58 |              List source = (List) sourceIterator.next(); | 
  | 570 |  |   | 
  | 571 | 58 |              for ( Iterator it = source.iterator(); it.hasNext(); ) | 
  | 572 |  |              { | 
  | 573 | 63 |                  Object item = it.next(); | 
  | 574 |  |   | 
  | 575 | 63 |                  if ( results.contains( item ) ) | 
  | 576 |  |                  { | 
  | 577 | 30 |                      if ( !missingFromResults.isEmpty() ) | 
  | 578 |  |                      { | 
  | 579 | 8 |                          int idx = results.indexOf( item ); | 
  | 580 |  |   | 
  | 581 | 8 |                          if ( idx < 0 ) | 
  | 582 |  |                          { | 
  | 583 | 0 |                              idx = 0; | 
  | 584 |  |                          } | 
  | 585 |  |   | 
  | 586 | 8 |                          results.addAll( idx, missingFromResults ); | 
  | 587 |  |   | 
  | 588 | 8 |                          missingFromResults.clear(); | 
  | 589 | 8 |                      } | 
  | 590 |  |                  } | 
  | 591 |  |                  else | 
  | 592 |  |                  { | 
  | 593 | 33 |                      missingFromResults.add( item ); | 
  | 594 |  |                  } | 
  | 595 | 63 |              } | 
  | 596 |  |   | 
  | 597 | 58 |              if ( !missingFromResults.isEmpty() ) | 
  | 598 |  |              { | 
  | 599 | 19 |                  results.addAll( missingFromResults ); | 
  | 600 |  |   | 
  | 601 | 19 |                  missingFromResults.clear(); | 
  | 602 |  |              } | 
  | 603 | 58 |          } | 
  | 604 |  |   | 
  | 605 | 29 |          return results; | 
  | 606 |  |      } | 
  | 607 |  |   | 
  | 608 |  |       | 
  | 609 |  |   | 
  | 610 |  |   | 
  | 611 |  |   | 
  | 612 |  |   | 
  | 613 |  |   | 
  | 614 |  |   | 
  | 615 |  |   | 
  | 616 |  |      public static void mergeReportPluginLists( Reporting child, Reporting parent, boolean handleAsInheritance ) | 
  | 617 |  |      { | 
  | 618 | 160 |          if ( ( child == null ) || ( parent == null ) ) | 
  | 619 |  |          { | 
  | 620 |  |               | 
  | 621 | 0 |              return; | 
  | 622 |  |          } | 
  | 623 |  |   | 
  | 624 | 160 |          List parentPlugins = parent.getPlugins(); | 
  | 625 |  |   | 
  | 626 | 160 |          if ( ( parentPlugins != null ) && !parentPlugins.isEmpty() ) | 
  | 627 |  |          { | 
  | 628 | 4 |              parentPlugins = new ArrayList( parentPlugins ); | 
  | 629 |  |   | 
  | 630 |  |               | 
  | 631 |  |               | 
  | 632 | 4 |              if ( handleAsInheritance ) | 
  | 633 |  |              { | 
  | 634 | 4 |                  for ( Iterator it = parentPlugins.iterator(); it.hasNext(); ) | 
  | 635 |  |                  { | 
  | 636 | 5 |                      ReportPlugin plugin = (ReportPlugin) it.next(); | 
  | 637 |  |   | 
  | 638 | 5 |                      String inherited = plugin.getInherited(); | 
  | 639 |  |   | 
  | 640 | 5 |                      if ( ( inherited != null ) && !Boolean.valueOf( inherited ).booleanValue() ) | 
  | 641 |  |                      { | 
  | 642 | 1 |                          it.remove(); | 
  | 643 |  |                      } | 
  | 644 | 5 |                  } | 
  | 645 |  |              } | 
  | 646 |  |   | 
  | 647 | 4 |              List assembledPlugins = new ArrayList(); | 
  | 648 |  |   | 
  | 649 | 4 |              Map childPlugins = child.getReportPluginsAsMap(); | 
  | 650 |  |   | 
  | 651 | 4 |              for ( Iterator it = parentPlugins.iterator(); it.hasNext(); ) | 
  | 652 |  |              { | 
  | 653 | 4 |                  ReportPlugin parentPlugin = (ReportPlugin) it.next(); | 
  | 654 |  |   | 
  | 655 | 4 |                  String parentInherited = parentPlugin.getInherited(); | 
  | 656 |  |   | 
  | 657 |  |                   | 
  | 658 |  |                   | 
  | 659 |  |                   | 
  | 660 |  |                   | 
  | 661 |  |                   | 
  | 662 | 4 |                  if ( !handleAsInheritance || ( parentInherited == null ) || | 
  | 663 |  |                      Boolean.valueOf( parentInherited ).booleanValue() ) | 
  | 664 |  |                  { | 
  | 665 | 4 |                      ReportPlugin childPlugin = (ReportPlugin) childPlugins.get( parentPlugin.getKey() ); | 
  | 666 |  |   | 
  | 667 | 4 |                      if ( ( childPlugin != null ) && !assembledPlugins.contains( childPlugin ) ) | 
  | 668 |  |                      { | 
  | 669 | 1 |                          ReportPlugin assembledPlugin = childPlugin; | 
  | 670 |  |   | 
  | 671 | 1 |                          mergeReportPluginDefinitions( childPlugin, parentPlugin, handleAsInheritance ); | 
  | 672 |  |   | 
  | 673 |  |                           | 
  | 674 | 1 |                          assembledPlugins.add( assembledPlugin ); | 
  | 675 |  |                      } | 
  | 676 |  |   | 
  | 677 |  |                       | 
  | 678 |  |                       | 
  | 679 |  |                       | 
  | 680 | 4 |                      if ( handleAsInheritance && ( parentInherited == null ) ) | 
  | 681 |  |                      { | 
  | 682 | 3 |                          parentPlugin.unsetInheritanceApplied(); | 
  | 683 |  |                      } | 
  | 684 |  |                  } | 
  | 685 |  |   | 
  | 686 |  |                   | 
  | 687 |  |                   | 
  | 688 | 4 |                  List results = ModelUtils.orderAfterMerge( assembledPlugins, parentPlugins, | 
  | 689 |  |                                                                          child.getPlugins() ); | 
  | 690 |  |   | 
  | 691 | 4 |                  child.setPlugins( results ); | 
  | 692 |  |   | 
  | 693 | 4 |                  child.flushReportPluginMap(); | 
  | 694 | 4 |              } | 
  | 695 |  |          } | 
  | 696 | 160 |      } | 
  | 697 |  |   | 
  | 698 |  |      public static void mergePluginDefinitions( Plugin child, Plugin parent, boolean handleAsInheritance ) | 
  | 699 |  |      { | 
  | 700 | 40 |          if ( ( child == null ) || ( parent == null ) ) | 
  | 701 |  |          { | 
  | 702 |  |               | 
  | 703 | 0 |              return; | 
  | 704 |  |          } | 
  | 705 |  |   | 
  | 706 | 40 |          if ( parent.isExtensions() ) | 
  | 707 |  |          { | 
  | 708 | 0 |              child.setExtensions( true ); | 
  | 709 |  |          } | 
  | 710 |  |   | 
  | 711 | 40 |          if ( ( child.getVersion() == null ) && ( parent.getVersion() != null ) ) | 
  | 712 |  |          { | 
  | 713 | 22 |              child.setVersion( parent.getVersion() ); | 
  | 714 |  |          } | 
  | 715 |  |   | 
  | 716 | 40 |          Xpp3Dom childConfiguration = (Xpp3Dom) child.getConfiguration(); | 
  | 717 | 40 |          Xpp3Dom parentConfiguration = (Xpp3Dom) parent.getConfiguration(); | 
  | 718 |  |   | 
  | 719 | 40 |          childConfiguration = Xpp3Dom.mergeXpp3Dom( childConfiguration, parentConfiguration ); | 
  | 720 |  |   | 
  | 721 | 40 |          child.setConfiguration( childConfiguration ); | 
  | 722 |  |   | 
  | 723 | 40 |          child.setDependencies( mergeDependencyList( child.getDependencies(), parent.getDependencies() ) ); | 
  | 724 |  |   | 
  | 725 |  |           | 
  | 726 | 40 |          String parentInherited = parent.getInherited(); | 
  | 727 |  |   | 
  | 728 | 40 |          boolean parentIsInherited = ( parentInherited == null ) || Boolean.valueOf( parentInherited ).booleanValue(); | 
  | 729 |  |   | 
  | 730 | 40 |          List parentExecutions = parent.getExecutions(); | 
  | 731 |  |   | 
  | 732 | 40 |          if ( ( parentExecutions != null ) && !parentExecutions.isEmpty() ) | 
  | 733 |  |          { | 
  | 734 | 12 |              List mergedExecutions = new ArrayList(); | 
  | 735 |  |   | 
  | 736 | 12 |              Map assembledExecutions = new TreeMap(); | 
  | 737 |  |   | 
  | 738 | 12 |              Map childExecutions = child.getExecutionsAsMap(); | 
  | 739 |  |   | 
  | 740 | 12 |              for ( Iterator it = parentExecutions.iterator(); it.hasNext(); ) | 
  | 741 |  |              { | 
  | 742 | 13 |                  PluginExecution parentExecution = (PluginExecution) it.next(); | 
  | 743 |  |   | 
  | 744 | 13 |                  String inherited = parentExecution.getInherited(); | 
  | 745 |  |   | 
  | 746 | 13 |                  boolean parentExecInherited = parentIsInherited && ( ( inherited == null ) || Boolean.valueOf( inherited ).booleanValue() ); | 
  | 747 |  |   | 
  | 748 | 13 |                  if ( !handleAsInheritance || parentExecInherited ) | 
  | 749 |  |                  { | 
  | 750 | 7 |                      PluginExecution assembled = parentExecution; | 
  | 751 |  |   | 
  | 752 | 7 |                      PluginExecution childExecution = (PluginExecution) childExecutions.get( parentExecution.getId() ); | 
  | 753 |  |   | 
  | 754 | 7 |                      if ( childExecution != null ) | 
  | 755 |  |                      { | 
  | 756 | 0 |                          mergePluginExecutionDefinitions( childExecution, parentExecution ); | 
  | 757 |  |   | 
  | 758 | 0 |                          assembled = childExecution; | 
  | 759 |  |                      } | 
  | 760 | 7 |                      else if ( handleAsInheritance && ( parentInherited == null ) ) | 
  | 761 |  |                      { | 
  | 762 | 2 |                          parentExecution.unsetInheritanceApplied(); | 
  | 763 |  |                      } | 
  | 764 |  |   | 
  | 765 | 7 |                      assembledExecutions.put( assembled.getId(), assembled ); | 
  | 766 | 7 |                      mergedExecutions.add(assembled); | 
  | 767 |  |                  } | 
  | 768 | 13 |              } | 
  | 769 |  |   | 
  | 770 | 12 |              for ( Iterator it = child.getExecutions().iterator(); it.hasNext(); ) | 
  | 771 |  |              { | 
  | 772 | 10 |                  PluginExecution childExecution = (PluginExecution)it.next(); | 
  | 773 |  |   | 
  | 774 | 10 |                  if ( !assembledExecutions.containsKey( childExecution.getId() ) ) | 
  | 775 |  |                  { | 
  | 776 | 10 |                      mergedExecutions.add(childExecution); | 
  | 777 |  |                  } | 
  | 778 | 10 |              } | 
  | 779 |  |   | 
  | 780 | 12 |              child.setExecutions(mergedExecutions); | 
  | 781 |  |   | 
  | 782 | 12 |              child.flushExecutionMap(); | 
  | 783 |  |          } | 
  | 784 |  |   | 
  | 785 | 40 |      } | 
  | 786 |  |   | 
  | 787 |  |      public static void mergeReportPluginDefinitions( ReportPlugin child, ReportPlugin parent, | 
  | 788 |  |                                                       boolean handleAsInheritance ) | 
  | 789 |  |      { | 
  | 790 | 1 |          if ( ( child == null ) || ( parent == null ) ) | 
  | 791 |  |          { | 
  | 792 |  |               | 
  | 793 | 0 |              return; | 
  | 794 |  |          } | 
  | 795 |  |   | 
  | 796 | 1 |          if ( ( child.getVersion() == null ) && ( parent.getVersion() != null ) ) | 
  | 797 |  |          { | 
  | 798 | 0 |              child.setVersion( parent.getVersion() ); | 
  | 799 |  |          } | 
  | 800 |  |   | 
  | 801 | 1 |          String parentInherited = parent.getInherited(); | 
  | 802 |  |   | 
  | 803 | 1 |          boolean parentIsInherited = ( parentInherited == null ) || Boolean.valueOf( parentInherited ).booleanValue(); | 
  | 804 |  |   | 
  | 805 |  |           | 
  | 806 | 1 |          if ( parentIsInherited ) | 
  | 807 |  |          { | 
  | 808 | 1 |              Xpp3Dom childConfiguration = (Xpp3Dom) child.getConfiguration(); | 
  | 809 | 1 |              Xpp3Dom parentConfiguration = (Xpp3Dom) parent.getConfiguration(); | 
  | 810 |  |   | 
  | 811 | 1 |              childConfiguration = Xpp3Dom.mergeXpp3Dom( childConfiguration, parentConfiguration ); | 
  | 812 |  |   | 
  | 813 | 1 |              child.setConfiguration( childConfiguration ); | 
  | 814 |  |          } | 
  | 815 |  |   | 
  | 816 |  |           | 
  | 817 | 1 |          List parentReportSets = parent.getReportSets(); | 
  | 818 |  |   | 
  | 819 | 1 |          if ( ( parentReportSets != null ) && !parentReportSets.isEmpty() ) | 
  | 820 |  |          { | 
  | 821 | 0 |              Map assembledReportSets = new TreeMap(); | 
  | 822 |  |   | 
  | 823 | 0 |              Map childReportSets = child.getReportSetsAsMap(); | 
  | 824 |  |   | 
  | 825 | 0 |              for ( Iterator it = parentReportSets.iterator(); it.hasNext(); ) | 
  | 826 |  |              { | 
  | 827 | 0 |                  ReportSet parentReportSet = (ReportSet) it.next(); | 
  | 828 |  |   | 
  | 829 | 0 |                  if ( !handleAsInheritance || parentIsInherited ) | 
  | 830 |  |                  { | 
  | 831 | 0 |                      ReportSet assembledReportSet = parentReportSet; | 
  | 832 |  |   | 
  | 833 | 0 |                      ReportSet childReportSet = (ReportSet) childReportSets.get( parentReportSet.getId() ); | 
  | 834 |  |   | 
  | 835 | 0 |                      if ( childReportSet != null ) | 
  | 836 |  |                      { | 
  | 837 | 0 |                          mergeReportSetDefinitions( childReportSet, parentReportSet ); | 
  | 838 |  |   | 
  | 839 | 0 |                          assembledReportSet = childReportSet; | 
  | 840 |  |                      } | 
  | 841 | 0 |                      else if ( handleAsInheritance && ( parentInherited == null ) ) | 
  | 842 |  |                      { | 
  | 843 | 0 |                          parentReportSet.unsetInheritanceApplied(); | 
  | 844 |  |                      } | 
  | 845 |  |   | 
  | 846 | 0 |                      assembledReportSets.put( assembledReportSet.getId(), assembledReportSet ); | 
  | 847 |  |                  } | 
  | 848 | 0 |              } | 
  | 849 |  |   | 
  | 850 | 0 |              for ( Iterator it = childReportSets.entrySet().iterator(); it.hasNext(); ) | 
  | 851 |  |              { | 
  | 852 | 0 |                  Map.Entry entry = (Map.Entry) it.next(); | 
  | 853 |  |   | 
  | 854 | 0 |                  String id = (String) entry.getKey(); | 
  | 855 |  |   | 
  | 856 | 0 |                  if ( !assembledReportSets.containsKey( id ) ) | 
  | 857 |  |                  { | 
  | 858 | 0 |                      assembledReportSets.put( id, entry.getValue() ); | 
  | 859 |  |                  } | 
  | 860 | 0 |              } | 
  | 861 |  |   | 
  | 862 | 0 |              child.setReportSets( new ArrayList( assembledReportSets.values() ) ); | 
  | 863 |  |   | 
  | 864 | 0 |              child.flushReportSetMap(); | 
  | 865 |  |          } | 
  | 866 |  |   | 
  | 867 | 1 |      } | 
  | 868 |  |   | 
  | 869 |  |      private static void mergePluginExecutionDefinitions( PluginExecution child, PluginExecution parent ) | 
  | 870 |  |      { | 
  | 871 | 0 |          if ( child.getPhase() == null ) | 
  | 872 |  |          { | 
  | 873 | 0 |              child.setPhase( parent.getPhase() ); | 
  | 874 |  |          } | 
  | 875 |  |   | 
  | 876 | 0 |          List parentGoals = parent.getGoals(); | 
  | 877 | 0 |          List childGoals = child.getGoals(); | 
  | 878 |  |   | 
  | 879 | 0 |          List goals = new ArrayList(); | 
  | 880 |  |   | 
  | 881 | 0 |          if ( ( childGoals != null ) && !childGoals.isEmpty() ) | 
  | 882 |  |          { | 
  | 883 | 0 |              goals.addAll( childGoals ); | 
  | 884 |  |          } | 
  | 885 |  |   | 
  | 886 | 0 |          if ( parentGoals != null ) | 
  | 887 |  |          { | 
  | 888 | 0 |              for ( Iterator goalIterator = parentGoals.iterator(); goalIterator.hasNext(); ) | 
  | 889 |  |              { | 
  | 890 | 0 |                  String goal = (String) goalIterator.next(); | 
  | 891 |  |   | 
  | 892 | 0 |                  if ( !goals.contains( goal ) ) | 
  | 893 |  |                  { | 
  | 894 | 0 |                      goals.add( goal ); | 
  | 895 |  |                  } | 
  | 896 | 0 |              } | 
  | 897 |  |          } | 
  | 898 |  |   | 
  | 899 | 0 |          child.setGoals( goals ); | 
  | 900 |  |   | 
  | 901 | 0 |          Xpp3Dom childConfiguration = (Xpp3Dom) child.getConfiguration(); | 
  | 902 | 0 |          Xpp3Dom parentConfiguration = (Xpp3Dom) parent.getConfiguration(); | 
  | 903 |  |   | 
  | 904 | 0 |          childConfiguration = Xpp3Dom.mergeXpp3Dom( childConfiguration, parentConfiguration ); | 
  | 905 |  |   | 
  | 906 | 0 |          child.setConfiguration( childConfiguration ); | 
  | 907 | 0 |      } | 
  | 908 |  |   | 
  | 909 |  |      private static void mergeReportSetDefinitions( ReportSet child, ReportSet parent ) | 
  | 910 |  |      { | 
  | 911 | 0 |          List parentReports = parent.getReports(); | 
  | 912 | 0 |          List childReports = child.getReports(); | 
  | 913 |  |   | 
  | 914 | 0 |          List reports = new ArrayList(); | 
  | 915 |  |   | 
  | 916 | 0 |          if ( ( childReports != null ) && !childReports.isEmpty() ) | 
  | 917 |  |          { | 
  | 918 | 0 |              reports.addAll( childReports ); | 
  | 919 |  |          } | 
  | 920 |  |   | 
  | 921 | 0 |          if ( parentReports != null ) | 
  | 922 |  |          { | 
  | 923 | 0 |              for ( Iterator i = parentReports.iterator(); i.hasNext(); ) | 
  | 924 |  |              { | 
  | 925 | 0 |                  String report = (String) i.next(); | 
  | 926 |  |   | 
  | 927 | 0 |                  if ( !reports.contains( report ) ) | 
  | 928 |  |                  { | 
  | 929 | 0 |                      reports.add( report ); | 
  | 930 |  |                  } | 
  | 931 | 0 |              } | 
  | 932 |  |          } | 
  | 933 |  |   | 
  | 934 | 0 |          child.setReports( reports ); | 
  | 935 |  |   | 
  | 936 | 0 |          Xpp3Dom childConfiguration = (Xpp3Dom) child.getConfiguration(); | 
  | 937 | 0 |          Xpp3Dom parentConfiguration = (Xpp3Dom) parent.getConfiguration(); | 
  | 938 |  |   | 
  | 939 | 0 |          childConfiguration = Xpp3Dom.mergeXpp3Dom( childConfiguration, parentConfiguration ); | 
  | 940 |  |   | 
  | 941 | 0 |          child.setConfiguration( childConfiguration ); | 
  | 942 | 0 |      } | 
  | 943 |  |   | 
  | 944 |  |      public static Model cloneModel( Model src ) | 
  | 945 |  |      { | 
  | 946 | 494 |          if ( src == null ) | 
  | 947 |  |          { | 
  | 948 | 0 |              return null; | 
  | 949 |  |          } | 
  | 950 |  |           | 
  | 951 | 494 |          Model result = new Model(); | 
  | 952 |  |           | 
  | 953 | 494 |          cloneModelBaseFields( src, result ); | 
  | 954 |  |   | 
  | 955 | 494 |          result.setArtifactId( src.getArtifactId() ); | 
  | 956 | 494 |          result.setBuild( cloneBuild( src.getBuild() ) ); | 
  | 957 | 494 |          result.setCiManagement( cloneCiManagement( src.getCiManagement() ) ); | 
  | 958 |  |           | 
  | 959 | 494 |          result.setContributors( cloneList( src.getContributors(), CONTRIBUTOR_CLONER ) ); | 
  | 960 |  |           | 
  | 961 | 494 |          result.setDescription( src.getDescription() ); | 
  | 962 | 494 |          result.setDevelopers( cloneList( src.getDevelopers(), DEVELOPER_CLONER ) ); | 
  | 963 |  |           | 
  | 964 | 494 |          result.setGroupId( src.getGroupId() ); | 
  | 965 | 494 |          result.setInceptionYear( src.getInceptionYear() ); | 
  | 966 | 494 |          result.setIssueManagement( cloneIssueManagement( src.getIssueManagement() ) ); | 
  | 967 | 494 |          result.setLicenses( cloneList( src.getLicenses(), LICENSE_CLONER ) ); | 
  | 968 |  |           | 
  | 969 | 494 |          result.setMailingLists( cloneList( src.getMailingLists(), MAILING_LIST_CLONER ) ); | 
  | 970 | 494 |          result.setModelVersion( src.getModelVersion() ); | 
  | 971 | 494 |          result.setName( src.getName() ); | 
  | 972 | 494 |          result.setOrganization( cloneOrganization( src.getOrganization() ) ); | 
  | 973 | 494 |          result.setPackaging( src.getPackaging() ); | 
  | 974 | 494 |          result.setParent( cloneParent( src.getParent() ) ); | 
  | 975 |  |           | 
  | 976 | 494 |          result.setPrerequisites( clonePrerequisites( src.getPrerequisites() ) ); | 
  | 977 | 494 |          result.setProfiles( cloneList( src.getProfiles(), PROFILE_CLONER ) ); | 
  | 978 |  |           | 
  | 979 | 494 |          result.setScm( cloneScm( src.getScm() ) ); | 
  | 980 | 494 |          result.setUrl( src.getUrl() ); | 
  | 981 | 494 |          result.setVersion( src.getVersion() ); | 
  | 982 |  |   | 
  | 983 | 494 |          return result; | 
  | 984 |  |      } | 
  | 985 |  |   | 
  | 986 |  |      public static Scm cloneScm( Scm src ) | 
  | 987 |  |      { | 
  | 988 | 494 |          if ( src == null ) | 
  | 989 |  |          { | 
  | 990 | 426 |              return null; | 
  | 991 |  |          } | 
  | 992 |  |           | 
  | 993 | 68 |          Scm result = new Scm(); | 
  | 994 |  |           | 
  | 995 | 68 |          result.setConnection( src.getConnection() ); | 
  | 996 | 68 |          result.setDeveloperConnection( src.getDeveloperConnection() ); | 
  | 997 | 68 |          result.setTag( src.getTag() ); | 
  | 998 | 68 |          result.setUrl( src.getUrl() ); | 
  | 999 |  |           | 
  | 1000 | 68 |          return result; | 
  | 1001 |  |      } | 
  | 1002 |  |   | 
  | 1003 |  |      public static Prerequisites clonePrerequisites( Prerequisites src ) | 
  | 1004 |  |      { | 
  | 1005 | 494 |          if ( src == null ) | 
  | 1006 |  |          { | 
  | 1007 | 494 |              return null; | 
  | 1008 |  |          } | 
  | 1009 |  |           | 
  | 1010 | 0 |          Prerequisites result = new Prerequisites(); | 
  | 1011 |  |           | 
  | 1012 | 0 |          result.setMaven( src.getMaven() ); | 
  | 1013 |  |   | 
  | 1014 | 0 |          return result; | 
  | 1015 |  |      } | 
  | 1016 |  |   | 
  | 1017 |  |      public static Organization cloneOrganization( Organization src ) | 
  | 1018 |  |      { | 
  | 1019 | 494 |          if ( src == null ) | 
  | 1020 |  |          { | 
  | 1021 | 324 |              return null; | 
  | 1022 |  |          } | 
  | 1023 |  |           | 
  | 1024 | 170 |          Organization result = new Organization(); | 
  | 1025 |  |           | 
  | 1026 | 170 |          result.setName( src.getName() ); | 
  | 1027 | 170 |          result.setUrl( src.getUrl() ); | 
  | 1028 |  |           | 
  | 1029 | 170 |          return result; | 
  | 1030 |  |      } | 
  | 1031 |  |   | 
  | 1032 |  |      public static License cloneLicense( License src ) | 
  | 1033 |  |      { | 
  | 1034 | 0 |          if ( src == null ) | 
  | 1035 |  |          { | 
  | 1036 | 0 |              return null; | 
  | 1037 |  |          } | 
  | 1038 |  |           | 
  | 1039 | 0 |          License result = new License(); | 
  | 1040 |  |           | 
  | 1041 | 0 |          result.setComments( src.getComments() ); | 
  | 1042 | 0 |          result.setDistribution( src.getDistribution() ); | 
  | 1043 | 0 |          result.setName( src.getName() ); | 
  | 1044 | 0 |          result.setUrl( src.getUrl() ); | 
  | 1045 |  |           | 
  | 1046 | 0 |          return result; | 
  | 1047 |  |      } | 
  | 1048 |  |   | 
  | 1049 |  |      public static IssueManagement cloneIssueManagement( IssueManagement src ) | 
  | 1050 |  |      { | 
  | 1051 | 494 |          if ( src == null ) | 
  | 1052 |  |          { | 
  | 1053 | 494 |              return null; | 
  | 1054 |  |          } | 
  | 1055 |  |           | 
  | 1056 | 0 |          IssueManagement result = new IssueManagement(); | 
  | 1057 |  |           | 
  | 1058 | 0 |          result.setSystem( src.getSystem() ); | 
  | 1059 | 0 |          result.setUrl( src.getUrl() ); | 
  | 1060 |  |           | 
  | 1061 | 0 |          return result; | 
  | 1062 |  |      } | 
  | 1063 |  |   | 
  | 1064 |  |      public static DistributionManagement cloneDistributionManagement( DistributionManagement src ) | 
  | 1065 |  |      { | 
  | 1066 | 494 |          if ( src == null ) | 
  | 1067 |  |          { | 
  | 1068 | 489 |              return null; | 
  | 1069 |  |          } | 
  | 1070 |  |           | 
  | 1071 | 5 |          DistributionManagement result = new DistributionManagement(); | 
  | 1072 |  |           | 
  | 1073 | 5 |          result.setDownloadUrl( src.getDownloadUrl() ); | 
  | 1074 | 5 |          result.setRelocation( cloneRelocation( src.getRelocation() ) ); | 
  | 1075 | 5 |          result.setRepository( cloneDeploymentRepository( src.getRepository() ) ); | 
  | 1076 | 5 |          result.setSite( cloneSite( src.getSite() ) ); | 
  | 1077 | 5 |          result.setSnapshotRepository( cloneDeploymentRepository( src.getSnapshotRepository() ) ); | 
  | 1078 | 5 |          result.setStatus( src.getStatus() ); | 
  | 1079 |  |           | 
  | 1080 | 5 |          return result; | 
  | 1081 |  |      } | 
  | 1082 |  |   | 
  | 1083 |  |      public static Site cloneSite( Site src ) | 
  | 1084 |  |      { | 
  | 1085 | 5 |          if ( src == null ) | 
  | 1086 |  |          { | 
  | 1087 | 5 |              return null; | 
  | 1088 |  |          } | 
  | 1089 |  |           | 
  | 1090 | 0 |          Site result = new Site(); | 
  | 1091 |  |           | 
  | 1092 | 0 |          result.setId( src.getId() ); | 
  | 1093 | 0 |          result.setName( src.getName() ); | 
  | 1094 | 0 |          result.setUrl( src.getUrl() ); | 
  | 1095 |  |           | 
  | 1096 | 0 |          return result; | 
  | 1097 |  |      } | 
  | 1098 |  |   | 
  | 1099 |  |      public static DeploymentRepository cloneDeploymentRepository( DeploymentRepository src ) | 
  | 1100 |  |      { | 
  | 1101 | 10 |          if ( src == null ) | 
  | 1102 |  |          { | 
  | 1103 | 0 |              return null; | 
  | 1104 |  |          } | 
  | 1105 |  |           | 
  | 1106 | 10 |          DeploymentRepository result = new DeploymentRepository(); | 
  | 1107 |  |           | 
  | 1108 | 10 |          result.setUniqueVersion( src.isUniqueVersion() ); | 
  | 1109 |  |           | 
  | 1110 | 10 |          cloneRepositoryBaseFields( src, result ); | 
  | 1111 |  |           | 
  | 1112 | 10 |          return result; | 
  | 1113 |  |      } | 
  | 1114 |  |   | 
  | 1115 |  |      private static void cloneRepositoryBaseFields( RepositoryBase src, RepositoryBase result ) | 
  | 1116 |  |      { | 
  | 1117 | 76 |          result.setId( src.getId() ); | 
  | 1118 | 76 |          result.setLayout( src.getLayout() ); | 
  | 1119 | 76 |          result.setName( src.getName() ); | 
  | 1120 | 76 |          result.setUrl( src.getUrl() ); | 
  | 1121 | 76 |      } | 
  | 1122 |  |   | 
  | 1123 |  |      public static Relocation cloneRelocation( Relocation src ) | 
  | 1124 |  |      { | 
  | 1125 | 5 |          if ( src == null ) | 
  | 1126 |  |          { | 
  | 1127 | 5 |              return null; | 
  | 1128 |  |          } | 
  | 1129 |  |           | 
  | 1130 | 0 |          Relocation result = new Relocation(); | 
  | 1131 |  |           | 
  | 1132 | 0 |          result.setArtifactId( src.getArtifactId() ); | 
  | 1133 | 0 |          result.setGroupId( src.getGroupId() ); | 
  | 1134 | 0 |          result.setMessage( src.getMessage() ); | 
  | 1135 | 0 |          result.setVersion( src.getVersion() ); | 
  | 1136 |  |           | 
  | 1137 | 0 |          return result; | 
  | 1138 |  |      } | 
  | 1139 |  |   | 
  | 1140 |  |      public static DependencyManagement cloneDependencyManagement( DependencyManagement src ) | 
  | 1141 |  |      { | 
  | 1142 | 494 |          if ( src == null ) | 
  | 1143 |  |          { | 
  | 1144 | 383 |              return null; | 
  | 1145 |  |          } | 
  | 1146 |  |           | 
  | 1147 | 111 |          DependencyManagement result = new DependencyManagement(); | 
  | 1148 | 111 |          result.setDependencies( cloneList( src.getDependencies(), DEPENDENCY_CLONER ) ); | 
  | 1149 |  |           | 
  | 1150 | 111 |          return result; | 
  | 1151 |  |      } | 
  | 1152 |  |   | 
  | 1153 |  |      private static List cloneList( List src, ModelPartCloner cloner ) | 
  | 1154 |  |      { | 
  | 1155 | 11413 |          List result = null; | 
  | 1156 | 11413 |          if ( src != null ) | 
  | 1157 |  |          { | 
  | 1158 | 11413 |              result = new ArrayList( src.size() ); | 
  | 1159 | 11413 |              for ( Iterator it = src.iterator(); it.hasNext(); ) | 
  | 1160 |  |              { | 
  | 1161 | 3798 |                  result.add( cloner.cloneModelPart( (Object) it.next() ) ); | 
  | 1162 |  |              } | 
  | 1163 |  |          } | 
  | 1164 |  |           | 
  | 1165 | 11413 |          return result; | 
  | 1166 |  |      } | 
  | 1167 |  |   | 
  | 1168 |  |      public static Contributor cloneContributor( Contributor src ) | 
  | 1169 |  |      { | 
  | 1170 | 4 |          if ( src == null ) | 
  | 1171 |  |          { | 
  | 1172 | 0 |              return null; | 
  | 1173 |  |          } | 
  | 1174 |  |           | 
  | 1175 | 4 |          Contributor result = new Contributor(); | 
  | 1176 | 4 |          cloneContributorFields( src, result ); | 
  | 1177 |  |           | 
  | 1178 | 4 |          return result; | 
  | 1179 |  |      } | 
  | 1180 |  |       | 
  | 1181 |  |      public static Developer cloneDeveloper( Developer src ) | 
  | 1182 |  |      { | 
  | 1183 | 4 |          if ( src == null ) | 
  | 1184 |  |          { | 
  | 1185 | 0 |              return null; | 
  | 1186 |  |          } | 
  | 1187 |  |           | 
  | 1188 | 4 |          Developer result = new Developer(); | 
  | 1189 |  |           | 
  | 1190 | 4 |          result.setId( src.getId() ); | 
  | 1191 |  |           | 
  | 1192 | 4 |          cloneContributorFields( src, result ); | 
  | 1193 |  |           | 
  | 1194 | 4 |          return result; | 
  | 1195 |  |      } | 
  | 1196 |  |       | 
  | 1197 |  |      private static void cloneContributorFields( Contributor src, Contributor result ) | 
  | 1198 |  |      { | 
  | 1199 | 8 |          result.setEmail( src.getEmail() ); | 
  | 1200 | 8 |          result.setName( src.getName() ); | 
  | 1201 | 8 |          result.setOrganization( src.getOrganization() ); | 
  | 1202 | 8 |          result.setOrganizationUrl( src.getOrganizationUrl() ); | 
  | 1203 | 8 |          result.setProperties( cloneProperties( src.getProperties() ) ); | 
  | 1204 | 8 |          result.setRoles( cloneListOfStrings( src.getRoles() ) ); | 
  | 1205 | 8 |          result.setTimezone( src.getTimezone() ); | 
  | 1206 | 8 |          result.setUrl( src.getUrl() ); | 
  | 1207 | 8 |      } | 
  | 1208 |  |   | 
  | 1209 |  |      public static CiManagement cloneCiManagement( CiManagement src ) | 
  | 1210 |  |      { | 
  | 1211 | 494 |          if ( src == null ) | 
  | 1212 |  |          { | 
  | 1213 | 494 |              return null; | 
  | 1214 |  |          } | 
  | 1215 |  |           | 
  | 1216 | 0 |          CiManagement result = new CiManagement(); | 
  | 1217 |  |           | 
  | 1218 | 0 |          List notifiers = null; | 
  | 1219 | 0 |          if ( src.getNotifiers() != null ) | 
  | 1220 |  |          { | 
  | 1221 | 0 |              notifiers = new ArrayList( src.getNotifiers().size() ); | 
  | 1222 | 0 |              for ( Iterator it = src.getNotifiers().iterator(); it.hasNext(); ) | 
  | 1223 |  |              { | 
  | 1224 | 0 |                  notifiers.add( cloneNotifier( (Notifier) it.next() ) ); | 
  | 1225 |  |              } | 
  | 1226 |  |          } | 
  | 1227 | 0 |          result.setNotifiers( cloneList( src.getNotifiers(), NOTIFIER_CLONER ) ); | 
  | 1228 |  |           | 
  | 1229 | 0 |          result.setSystem( src.getSystem() ); | 
  | 1230 | 0 |          result.setUrl( src.getUrl() ); | 
  | 1231 |  |           | 
  | 1232 | 0 |          return result; | 
  | 1233 |  |      } | 
  | 1234 |  |   | 
  | 1235 |  |      public static Notifier cloneNotifier( Notifier src ) | 
  | 1236 |  |      { | 
  | 1237 | 0 |          if ( src == null ) | 
  | 1238 |  |          { | 
  | 1239 | 0 |              return null; | 
  | 1240 |  |          } | 
  | 1241 |  |           | 
  | 1242 | 0 |          Notifier result = new Notifier(); | 
  | 1243 | 0 |          result.setAddress( src.getAddress() ); | 
  | 1244 | 0 |          result.setConfiguration( cloneProperties( src.getConfiguration() ) ); | 
  | 1245 | 0 |          result.setSendOnError( src.isSendOnError() ); | 
  | 1246 | 0 |          result.setSendOnFailure( result.isSendOnFailure() ); | 
  | 1247 | 0 |          result.setSendOnSuccess( result.isSendOnSuccess() ); | 
  | 1248 | 0 |          result.setSendOnWarning( result.isSendOnWarning() ); | 
  | 1249 |  |           | 
  | 1250 | 0 |          return result; | 
  | 1251 |  |      } | 
  | 1252 |  |   | 
  | 1253 |  |      public static Properties cloneProperties( Properties src ) | 
  | 1254 |  |      { | 
  | 1255 | 502 |          if ( src == null ) | 
  | 1256 |  |          { | 
  | 1257 | 0 |              return null; | 
  | 1258 |  |          } | 
  | 1259 |  |           | 
  | 1260 | 502 |          Properties result = new Properties(); | 
  | 1261 | 502 |          for( Enumeration e = src.propertyNames(); e.hasMoreElements(); ) | 
  | 1262 |  |          { | 
  | 1263 | 33 |              String key = (String) e.nextElement(); | 
  | 1264 | 33 |              result.setProperty( key, src.getProperty( key ) ); | 
  | 1265 | 33 |          } | 
  | 1266 |  |           | 
  | 1267 | 502 |          return result; | 
  | 1268 |  |      } | 
  | 1269 |  |   | 
  | 1270 |  |      public static Build cloneBuild( Build src ) | 
  | 1271 |  |      { | 
  | 1272 | 618 |          if ( src == null ) | 
  | 1273 |  |          { | 
  | 1274 | 358 |              return null; | 
  | 1275 |  |          } | 
  | 1276 |  |   | 
  | 1277 | 260 |          Build result = new Build(); | 
  | 1278 |  |           | 
  | 1279 | 260 |          cloneBuildBaseFields( src, result ); | 
  | 1280 |  |           | 
  | 1281 | 260 |          result.setExtensions( cloneList( src.getExtensions(), EXTENSION_CLONER ) ); | 
  | 1282 | 260 |          result.setOutputDirectory( src.getOutputDirectory() ); | 
  | 1283 |  |           | 
  | 1284 | 260 |          result.setScriptSourceDirectory( src.getScriptSourceDirectory() ); | 
  | 1285 | 260 |          result.setSourceDirectory( src.getSourceDirectory() ); | 
  | 1286 | 260 |          result.setTestOutputDirectory( src.getTestOutputDirectory() ); | 
  | 1287 | 260 |          result.setTestSourceDirectory( src.getTestSourceDirectory() ); | 
  | 1288 |  |           | 
  | 1289 | 260 |          return result; | 
  | 1290 |  |      } | 
  | 1291 |  |   | 
  | 1292 |  |      public static void cloneBuildBaseFields( BuildBase src, BuildBase result ) | 
  | 1293 |  |      { | 
  | 1294 | 260 |          result.setDefaultGoal( src.getDefaultGoal() ); | 
  | 1295 | 260 |          result.setDirectory( src.getDirectory() ); | 
  | 1296 |  |           | 
  | 1297 | 260 |          result.setFilters( cloneListOfStrings( src.getFilters() ) ); | 
  | 1298 | 260 |          result.setFinalName( src.getFinalName() ); | 
  | 1299 |  |           | 
  | 1300 | 260 |          result.setPluginManagement( clonePluginManagement( src.getPluginManagement() ) ); | 
  | 1301 | 260 |          result.setPlugins( cloneList( src.getPlugins(), PLUGIN_CLONER ) ); | 
  | 1302 |  |    | 
  | 1303 | 260 |          result.setResources( cloneList( src.getResources(), RESOURCE_CLONER ) ); | 
  | 1304 |  |           | 
  | 1305 | 260 |          result.setTestResources( cloneList( src.getTestResources(), RESOURCE_CLONER ) ); | 
  | 1306 | 260 |      } | 
  | 1307 |  |   | 
  | 1308 |  |      public static PluginManagement clonePluginManagement( PluginManagement src ) | 
  | 1309 |  |      { | 
  | 1310 | 260 |          PluginManagement pMgmt = null; | 
  | 1311 | 260 |          if ( src != null ) | 
  | 1312 |  |          { | 
  | 1313 | 142 |              pMgmt = new PluginManagement(); | 
  | 1314 | 142 |              pMgmt.setPlugins( cloneList( src.getPlugins(), PLUGIN_CLONER ) ); | 
  | 1315 |  |          } | 
  | 1316 |  |           | 
  | 1317 | 260 |          return pMgmt; | 
  | 1318 |  |      } | 
  | 1319 |  |   | 
  | 1320 |  |      public static Resource cloneResource( Resource src ) | 
  | 1321 |  |      { | 
  | 1322 | 317 |          Resource result = null; | 
  | 1323 | 317 |          if ( src != null ) | 
  | 1324 |  |          { | 
  | 1325 | 317 |              result = new Resource(); | 
  | 1326 |  |               | 
  | 1327 | 317 |              result.setDirectory( src.getDirectory() ); | 
  | 1328 | 317 |              result.setExcludes( cloneListOfStrings( src.getExcludes() ) ); | 
  | 1329 | 317 |              result.setFiltering( src.isFiltering() ); | 
  | 1330 | 317 |              result.setIncludes( cloneListOfStrings( src.getIncludes() ) ); | 
  | 1331 | 317 |              result.setMergeId( src.getMergeId() ); | 
  | 1332 | 317 |              result.setTargetPath( src.getTargetPath() ); | 
  | 1333 |  |          } | 
  | 1334 |  |           | 
  | 1335 | 317 |          return result; | 
  | 1336 |  |      } | 
  | 1337 |  |   | 
  | 1338 |  |      public static Plugin clonePlugin( Plugin src ) | 
  | 1339 |  |      { | 
  | 1340 | 2831 |          Plugin result = null; | 
  | 1341 | 2831 |          if ( src != null ) | 
  | 1342 |  |          { | 
  | 1343 | 2831 |              result = new Plugin(); | 
  | 1344 | 2831 |              result.setArtifactId( src.getArtifactId() ); | 
  | 1345 |  |               | 
  | 1346 | 2831 |              result.setConfiguration( cloneConfiguration( src.getConfiguration() ) ); | 
  | 1347 |  |               | 
  | 1348 | 2831 |              result.setDependencies( cloneList( src.getDependencies(), DEPENDENCY_CLONER ) ); | 
  | 1349 | 2831 |              result.setExecutions( cloneList( src.getExecutions(), PLUGIN_EXECUTION_CLONER ) ); | 
  | 1350 |  |               | 
  | 1351 | 2831 |              result.setExtensions( src.isExtensions() ); | 
  | 1352 | 2831 |              result.setGroupId( src.getGroupId() ); | 
  | 1353 | 2831 |              result.setInherited( src.getInherited() ); | 
  | 1354 | 2831 |              result.setVersion( src.getVersion() ); | 
  | 1355 |  |          } | 
  | 1356 |  |           | 
  | 1357 | 2831 |          return result; | 
  | 1358 |  |      } | 
  | 1359 |  |   | 
  | 1360 |  |      public static PluginExecution clonePluginExecution( PluginExecution src ) | 
  | 1361 |  |      { | 
  | 1362 | 52 |          PluginExecution result = null; | 
  | 1363 |  |           | 
  | 1364 | 52 |          if ( src != null ) | 
  | 1365 |  |          { | 
  | 1366 | 52 |              result = new PluginExecution(); | 
  | 1367 |  |               | 
  | 1368 | 52 |              result.setId( src.getId() ); | 
  | 1369 | 52 |              result.setGoals( cloneListOfStrings( src.getGoals() ) ); | 
  | 1370 | 52 |              result.setConfiguration( cloneConfiguration( src.getConfiguration() ) ); | 
  | 1371 | 52 |              result.setInherited( src.getInherited() ); | 
  | 1372 | 52 |              result.setPhase( src.getPhase() ); | 
  | 1373 |  |          } | 
  | 1374 |  |           | 
  | 1375 | 52 |          return result; | 
  | 1376 |  |      } | 
  | 1377 |  |   | 
  | 1378 |  |       | 
  | 1379 |  |      public static Object cloneConfiguration( Object configuration ) | 
  | 1380 |  |      { | 
  | 1381 | 2883 |          if ( configuration == null ) | 
  | 1382 |  |          { | 
  | 1383 | 2793 |              return null; | 
  | 1384 |  |          } | 
  | 1385 |  |           | 
  | 1386 | 90 |          return new Xpp3Dom( (Xpp3Dom) configuration ); | 
  | 1387 |  |      } | 
  | 1388 |  |   | 
  | 1389 |  |      public static Dependency cloneDependency( Dependency src ) | 
  | 1390 |  |      { | 
  | 1391 | 488 |          Dependency result = null; | 
  | 1392 | 488 |          if ( src != null ) | 
  | 1393 |  |          { | 
  | 1394 | 488 |              result = new Dependency(); | 
  | 1395 |  |               | 
  | 1396 | 488 |              result.setArtifactId( src.getArtifactId() ); | 
  | 1397 | 488 |              result.setClassifier( src.getClassifier() ); | 
  | 1398 | 488 |              result.setExclusions( cloneList( src.getExclusions(), DEPENDENCY_EXCLUSION_CLONER ) ); | 
  | 1399 | 488 |              result.setGroupId( src.getGroupId() ); | 
  | 1400 | 488 |              result.setOptional( src.isOptional() ); | 
  | 1401 | 488 |              result.setScope( src.getScope() ); | 
  | 1402 | 488 |              result.setSystemPath( src.getSystemPath() ); | 
  | 1403 | 488 |              result.setType( src.getType() ); | 
  | 1404 | 488 |              result.setVersion( src.getVersion() ); | 
  | 1405 |  |          } | 
  | 1406 |  |           | 
  | 1407 | 488 |          return result; | 
  | 1408 |  |      } | 
  | 1409 |  |   | 
  | 1410 |  |      public static Exclusion cloneExclusion( Exclusion src ) | 
  | 1411 |  |      { | 
  | 1412 | 14 |          Exclusion result = null; | 
  | 1413 | 14 |          if ( src != null ) | 
  | 1414 |  |          { | 
  | 1415 | 14 |              result = new Exclusion(); | 
  | 1416 | 14 |              result.setArtifactId( src.getArtifactId() ); | 
  | 1417 | 14 |              result.setGroupId( src.getGroupId() ); | 
  | 1418 |  |          } | 
  | 1419 |  |           | 
  | 1420 | 14 |          return result; | 
  | 1421 |  |      } | 
  | 1422 |  |   | 
  | 1423 |  |      public static List cloneListOfStrings( List src ) | 
  | 1424 |  |      { | 
  | 1425 | 1448 |          List result = null; | 
  | 1426 | 1448 |          if ( src != null ) | 
  | 1427 |  |          { | 
  | 1428 | 1448 |              result = new ArrayList( src.size() ); | 
  | 1429 | 1448 |              for ( Iterator it = src.iterator(); it.hasNext(); ) | 
  | 1430 |  |              { | 
  | 1431 | 233 |                  String item = (String) it.next(); | 
  | 1432 | 233 |                  result.add( item ); | 
  | 1433 | 233 |              } | 
  | 1434 |  |          } | 
  | 1435 |  |           | 
  | 1436 | 1448 |          return result; | 
  | 1437 |  |      } | 
  | 1438 |  |   | 
  | 1439 |  |      public static Extension cloneExtension( Extension src ) | 
  | 1440 |  |      { | 
  | 1441 | 0 |          Extension rExt = new Extension(); | 
  | 1442 | 0 |          rExt.setArtifactId( src.getArtifactId() ); | 
  | 1443 | 0 |          rExt.setGroupId( src.getGroupId() ); | 
  | 1444 | 0 |          rExt.setVersion( src.getVersion() ); | 
  | 1445 |  |           | 
  | 1446 | 0 |          return rExt; | 
  | 1447 |  |      } | 
  | 1448 |  |   | 
  | 1449 |  |      public static Exclusion cloneDependencyExclusion( Exclusion src ) | 
  | 1450 |  |      { | 
  | 1451 | 0 |          if ( src == null ) | 
  | 1452 |  |          { | 
  | 1453 | 0 |              return null; | 
  | 1454 |  |          } | 
  | 1455 |  |           | 
  | 1456 | 0 |          Exclusion result = new Exclusion(); | 
  | 1457 |  |   | 
  | 1458 | 0 |          result.setArtifactId( src.getArtifactId() ); | 
  | 1459 | 0 |          result.setGroupId( src.getGroupId() ); | 
  | 1460 |  |           | 
  | 1461 | 0 |          return result; | 
  | 1462 |  |      } | 
  | 1463 |  |   | 
  | 1464 |  |      public static Parent cloneParent( Parent src ) | 
  | 1465 |  |      { | 
  | 1466 | 494 |          if ( src == null ) | 
  | 1467 |  |          { | 
  | 1468 | 337 |              return null; | 
  | 1469 |  |          } | 
  | 1470 |  |   | 
  | 1471 | 157 |          Parent result = new Parent(); | 
  | 1472 | 157 |          result.setArtifactId( src.getArtifactId() ); | 
  | 1473 | 157 |          result.setGroupId( src.getGroupId() ); | 
  | 1474 | 157 |          result.setRelativePath( src.getRelativePath() ); | 
  | 1475 | 157 |          result.setVersion( src.getVersion() ); | 
  | 1476 |  |           | 
  | 1477 | 157 |          return result; | 
  | 1478 |  |      } | 
  | 1479 |  |   | 
  | 1480 |  |      public static List mergeRepositoryLists( List dominant, List recessive ) | 
  | 1481 |  |      { | 
  | 1482 | 398 |          List repositories = new ArrayList(); | 
  | 1483 |  |   | 
  | 1484 | 398 |          for ( Iterator it = dominant.iterator(); it.hasNext(); ) | 
  | 1485 |  |          { | 
  | 1486 | 15 |              Repository repository = (Repository) it.next(); | 
  | 1487 |  |   | 
  | 1488 | 15 |              repositories.add( repository ); | 
  | 1489 | 15 |          } | 
  | 1490 |  |   | 
  | 1491 | 398 |          for ( Iterator it = recessive.iterator(); it.hasNext(); ) | 
  | 1492 |  |          { | 
  | 1493 | 301 |              Repository repository = (Repository) it.next(); | 
  | 1494 |  |   | 
  | 1495 | 301 |              if ( !repositories.contains( repository ) ) | 
  | 1496 |  |              { | 
  | 1497 | 288 |                  repositories.add( repository ); | 
  | 1498 |  |              } | 
  | 1499 | 301 |          } | 
  | 1500 |  |   | 
  | 1501 | 398 |          return repositories; | 
  | 1502 |  |      } | 
  | 1503 |  |   | 
  | 1504 |  |      public static void mergeExtensionLists( Build childBuild, Build parentBuild ) | 
  | 1505 |  |      { | 
  | 1506 | 150 |          Map extMap = new LinkedHashMap(); | 
  | 1507 |  |   | 
  | 1508 | 150 |          List ext = childBuild.getExtensions(); | 
  | 1509 |  |   | 
  | 1510 | 150 |          if ( ext != null ) | 
  | 1511 |  |          { | 
  | 1512 | 150 |              for ( Iterator it = ext.iterator(); it.hasNext(); ) | 
  | 1513 |  |              { | 
  | 1514 | 0 |                  Extension extension = (Extension) it.next(); | 
  | 1515 | 0 |                  extMap.put( extension.getKey(), extension ); | 
  | 1516 | 0 |              } | 
  | 1517 |  |          } | 
  | 1518 |  |   | 
  | 1519 | 150 |          ext = parentBuild.getExtensions(); | 
  | 1520 |  |   | 
  | 1521 | 150 |          if ( ext != null ) | 
  | 1522 |  |          { | 
  | 1523 | 150 |              for ( Iterator it = ext.iterator(); it.hasNext(); ) | 
  | 1524 |  |              { | 
  | 1525 | 0 |                  Extension extension = (Extension) it.next(); | 
  | 1526 | 0 |                  if ( !extMap.containsKey( extension.getKey() ) ) | 
  | 1527 |  |                  { | 
  | 1528 | 0 |                      extMap.put( extension.getKey(), extension ); | 
  | 1529 |  |                  } | 
  | 1530 | 0 |              } | 
  | 1531 |  |          } | 
  | 1532 |  |   | 
  | 1533 | 150 |          childBuild.setExtensions( new ArrayList( extMap.values() ) ); | 
  | 1534 | 150 |      } | 
  | 1535 |  |   | 
  | 1536 |  |      public static void mergeResourceLists( List childResources, List parentResources ) | 
  | 1537 |  |      { | 
  | 1538 | 6 |          for ( Iterator i = parentResources.iterator(); i.hasNext(); ) | 
  | 1539 |  |          { | 
  | 1540 | 0 |              Resource r = (Resource) i.next(); | 
  | 1541 | 0 |              if ( !childResources.contains( r ) ) | 
  | 1542 |  |              { | 
  | 1543 | 0 |                  childResources.add( r ); | 
  | 1544 |  |              } | 
  | 1545 | 0 |          } | 
  | 1546 | 6 |      } | 
  | 1547 |  |   | 
  | 1548 |  |      public static void mergeFilterLists( List childFilters, List parentFilters ) | 
  | 1549 |  |      { | 
  | 1550 | 153 |          for ( Iterator i = parentFilters.iterator(); i.hasNext(); ) | 
  | 1551 |  |          { | 
  | 1552 | 0 |              String f = (String) i.next(); | 
  | 1553 | 0 |              if ( !childFilters.contains( f ) ) | 
  | 1554 |  |              { | 
  | 1555 | 0 |                  childFilters.add( f ); | 
  | 1556 |  |              } | 
  | 1557 | 0 |          } | 
  | 1558 | 153 |      } | 
  | 1559 |  |   | 
  | 1560 |  |      public static List mergeDependencyList( List child, List parent ) | 
  | 1561 |  |      { | 
  | 1562 | 230 |          Map depsMap = new LinkedHashMap(); | 
  | 1563 |  |   | 
  | 1564 | 230 |          if ( child != null ) | 
  | 1565 |  |          { | 
  | 1566 | 230 |              for ( Iterator it = child.iterator(); it.hasNext(); ) | 
  | 1567 |  |              { | 
  | 1568 | 75 |                  Dependency dependency = (Dependency) it.next(); | 
  | 1569 | 75 |                  depsMap.put( dependency.getManagementKey(), dependency ); | 
  | 1570 | 75 |              } | 
  | 1571 |  |          } | 
  | 1572 |  |   | 
  | 1573 | 230 |          if ( parent != null ) | 
  | 1574 |  |          { | 
  | 1575 | 230 |              for ( Iterator it = parent.iterator(); it.hasNext(); ) | 
  | 1576 |  |              { | 
  | 1577 | 6 |                  Dependency dependency = (Dependency) it.next(); | 
  | 1578 | 6 |                  if ( !depsMap.containsKey( dependency.getManagementKey() ) ) | 
  | 1579 |  |                  { | 
  | 1580 | 4 |                      depsMap.put( dependency.getManagementKey(), dependency ); | 
  | 1581 |  |                  } | 
  | 1582 | 6 |              } | 
  | 1583 |  |          } | 
  | 1584 |  |   | 
  | 1585 | 230 |          return new ArrayList( depsMap.values() ); | 
  | 1586 |  |      } | 
  | 1587 |  |       | 
  | 1588 | 0 |      public static interface ModelPartCloner | 
  | 1589 |  |      { | 
  | 1590 |  |          Object cloneModelPart( Object src ); | 
  | 1591 |  |      } | 
  | 1592 |  |       | 
  | 1593 |  |   | 
  | 1594 |  |  } |