* @param query The query to extract the data-set to export
* @throws Exception
*/
public void partialExport(String outputFolder, List<TableInfoPartialExportBean> filteredTableToExport) throws Exception{
IDatabaseConnection conn = null;
try {
if(outputFolder == null || outputFolder.equalsIgnoreCase(""))
throw new Exception("Invalid destination folder !");
BasicDataSource ds = DatabaseConnectionFactory.getDataSource();
conn = new DatabaseConnection(ds.getConnection());
if(filteredTableToExport.size() >0)
{
String targetDbName = DatabaseConnectionFactory.getDatabaseName();
QueryDataSet partialDataSet = new QueryDataSet(conn);
// build the data-set. NOTE: the new inserted value will be inserted in the model only when the editable cell lose the focuc
for(int i=0;i<filteredTableToExport.size();i++){
//System.out.println(filteredTableToExport.get(i).isIncludeTable());
//System.out.println("ADD: "+filteredTableToExport.get(i).getTableName()+","+filteredTableToExport.get(i).getExportQuery());
partialDataSet.addTable(filteredTableToExport.get(i).getTableName(),filteredTableToExport.get(i).getExportQuery());
}
FlatXmlDataSet.write(partialDataSet, new FileOutputStream(outputFolder+File.separator+targetDbName+".xml"));
}else
throw new Exception("Select at least one table !");
} catch (Exception e) {
throw e;
}finally{
if(conn !=null)
conn.close();
}
}