Coverage Report - org.apache.maven.plugin.invoker.model.io.xpp3.BuildJobXpp3Writer
 
Classes in this File Line Coverage Branch Coverage Complexity
BuildJobXpp3Writer
0%
0/35
0%
0/14
3,333
 
 1  
 /*
 2  
  =================== DO NOT EDIT THIS FILE ====================
 3  
  Generated by Modello 1.4 on 2012-11-23 17:40:29,
 4  
  any modifications will be overwritten.
 5  
  ==============================================================
 6  
  */
 7  
 
 8  
 package org.apache.maven.plugin.invoker.model.io.xpp3;
 9  
 
 10  
   //---------------------------------/
 11  
  //- Imported classes and packages -/
 12  
 //---------------------------------/
 13  
 
 14  
 import java.io.OutputStream;
 15  
 import java.io.Writer;
 16  
 import java.text.DateFormat;
 17  
 import java.util.Iterator;
 18  
 import java.util.Locale;
 19  
 import org.apache.maven.plugin.invoker.model.BuildJob;
 20  
 import org.codehaus.plexus.util.xml.pull.MXSerializer;
 21  
 import org.codehaus.plexus.util.xml.pull.XmlSerializer;
 22  
 
 23  
 /**
 24  
  * Class BuildJobXpp3Writer.
 25  
  * 
 26  
  * @version $Revision$ $Date$
 27  
  */
 28  
 @SuppressWarnings( "all" )
 29  0
 public class BuildJobXpp3Writer
 30  
 {
 31  
 
 32  
       //--------------------------/
 33  
      //- Class/Member Variables -/
 34  
     //--------------------------/
 35  
 
 36  
     /**
 37  
      * Field NAMESPACE.
 38  
      */
 39  0
     private static final String NAMESPACE = null;
 40  
 
 41  
 
 42  
       //-----------/
 43  
      //- Methods -/
 44  
     //-----------/
 45  
 
 46  
     /**
 47  
      * Method write.
 48  
      * 
 49  
      * @param writer
 50  
      * @param buildJob
 51  
      * @throws java.io.IOException
 52  
      */
 53  
     public void write( Writer writer, BuildJob buildJob )
 54  
         throws java.io.IOException
 55  
     {
 56  0
         XmlSerializer serializer = new MXSerializer();
 57  0
         serializer.setProperty( "http://xmlpull.org/v1/doc/properties.html#serializer-indentation", "  " );
 58  0
         serializer.setProperty( "http://xmlpull.org/v1/doc/properties.html#serializer-line-separator", "\n" );
 59  0
         serializer.setOutput( writer );
 60  0
         serializer.startDocument( buildJob.getModelEncoding(), null );
 61  0
         writeBuildJob( buildJob, "build-job", serializer );
 62  0
         serializer.endDocument();
 63  0
     } //-- void write( Writer, BuildJob )
 64  
 
 65  
     /**
 66  
      * Method write.
 67  
      * 
 68  
      * @param stream
 69  
      * @param buildJob
 70  
      * @throws java.io.IOException
 71  
      */
 72  
     public void write( OutputStream stream, BuildJob buildJob )
 73  
         throws java.io.IOException
 74  
     {
 75  0
         XmlSerializer serializer = new MXSerializer();
 76  0
         serializer.setProperty( "http://xmlpull.org/v1/doc/properties.html#serializer-indentation", "  " );
 77  0
         serializer.setProperty( "http://xmlpull.org/v1/doc/properties.html#serializer-line-separator", "\n" );
 78  0
         serializer.setOutput( stream, buildJob.getModelEncoding() );
 79  0
         serializer.startDocument( buildJob.getModelEncoding(), null );
 80  0
         writeBuildJob( buildJob, "build-job", serializer );
 81  0
         serializer.endDocument();
 82  0
     } //-- void write( OutputStream, BuildJob )
 83  
 
 84  
     /**
 85  
      * Method writeBuildJob.
 86  
      * 
 87  
      * @param buildJob
 88  
      * @param serializer
 89  
      * @param tagName
 90  
      * @throws java.io.IOException
 91  
      */
 92  
     private void writeBuildJob( BuildJob buildJob, String tagName, XmlSerializer serializer )
 93  
         throws java.io.IOException
 94  
     {
 95  0
         serializer.startTag( NAMESPACE, tagName );
 96  0
         if ( buildJob.getProject() != null )
 97  
         {
 98  0
             serializer.attribute( NAMESPACE, "project", buildJob.getProject() );
 99  
         }
 100  0
         if ( buildJob.getName() != null )
 101  
         {
 102  0
             serializer.attribute( NAMESPACE, "name", buildJob.getName() );
 103  
         }
 104  0
         if ( buildJob.getDescription() != null )
 105  
         {
 106  0
             serializer.attribute( NAMESPACE, "description", buildJob.getDescription() );
 107  
         }
 108  0
         if ( buildJob.getResult() != null )
 109  
         {
 110  0
             serializer.attribute( NAMESPACE, "result", buildJob.getResult() );
 111  
         }
 112  0
         if ( buildJob.getTime() != 0.0 )
 113  
         {
 114  0
             serializer.attribute( NAMESPACE, "time", String.valueOf( buildJob.getTime() ) );
 115  
         }
 116  0
         if ( buildJob.getType() != null )
 117  
         {
 118  0
             serializer.attribute( NAMESPACE, "type", buildJob.getType() );
 119  
         }
 120  0
         if ( buildJob.getFailureMessage() != null )
 121  
         {
 122  0
             serializer.startTag( NAMESPACE, "failureMessage" ).text( buildJob.getFailureMessage() ).endTag( NAMESPACE, "failureMessage" );
 123  
         }
 124  0
         serializer.endTag( NAMESPACE, tagName );
 125  0
     } //-- void writeBuildJob( BuildJob, String, XmlSerializer )
 126  
 
 127  
 }