Coverage Report - org.apache.maven.plugin.verifier.model.io.xpp3.VerificationsXpp3Writer
 
Classes in this File Line Coverage Branch Coverage Complexity
VerificationsXpp3Writer
0%
0/31
0%
0/16
3,667
 
 1  
 /*
 2  
  =================== DO NOT EDIT THIS FILE ====================
 3  
  Generated by Modello 1.0.1 on 2010-01-21 22:42:55,
 4  
  any modifications will be overwritten.
 5  
  ==============================================================
 6  
  */
 7  
 
 8  
 package org.apache.maven.plugin.verifier.model.io.xpp3;
 9  
 
 10  
   //---------------------------------/
 11  
  //- Imported classes and packages -/
 12  
 //---------------------------------/
 13  
 
 14  
 import java.io.Writer;
 15  
 import java.text.DateFormat;
 16  
 import java.util.Iterator;
 17  
 import java.util.Locale;
 18  
 import org.apache.maven.plugin.verifier.model.File;
 19  
 import org.apache.maven.plugin.verifier.model.Verifications;
 20  
 import org.codehaus.plexus.util.xml.pull.MXSerializer;
 21  
 import org.codehaus.plexus.util.xml.pull.XmlSerializer;
 22  
 
 23  
 /**
 24  
  * Class VerificationsXpp3Writer.
 25  
  * 
 26  
  * @version $Revision$ $Date$
 27  
  */
 28  0
 public class VerificationsXpp3Writer
 29  
 {
 30  
 
 31  
       //--------------------------/
 32  
      //- Class/Member Variables -/
 33  
     //--------------------------/
 34  
 
 35  
     /**
 36  
      * Field NAMESPACE.
 37  
      */
 38  0
     private static final String NAMESPACE = null;
 39  
 
 40  
 
 41  
       //-----------/
 42  
      //- Methods -/
 43  
     //-----------/
 44  
 
 45  
     /**
 46  
      * Method write.
 47  
      * 
 48  
      * @param writer
 49  
      * @param verifications
 50  
      * @throws java.io.IOException
 51  
      */
 52  
     public void write( Writer writer, Verifications verifications )
 53  
         throws java.io.IOException
 54  
     {
 55  0
         XmlSerializer serializer = new MXSerializer();
 56  0
         serializer.setProperty( "http://xmlpull.org/v1/doc/properties.html#serializer-indentation", "  " );
 57  0
         serializer.setProperty( "http://xmlpull.org/v1/doc/properties.html#serializer-line-separator", "\n" );
 58  0
         serializer.setOutput( writer );
 59  0
         serializer.startDocument( verifications.getModelEncoding(), null );
 60  0
         writeVerifications( verifications, "verifications", serializer );
 61  0
         serializer.endDocument();
 62  0
     } //-- void write( Writer, Verifications )
 63  
 
 64  
     /**
 65  
      * Method writeFile.
 66  
      * 
 67  
      * @param file
 68  
      * @param serializer
 69  
      * @param tagName
 70  
      * @throws java.io.IOException
 71  
      */
 72  
     private void writeFile( File file, String tagName, XmlSerializer serializer )
 73  
         throws java.io.IOException
 74  
     {
 75  0
         if ( file != null )
 76  
         {
 77  0
             serializer.startTag( NAMESPACE, tagName );
 78  0
             if ( file.getLocation() != null )
 79  
             {
 80  0
                 serializer.startTag( NAMESPACE, "location" ).text( file.getLocation() ).endTag( NAMESPACE, "location" );
 81  
             }
 82  0
             if ( file.getContains() != null )
 83  
             {
 84  0
                 serializer.startTag( NAMESPACE, "contains" ).text( file.getContains() ).endTag( NAMESPACE, "contains" );
 85  
             }
 86  0
             if ( file.isExists() != true )
 87  
             {
 88  0
                 serializer.startTag( NAMESPACE, "exists" ).text( String.valueOf( file.isExists() ) ).endTag( NAMESPACE, "exists" );
 89  
             }
 90  0
             serializer.endTag( NAMESPACE, tagName );
 91  
         }
 92  0
     } //-- void writeFile( File, String, XmlSerializer )
 93  
 
 94  
     /**
 95  
      * Method writeVerifications.
 96  
      * 
 97  
      * @param verifications
 98  
      * @param serializer
 99  
      * @param tagName
 100  
      * @throws java.io.IOException
 101  
      */
 102  
     private void writeVerifications( Verifications verifications, String tagName, XmlSerializer serializer )
 103  
         throws java.io.IOException
 104  
     {
 105  0
         if ( verifications != null )
 106  
         {
 107  0
             serializer.startTag( NAMESPACE, tagName );
 108  0
             if ( ( verifications.getFiles() != null ) && ( verifications.getFiles().size() > 0 ) )
 109  
             {
 110  0
                 serializer.startTag( NAMESPACE, "files" );
 111  0
                 for ( Iterator iter = verifications.getFiles().iterator(); iter.hasNext(); )
 112  
                 {
 113  0
                     File o = (File) iter.next();
 114  0
                     writeFile( o, "file", serializer );
 115  0
                 }
 116  0
                 serializer.endTag( NAMESPACE, "files" );
 117  
             }
 118  0
             serializer.endTag( NAMESPACE, tagName );
 119  
         }
 120  0
     } //-- void writeVerifications( Verifications, String, XmlSerializer )
 121  
 
 122  
 
 123  
 }