Coverage Report - org.apache.maven.plugins.shade.pom.MavenJDOMWriter
 
Classes in this File Line Coverage Branch Coverage Complexity
MavenJDOMWriter
0%
0/876
0%
0/534
3,319
MavenJDOMWriter$Counter
0%
0/8
N/A
3,319
 
 1  
 package org.apache.maven.plugins.shade.pom;
 2  
 
 3  
 /*
 4  
  * Licensed to the Apache Software Foundation (ASF) under one
 5  
  * or more contributor license agreements.  See the NOTICE file
 6  
  * distributed with this work for additional information
 7  
  * regarding copyright ownership.  The ASF licenses this file
 8  
  * to you under the Apache License, Version 2.0 (the
 9  
  * "License"); you may not use this file except in compliance
 10  
  * with the License.  You may obtain a copy of the License at
 11  
  *
 12  
  *   http://www.apache.org/licenses/LICENSE-2.0
 13  
  *
 14  
  * Unless required by applicable law or agreed to in writing,
 15  
  * software distributed under the License is distributed on an
 16  
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 17  
  * KIND, either express or implied.  See the License for the
 18  
  * specific language governing permissions and limitations
 19  
  * under the License.
 20  
  */
 21  
 
 22  
 //package org.apache.maven.model.io.jdom;
 23  
 
 24  
   //---------------------------------/
 25  
  //- Imported classes and packages -/
 26  
 //---------------------------------/
 27  
 
 28  
 import java.io.OutputStream;
 29  
 import java.io.OutputStreamWriter;
 30  
 import java.io.Writer;
 31  
 import java.util.ArrayList;
 32  
 import java.util.Collection;
 33  
 import java.util.Iterator;
 34  
 import java.util.ListIterator;
 35  
 import java.util.Map;
 36  
 
 37  
 import org.apache.maven.model.ActivationFile;
 38  
 import org.apache.maven.model.ActivationOS;
 39  
 import org.apache.maven.model.ActivationProperty;
 40  
 import org.apache.maven.model.Build;
 41  
 import org.apache.maven.model.BuildBase;
 42  
 import org.apache.maven.model.CiManagement;
 43  
 import org.apache.maven.model.ConfigurationContainer;
 44  
 import org.apache.maven.model.Contributor;
 45  
 import org.apache.maven.model.Dependency;
 46  
 import org.apache.maven.model.DependencyManagement;
 47  
 import org.apache.maven.model.DeploymentRepository;
 48  
 import org.apache.maven.model.Developer;
 49  
 import org.apache.maven.model.DistributionManagement;
 50  
 import org.apache.maven.model.Exclusion;
 51  
 import org.apache.maven.model.Extension;
 52  
 import org.apache.maven.model.FileSet;
 53  
 import org.apache.maven.model.IssueManagement;
 54  
 import org.apache.maven.model.License;
 55  
 import org.apache.maven.model.MailingList;
 56  
 import org.apache.maven.model.Model;
 57  
 import org.apache.maven.model.ModelBase;
 58  
 import org.apache.maven.model.Notifier;
 59  
 import org.apache.maven.model.Organization;
 60  
 import org.apache.maven.model.Parent;
 61  
 import org.apache.maven.model.PatternSet;
 62  
 import org.apache.maven.model.Plugin;
 63  
 import org.apache.maven.model.PluginConfiguration;
 64  
 import org.apache.maven.model.PluginContainer;
 65  
 import org.apache.maven.model.PluginExecution;
 66  
 import org.apache.maven.model.PluginManagement;
 67  
 import org.apache.maven.model.Prerequisites;
 68  
 import org.apache.maven.model.Profile;
 69  
 import org.apache.maven.model.Relocation;
 70  
 import org.apache.maven.model.ReportPlugin;
 71  
 import org.apache.maven.model.ReportSet;
 72  
 import org.apache.maven.model.Reporting;
 73  
 import org.apache.maven.model.Repository;
 74  
 import org.apache.maven.model.RepositoryBase;
 75  
 import org.apache.maven.model.RepositoryPolicy;
 76  
 import org.apache.maven.model.Resource;
 77  
 import org.apache.maven.model.Scm;
 78  
 import org.apache.maven.model.Site;
 79  
 import org.codehaus.plexus.util.xml.Xpp3Dom;
 80  
 import org.jdom.Content;
 81  
 import org.jdom.DefaultJDOMFactory;
 82  
 import org.jdom.Document;
 83  
 import org.jdom.Element;
 84  
 import org.jdom.Text;
 85  
 import org.jdom.output.Format;
 86  
 import org.jdom.output.XMLOutputter;
 87  
 
 88  
 /**
 89  
  * Class MavenJDOMWriter.
 90  
  *
 91  
  * @version $Revision$ $Date$
 92  
  */
 93  
 public class MavenJDOMWriter {
 94  
 
 95  
 
 96  
       //--------------------------/
 97  
      //- Class/Member Variables -/
 98  
     //--------------------------/
 99  
 
 100  
     /**
 101  
      * Field factory
 102  
      */
 103  
     private DefaultJDOMFactory factory;
 104  
 
 105  
     /**
 106  
      * Field lineSeparator
 107  
      */
 108  
     private String lineSeparator;
 109  
 
 110  
 
 111  
       //----------------/
 112  
      //- Constructors -/
 113  
     //----------------/
 114  
 
 115  0
     public MavenJDOMWriter() {
 116  0
         factory = new DefaultJDOMFactory();
 117  0
         lineSeparator = "\n";
 118  0
     } //-- org.apache.maven.model.io.jdom.MavenJDOMWriter()
 119  
 
 120  
 
 121  
       //-----------/
 122  
      //- Methods -/
 123  
     //-----------/
 124  
 
 125  
     /**
 126  
      * Method findAndReplaceProperties
 127  
      *
 128  
      * @param counter
 129  
      * @param props
 130  
      * @param name
 131  
      * @param parent
 132  
      */
 133  
     protected Element findAndReplaceProperties(Counter counter, Element parent, String name, Map props)
 134  
     {
 135  0
         boolean shouldExist = props != null && ! props.isEmpty();
 136  0
         Element element = updateElement(counter, parent, name, shouldExist);
 137  0
         if (shouldExist) {
 138  0
             Iterator it = props.keySet().iterator();
 139  0
             Counter innerCounter = new Counter(counter.getDepth() + 1);
 140  0
             while (it.hasNext()) {
 141  0
                 String key = (String) it.next();
 142  0
                 findAndReplaceSimpleElement(innerCounter, element, key, (String)props.get(key), null);
 143  0
                 }
 144  0
             ArrayList lst = new ArrayList(props.keySet());
 145  0
             it = element.getChildren().iterator();
 146  0
             while (it.hasNext()) {
 147  0
                 Element elem = (Element) it.next();
 148  0
                 String key = elem.getName();
 149  0
                 if (!lst.contains(key)) {
 150  0
                     it.remove();
 151  
                 }
 152  0
             }
 153  
         }
 154  0
         return element;
 155  
     } //-- Element findAndReplaceProperties(Counter, Element, String, Map)
 156  
 
 157  
     /**
 158  
      * Method findAndReplaceSimpleElement
 159  
      *
 160  
      * @param counter
 161  
      * @param defaultValue
 162  
      * @param text
 163  
      * @param name
 164  
      * @param parent
 165  
      */
 166  
     protected Element findAndReplaceSimpleElement(Counter counter, Element parent, String name, String text, String defaultValue)
 167  
     {
 168  0
         if (defaultValue != null && text != null && defaultValue.equals(text)) {
 169  0
             Element element =  parent.getChild(name, parent.getNamespace());
 170  
             // if exist and is default value or if doesn't exist.. just keep the way it is..
 171  0
             if ((element != null && defaultValue.equals(element.getText())) || element == null) {
 172  0
                 return element;
 173  
             }
 174  
         }
 175  0
         boolean shouldExist = text != null && text.trim().length() > 0;
 176  0
         Element element = updateElement(counter, parent, name, shouldExist);
 177  0
         if (shouldExist) {
 178  0
             element.setText(text);
 179  
         }
 180  0
         return element;
 181  
     } //-- Element findAndReplaceSimpleElement(Counter, Element, String, String, String)
 182  
 
 183  
     /**
 184  
      * Method findAndReplaceSimpleLists
 185  
      *
 186  
      * @param counter
 187  
      * @param childName
 188  
      * @param parentName
 189  
      * @param list
 190  
      * @param parent
 191  
      */
 192  
     protected Element findAndReplaceSimpleLists(Counter counter, Element parent, java.util.Collection list, String parentName, String childName)
 193  
     {
 194  0
         boolean shouldExist = list != null && list.size() > 0;
 195  0
         Element element = updateElement(counter, parent, parentName, shouldExist);
 196  0
         if (shouldExist) {
 197  0
             Iterator it = list.iterator();
 198  0
             Iterator elIt = element.getChildren(childName, element.getNamespace()).iterator();
 199  0
             if (! elIt.hasNext()) elIt = null;
 200  0
             Counter innerCount = new Counter(counter.getDepth() + 1);
 201  0
             while (it.hasNext()) {
 202  0
                 String value = (String) it.next();
 203  
                 Element el;
 204  0
                 if (elIt != null && elIt.hasNext()) {
 205  0
                     el = (Element) elIt.next();
 206  0
                     if (! elIt.hasNext()) elIt = null;
 207  
                 } else {
 208  0
                     el = factory.element(childName, element.getNamespace());
 209  0
                     insertAtPreferredLocation(element, el, innerCount);
 210  
                 }
 211  0
                 el.setText(value);
 212  0
                 innerCount.increaseCount();
 213  0
             }
 214  0
             if (elIt != null) {
 215  0
                 while (elIt.hasNext()) {
 216  0
                     elIt.next();
 217  0
                     elIt.remove();
 218  
                 }
 219  
             }
 220  
         }
 221  0
         return element;
 222  
     } //-- Element findAndReplaceSimpleLists(Counter, Element, java.util.Collection, String, String)
 223  
 
 224  
     /**
 225  
      * Method findAndReplaceXpp3DOM
 226  
      *
 227  
      * @param counter
 228  
      * @param dom
 229  
      * @param name
 230  
      * @param parent
 231  
      */
 232  
     protected Element findAndReplaceXpp3DOM(Counter counter, Element parent, String name, Xpp3Dom dom)
 233  
     {
 234  0
         boolean shouldExist = dom != null && (dom.getChildCount() > 0 || dom.getValue() != null);
 235  0
         Element element = updateElement(counter, parent, name, shouldExist);
 236  0
         if (shouldExist) {
 237  0
             replaceXpp3DOM(element, dom, new Counter(counter.getDepth() + 1));
 238  
         }
 239  0
         return element;
 240  
     } //-- Element findAndReplaceXpp3DOM(Counter, Element, String, Xpp3Dom)
 241  
 
 242  
     /**
 243  
      * Method insertAtPreferredLocation
 244  
      *
 245  
      * @param parent
 246  
      * @param counter
 247  
      * @param child
 248  
      */
 249  
     protected void insertAtPreferredLocation(Element parent, Element child, Counter counter)
 250  
     {
 251  0
         int contentIndex = 0;
 252  0
         int elementCounter = 0;
 253  0
         Iterator it = parent.getContent().iterator();
 254  0
         Text lastText = null;
 255  0
         int offset = 0;
 256  0
         while (it.hasNext() && elementCounter <= counter.getCurrentIndex()) {
 257  0
             Object next = it.next();
 258  0
             offset = offset + 1;
 259  0
             if (next instanceof Element) {
 260  0
                 elementCounter = elementCounter + 1;
 261  0
                 contentIndex = contentIndex + offset;
 262  0
                 offset = 0;
 263  
             }
 264  0
             if (next instanceof Text && it.hasNext()) {
 265  0
                 lastText = (Text)next;
 266  
             }
 267  0
         }
 268  0
         if (lastText != null && lastText.getTextTrim().length() == 0) {
 269  0
             lastText = (Text)lastText.clone();
 270  
         } else {
 271  0
             String starter = lineSeparator;
 272  0
             for (int i = 0; i < counter.getDepth(); i++) {
 273  0
                 starter = starter + "    "; //TODO make settable?
 274  
             }
 275  0
             lastText = factory.text(starter);
 276  
         }
 277  0
         if (parent.getContentSize() == 0) {
 278  0
             Text finalText = (Text)lastText.clone();
 279  0
             finalText.setText(finalText.getText().substring(0, finalText.getText().length() - "    ".length()));
 280  0
             parent.addContent(contentIndex, finalText);
 281  
         }
 282  0
         parent.addContent(contentIndex, child);
 283  0
         parent.addContent(contentIndex, lastText);
 284  0
     } //-- void insertAtPreferredLocation(Element, Element, Counter)
 285  
 
 286  
     /**
 287  
      * Method iterateContributor
 288  
      *
 289  
      * @param counter
 290  
      * @param childTag
 291  
      * @param parentTag
 292  
      * @param list
 293  
      * @param parent
 294  
      */
 295  
     protected void iterateContributor(Counter counter, Element parent, java.util.Collection list, java.lang.String parentTag, java.lang.String childTag)
 296  
     {
 297  0
         boolean shouldExist = list != null && list.size() > 0;
 298  0
         Element element = updateElement(counter, parent, parentTag, shouldExist);
 299  0
         if (shouldExist) {
 300  0
             Iterator it = list.iterator();
 301  0
             Iterator elIt = element.getChildren(childTag, element.getNamespace()).iterator();
 302  0
             if (!elIt.hasNext()) elIt = null;
 303  0
             Counter innerCount = new Counter(counter.getDepth() + 1);
 304  0
             while (it.hasNext()) {
 305  0
                 Contributor value = (Contributor) it.next();
 306  
                 Element el;
 307  0
                 if (elIt != null && elIt.hasNext()) {
 308  0
                     el = (Element) elIt.next();
 309  0
                     if (! elIt.hasNext()) elIt = null;
 310  
                 } else {
 311  0
                     el = factory.element(childTag, element.getNamespace());
 312  0
                     insertAtPreferredLocation(element, el, innerCount);
 313  
                 }
 314  0
                 updateContributor(value, childTag, innerCount, el);
 315  0
                 innerCount.increaseCount();
 316  0
             }
 317  0
             if (elIt != null) {
 318  0
                 while (elIt.hasNext()) {
 319  0
                     elIt.next();
 320  0
                     elIt.remove();
 321  
                 }
 322  
             }
 323  
         }
 324  0
     } //-- void iterateContributor(Counter, Element, java.util.Collection, java.lang.String, java.lang.String)
 325  
 
 326  
     /**
 327  
      * Method iterateDependency
 328  
      *
 329  
      * @param counter
 330  
      * @param childTag
 331  
      * @param parentTag
 332  
      * @param list
 333  
      * @param parent
 334  
      */
 335  
     protected void iterateDependency(Counter counter, Element parent, java.util.Collection list, java.lang.String parentTag, java.lang.String childTag)
 336  
     {
 337  0
         boolean shouldExist = list != null && list.size() > 0;
 338  0
         Element element = updateElement(counter, parent, parentTag, shouldExist);
 339  0
         if (shouldExist) {
 340  0
             Iterator it = list.iterator();
 341  0
             Iterator elIt = element.getChildren(childTag, element.getNamespace()).iterator();
 342  0
             if (!elIt.hasNext()) elIt = null;
 343  0
             Counter innerCount = new Counter(counter.getDepth() + 1);
 344  0
             while (it.hasNext()) {
 345  0
                 Dependency value = (Dependency) it.next();
 346  
                 Element el;
 347  0
                 if (elIt != null && elIt.hasNext()) {
 348  0
                     el = (Element) elIt.next();
 349  0
                     if (! elIt.hasNext()) elIt = null;
 350  
                 } else {
 351  0
                     el = factory.element(childTag, element.getNamespace());
 352  0
                     insertAtPreferredLocation(element, el, innerCount);
 353  
                 }
 354  0
                 updateDependency(value, childTag, innerCount, el);
 355  0
                 innerCount.increaseCount();
 356  0
             }
 357  0
             if (elIt != null) {
 358  0
                 while (elIt.hasNext()) {
 359  0
                     elIt.next();
 360  0
                     elIt.remove();
 361  
                 }
 362  
             }
 363  
         }
 364  0
     } //-- void iterateDependency(Counter, Element, java.util.Collection, java.lang.String, java.lang.String)
 365  
 
 366  
     /**
 367  
      * Method iterateDeveloper
 368  
      *
 369  
      * @param counter
 370  
      * @param childTag
 371  
      * @param parentTag
 372  
      * @param list
 373  
      * @param parent
 374  
      */
 375  
     protected void iterateDeveloper(Counter counter, Element parent, java.util.Collection list, java.lang.String parentTag, java.lang.String childTag)
 376  
     {
 377  0
         boolean shouldExist = list != null && list.size() > 0;
 378  0
         Element element = updateElement(counter, parent, parentTag, shouldExist);
 379  0
         if (shouldExist) {
 380  0
             Iterator it = list.iterator();
 381  0
             Iterator elIt = element.getChildren(childTag, element.getNamespace()).iterator();
 382  0
             if (!elIt.hasNext()) elIt = null;
 383  0
             Counter innerCount = new Counter(counter.getDepth() + 1);
 384  0
             while (it.hasNext()) {
 385  0
                 Developer value = (Developer) it.next();
 386  
                 Element el;
 387  0
                 if (elIt != null && elIt.hasNext()) {
 388  0
                     el = (Element) elIt.next();
 389  0
                     if (! elIt.hasNext()) elIt = null;
 390  
                 } else {
 391  0
                     el = factory.element(childTag, element.getNamespace());
 392  0
                     insertAtPreferredLocation(element, el, innerCount);
 393  
                 }
 394  0
                 updateDeveloper(value, childTag, innerCount, el);
 395  0
                 innerCount.increaseCount();
 396  0
             }
 397  0
             if (elIt != null) {
 398  0
                 while (elIt.hasNext()) {
 399  0
                     elIt.next();
 400  0
                     elIt.remove();
 401  
                 }
 402  
             }
 403  
         }
 404  0
     } //-- void iterateDeveloper(Counter, Element, java.util.Collection, java.lang.String, java.lang.String)
 405  
 
 406  
     /**
 407  
      * Method iterateExclusion
 408  
      *
 409  
      * @param counter
 410  
      * @param childTag
 411  
      * @param parentTag
 412  
      * @param list
 413  
      * @param parent
 414  
      */
 415  
     protected void iterateExclusion(Counter counter, Element parent, java.util.Collection list, java.lang.String parentTag, java.lang.String childTag)
 416  
     {
 417  0
         boolean shouldExist = list != null && list.size() > 0;
 418  0
         Element element = updateElement(counter, parent, parentTag, shouldExist);
 419  0
         if (shouldExist) {
 420  0
             Iterator it = list.iterator();
 421  0
             Iterator elIt = element.getChildren(childTag, element.getNamespace()).iterator();
 422  0
             if (!elIt.hasNext()) elIt = null;
 423  0
             Counter innerCount = new Counter(counter.getDepth() + 1);
 424  0
             while (it.hasNext()) {
 425  0
                 Exclusion value = (Exclusion) it.next();
 426  
                 Element el;
 427  0
                 if (elIt != null && elIt.hasNext()) {
 428  0
                     el = (Element) elIt.next();
 429  0
                     if (! elIt.hasNext()) elIt = null;
 430  
                 } else {
 431  0
                     el = factory.element(childTag, element.getNamespace());
 432  0
                     insertAtPreferredLocation(element, el, innerCount);
 433  
                 }
 434  0
                 updateExclusion(value, childTag, innerCount, el);
 435  0
                 innerCount.increaseCount();
 436  0
             }
 437  0
             if (elIt != null) {
 438  0
                 while (elIt.hasNext()) {
 439  0
                     elIt.next();
 440  0
                     elIt.remove();
 441  
                 }
 442  
             }
 443  
         }
 444  0
     } //-- void iterateExclusion(Counter, Element, java.util.Collection, java.lang.String, java.lang.String)
 445  
 
 446  
     /**
 447  
      * Method iterateExtension
 448  
      *
 449  
      * @param counter
 450  
      * @param childTag
 451  
      * @param parentTag
 452  
      * @param list
 453  
      * @param parent
 454  
      */
 455  
     protected void iterateExtension(Counter counter, Element parent, java.util.Collection list, java.lang.String parentTag, java.lang.String childTag)
 456  
     {
 457  0
         boolean shouldExist = list != null && list.size() > 0;
 458  0
         Element element = updateElement(counter, parent, parentTag, shouldExist);
 459  0
         if (shouldExist) {
 460  0
             Iterator it = list.iterator();
 461  0
             Iterator elIt = element.getChildren(childTag, element.getNamespace()).iterator();
 462  0
             if (!elIt.hasNext()) elIt = null;
 463  0
             Counter innerCount = new Counter(counter.getDepth() + 1);
 464  0
             while (it.hasNext()) {
 465  0
                 Extension value = (Extension) it.next();
 466  
                 Element el;
 467  0
                 if (elIt != null && elIt.hasNext()) {
 468  0
                     el = (Element) elIt.next();
 469  0
                     if (! elIt.hasNext()) elIt = null;
 470  
                 } else {
 471  0
                     el = factory.element(childTag, element.getNamespace());
 472  0
                     insertAtPreferredLocation(element, el, innerCount);
 473  
                 }
 474  0
                 updateExtension(value, childTag, innerCount, el);
 475  0
                 innerCount.increaseCount();
 476  0
             }
 477  0
             if (elIt != null) {
 478  0
                 while (elIt.hasNext()) {
 479  0
                     elIt.next();
 480  0
                     elIt.remove();
 481  
                 }
 482  
             }
 483  
         }
 484  0
     } //-- void iterateExtension(Counter, Element, java.util.Collection, java.lang.String, java.lang.String)
 485  
 
 486  
     /**
 487  
      * Method iterateLicense
 488  
      *
 489  
      * @param counter
 490  
      * @param childTag
 491  
      * @param parentTag
 492  
      * @param list
 493  
      * @param parent
 494  
      */
 495  
     protected void iterateLicense(Counter counter, Element parent, java.util.Collection list, java.lang.String parentTag, java.lang.String childTag)
 496  
     {
 497  0
         boolean shouldExist = list != null && list.size() > 0;
 498  0
         Element element = updateElement(counter, parent, parentTag, shouldExist);
 499  0
         if (shouldExist) {
 500  0
             Iterator it = list.iterator();
 501  0
             Iterator elIt = element.getChildren(childTag, element.getNamespace()).iterator();
 502  0
             if (!elIt.hasNext()) elIt = null;
 503  0
             Counter innerCount = new Counter(counter.getDepth() + 1);
 504  0
             while (it.hasNext()) {
 505  0
                 License value = (License) it.next();
 506  
                 Element el;
 507  0
                 if (elIt != null && elIt.hasNext()) {
 508  0
                     el = (Element) elIt.next();
 509  0
                     if (! elIt.hasNext()) elIt = null;
 510  
                 } else {
 511  0
                     el = factory.element(childTag, element.getNamespace());
 512  0
                     insertAtPreferredLocation(element, el, innerCount);
 513  
                 }
 514  0
                 updateLicense(value, childTag, innerCount, el);
 515  0
                 innerCount.increaseCount();
 516  0
             }
 517  0
             if (elIt != null) {
 518  0
                 while (elIt.hasNext()) {
 519  0
                     elIt.next();
 520  0
                     elIt.remove();
 521  
                 }
 522  
             }
 523  
         }
 524  0
     } //-- void iterateLicense(Counter, Element, java.util.Collection, java.lang.String, java.lang.String)
 525  
 
 526  
     /**
 527  
      * Method iterateMailingList
 528  
      *
 529  
      * @param counter
 530  
      * @param childTag
 531  
      * @param parentTag
 532  
      * @param list
 533  
      * @param parent
 534  
      */
 535  
     protected void iterateMailingList(Counter counter, Element parent, java.util.Collection list, java.lang.String parentTag, java.lang.String childTag)
 536  
     {
 537  0
         boolean shouldExist = list != null && list.size() > 0;
 538  0
         Element element = updateElement(counter, parent, parentTag, shouldExist);
 539  0
         if (shouldExist) {
 540  0
             Iterator it = list.iterator();
 541  0
             Iterator elIt = element.getChildren(childTag, element.getNamespace()).iterator();
 542  0
             if (!elIt.hasNext()) elIt = null;
 543  0
             Counter innerCount = new Counter(counter.getDepth() + 1);
 544  0
             while (it.hasNext()) {
 545  0
                 MailingList value = (MailingList) it.next();
 546  
                 Element el;
 547  0
                 if (elIt != null && elIt.hasNext()) {
 548  0
                     el = (Element) elIt.next();
 549  0
                     if (! elIt.hasNext()) elIt = null;
 550  
                 } else {
 551  0
                     el = factory.element(childTag, element.getNamespace());
 552  0
                     insertAtPreferredLocation(element, el, innerCount);
 553  
                 }
 554  0
                 updateMailingList(value, childTag, innerCount, el);
 555  0
                 innerCount.increaseCount();
 556  0
             }
 557  0
             if (elIt != null) {
 558  0
                 while (elIt.hasNext()) {
 559  0
                     elIt.next();
 560  0
                     elIt.remove();
 561  
                 }
 562  
             }
 563  
         }
 564  0
     } //-- void iterateMailingList(Counter, Element, java.util.Collection, java.lang.String, java.lang.String)
 565  
 
 566  
     /**
 567  
      * Method iterateNotifier
 568  
      *
 569  
      * @param counter
 570  
      * @param childTag
 571  
      * @param parentTag
 572  
      * @param list
 573  
      * @param parent
 574  
      */
 575  
     protected void iterateNotifier(Counter counter, Element parent, java.util.Collection list, java.lang.String parentTag, java.lang.String childTag)
 576  
     {
 577  0
         boolean shouldExist = list != null && list.size() > 0;
 578  0
         Element element = updateElement(counter, parent, parentTag, shouldExist);
 579  0
         if (shouldExist) {
 580  0
             Iterator it = list.iterator();
 581  0
             Iterator elIt = element.getChildren(childTag, element.getNamespace()).iterator();
 582  0
             if (!elIt.hasNext()) elIt = null;
 583  0
             Counter innerCount = new Counter(counter.getDepth() + 1);
 584  0
             while (it.hasNext()) {
 585  0
                 Notifier value = (Notifier) it.next();
 586  
                 Element el;
 587  0
                 if (elIt != null && elIt.hasNext()) {
 588  0
                     el = (Element) elIt.next();
 589  0
                     if (! elIt.hasNext()) elIt = null;
 590  
                 } else {
 591  0
                     el = factory.element(childTag, element.getNamespace());
 592  0
                     insertAtPreferredLocation(element, el, innerCount);
 593  
                 }
 594  0
                 updateNotifier(value, childTag, innerCount, el);
 595  0
                 innerCount.increaseCount();
 596  0
             }
 597  0
             if (elIt != null) {
 598  0
                 while (elIt.hasNext()) {
 599  0
                     elIt.next();
 600  0
                     elIt.remove();
 601  
                 }
 602  
             }
 603  
         }
 604  0
     } //-- void iterateNotifier(Counter, Element, java.util.Collection, java.lang.String, java.lang.String)
 605  
 
 606  
     /**
 607  
      * Method iteratePlugin
 608  
      *
 609  
      * @param counter
 610  
      * @param childTag
 611  
      * @param parentTag
 612  
      * @param list
 613  
      * @param parent
 614  
      */
 615  
     protected void iteratePlugin(Counter counter, Element parent, java.util.Collection list, java.lang.String parentTag, java.lang.String childTag)
 616  
     {
 617  0
         boolean shouldExist = list != null && list.size() > 0;
 618  0
         Element element = updateElement(counter, parent, parentTag, shouldExist);
 619  0
         if (shouldExist) {
 620  0
             Iterator it = list.iterator();
 621  0
             Iterator elIt = element.getChildren(childTag, element.getNamespace()).iterator();
 622  0
             if (!elIt.hasNext()) elIt = null;
 623  0
             Counter innerCount = new Counter(counter.getDepth() + 1);
 624  0
             while (it.hasNext()) {
 625  0
                 Plugin value = (Plugin) it.next();
 626  
                 Element el;
 627  0
                 if (elIt != null && elIt.hasNext()) {
 628  0
                     el = (Element) elIt.next();
 629  0
                     if (! elIt.hasNext()) elIt = null;
 630  
                 } else {
 631  0
                     el = factory.element(childTag, element.getNamespace());
 632  0
                     insertAtPreferredLocation(element, el, innerCount);
 633  
                 }
 634  0
                 updatePlugin(value, childTag, innerCount, el);
 635  0
                 innerCount.increaseCount();
 636  0
             }
 637  0
             if (elIt != null) {
 638  0
                 while (elIt.hasNext()) {
 639  0
                     elIt.next();
 640  0
                     elIt.remove();
 641  
                 }
 642  
             }
 643  
         }
 644  0
     } //-- void iteratePlugin(Counter, Element, java.util.Collection, java.lang.String, java.lang.String)
 645  
 
 646  
     /**
 647  
      * Method iteratePluginExecution
 648  
      *
 649  
      * @param counter
 650  
      * @param childTag
 651  
      * @param parentTag
 652  
      * @param list
 653  
      * @param parent
 654  
      */
 655  
     protected void iteratePluginExecution(Counter counter, Element parent, java.util.Collection list, java.lang.String parentTag, java.lang.String childTag)
 656  
     {
 657  0
         boolean shouldExist = list != null && list.size() > 0;
 658  0
         Element element = updateElement(counter, parent, parentTag, shouldExist);
 659  0
         if (shouldExist) {
 660  0
             Iterator it = list.iterator();
 661  0
             Iterator elIt = element.getChildren(childTag, element.getNamespace()).iterator();
 662  0
             if (!elIt.hasNext()) elIt = null;
 663  0
             Counter innerCount = new Counter(counter.getDepth() + 1);
 664  0
             while (it.hasNext()) {
 665  0
                 PluginExecution value = (PluginExecution) it.next();
 666  
                 Element el;
 667  0
                 if (elIt != null && elIt.hasNext()) {
 668  0
                     el = (Element) elIt.next();
 669  0
                     if (! elIt.hasNext()) elIt = null;
 670  
                 } else {
 671  0
                     el = factory.element(childTag, element.getNamespace());
 672  0
                     insertAtPreferredLocation(element, el, innerCount);
 673  
                 }
 674  0
                 updatePluginExecution(value, childTag, innerCount, el);
 675  0
                 innerCount.increaseCount();
 676  0
             }
 677  0
             if (elIt != null) {
 678  0
                 while (elIt.hasNext()) {
 679  0
                     elIt.next();
 680  0
                     elIt.remove();
 681  
                 }
 682  
             }
 683  
         }
 684  0
     } //-- void iteratePluginExecution(Counter, Element, java.util.Collection, java.lang.String, java.lang.String)
 685  
 
 686  
     /**
 687  
      * Method iterateProfile
 688  
      *
 689  
      * @param counter
 690  
      * @param childTag
 691  
      * @param parentTag
 692  
      * @param list
 693  
      * @param parent
 694  
      */
 695  
     protected void iterateProfile(Counter counter, Element parent, java.util.Collection list, java.lang.String parentTag, java.lang.String childTag)
 696  
     {
 697  0
         boolean shouldExist = list != null && list.size() > 0;
 698  0
         Element element = updateElement(counter, parent, parentTag, shouldExist);
 699  0
         if (shouldExist) {
 700  0
             Iterator it = list.iterator();
 701  0
             Iterator elIt = element.getChildren(childTag, element.getNamespace()).iterator();
 702  0
             if (!elIt.hasNext()) elIt = null;
 703  0
             Counter innerCount = new Counter(counter.getDepth() + 1);
 704  0
             while (it.hasNext()) {
 705  0
                 Profile value = (Profile) it.next();
 706  
                 Element el;
 707  0
                 if (elIt != null && elIt.hasNext()) {
 708  0
                     el = (Element) elIt.next();
 709  0
                     if (! elIt.hasNext()) elIt = null;
 710  
                 } else {
 711  0
                     el = factory.element(childTag, element.getNamespace());
 712  0
                     insertAtPreferredLocation(element, el, innerCount);
 713  
                 }
 714  0
                 updateProfile(value, childTag, innerCount, el);
 715  0
                 innerCount.increaseCount();
 716  0
             }
 717  0
             if (elIt != null) {
 718  0
                 while (elIt.hasNext()) {
 719  0
                     elIt.next();
 720  0
                     elIt.remove();
 721  
                 }
 722  
             }
 723  
         }
 724  0
     } //-- void iterateProfile(Counter, Element, java.util.Collection, java.lang.String, java.lang.String)
 725  
 
 726  
     /**
 727  
      * Method iterateReportPlugin
 728  
      *
 729  
      * @param counter
 730  
      * @param childTag
 731  
      * @param parentTag
 732  
      * @param list
 733  
      * @param parent
 734  
      */
 735  
     protected void iterateReportPlugin(Counter counter, Element parent, java.util.Collection list, java.lang.String parentTag, java.lang.String childTag)
 736  
     {
 737  0
         boolean shouldExist = list != null && list.size() > 0;
 738  0
         Element element = updateElement(counter, parent, parentTag, shouldExist);
 739  0
         if (shouldExist) {
 740  0
             Iterator it = list.iterator();
 741  0
             Iterator elIt = element.getChildren(childTag, element.getNamespace()).iterator();
 742  0
             if (!elIt.hasNext()) elIt = null;
 743  0
             Counter innerCount = new Counter(counter.getDepth() + 1);
 744  0
             while (it.hasNext()) {
 745  0
                 ReportPlugin value = (ReportPlugin) it.next();
 746  
                 Element el;
 747  0
                 if (elIt != null && elIt.hasNext()) {
 748  0
                     el = (Element) elIt.next();
 749  0
                     if (! elIt.hasNext()) elIt = null;
 750  
                 } else {
 751  0
                     el = factory.element(childTag, element.getNamespace());
 752  0
                     insertAtPreferredLocation(element, el, innerCount);
 753  
                 }
 754  0
                 updateReportPlugin(value, childTag, innerCount, el);
 755  0
                 innerCount.increaseCount();
 756  0
             }
 757  0
             if (elIt != null) {
 758  0
                 while (elIt.hasNext()) {
 759  0
                     elIt.next();
 760  0
                     elIt.remove();
 761  
                 }
 762  
             }
 763  
         }
 764  0
     } //-- void iterateReportPlugin(Counter, Element, java.util.Collection, java.lang.String, java.lang.String)
 765  
 
 766  
     /**
 767  
      * Method iterateReportSet
 768  
      *
 769  
      * @param counter
 770  
      * @param childTag
 771  
      * @param parentTag
 772  
      * @param list
 773  
      * @param parent
 774  
      */
 775  
     protected void iterateReportSet(Counter counter, Element parent, java.util.Collection list, java.lang.String parentTag, java.lang.String childTag)
 776  
     {
 777  0
         boolean shouldExist = list != null && list.size() > 0;
 778  0
         Element element = updateElement(counter, parent, parentTag, shouldExist);
 779  0
         if (shouldExist) {
 780  0
             Iterator it = list.iterator();
 781  0
             Iterator elIt = element.getChildren(childTag, element.getNamespace()).iterator();
 782  0
             if (!elIt.hasNext()) elIt = null;
 783  0
             Counter innerCount = new Counter(counter.getDepth() + 1);
 784  0
             while (it.hasNext()) {
 785  0
                 ReportSet value = (ReportSet) it.next();
 786  
                 Element el;
 787  0
                 if (elIt != null && elIt.hasNext()) {
 788  0
                     el = (Element) elIt.next();
 789  0
                     if (! elIt.hasNext()) elIt = null;
 790  
                 } else {
 791  0
                     el = factory.element(childTag, element.getNamespace());
 792  0
                     insertAtPreferredLocation(element, el, innerCount);
 793  
                 }
 794  0
                 updateReportSet(value, childTag, innerCount, el);
 795  0
                 innerCount.increaseCount();
 796  0
             }
 797  0
             if (elIt != null) {
 798  0
                 while (elIt.hasNext()) {
 799  0
                     elIt.next();
 800  0
                     elIt.remove();
 801  
                 }
 802  
             }
 803  
         }
 804  0
     } //-- void iterateReportSet(Counter, Element, java.util.Collection, java.lang.String, java.lang.String)
 805  
 
 806  
     /**
 807  
      * Method iterateRepository
 808  
      *
 809  
      * @param counter
 810  
      * @param childTag
 811  
      * @param parentTag
 812  
      * @param list
 813  
      * @param parent
 814  
      */
 815  
     protected void iterateRepository(Counter counter, Element parent, java.util.Collection list, java.lang.String parentTag, java.lang.String childTag)
 816  
     {
 817  0
         boolean shouldExist = list != null && list.size() > 0;
 818  0
         Element element = updateElement(counter, parent, parentTag, shouldExist);
 819  0
         if (shouldExist) {
 820  0
             Iterator it = list.iterator();
 821  0
             Iterator elIt = element.getChildren(childTag, element.getNamespace()).iterator();
 822  0
             if (!elIt.hasNext()) elIt = null;
 823  0
             Counter innerCount = new Counter(counter.getDepth() + 1);
 824  0
             while (it.hasNext()) {
 825  0
                 Repository value = (Repository) it.next();
 826  
                 Element el;
 827  0
                 if (elIt != null && elIt.hasNext()) {
 828  0
                     el = (Element) elIt.next();
 829  0
                     if (! elIt.hasNext()) elIt = null;
 830  
                 } else {
 831  0
                     el = factory.element(childTag, element.getNamespace());
 832  0
                     insertAtPreferredLocation(element, el, innerCount);
 833  
                 }
 834  0
                 updateRepository(value, childTag, innerCount, el);
 835  0
                 innerCount.increaseCount();
 836  0
             }
 837  0
             if (elIt != null) {
 838  0
                 while (elIt.hasNext()) {
 839  0
                     elIt.next();
 840  0
                     elIt.remove();
 841  
                 }
 842  
             }
 843  
         }
 844  0
     } //-- void iterateRepository(Counter, Element, java.util.Collection, java.lang.String, java.lang.String)
 845  
 
 846  
     /**
 847  
      * Method iterateResource
 848  
      *
 849  
      * @param counter
 850  
      * @param childTag
 851  
      * @param parentTag
 852  
      * @param list
 853  
      * @param parent
 854  
      */
 855  
     protected void iterateResource(Counter counter, Element parent, java.util.Collection list, java.lang.String parentTag, java.lang.String childTag)
 856  
     {
 857  0
         boolean shouldExist = list != null && list.size() > 0;
 858  0
         Element element = updateElement(counter, parent, parentTag, shouldExist);
 859  0
         if (shouldExist) {
 860  0
             Iterator it = list.iterator();
 861  0
             Iterator elIt = element.getChildren(childTag, element.getNamespace()).iterator();
 862  0
             if (!elIt.hasNext()) elIt = null;
 863  0
             Counter innerCount = new Counter(counter.getDepth() + 1);
 864  0
             while (it.hasNext()) {
 865  0
                 Resource value = (Resource) it.next();
 866  
                 Element el;
 867  0
                 if (elIt != null && elIt.hasNext()) {
 868  0
                     el = (Element) elIt.next();
 869  0
                     if (! elIt.hasNext()) elIt = null;
 870  
                 } else {
 871  0
                     el = factory.element(childTag, element.getNamespace());
 872  0
                     insertAtPreferredLocation(element, el, innerCount);
 873  
                 }
 874  0
                 updateResource(value, childTag, innerCount, el);
 875  0
                 innerCount.increaseCount();
 876  0
             }
 877  0
             if (elIt != null) {
 878  0
                 while (elIt.hasNext()) {
 879  0
                     elIt.next();
 880  0
                     elIt.remove();
 881  
                 }
 882  
             }
 883  
         }
 884  0
     } //-- void iterateResource(Counter, Element, java.util.Collection, java.lang.String, java.lang.String)
 885  
 
 886  
     /**
 887  
      * Method replaceXpp3DOM
 888  
      *
 889  
      * @param parent
 890  
      * @param counter
 891  
      * @param parentDom
 892  
      */
 893  
     protected void replaceXpp3DOM(Element parent, Xpp3Dom parentDom, Counter counter)
 894  
     {
 895  0
         if (parentDom.getChildCount() > 0) {
 896  0
             Xpp3Dom[] childs = parentDom.getChildren();
 897  0
             Collection domChilds = new ArrayList();
 898  0
             for (int i = 0; i < childs.length; i++) {
 899  0
                 domChilds.add(childs[i]);
 900  
             }
 901  
            // int domIndex = 0;
 902  0
             ListIterator it = parent.getChildren().listIterator();
 903  0
             while (it.hasNext()) {
 904  0
                 Element elem = (Element) it.next();
 905  0
                 Iterator it2 = domChilds.iterator();
 906  0
                 Xpp3Dom corrDom = null;
 907  0
                 while (it2.hasNext()) {
 908  0
                     Xpp3Dom dm = (Xpp3Dom)it2.next();
 909  0
                     if (dm.getName().equals(elem.getName())) {
 910  0
                         corrDom = dm;
 911  0
                         break;
 912  
                     }
 913  0
                 }
 914  0
                 if (corrDom != null) {
 915  0
                     domChilds.remove(corrDom);
 916  0
                     replaceXpp3DOM(elem, corrDom, new Counter(counter.getDepth() + 1));
 917  0
                     counter.increaseCount();
 918  
                 } else {
 919  0
                     parent.removeContent(elem);
 920  
                 }
 921  0
             }
 922  0
             Iterator it2 = domChilds.iterator();
 923  0
             while (it2.hasNext()) {
 924  0
                 Xpp3Dom dm = (Xpp3Dom) it2.next();
 925  0
                 Element elem = factory.element(dm.getName(), parent.getNamespace());
 926  0
                 insertAtPreferredLocation(parent, elem, counter);
 927  0
                 counter.increaseCount();
 928  0
                 replaceXpp3DOM(elem, dm, new Counter(counter.getDepth() + 1));
 929  0
             }
 930  0
         } else if (parentDom.getValue() != null) {
 931  0
             parent.setText(parentDom.getValue());
 932  
         }
 933  0
     } //-- void replaceXpp3DOM(Element, Xpp3Dom, Counter)
 934  
 
 935  
     /**
 936  
      * Method updateActivation
 937  
      *
 938  
      * @param value
 939  
      * @param element
 940  
      * @param counter
 941  
      * @param xmlTag
 942  
      */
 943  
     /*
 944  
     protected void updateActivation(Activation value, String xmlTag, Counter counter, Element element)
 945  
     {
 946  
         boolean shouldExist = value != null;
 947  
         Element root = updateElement(counter, element, xmlTag, shouldExist);
 948  
         if (shouldExist) {
 949  
             Counter innerCount = new Counter(counter.getDepth() + 1);
 950  
             findAndReplaceSimpleElement(innerCount, root,  "activeByDefault", value.isActiveByDefault() == false ? null : String.valueOf( value.isActiveByDefault() ), "false");
 951  
             findAndReplaceSimpleElement(innerCount, root,  "jdk", value.getJdk(), null);
 952  
             updateActivationOS( value.getOs(), "os", innerCount, root);
 953  
             updateActivationProperty( value.getProperty(), "property", innerCount, root);
 954  
             updateActivationFile( value.getFile(), "file", innerCount, root);
 955  
             updateActivationCustom( value.getCustom(), "custom", innerCount, root);
 956  
         }
 957  
     } //-- void updateActivation(Activation, String, Counter, Element)
 958  
      */
 959  
 
 960  
     /**
 961  
      * Method updateActivationCustom
 962  
      *
 963  
      * @param value
 964  
      * @param element
 965  
      * @param counter
 966  
      * @param xmlTag
 967  
      */
 968  
     /*
 969  
     protected void updateActivationCustom(ActivationCustom value, String xmlTag, Counter counter, Element element)
 970  
     {
 971  
         boolean shouldExist = value != null;
 972  
         Element root = updateElement(counter, element, xmlTag, shouldExist);
 973  
         if (shouldExist) {
 974  
             Counter innerCount = new Counter(counter.getDepth() + 1);
 975  
             findAndReplaceXpp3DOM(innerCount, root, "configuration", (Xpp3Dom)value.getConfiguration());
 976  
             findAndReplaceSimpleElement(innerCount, root,  "type", value.getType(), null);
 977  
         }
 978  
     } //-- void updateActivationCustom(ActivationCustom, String, Counter, Element)
 979  
       */
 980  
 
 981  
     /**
 982  
      * Method updateActivationFile
 983  
      *
 984  
      * @param value
 985  
      * @param element
 986  
      * @param counter
 987  
      * @param xmlTag
 988  
      */
 989  
     protected void updateActivationFile(ActivationFile value, String xmlTag, Counter counter, Element element)
 990  
     {
 991  0
         boolean shouldExist = value != null;
 992  0
         Element root = updateElement(counter, element, xmlTag, shouldExist);
 993  0
         if (shouldExist) {
 994  0
             Counter innerCount = new Counter(counter.getDepth() + 1);
 995  0
             findAndReplaceSimpleElement(innerCount, root,  "missing", value.getMissing(), null);
 996  0
             findAndReplaceSimpleElement(innerCount, root,  "exists", value.getExists(), null);
 997  
         }
 998  0
     } //-- void updateActivationFile(ActivationFile, String, Counter, Element)
 999  
 
 1000  
     /**
 1001  
      * Method updateActivationOS
 1002  
      *
 1003  
      * @param value
 1004  
      * @param element
 1005  
      * @param counter
 1006  
      * @param xmlTag
 1007  
      */
 1008  
     protected void updateActivationOS(ActivationOS value, String xmlTag, Counter counter, Element element)
 1009  
     {
 1010  0
         boolean shouldExist = value != null;
 1011  0
         Element root = updateElement(counter, element, xmlTag, shouldExist);
 1012  0
         if (shouldExist) {
 1013  0
             Counter innerCount = new Counter(counter.getDepth() + 1);
 1014  0
             findAndReplaceSimpleElement(innerCount, root,  "name", value.getName(), null);
 1015  0
             findAndReplaceSimpleElement(innerCount, root,  "family", value.getFamily(), null);
 1016  0
             findAndReplaceSimpleElement(innerCount, root,  "arch", value.getArch(), null);
 1017  0
             findAndReplaceSimpleElement(innerCount, root,  "version", value.getVersion(), null);
 1018  
         }
 1019  0
     } //-- void updateActivationOS(ActivationOS, String, Counter, Element)
 1020  
 
 1021  
     /**
 1022  
      * Method updateActivationProperty
 1023  
      *
 1024  
      * @param value
 1025  
      * @param element
 1026  
      * @param counter
 1027  
      * @param xmlTag
 1028  
      */
 1029  
     protected void updateActivationProperty(ActivationProperty value, String xmlTag, Counter counter, Element element)
 1030  
     {
 1031  0
         boolean shouldExist = value != null;
 1032  0
         Element root = updateElement(counter, element, xmlTag, shouldExist);
 1033  0
         if (shouldExist) {
 1034  0
             Counter innerCount = new Counter(counter.getDepth() + 1);
 1035  0
             findAndReplaceSimpleElement(innerCount, root,  "name", value.getName(), null);
 1036  0
             findAndReplaceSimpleElement(innerCount, root,  "value", value.getValue(), null);
 1037  
         }
 1038  0
     } //-- void updateActivationProperty(ActivationProperty, String, Counter, Element)
 1039  
 
 1040  
     /**
 1041  
      * Method updateBuild
 1042  
      *
 1043  
      * @param value
 1044  
      * @param element
 1045  
      * @param counter
 1046  
      * @param xmlTag
 1047  
      */
 1048  
     protected void updateBuild(Build value, String xmlTag, Counter counter, Element element)
 1049  
     {
 1050  0
         boolean shouldExist = value != null;
 1051  0
         Element root = updateElement(counter, element, xmlTag, shouldExist);
 1052  0
         if (shouldExist) {
 1053  0
             Counter innerCount = new Counter(counter.getDepth() + 1);
 1054  0
             findAndReplaceSimpleElement(innerCount, root,  "sourceDirectory", value.getSourceDirectory(), null);
 1055  0
             findAndReplaceSimpleElement(innerCount, root,  "scriptSourceDirectory", value.getScriptSourceDirectory(), null);
 1056  0
             findAndReplaceSimpleElement(innerCount, root,  "testSourceDirectory", value.getTestSourceDirectory(), null);
 1057  0
             findAndReplaceSimpleElement(innerCount, root,  "outputDirectory", value.getOutputDirectory(), null);
 1058  0
             findAndReplaceSimpleElement(innerCount, root,  "testOutputDirectory", value.getTestOutputDirectory(), null);
 1059  0
             iterateExtension(innerCount, root, value.getExtensions(),"extensions","extension");
 1060  0
             findAndReplaceSimpleElement(innerCount, root,  "defaultGoal", value.getDefaultGoal(), null);
 1061  0
             iterateResource(innerCount, root, value.getResources(),"resources","resource");
 1062  0
             iterateResource(innerCount, root, value.getTestResources(),"testResources","testResource");
 1063  0
             findAndReplaceSimpleElement(innerCount, root,  "directory", value.getDirectory(), null);
 1064  0
             findAndReplaceSimpleElement(innerCount, root,  "finalName", value.getFinalName(), null);
 1065  0
             findAndReplaceSimpleLists(innerCount, root, value.getFilters(), "filters", "filter");
 1066  0
             updatePluginManagement( value.getPluginManagement(), "pluginManagement", innerCount, root);
 1067  0
             iteratePlugin(innerCount, root, value.getPlugins(),"plugins","plugin");
 1068  
         }
 1069  0
     } //-- void updateBuild(Build, String, Counter, Element)
 1070  
 
 1071  
     /**
 1072  
      * Method updateBuildBase
 1073  
      *
 1074  
      * @param value
 1075  
      * @param element
 1076  
      * @param counter
 1077  
      * @param xmlTag
 1078  
      */
 1079  
     protected void updateBuildBase(BuildBase value, String xmlTag, Counter counter, Element element)
 1080  
     {
 1081  0
         boolean shouldExist = value != null;
 1082  0
         Element root = updateElement(counter, element, xmlTag, shouldExist);
 1083  0
         if (shouldExist) {
 1084  0
             Counter innerCount = new Counter(counter.getDepth() + 1);
 1085  0
             findAndReplaceSimpleElement(innerCount, root,  "defaultGoal", value.getDefaultGoal(), null);
 1086  0
             iterateResource(innerCount, root, value.getResources(),"resources","resource");
 1087  0
             iterateResource(innerCount, root, value.getTestResources(),"testResources","testResource");
 1088  0
             findAndReplaceSimpleElement(innerCount, root,  "directory", value.getDirectory(), null);
 1089  0
             findAndReplaceSimpleElement(innerCount, root,  "finalName", value.getFinalName(), null);
 1090  0
             findAndReplaceSimpleLists(innerCount, root, value.getFilters(), "filters", "filter");
 1091  0
             updatePluginManagement( value.getPluginManagement(), "pluginManagement", innerCount, root);
 1092  0
             iteratePlugin(innerCount, root, value.getPlugins(),"plugins","plugin");
 1093  
         }
 1094  0
     } //-- void updateBuildBase(BuildBase, String, Counter, Element)
 1095  
 
 1096  
     /**
 1097  
      * Method updateCiManagement
 1098  
      *
 1099  
      * @param value
 1100  
      * @param element
 1101  
      * @param counter
 1102  
      * @param xmlTag
 1103  
      */
 1104  
     protected void updateCiManagement(CiManagement value, String xmlTag, Counter counter, Element element)
 1105  
     {
 1106  0
         boolean shouldExist = value != null;
 1107  0
         Element root = updateElement(counter, element, xmlTag, shouldExist);
 1108  0
         if (shouldExist) {
 1109  0
             Counter innerCount = new Counter(counter.getDepth() + 1);
 1110  0
             findAndReplaceSimpleElement(innerCount, root,  "system", value.getSystem(), null);
 1111  0
             findAndReplaceSimpleElement(innerCount, root,  "url", value.getUrl(), null);
 1112  0
             iterateNotifier(innerCount, root, value.getNotifiers(),"notifiers","notifier");
 1113  
         }
 1114  0
     } //-- void updateCiManagement(CiManagement, String, Counter, Element)
 1115  
 
 1116  
     /**
 1117  
      * Method updateConfigurationContainer
 1118  
      *
 1119  
      * @param value
 1120  
      * @param element
 1121  
      * @param counter
 1122  
      * @param xmlTag
 1123  
      */
 1124  
     protected void updateConfigurationContainer(ConfigurationContainer value, String xmlTag, Counter counter, Element element)
 1125  
     {
 1126  0
         boolean shouldExist = value != null;
 1127  0
         Element root = updateElement(counter, element, xmlTag, shouldExist);
 1128  0
         if (shouldExist) {
 1129  0
             Counter innerCount = new Counter(counter.getDepth() + 1);
 1130  0
             findAndReplaceSimpleElement(innerCount, root,  "inherited", value.getInherited(), null);
 1131  0
             findAndReplaceXpp3DOM(innerCount, root, "configuration", (Xpp3Dom)value.getConfiguration());
 1132  
         }
 1133  0
     } //-- void updateConfigurationContainer(ConfigurationContainer, String, Counter, Element)
 1134  
 
 1135  
     /**
 1136  
      * Method updateContributor
 1137  
      *
 1138  
      * @param value
 1139  
      * @param element
 1140  
      * @param counter
 1141  
      * @param xmlTag
 1142  
      */
 1143  
     protected void updateContributor(Contributor value, String xmlTag, Counter counter, Element element)
 1144  
     {
 1145  0
         Element root = element;
 1146  0
         Counter innerCount = new Counter(counter.getDepth() + 1);
 1147  0
         findAndReplaceSimpleElement(innerCount, root,  "name", value.getName(), null);
 1148  0
         findAndReplaceSimpleElement(innerCount, root,  "email", value.getEmail(), null);
 1149  0
         findAndReplaceSimpleElement(innerCount, root,  "url", value.getUrl(), null);
 1150  0
         findAndReplaceSimpleElement(innerCount, root,  "organization", value.getOrganization(), null);
 1151  0
         findAndReplaceSimpleElement(innerCount, root,  "organizationUrl", value.getOrganizationUrl(), null);
 1152  0
         findAndReplaceSimpleLists(innerCount, root, value.getRoles(), "roles", "role");
 1153  0
         findAndReplaceSimpleElement(innerCount, root,  "timezone", value.getTimezone(), null);
 1154  0
         findAndReplaceProperties(innerCount, root,  "properties", value.getProperties());
 1155  0
     } //-- void updateContributor(Contributor, String, Counter, Element)
 1156  
 
 1157  
     /**
 1158  
      * Method updateDependency
 1159  
      *
 1160  
      * @param value
 1161  
      * @param element
 1162  
      * @param counter
 1163  
      * @param xmlTag
 1164  
      */
 1165  
     protected void updateDependency(Dependency value, String xmlTag, Counter counter, Element element)
 1166  
     {
 1167  0
         Element root = element;
 1168  0
         Counter innerCount = new Counter(counter.getDepth() + 1);
 1169  0
         findAndReplaceSimpleElement(innerCount, root,  "groupId", value.getGroupId(), null);
 1170  0
         findAndReplaceSimpleElement(innerCount, root,  "artifactId", value.getArtifactId(), null);
 1171  0
         findAndReplaceSimpleElement(innerCount, root,  "version", value.getVersion(), null);
 1172  0
         findAndReplaceSimpleElement(innerCount, root,  "type", value.getType(), "jar");
 1173  0
         findAndReplaceSimpleElement(innerCount, root,  "classifier", value.getClassifier(), null);
 1174  0
         findAndReplaceSimpleElement(innerCount, root,  "scope", value.getScope(), null);
 1175  0
         findAndReplaceSimpleElement(innerCount, root,  "systemPath", value.getSystemPath(), null);
 1176  0
         iterateExclusion(innerCount, root, value.getExclusions(),"exclusions","exclusion");
 1177  0
         findAndReplaceSimpleElement(innerCount, root,  "optional", value.isOptional() == false ? null : String.valueOf( value.isOptional() ), "false");
 1178  0
     } //-- void updateDependency(Dependency, String, Counter, Element)
 1179  
 
 1180  
     /**
 1181  
      * Method updateDependencyManagement
 1182  
      *
 1183  
      * @param value
 1184  
      * @param element
 1185  
      * @param counter
 1186  
      * @param xmlTag
 1187  
      */
 1188  
     protected void updateDependencyManagement(DependencyManagement value, String xmlTag, Counter counter, Element element)
 1189  
     {
 1190  0
         boolean shouldExist = value != null;
 1191  0
         Element root = updateElement(counter, element, xmlTag, shouldExist);
 1192  0
         if (shouldExist) {
 1193  0
             Counter innerCount = new Counter(counter.getDepth() + 1);
 1194  0
             iterateDependency(innerCount, root, value.getDependencies(),"dependencies","dependency");
 1195  
         }
 1196  0
     } //-- void updateDependencyManagement(DependencyManagement, String, Counter, Element)
 1197  
 
 1198  
     /**
 1199  
      * Method updateDeploymentRepository
 1200  
      *
 1201  
      * @param value
 1202  
      * @param element
 1203  
      * @param counter
 1204  
      * @param xmlTag
 1205  
      */
 1206  
     protected void updateDeploymentRepository(DeploymentRepository value, String xmlTag, Counter counter, Element element)
 1207  
     {
 1208  0
         boolean shouldExist = value != null;
 1209  0
         Element root = updateElement(counter, element, xmlTag, shouldExist);
 1210  0
         if (shouldExist) {
 1211  0
             Counter innerCount = new Counter(counter.getDepth() + 1);
 1212  0
             findAndReplaceSimpleElement(innerCount, root,  "uniqueVersion", value.isUniqueVersion() == true ? null : String.valueOf( value.isUniqueVersion() ), "true");
 1213  0
             findAndReplaceSimpleElement(innerCount, root,  "id", value.getId(), null);
 1214  0
             findAndReplaceSimpleElement(innerCount, root,  "name", value.getName(), null);
 1215  0
             findAndReplaceSimpleElement(innerCount, root,  "url", value.getUrl(), null);
 1216  0
             findAndReplaceSimpleElement(innerCount, root,  "layout", value.getLayout(), "default");
 1217  
         }
 1218  0
     } //-- void updateDeploymentRepository(DeploymentRepository, String, Counter, Element)
 1219  
 
 1220  
     /**
 1221  
      * Method updateDeveloper
 1222  
      *
 1223  
      * @param value
 1224  
      * @param element
 1225  
      * @param counter
 1226  
      * @param xmlTag
 1227  
      */
 1228  
     protected void updateDeveloper(Developer value, String xmlTag, Counter counter, Element element)
 1229  
     {
 1230  0
         Element root = element;
 1231  0
         Counter innerCount = new Counter(counter.getDepth() + 1);
 1232  0
         findAndReplaceSimpleElement(innerCount, root,  "id", value.getId(), null);
 1233  0
         findAndReplaceSimpleElement(innerCount, root,  "name", value.getName(), null);
 1234  0
         findAndReplaceSimpleElement(innerCount, root,  "email", value.getEmail(), null);
 1235  0
         findAndReplaceSimpleElement(innerCount, root,  "url", value.getUrl(), null);
 1236  0
         findAndReplaceSimpleElement(innerCount, root,  "organization", value.getOrganization(), null);
 1237  0
         findAndReplaceSimpleElement(innerCount, root,  "organizationUrl", value.getOrganizationUrl(), null);
 1238  0
         findAndReplaceSimpleLists(innerCount, root, value.getRoles(), "roles", "role");
 1239  0
         findAndReplaceSimpleElement(innerCount, root,  "timezone", value.getTimezone(), null);
 1240  0
         findAndReplaceProperties(innerCount, root,  "properties", value.getProperties());
 1241  0
     } //-- void updateDeveloper(Developer, String, Counter, Element)
 1242  
 
 1243  
     /**
 1244  
      * Method updateDistributionManagement
 1245  
      *
 1246  
      * @param value
 1247  
      * @param element
 1248  
      * @param counter
 1249  
      * @param xmlTag
 1250  
      */
 1251  
     protected void updateDistributionManagement(DistributionManagement value, String xmlTag, Counter counter, Element element)
 1252  
     {
 1253  0
         boolean shouldExist = value != null;
 1254  0
         Element root = updateElement(counter, element, xmlTag, shouldExist);
 1255  0
         if (shouldExist) {
 1256  0
             Counter innerCount = new Counter(counter.getDepth() + 1);
 1257  0
             updateDeploymentRepository( value.getRepository(), "repository", innerCount, root);
 1258  0
             updateDeploymentRepository( value.getSnapshotRepository(), "snapshotRepository", innerCount, root);
 1259  0
             updateSite( value.getSite(), "site", innerCount, root);
 1260  0
             findAndReplaceSimpleElement(innerCount, root,  "downloadUrl", value.getDownloadUrl(), null);
 1261  0
             updateRelocation( value.getRelocation(), "relocation", innerCount, root);
 1262  0
             findAndReplaceSimpleElement(innerCount, root,  "status", value.getStatus(), null);
 1263  
         }
 1264  0
     } //-- void updateDistributionManagement(DistributionManagement, String, Counter, Element)
 1265  
 
 1266  
     /**
 1267  
      * Method updateElement
 1268  
      *
 1269  
      * @param counter
 1270  
      * @param shouldExist
 1271  
      * @param name
 1272  
      * @param parent
 1273  
      */
 1274  
     protected Element updateElement(Counter counter, Element parent, String name, boolean shouldExist)
 1275  
     {
 1276  0
         Element element =  parent.getChild(name, parent.getNamespace());
 1277  0
         if (element != null && shouldExist) {
 1278  0
             counter.increaseCount();
 1279  
         }
 1280  0
         if (element == null && shouldExist) {
 1281  0
             element = factory.element(name, parent.getNamespace());
 1282  0
             insertAtPreferredLocation(parent, element, counter);
 1283  0
             counter.increaseCount();
 1284  
         }
 1285  0
         if (!shouldExist && element != null) {
 1286  0
             int index = parent.indexOf(element);
 1287  0
             if (index > 0) {
 1288  0
                 Content previous = parent.getContent(index - 1);
 1289  0
                 if (previous instanceof Text) {
 1290  0
                     Text txt = (Text)previous;
 1291  0
                     if (txt.getTextTrim().length() == 0) {
 1292  0
                         parent.removeContent(txt);
 1293  
                     }
 1294  
                 }
 1295  
             }
 1296  0
             parent.removeContent(element);
 1297  
         }
 1298  0
         return element;
 1299  
     } //-- Element updateElement(Counter, Element, String, boolean)
 1300  
 
 1301  
     /**
 1302  
      * Method updateExclusion
 1303  
      *
 1304  
      * @param value
 1305  
      * @param element
 1306  
      * @param counter
 1307  
      * @param xmlTag
 1308  
      */
 1309  
     protected void updateExclusion(Exclusion value, String xmlTag, Counter counter, Element element)
 1310  
     {
 1311  0
         Element root = element;
 1312  0
         Counter innerCount = new Counter(counter.getDepth() + 1);
 1313  0
         findAndReplaceSimpleElement(innerCount, root,  "artifactId", value.getArtifactId(), null);
 1314  0
         findAndReplaceSimpleElement(innerCount, root,  "groupId", value.getGroupId(), null);
 1315  0
     } //-- void updateExclusion(Exclusion, String, Counter, Element)
 1316  
 
 1317  
     /**
 1318  
      * Method updateExtension
 1319  
      *
 1320  
      * @param value
 1321  
      * @param element
 1322  
      * @param counter
 1323  
      * @param xmlTag
 1324  
      */
 1325  
     protected void updateExtension(Extension value, String xmlTag, Counter counter, Element element)
 1326  
     {
 1327  0
         Element root = element;
 1328  0
         Counter innerCount = new Counter(counter.getDepth() + 1);
 1329  0
         findAndReplaceSimpleElement(innerCount, root,  "groupId", value.getGroupId(), null);
 1330  0
         findAndReplaceSimpleElement(innerCount, root,  "artifactId", value.getArtifactId(), null);
 1331  0
         findAndReplaceSimpleElement(innerCount, root,  "version", value.getVersion(), null);
 1332  0
     } //-- void updateExtension(Extension, String, Counter, Element)
 1333  
 
 1334  
     /**
 1335  
      * Method updateFileSet
 1336  
      *
 1337  
      * @param value
 1338  
      * @param element
 1339  
      * @param counter
 1340  
      * @param xmlTag
 1341  
      */
 1342  
     protected void updateFileSet(FileSet value, String xmlTag, Counter counter, Element element)
 1343  
     {
 1344  0
         boolean shouldExist = value != null;
 1345  0
         Element root = updateElement(counter, element, xmlTag, shouldExist);
 1346  0
         if (shouldExist) {
 1347  0
             Counter innerCount = new Counter(counter.getDepth() + 1);
 1348  0
             findAndReplaceSimpleElement(innerCount, root,  "directory", value.getDirectory(), null);
 1349  0
             findAndReplaceSimpleLists(innerCount, root, value.getIncludes(), "includes", "include");
 1350  0
             findAndReplaceSimpleLists(innerCount, root, value.getExcludes(), "excludes", "exclude");
 1351  
         }
 1352  0
     } //-- void updateFileSet(FileSet, String, Counter, Element)
 1353  
 
 1354  
     /**
 1355  
      * Method updateIssueManagement
 1356  
      *
 1357  
      * @param value
 1358  
      * @param element
 1359  
      * @param counter
 1360  
      * @param xmlTag
 1361  
      */
 1362  
     protected void updateIssueManagement(IssueManagement value, String xmlTag, Counter counter, Element element)
 1363  
     {
 1364  0
         boolean shouldExist = value != null;
 1365  0
         Element root = updateElement(counter, element, xmlTag, shouldExist);
 1366  0
         if (shouldExist) {
 1367  0
             Counter innerCount = new Counter(counter.getDepth() + 1);
 1368  0
             findAndReplaceSimpleElement(innerCount, root,  "system", value.getSystem(), null);
 1369  0
             findAndReplaceSimpleElement(innerCount, root,  "url", value.getUrl(), null);
 1370  
         }
 1371  0
     } //-- void updateIssueManagement(IssueManagement, String, Counter, Element)
 1372  
 
 1373  
     /**
 1374  
      * Method updateLicense
 1375  
      *
 1376  
      * @param value
 1377  
      * @param element
 1378  
      * @param counter
 1379  
      * @param xmlTag
 1380  
      */
 1381  
     protected void updateLicense(License value, String xmlTag, Counter counter, Element element)
 1382  
     {
 1383  0
         Element root = element;
 1384  0
         Counter innerCount = new Counter(counter.getDepth() + 1);
 1385  0
         findAndReplaceSimpleElement(innerCount, root,  "name", value.getName(), null);
 1386  0
         findAndReplaceSimpleElement(innerCount, root,  "url", value.getUrl(), null);
 1387  0
         findAndReplaceSimpleElement(innerCount, root,  "distribution", value.getDistribution(), null);
 1388  0
         findAndReplaceSimpleElement(innerCount, root,  "comments", value.getComments(), null);
 1389  0
     } //-- void updateLicense(License, String, Counter, Element)
 1390  
 
 1391  
     /**
 1392  
      * Method updateMailingList
 1393  
      *
 1394  
      * @param value
 1395  
      * @param element
 1396  
      * @param counter
 1397  
      * @param xmlTag
 1398  
      */
 1399  
     protected void updateMailingList(MailingList value, String xmlTag, Counter counter, Element element)
 1400  
     {
 1401  0
         Element root = element;
 1402  0
         Counter innerCount = new Counter(counter.getDepth() + 1);
 1403  0
         findAndReplaceSimpleElement(innerCount, root,  "name", value.getName(), null);
 1404  0
         findAndReplaceSimpleElement(innerCount, root,  "subscribe", value.getSubscribe(), null);
 1405  0
         findAndReplaceSimpleElement(innerCount, root,  "unsubscribe", value.getUnsubscribe(), null);
 1406  0
         findAndReplaceSimpleElement(innerCount, root,  "post", value.getPost(), null);
 1407  0
         findAndReplaceSimpleElement(innerCount, root,  "archive", value.getArchive(), null);
 1408  0
         findAndReplaceSimpleLists(innerCount, root, value.getOtherArchives(), "otherArchives", "otherArchive");
 1409  0
     } //-- void updateMailingList(MailingList, String, Counter, Element)
 1410  
 
 1411  
     /**
 1412  
      * Method updateModel
 1413  
      *
 1414  
      * @param value
 1415  
      * @param element
 1416  
      * @param counter
 1417  
      * @param xmlTag
 1418  
      */
 1419  
     protected void updateModel(Model value, String xmlTag, Counter counter, Element element)
 1420  
     {
 1421  0
         Element root = element;
 1422  0
         Counter innerCount = new Counter(counter.getDepth() + 1);
 1423  0
         updateParent( value.getParent(), "parent", innerCount, root);
 1424  0
         findAndReplaceSimpleElement(innerCount, root,  "modelVersion", value.getModelVersion(), null);
 1425  0
         findAndReplaceSimpleElement(innerCount, root,  "groupId", value.getGroupId(), null);
 1426  0
         findAndReplaceSimpleElement(innerCount, root,  "artifactId", value.getArtifactId(), null);
 1427  0
         findAndReplaceSimpleElement(innerCount, root,  "packaging", value.getPackaging(), "jar");
 1428  0
         findAndReplaceSimpleElement(innerCount, root,  "name", value.getName(), null);
 1429  0
         findAndReplaceSimpleElement(innerCount, root,  "version", value.getVersion(), null);
 1430  0
         findAndReplaceSimpleElement(innerCount, root,  "description", value.getDescription(), null);
 1431  0
         findAndReplaceSimpleElement(innerCount, root,  "url", value.getUrl(), null);
 1432  0
         updatePrerequisites( value.getPrerequisites(), "prerequisites", innerCount, root);
 1433  0
         updateIssueManagement( value.getIssueManagement(), "issueManagement", innerCount, root);
 1434  0
         updateCiManagement( value.getCiManagement(), "ciManagement", innerCount, root);
 1435  0
         findAndReplaceSimpleElement(innerCount, root,  "inceptionYear", value.getInceptionYear(), null);
 1436  0
         iterateMailingList(innerCount, root, value.getMailingLists(),"mailingLists","mailingList");
 1437  0
         iterateDeveloper(innerCount, root, value.getDevelopers(),"developers","developer");
 1438  0
         iterateContributor(innerCount, root, value.getContributors(),"contributors","contributor");
 1439  0
         iterateLicense(innerCount, root, value.getLicenses(),"licenses","license");
 1440  0
         updateScm( value.getScm(), "scm", innerCount, root);
 1441  0
         updateOrganization( value.getOrganization(), "organization", innerCount, root);
 1442  0
         updateBuild( value.getBuild(), "build", innerCount, root);
 1443  0
         iterateProfile(innerCount, root, value.getProfiles(),"profiles","profile");
 1444  0
         findAndReplaceSimpleLists(innerCount, root, value.getModules(), "modules", "module");
 1445  0
         iterateRepository(innerCount, root, value.getRepositories(),"repositories","repository");
 1446  0
         iterateRepository(innerCount, root, value.getPluginRepositories(),"pluginRepositories","pluginRepository");
 1447  0
         iterateDependency(innerCount, root, value.getDependencies(),"dependencies","dependency");
 1448  0
         findAndReplaceXpp3DOM(innerCount, root, "reports", (Xpp3Dom)value.getReports());
 1449  0
         updateReporting( value.getReporting(), "reporting", innerCount, root);
 1450  0
         updateDependencyManagement( value.getDependencyManagement(), "dependencyManagement", innerCount, root);
 1451  0
         updateDistributionManagement( value.getDistributionManagement(), "distributionManagement", innerCount, root);
 1452  0
         findAndReplaceProperties(innerCount, root,  "properties", value.getProperties());
 1453  0
     } //-- void updateModel(Model, String, Counter, Element)
 1454  
 
 1455  
     /**
 1456  
      * Method updateModelBase
 1457  
      *
 1458  
      * @param value
 1459  
      * @param element
 1460  
      * @param counter
 1461  
      * @param xmlTag
 1462  
      */
 1463  
     protected void updateModelBase(ModelBase value, String xmlTag, Counter counter, Element element)
 1464  
     {
 1465  0
         boolean shouldExist = value != null;
 1466  0
         Element root = updateElement(counter, element, xmlTag, shouldExist);
 1467  0
         if (shouldExist) {
 1468  0
             Counter innerCount = new Counter(counter.getDepth() + 1);
 1469  0
             findAndReplaceSimpleLists(innerCount, root, value.getModules(), "modules", "module");
 1470  0
             iterateRepository(innerCount, root, value.getRepositories(),"repositories","repository");
 1471  0
             iterateRepository(innerCount, root, value.getPluginRepositories(),"pluginRepositories","pluginRepository");
 1472  0
             iterateDependency(innerCount, root, value.getDependencies(),"dependencies","dependency");
 1473  0
             findAndReplaceXpp3DOM(innerCount, root, "reports", (Xpp3Dom)value.getReports());
 1474  0
             updateReporting( value.getReporting(), "reporting", innerCount, root);
 1475  0
             updateDependencyManagement( value.getDependencyManagement(), "dependencyManagement", innerCount, root);
 1476  0
             updateDistributionManagement( value.getDistributionManagement(), "distributionManagement", innerCount, root);
 1477  0
             findAndReplaceProperties(innerCount, root,  "properties", value.getProperties());
 1478  
         }
 1479  0
     } //-- void updateModelBase(ModelBase, String, Counter, Element)
 1480  
 
 1481  
     /**
 1482  
      * Method updateNotifier
 1483  
      *
 1484  
      * @param value
 1485  
      * @param element
 1486  
      * @param counter
 1487  
      * @param xmlTag
 1488  
      */
 1489  
     protected void updateNotifier(Notifier value, String xmlTag, Counter counter, Element element)
 1490  
     {
 1491  0
         Element root = element;
 1492  0
         Counter innerCount = new Counter(counter.getDepth() + 1);
 1493  0
         findAndReplaceSimpleElement(innerCount, root,  "type", value.getType(), "mail");
 1494  0
         findAndReplaceSimpleElement(innerCount, root,  "sendOnError", value.isSendOnError() == true ? null : String.valueOf( value.isSendOnError() ), "true");
 1495  0
         findAndReplaceSimpleElement(innerCount, root,  "sendOnFailure", value.isSendOnFailure() == true ? null : String.valueOf( value.isSendOnFailure() ), "true");
 1496  0
         findAndReplaceSimpleElement(innerCount, root,  "sendOnSuccess", value.isSendOnSuccess() == true ? null : String.valueOf( value.isSendOnSuccess() ), "true");
 1497  0
         findAndReplaceSimpleElement(innerCount, root,  "sendOnWarning", value.isSendOnWarning() == true ? null : String.valueOf( value.isSendOnWarning() ), "true");
 1498  0
         findAndReplaceSimpleElement(innerCount, root,  "address", value.getAddress(), null);
 1499  0
         findAndReplaceProperties(innerCount, root,  "configuration", value.getConfiguration());
 1500  0
     } //-- void updateNotifier(Notifier, String, Counter, Element)
 1501  
 
 1502  
     /**
 1503  
      * Method updateOrganization
 1504  
      *
 1505  
      * @param value
 1506  
      * @param element
 1507  
      * @param counter
 1508  
      * @param xmlTag
 1509  
      */
 1510  
     protected void updateOrganization(Organization value, String xmlTag, Counter counter, Element element)
 1511  
     {
 1512  0
         boolean shouldExist = value != null;
 1513  0
         Element root = updateElement(counter, element, xmlTag, shouldExist);
 1514  0
         if (shouldExist) {
 1515  0
             Counter innerCount = new Counter(counter.getDepth() + 1);
 1516  0
             findAndReplaceSimpleElement(innerCount, root,  "name", value.getName(), null);
 1517  0
             findAndReplaceSimpleElement(innerCount, root,  "url", value.getUrl(), null);
 1518  
         }
 1519  0
     } //-- void updateOrganization(Organization, String, Counter, Element)
 1520  
 
 1521  
     /**
 1522  
      * Method updateParent
 1523  
      *
 1524  
      * @param value
 1525  
      * @param element
 1526  
      * @param counter
 1527  
      * @param xmlTag
 1528  
      */
 1529  
     protected void updateParent(Parent value, String xmlTag, Counter counter, Element element)
 1530  
     {
 1531  0
         boolean shouldExist = value != null;
 1532  0
         Element root = updateElement(counter, element, xmlTag, shouldExist);
 1533  0
         if (shouldExist) {
 1534  0
             Counter innerCount = new Counter(counter.getDepth() + 1);
 1535  0
             findAndReplaceSimpleElement(innerCount, root,  "artifactId", value.getArtifactId(), null);
 1536  0
             findAndReplaceSimpleElement(innerCount, root,  "groupId", value.getGroupId(), null);
 1537  0
             findAndReplaceSimpleElement(innerCount, root,  "version", value.getVersion(), null);
 1538  0
             findAndReplaceSimpleElement(innerCount, root,  "relativePath", value.getRelativePath(), "../pom.xml");
 1539  
         }
 1540  0
     } //-- void updateParent(Parent, String, Counter, Element)
 1541  
 
 1542  
     /**
 1543  
      * Method updatePatternSet
 1544  
      *
 1545  
      * @param value
 1546  
      * @param element
 1547  
      * @param counter
 1548  
      * @param xmlTag
 1549  
      */
 1550  
     protected void updatePatternSet(PatternSet value, String xmlTag, Counter counter, Element element)
 1551  
     {
 1552  0
         boolean shouldExist = value != null;
 1553  0
         Element root = updateElement(counter, element, xmlTag, shouldExist);
 1554  0
         if (shouldExist) {
 1555  0
             Counter innerCount = new Counter(counter.getDepth() + 1);
 1556  0
             findAndReplaceSimpleLists(innerCount, root, value.getIncludes(), "includes", "include");
 1557  0
             findAndReplaceSimpleLists(innerCount, root, value.getExcludes(), "excludes", "exclude");
 1558  
         }
 1559  0
     } //-- void updatePatternSet(PatternSet, String, Counter, Element)
 1560  
 
 1561  
     /**
 1562  
      * Method updatePlugin
 1563  
      *
 1564  
      * @param value
 1565  
      * @param element
 1566  
      * @param counter
 1567  
      * @param xmlTag
 1568  
      */
 1569  
     protected void updatePlugin(Plugin value, String xmlTag, Counter counter, Element element)
 1570  
     {
 1571  0
         Element root = element;
 1572  0
         Counter innerCount = new Counter(counter.getDepth() + 1);
 1573  0
         findAndReplaceSimpleElement(innerCount, root,  "groupId", value.getGroupId(), "org.apache.maven.plugins");
 1574  0
         findAndReplaceSimpleElement(innerCount, root,  "artifactId", value.getArtifactId(), null);
 1575  0
         findAndReplaceSimpleElement(innerCount, root,  "version", value.getVersion(), null);
 1576  0
         findAndReplaceSimpleElement(innerCount, root,  "extensions", value.isExtensions() == false ? null : String.valueOf( value.isExtensions() ), "false");
 1577  0
         iteratePluginExecution(innerCount, root, value.getExecutions(),"executions","execution");
 1578  0
         iterateDependency(innerCount, root, value.getDependencies(),"dependencies","dependency");
 1579  0
         findAndReplaceXpp3DOM(innerCount, root, "goals", (Xpp3Dom)value.getGoals());
 1580  0
         findAndReplaceSimpleElement(innerCount, root,  "inherited", value.getInherited(), null);
 1581  0
         findAndReplaceXpp3DOM(innerCount, root, "configuration", (Xpp3Dom)value.getConfiguration());
 1582  0
     } //-- void updatePlugin(Plugin, String, Counter, Element)
 1583  
 
 1584  
     /**
 1585  
      * Method updatePluginConfiguration
 1586  
      *
 1587  
      * @param value
 1588  
      * @param element
 1589  
      * @param counter
 1590  
      * @param xmlTag
 1591  
      */
 1592  
     protected void updatePluginConfiguration(PluginConfiguration value, String xmlTag, Counter counter, Element element)
 1593  
     {
 1594  0
         boolean shouldExist = value != null;
 1595  0
         Element root = updateElement(counter, element, xmlTag, shouldExist);
 1596  0
         if (shouldExist) {
 1597  0
             Counter innerCount = new Counter(counter.getDepth() + 1);
 1598  0
             updatePluginManagement( value.getPluginManagement(), "pluginManagement", innerCount, root);
 1599  0
             iteratePlugin(innerCount, root, value.getPlugins(),"plugins","plugin");
 1600  
         }
 1601  0
     } //-- void updatePluginConfiguration(PluginConfiguration, String, Counter, Element)
 1602  
 
 1603  
     /**
 1604  
      * Method updatePluginContainer
 1605  
      *
 1606  
      * @param value
 1607  
      * @param element
 1608  
      * @param counter
 1609  
      * @param xmlTag
 1610  
      */
 1611  
     protected void updatePluginContainer(PluginContainer value, String xmlTag, Counter counter, Element element)
 1612  
     {
 1613  0
         boolean shouldExist = value != null;
 1614  0
         Element root = updateElement(counter, element, xmlTag, shouldExist);
 1615  0
         if (shouldExist) {
 1616  0
             Counter innerCount = new Counter(counter.getDepth() + 1);
 1617  0
             iteratePlugin(innerCount, root, value.getPlugins(),"plugins","plugin");
 1618  
         }
 1619  0
     } //-- void updatePluginContainer(PluginContainer, String, Counter, Element)
 1620  
 
 1621  
     /**
 1622  
      * Method updatePluginExecution
 1623  
      *
 1624  
      * @param value
 1625  
      * @param element
 1626  
      * @param counter
 1627  
      * @param xmlTag
 1628  
      */
 1629  
     protected void updatePluginExecution(PluginExecution value, String xmlTag, Counter counter, Element element)
 1630  
     {
 1631  0
         Element root = element;
 1632  0
         Counter innerCount = new Counter(counter.getDepth() + 1);
 1633  0
         findAndReplaceSimpleElement(innerCount, root,  "id", value.getId(), "default");
 1634  0
         findAndReplaceSimpleElement(innerCount, root,  "phase", value.getPhase(), null);
 1635  0
         findAndReplaceSimpleLists(innerCount, root, value.getGoals(), "goals", "goal");
 1636  0
         findAndReplaceSimpleElement(innerCount, root,  "inherited", value.getInherited(), null);
 1637  0
         findAndReplaceXpp3DOM(innerCount, root, "configuration", (Xpp3Dom)value.getConfiguration());
 1638  0
     } //-- void updatePluginExecution(PluginExecution, String, Counter, Element)
 1639  
 
 1640  
     /**
 1641  
      * Method updatePluginManagement
 1642  
      *
 1643  
      * @param value
 1644  
      * @param element
 1645  
      * @param counter
 1646  
      * @param xmlTag
 1647  
      */
 1648  
     protected void updatePluginManagement(PluginManagement value, String xmlTag, Counter counter, Element element)
 1649  
     {
 1650  0
         boolean shouldExist = value != null;
 1651  0
         Element root = updateElement(counter, element, xmlTag, shouldExist);
 1652  0
         if (shouldExist) {
 1653  0
             Counter innerCount = new Counter(counter.getDepth() + 1);
 1654  0
             iteratePlugin(innerCount, root, value.getPlugins(),"plugins","plugin");
 1655  
         }
 1656  0
     } //-- void updatePluginManagement(PluginManagement, String, Counter, Element)
 1657  
 
 1658  
     /**
 1659  
      * Method updatePrerequisites
 1660  
      *
 1661  
      * @param value
 1662  
      * @param element
 1663  
      * @param counter
 1664  
      * @param xmlTag
 1665  
      */
 1666  
     protected void updatePrerequisites(Prerequisites value, String xmlTag, Counter counter, Element element)
 1667  
     {
 1668  0
         boolean shouldExist = value != null;
 1669  0
         Element root = updateElement(counter, element, xmlTag, shouldExist);
 1670  0
         if (shouldExist) {
 1671  0
             Counter innerCount = new Counter(counter.getDepth() + 1);
 1672  0
             findAndReplaceSimpleElement(innerCount, root,  "maven", value.getMaven(), "2.0");
 1673  
         }
 1674  0
     } //-- void updatePrerequisites(Prerequisites, String, Counter, Element)
 1675  
 
 1676  
     /**
 1677  
      * Method updateProfile
 1678  
      *
 1679  
      * @param value
 1680  
      * @param element
 1681  
      * @param counter
 1682  
      * @param xmlTag
 1683  
      */
 1684  
     protected void updateProfile(Profile value, String xmlTag, Counter counter, Element element)
 1685  
     {
 1686  0
         Element root = element;
 1687  0
         Counter innerCount = new Counter(counter.getDepth() + 1);
 1688  0
         findAndReplaceSimpleElement(innerCount, root,  "id", value.getId(), "default");
 1689  
         //updateActivation( value.getActivation(), "activation", innerCount, root);
 1690  0
         updateBuildBase( value.getBuild(), "build", innerCount, root);
 1691  0
         findAndReplaceSimpleLists(innerCount, root, value.getModules(), "modules", "module");
 1692  0
         iterateRepository(innerCount, root, value.getRepositories(),"repositories","repository");
 1693  0
         iterateRepository(innerCount, root, value.getPluginRepositories(),"pluginRepositories","pluginRepository");
 1694  0
         iterateDependency(innerCount, root, value.getDependencies(),"dependencies","dependency");
 1695  0
         findAndReplaceXpp3DOM(innerCount, root, "reports", (Xpp3Dom)value.getReports());
 1696  0
         updateReporting( value.getReporting(), "reporting", innerCount, root);
 1697  0
         updateDependencyManagement( value.getDependencyManagement(), "dependencyManagement", innerCount, root);
 1698  0
         updateDistributionManagement( value.getDistributionManagement(), "distributionManagement", innerCount, root);
 1699  0
         findAndReplaceProperties(innerCount, root,  "properties", value.getProperties());
 1700  0
     } //-- void updateProfile(Profile, String, Counter, Element)
 1701  
 
 1702  
     /**
 1703  
      * Method updateRelocation
 1704  
      *
 1705  
      * @param value
 1706  
      * @param element
 1707  
      * @param counter
 1708  
      * @param xmlTag
 1709  
      */
 1710  
     protected void updateRelocation(Relocation value, String xmlTag, Counter counter, Element element)
 1711  
     {
 1712  0
         boolean shouldExist = value != null;
 1713  0
         Element root = updateElement(counter, element, xmlTag, shouldExist);
 1714  0
         if (shouldExist) {
 1715  0
             Counter innerCount = new Counter(counter.getDepth() + 1);
 1716  0
             findAndReplaceSimpleElement(innerCount, root,  "groupId", value.getGroupId(), null);
 1717  0
             findAndReplaceSimpleElement(innerCount, root,  "artifactId", value.getArtifactId(), null);
 1718  0
             findAndReplaceSimpleElement(innerCount, root,  "version", value.getVersion(), null);
 1719  0
             findAndReplaceSimpleElement(innerCount, root,  "message", value.getMessage(), null);
 1720  
         }
 1721  0
     } //-- void updateRelocation(Relocation, String, Counter, Element)
 1722  
 
 1723  
     /**
 1724  
      * Method updateReportPlugin
 1725  
      *
 1726  
      * @param value
 1727  
      * @param element
 1728  
      * @param counter
 1729  
      * @param xmlTag
 1730  
      */
 1731  
     protected void updateReportPlugin(ReportPlugin value, String xmlTag, Counter counter, Element element)
 1732  
     {
 1733  0
         Element root = element;
 1734  0
         Counter innerCount = new Counter(counter.getDepth() + 1);
 1735  0
         findAndReplaceSimpleElement(innerCount, root,  "groupId", value.getGroupId(), "org.apache.maven.plugins");
 1736  0
         findAndReplaceSimpleElement(innerCount, root,  "artifactId", value.getArtifactId(), null);
 1737  0
         findAndReplaceSimpleElement(innerCount, root,  "version", value.getVersion(), null);
 1738  0
         findAndReplaceSimpleElement(innerCount, root,  "inherited", value.getInherited(), null);
 1739  0
         findAndReplaceXpp3DOM(innerCount, root, "configuration", (Xpp3Dom)value.getConfiguration());
 1740  0
         iterateReportSet(innerCount, root, value.getReportSets(),"reportSets","reportSet");
 1741  0
     } //-- void updateReportPlugin(ReportPlugin, String, Counter, Element)
 1742  
 
 1743  
     /**
 1744  
      * Method updateReportSet
 1745  
      *
 1746  
      * @param value
 1747  
      * @param element
 1748  
      * @param counter
 1749  
      * @param xmlTag
 1750  
      */
 1751  
     protected void updateReportSet(ReportSet value, String xmlTag, Counter counter, Element element)
 1752  
     {
 1753  0
         Element root = element;
 1754  0
         Counter innerCount = new Counter(counter.getDepth() + 1);
 1755  0
         findAndReplaceSimpleElement(innerCount, root,  "id", value.getId(), "default");
 1756  0
         findAndReplaceXpp3DOM(innerCount, root, "configuration", (Xpp3Dom)value.getConfiguration());
 1757  0
         findAndReplaceSimpleElement(innerCount, root,  "inherited", value.getInherited(), null);
 1758  0
         findAndReplaceSimpleLists(innerCount, root, value.getReports(), "reports", "report");
 1759  0
     } //-- void updateReportSet(ReportSet, String, Counter, Element)
 1760  
 
 1761  
     /**
 1762  
      * Method updateReporting
 1763  
      *
 1764  
      * @param value
 1765  
      * @param element
 1766  
      * @param counter
 1767  
      * @param xmlTag
 1768  
      */
 1769  
     protected void updateReporting(Reporting value, String xmlTag, Counter counter, Element element)
 1770  
     {
 1771  0
         boolean shouldExist = value != null;
 1772  0
         Element root = updateElement(counter, element, xmlTag, shouldExist);
 1773  0
         if (shouldExist) {
 1774  0
             Counter innerCount = new Counter(counter.getDepth() + 1);
 1775  0
             findAndReplaceSimpleElement(innerCount, root,  "excludeDefaults", value.isExcludeDefaults() == false ? null : String.valueOf( value.isExcludeDefaults() ), "false");
 1776  0
             findAndReplaceSimpleElement(innerCount, root,  "outputDirectory", value.getOutputDirectory(), null);
 1777  0
             iterateReportPlugin(innerCount, root, value.getPlugins(),"plugins","plugin");
 1778  
         }
 1779  0
     } //-- void updateReporting(Reporting, String, Counter, Element)
 1780  
 
 1781  
     /**
 1782  
      * Method updateRepository
 1783  
      *
 1784  
      * @param value
 1785  
      * @param element
 1786  
      * @param counter
 1787  
      * @param xmlTag
 1788  
      */
 1789  
     protected void updateRepository(Repository value, String xmlTag, Counter counter, Element element)
 1790  
     {
 1791  0
         Element root = element;
 1792  0
         Counter innerCount = new Counter(counter.getDepth() + 1);
 1793  0
         updateRepositoryPolicy( value.getReleases(), "releases", innerCount, root);
 1794  0
         updateRepositoryPolicy( value.getSnapshots(), "snapshots", innerCount, root);
 1795  0
         findAndReplaceSimpleElement(innerCount, root,  "id", value.getId(), null);
 1796  0
         findAndReplaceSimpleElement(innerCount, root,  "name", value.getName(), null);
 1797  0
         findAndReplaceSimpleElement(innerCount, root,  "url", value.getUrl(), null);
 1798  0
         findAndReplaceSimpleElement(innerCount, root,  "layout", value.getLayout(), "default");
 1799  0
     } //-- void updateRepository(Repository, String, Counter, Element)
 1800  
 
 1801  
     /**
 1802  
      * Method updateRepositoryBase
 1803  
      *
 1804  
      * @param value
 1805  
      * @param element
 1806  
      * @param counter
 1807  
      * @param xmlTag
 1808  
      */
 1809  
     protected void updateRepositoryBase(RepositoryBase value, String xmlTag, Counter counter, Element element)
 1810  
     {
 1811  0
         boolean shouldExist = value != null;
 1812  0
         Element root = updateElement(counter, element, xmlTag, shouldExist);
 1813  0
         if (shouldExist) {
 1814  0
             Counter innerCount = new Counter(counter.getDepth() + 1);
 1815  0
             findAndReplaceSimpleElement(innerCount, root,  "id", value.getId(), null);
 1816  0
             findAndReplaceSimpleElement(innerCount, root,  "name", value.getName(), null);
 1817  0
             findAndReplaceSimpleElement(innerCount, root,  "url", value.getUrl(), null);
 1818  0
             findAndReplaceSimpleElement(innerCount, root,  "layout", value.getLayout(), "default");
 1819  
         }
 1820  0
     } //-- void updateRepositoryBase(RepositoryBase, String, Counter, Element)
 1821  
 
 1822  
     /**
 1823  
      * Method updateRepositoryPolicy
 1824  
      *
 1825  
      * @param value
 1826  
      * @param element
 1827  
      * @param counter
 1828  
      * @param xmlTag
 1829  
      */
 1830  
     protected void updateRepositoryPolicy(RepositoryPolicy value, String xmlTag, Counter counter, Element element)
 1831  
     {
 1832  0
         boolean shouldExist = value != null;
 1833  0
         Element root = updateElement(counter, element, xmlTag, shouldExist);
 1834  0
         if (shouldExist) {
 1835  0
             Counter innerCount = new Counter(counter.getDepth() + 1);
 1836  0
             findAndReplaceSimpleElement(innerCount, root,  "enabled", value.isEnabled() == true ? null : String.valueOf( value.isEnabled() ), "true");
 1837  0
             findAndReplaceSimpleElement(innerCount, root,  "updatePolicy", value.getUpdatePolicy(), null);
 1838  0
             findAndReplaceSimpleElement(innerCount, root,  "checksumPolicy", value.getChecksumPolicy(), null);
 1839  
         }
 1840  0
     } //-- void updateRepositoryPolicy(RepositoryPolicy, String, Counter, Element)
 1841  
 
 1842  
     /**
 1843  
      * Method updateResource
 1844  
      *
 1845  
      * @param value
 1846  
      * @param element
 1847  
      * @param counter
 1848  
      * @param xmlTag
 1849  
      */
 1850  
     protected void updateResource(Resource value, String xmlTag, Counter counter, Element element)
 1851  
     {
 1852  0
         Element root = element;
 1853  0
         Counter innerCount = new Counter(counter.getDepth() + 1);
 1854  0
         findAndReplaceSimpleElement(innerCount, root,  "targetPath", value.getTargetPath(), null);
 1855  0
         findAndReplaceSimpleElement(innerCount, root,  "filtering", value.isFiltering() == false ? null : String.valueOf( value.isFiltering() ), "false");
 1856  0
         findAndReplaceSimpleElement(innerCount, root,  "directory", value.getDirectory(), null);
 1857  0
         findAndReplaceSimpleLists(innerCount, root, value.getIncludes(), "includes", "include");
 1858  0
         findAndReplaceSimpleLists(innerCount, root, value.getExcludes(), "excludes", "exclude");
 1859  0
     } //-- void updateResource(Resource, String, Counter, Element)
 1860  
 
 1861  
     /**
 1862  
      * Method updateScm
 1863  
      *
 1864  
      * @param value
 1865  
      * @param element
 1866  
      * @param counter
 1867  
      * @param xmlTag
 1868  
      */
 1869  
     protected void updateScm(Scm value, String xmlTag, Counter counter, Element element)
 1870  
     {
 1871  0
         boolean shouldExist = value != null;
 1872  0
         Element root = updateElement(counter, element, xmlTag, shouldExist);
 1873  0
         if (shouldExist) {
 1874  0
             Counter innerCount = new Counter(counter.getDepth() + 1);
 1875  0
             findAndReplaceSimpleElement(innerCount, root,  "connection", value.getConnection(), null);
 1876  0
             findAndReplaceSimpleElement(innerCount, root,  "developerConnection", value.getDeveloperConnection(), null);
 1877  0
             findAndReplaceSimpleElement(innerCount, root,  "tag", value.getTag(), "HEAD");
 1878  0
             findAndReplaceSimpleElement(innerCount, root,  "url", value.getUrl(), null);
 1879  
         }
 1880  0
     } //-- void updateScm(Scm, String, Counter, Element)
 1881  
 
 1882  
     /**
 1883  
      * Method updateSite
 1884  
      *
 1885  
      * @param value
 1886  
      * @param element
 1887  
      * @param counter
 1888  
      * @param xmlTag
 1889  
      */
 1890  
     protected void updateSite(Site value, String xmlTag, Counter counter, Element element)
 1891  
     {
 1892  0
         boolean shouldExist = value != null;
 1893  0
         Element root = updateElement(counter, element, xmlTag, shouldExist);
 1894  0
         if (shouldExist) {
 1895  0
             Counter innerCount = new Counter(counter.getDepth() + 1);
 1896  0
             findAndReplaceSimpleElement(innerCount, root,  "id", value.getId(), null);
 1897  0
             findAndReplaceSimpleElement(innerCount, root,  "name", value.getName(), null);
 1898  0
             findAndReplaceSimpleElement(innerCount, root,  "url", value.getUrl(), null);
 1899  
         }
 1900  0
     } //-- void updateSite(Site, String, Counter, Element)
 1901  
 
 1902  
     /**
 1903  
      * Method write
 1904  
      * @deprecated
 1905  
      *
 1906  
      * @param project
 1907  
      * @param stream
 1908  
      * @param document
 1909  
      */
 1910  
     public void write(Model project, Document document, OutputStream stream)
 1911  
         throws java.io.IOException
 1912  
     {
 1913  0
         updateModel(project, "project", new Counter(0), document.getRootElement());
 1914  0
         XMLOutputter outputter = new XMLOutputter();
 1915  0
         outputter.setFormat(Format.getPrettyFormat()
 1916  
         .setIndent("    ")
 1917  
         .setLineSeparator(System.getProperty("line.separator")));
 1918  0
         outputter.output(document, stream);
 1919  0
     } //-- void write(Model, Document, OutputStream)
 1920  
 
 1921  
     /**
 1922  
      * Method write
 1923  
      *
 1924  
      * @param project
 1925  
      * @param writer
 1926  
      * @param document
 1927  
      */
 1928  
     public void write(Model project, Document document, OutputStreamWriter writer)
 1929  
         throws java.io.IOException
 1930  
     {
 1931  0
         Format format = Format.getRawFormat()
 1932  
         .setEncoding(writer.getEncoding())
 1933  
         .setLineSeparator(System.getProperty("line.separator"));
 1934  0
         write(project, document, writer, format);
 1935  0
     } //-- void write(Model, Document, OutputStreamWriter)
 1936  
 
 1937  
     /**
 1938  
      * Method write
 1939  
      *
 1940  
      * @param project
 1941  
      * @param jdomFormat
 1942  
      * @param writer
 1943  
      * @param document
 1944  
      */
 1945  
     public void write(Model project, Document document, Writer writer, Format jdomFormat)
 1946  
         throws java.io.IOException
 1947  
     {
 1948  0
         updateModel(project, "project", new Counter(0), document.getRootElement());
 1949  0
         XMLOutputter outputter = new XMLOutputter();
 1950  0
         outputter.setFormat(jdomFormat);
 1951  0
         outputter.output(document, writer);
 1952  0
     } //-- void write(Model, Document, Writer, Format)
 1953  
 
 1954  
 
 1955  
       //-----------------/
 1956  
      //- Inner Classes -/
 1957  
     //-----------------/
 1958  
 
 1959  
     /**
 1960  
      * Class Counter.
 1961  
      *
 1962  
      * @version $Revision$ $Date$
 1963  
      */
 1964  
     public class Counter {
 1965  
 
 1966  
 
 1967  
           //--------------------------/
 1968  
          //- Class/Member Variables -/
 1969  
         //--------------------------/
 1970  
 
 1971  
         /**
 1972  
          * Field currentIndex
 1973  
          */
 1974  0
         private int currentIndex = 0;
 1975  
 
 1976  
         /**
 1977  
          * Field level
 1978  
          */
 1979  
         private int level;
 1980  
 
 1981  
 
 1982  
           //----------------/
 1983  
          //- Constructors -/
 1984  
         //----------------/
 1985  
 
 1986  0
         public Counter(int depthLevel) {
 1987  0
             level = depthLevel;
 1988  0
         } //-- org.apache.maven.model.io.jdom.Counter(int)
 1989  
 
 1990  
 
 1991  
           //-----------/
 1992  
          //- Methods -/
 1993  
         //-----------/
 1994  
 
 1995  
         /**
 1996  
          * Method getCurrentIndex
 1997  
          */
 1998  
         public int getCurrentIndex()
 1999  
         {
 2000  0
             return currentIndex;
 2001  
         } //-- int getCurrentIndex()
 2002  
 
 2003  
         /**
 2004  
          * Method getDepth
 2005  
          */
 2006  
         public int getDepth()
 2007  
         {
 2008  0
             return level;
 2009  
         } //-- int getDepth()
 2010  
 
 2011  
         /**
 2012  
          * Method increaseCount
 2013  
          */
 2014  
         public void increaseCount()
 2015  
         {
 2016  0
             currentIndex = currentIndex + 1;
 2017  0
         } //-- void increaseCount()
 2018  
 
 2019  
     }
 2020  
 
 2021  
 }