com.bm.testsuite.dataloader
Class CSVInitialDataSet<T>

java.lang.Object
  extended by com.bm.testsuite.dataloader.CSVInitialDataSet<T>
Type Parameters:
T - the type of the entity bean (mapping the table)
All Implemented Interfaces:
InitialDataSet

public class CSVInitialDataSet<T>
extends java.lang.Object
implements InitialDataSet

This class creates initial data from a comma separated file.

Since:
17.04.2006
Author:
Daniel Wiese, Istvan Devai, Peter Doornbosch

Constructor Summary
CSVInitialDataSet(java.lang.Class<T> entityBeanClass, java.lang.String csvFileName, boolean isCompressed, boolean useSchemaName, java.lang.String... propertyMapping)
          Constructor.
CSVInitialDataSet(java.lang.Class<T> entityBeanClass, java.lang.String csvFileName, boolean isCompressed, java.lang.String... propertyMapping)
          Constructor.
CSVInitialDataSet(java.lang.Class<T> entityBeanClass, java.lang.String csvFileName, java.lang.String... propertyMapping)
          Constructor.
 
Method Summary
 CSVInitialDataSet<T> addDateFormat(DateFormats dateFormat)
          Allows to specify a user specific date format pattern's.
 java.lang.String buildInsertSQL()
          Returns the insert SQL.
 void cleanup(javax.persistence.EntityManager em)
          Deletes the data.
 void create()
          Creates the data.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CSVInitialDataSet

public CSVInitialDataSet(java.lang.Class<T> entityBeanClass,
                         java.lang.String csvFileName,
                         boolean isCompressed,
                         boolean useSchemaName,
                         java.lang.String... propertyMapping)
Constructor.

Parameters:
entityBeanClass - - the corresponding entity bean class
propertyMapping - - a string array with the meaning the first column of the cvs file belongs to the property with the name propertyMapping[0]
isCompressed - - true if compressed (zip)
useSchemaName - the schema name will be used for sql generation
csvFileName - - the name of the csv file

CSVInitialDataSet

public CSVInitialDataSet(java.lang.Class<T> entityBeanClass,
                         java.lang.String csvFileName,
                         boolean isCompressed,
                         java.lang.String... propertyMapping)
Constructor.

Parameters:
entityBeanClass - - the corresponding entity bean class
propertyMapping - - a string array with the meaning the first column of the csv file belongs to the property with the name propertyMapping[0]
isCompressed - - true if compressed (zip)
csvFileName - - the name of the csv file

CSVInitialDataSet

public CSVInitialDataSet(java.lang.Class<T> entityBeanClass,
                         java.lang.String csvFileName,
                         java.lang.String... propertyMapping)
Constructor.

Parameters:
entityBeanClass - - the corresponding entity bean class
propertyMapping - - a string array with the meaning the first column of the csv file belongs to the property with the name propertyMapping[0]
csvFileName - - the name of the csv file
Method Detail

addDateFormat

public CSVInitialDataSet<T> addDateFormat(DateFormats dateFormat)
Allows to specify a user specific date format pattern's. The are processed in the added order.

Parameters:
dateFormat - the date format pattern
Returns:
this instance for inlining.

buildInsertSQL

public java.lang.String buildInsertSQL()
Returns the insert SQL.

Returns:
the insert SQL

create

public void create()
Creates the data.

Specified by:
create in interface InitialDataSet
Since:
17.04.2006
See Also:
InitialDataSet.create()

cleanup

public void cleanup(javax.persistence.EntityManager em)
Deletes the data.

Specified by:
cleanup in interface InitialDataSet
Parameters:
em - - the entyty manager.
Since:
17.04.2006
See Also:
InitialDataSet.cleanup(EntityManager)


Copyright © 2008. All Rights Reserved.