use of ch.interlis.iom_j.xtf.XtfWriter in project ili2db by claeis.
the class Ili2db method transferToXtf.
/**
* transfer data from database to xml file
*/
private static void transferToXtf(Connection conn, String xtffile, NameMapping ili2sqlName, TransferDescription td, SqlColumnConverter geomConv, String sender, Config config, String[] exportParamModelnames, long[] basketSqlIds, Map<Long, BasketStat> stat, TrafoConfig trafoConfig, Viewable2TableMapping class2wrapper) {
java.io.File outfile = new java.io.File(xtffile);
IoxWriter ioxWriter = null;
try {
if (Config.ILIGML20.equals(config.getTransferFileFormat())) {
ioxWriter = new Iligml20Writer(outfile, td);
} else {
String ext = ch.ehi.basics.view.GenericFileFilter.getFileExtension(xtffile).toLowerCase();
if (config.isItfTransferfile()) {
if (!config.getDoItfLineTables()) {
ioxWriter = new ItfWriter2(outfile, td);
} else {
ioxWriter = new ItfWriter(outfile, td);
}
config.setValue(ch.interlis.iox_j.validator.Validator.CONFIG_DO_ITF_OIDPERTABLE, ch.interlis.iox_j.validator.Validator.CONFIG_DO_ITF_OIDPERTABLE_DO);
} else if (ext != null && ext.equals("gml")) {
ioxWriter = new Iligml10Writer(outfile, td);
} else {
ioxWriter = new XtfWriter(outfile, td);
}
}
TransferToXtf trsfr = new TransferToXtf(ili2sqlName, td, conn, geomConv, config, trafoConfig, class2wrapper);
trsfr.doit(outfile.getName(), ioxWriter, sender, exportParamModelnames, basketSqlIds, stat);
// trsfr.doitJava();
ioxWriter.flush();
} catch (ch.interlis.iox.IoxException ex) {
EhiLogger.logError("failed to write xml output", ex);
} finally {
if (ioxWriter != null) {
try {
ioxWriter.close();
} catch (ch.interlis.iox.IoxException ex) {
EhiLogger.logError("failed to close xml output", ex);
}
}
ioxWriter = null;
}
}
Aggregations