Coverage Report - org.apache.torque.mojo.ExportDataMojo
 
Classes in this File Line Coverage Branch Coverage Complexity
ExportDataMojo
0%
0/20
0%
0/2
1.667
 
 1  
 package org.apache.torque.mojo;
 2  
 
 3  
 import java.io.File;
 4  
 import java.io.IOException;
 5  
 
 6  
 import org.apache.commons.io.FileUtils;
 7  
 import org.apache.maven.plugin.MojoExecutionException;
 8  
 import org.kuali.core.db.torque.KualiTorqueDataDumpTask;
 9  
 
 10  
 /**
 11  
  * Reads the content of tables from a database and exports the data in a database agnostic format to XML files.
 12  
  * 
 13  
  * @goal exportdata
 14  
  * @phase generate-sources
 15  
  */
 16  0
 public class ExportDataMojo extends ExportMojo {
 17  
 
 18  
     /**
 19  
      * The format to use for dates/timestamps
 20  
      * 
 21  
      * @parameter expression="${dateFormat}" default-value="yyyyMMddHHmmss z"
 22  
      * @required
 23  
      */
 24  
     private String dateFormat;
 25  
 
 26  
     /**
 27  
      * The directory where data XML files will be written
 28  
      * 
 29  
      * @parameter expression="${dataXMLDir}" default-value="${basedir}/src/main/impex"
 30  
      * @required
 31  
      */
 32  
     private File dataXMLDir;
 33  
 
 34  
     /**
 35  
      * Configure the Ant task
 36  
      */
 37  
     @Override
 38  
     protected void configureTask() throws MojoExecutionException {
 39  0
         KualiTorqueDataDumpTask task = new KualiTorqueDataDumpTask();
 40  0
         task.setBuildDirectory(new File(getProject().getBuild().getDirectory()));
 41  0
         setAntTask(task);
 42  0
         super.configureTask();
 43  0
         makeOutputDir();
 44  0
     }
 45  
 
 46  
     protected void makeOutputDir() throws MojoExecutionException {
 47  0
         if (getDataXMLDir().exists()) {
 48  0
             return;
 49  
         }
 50  
         try {
 51  0
             FileUtils.forceMkdir(getDataXMLDir());
 52  0
         } catch (IOException e) {
 53  0
             throw new MojoExecutionException("Error creating output directory", e);
 54  0
         }
 55  0
     }
 56  
 
 57  
     public File getDataXMLDir() {
 58  0
         return dataXMLDir;
 59  
     }
 60  
 
 61  
     public void setDataXMLDir(File outputDir) {
 62  0
         this.dataXMLDir = outputDir;
 63  0
     }
 64  
 
 65  
     public String getDateFormat() {
 66  0
         return dateFormat;
 67  
     }
 68  
 
 69  
     public void setDateFormat(String dateFormat) {
 70  0
         this.dateFormat = dateFormat;
 71  0
     }
 72  
 }