Coverage Report - org.apache.maven.plugin.resources.remote.io.xpp3.SupplementalDataModelXpp3Writer
 
Classes in this File Line Coverage Branch Coverage Complexity
SupplementalDataModelXpp3Writer
0%
0/34
0%
0/8
0
 
 1  
 /*
 2  
  =================== DO NOT EDIT THIS FILE ====================
 3  
  Generated by Modello 1.4.1 on 2011-06-14 21:26:11,
 4  
  any modifications will be overwritten.
 5  
  ==============================================================
 6  
  */
 7  
 
 8  
 package org.apache.maven.plugin.resources.remote.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.resources.remote.Supplement;
 20  
 import org.apache.maven.plugin.resources.remote.SupplementalDataModel;
 21  
 import org.codehaus.plexus.util.xml.Xpp3Dom;
 22  
 import org.codehaus.plexus.util.xml.pull.MXSerializer;
 23  
 import org.codehaus.plexus.util.xml.pull.XmlSerializer;
 24  
 
 25  
 /**
 26  
  * Class SupplementalDataModelXpp3Writer.
 27  
  * 
 28  
  * @version $Revision$ $Date$
 29  
  */
 30  
 @SuppressWarnings( "all" )
 31  0
 public class SupplementalDataModelXpp3Writer
 32  
 {
 33  
 
 34  
       //--------------------------/
 35  
      //- Class/Member Variables -/
 36  
     //--------------------------/
 37  
 
 38  
     /**
 39  
      * Field NAMESPACE.
 40  
      */
 41  0
     private static final String NAMESPACE = null;
 42  
 
 43  
 
 44  
       //-----------/
 45  
      //- Methods -/
 46  
     //-----------/
 47  
 
 48  
     /**
 49  
      * Method write.
 50  
      * 
 51  
      * @param writer
 52  
      * @param supplementalDataModel
 53  
      * @throws java.io.IOException
 54  
      */
 55  
     public void write( Writer writer, SupplementalDataModel supplementalDataModel )
 56  
         throws java.io.IOException
 57  
     {
 58  0
         XmlSerializer serializer = new MXSerializer();
 59  0
         serializer.setProperty( "http://xmlpull.org/v1/doc/properties.html#serializer-indentation", "  " );
 60  0
         serializer.setProperty( "http://xmlpull.org/v1/doc/properties.html#serializer-line-separator", "\n" );
 61  0
         serializer.setOutput( writer );
 62  0
         serializer.startDocument( supplementalDataModel.getModelEncoding(), null );
 63  0
         writeSupplementalDataModel( supplementalDataModel, "supplementalDataModels", serializer );
 64  0
         serializer.endDocument();
 65  0
     } //-- void write( Writer, SupplementalDataModel )
 66  
 
 67  
     /**
 68  
      * Method write.
 69  
      * 
 70  
      * @param stream
 71  
      * @param supplementalDataModel
 72  
      * @throws java.io.IOException
 73  
      */
 74  
     public void write( OutputStream stream, SupplementalDataModel supplementalDataModel )
 75  
         throws java.io.IOException
 76  
     {
 77  0
         XmlSerializer serializer = new MXSerializer();
 78  0
         serializer.setProperty( "http://xmlpull.org/v1/doc/properties.html#serializer-indentation", "  " );
 79  0
         serializer.setProperty( "http://xmlpull.org/v1/doc/properties.html#serializer-line-separator", "\n" );
 80  0
         serializer.setOutput( stream, supplementalDataModel.getModelEncoding() );
 81  0
         serializer.startDocument( supplementalDataModel.getModelEncoding(), null );
 82  0
         writeSupplementalDataModel( supplementalDataModel, "supplementalDataModels", serializer );
 83  0
         serializer.endDocument();
 84  0
     } //-- void write( OutputStream, SupplementalDataModel )
 85  
 
 86  
     /**
 87  
      * Method writeSupplement.
 88  
      * 
 89  
      * @param supplement
 90  
      * @param serializer
 91  
      * @param tagName
 92  
      * @throws java.io.IOException
 93  
      */
 94  
     private void writeSupplement( Supplement supplement, String tagName, XmlSerializer serializer )
 95  
         throws java.io.IOException
 96  
     {
 97  0
         serializer.startTag( NAMESPACE, tagName );
 98  0
         if ( supplement.getProject() != null )
 99  
         {
 100  0
             ((Xpp3Dom) supplement.getProject()).writeToSerializer( NAMESPACE, serializer );
 101  
         }
 102  0
         serializer.endTag( NAMESPACE, tagName );
 103  0
     } //-- void writeSupplement( Supplement, String, XmlSerializer )
 104  
 
 105  
     /**
 106  
      * Method writeSupplementalDataModel.
 107  
      * 
 108  
      * @param supplementalDataModel
 109  
      * @param serializer
 110  
      * @param tagName
 111  
      * @throws java.io.IOException
 112  
      */
 113  
     private void writeSupplementalDataModel( SupplementalDataModel supplementalDataModel, String tagName, XmlSerializer serializer )
 114  
         throws java.io.IOException
 115  
     {
 116  0
         serializer.setPrefix( "", "http://maven.apache.org/supplemental-model/1.0.0" );
 117  0
         serializer.setPrefix( "xsi", "http://www.w3.org/2001/XMLSchema-instance" );
 118  0
         serializer.startTag( NAMESPACE, tagName );
 119  0
         serializer.attribute( "", "xsi:schemaLocation", "http://maven.apache.org/supplemental-model/1.0.0 http://maven.apache.org/xsd/supplemental-model-1.0.0.xsd" );
 120  0
         if ( ( supplementalDataModel.getSupplement() != null ) && ( supplementalDataModel.getSupplement().size() > 0 ) )
 121  
         {
 122  0
             for ( Iterator iter = supplementalDataModel.getSupplement().iterator(); iter.hasNext(); )
 123  
             {
 124  0
                 Supplement o = (Supplement) iter.next();
 125  0
                 writeSupplement( o, "supplement", serializer );
 126  0
             }
 127  
         }
 128  0
         serializer.endTag( NAMESPACE, tagName );
 129  0
     } //-- void writeSupplementalDataModel( SupplementalDataModel, String, XmlSerializer )
 130  
 
 131  
 }