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