use of com.linuxense.javadbf.DBFReader in project janrufmonitor by tbrandt77.
the class FritzXCallImporter method doImport.
public ICallList doImport() {
long startDate = System.currentTimeMillis();
try {
File fritzxfile = new File(m_filename);
FileInputStream fis = new FileInputStream(fritzxfile);
DBFReader dbfReader = new DBFReader(fis);
int size = dbfReader.getRecordCount();
size = Math.abs(size);
m_callList = getRuntime().getCallFactory().createCallList(size);
Object[] rowObjects = null;
CallCollection cc = null;
List cc_list = new ArrayList();
while ((rowObjects = dbfReader.nextRecord()) != null) {
if (cc != null && cc.getId().equalsIgnoreCase((String) rowObjects[0])) {
cc.add(rowObjects);
} else {
cc = new CallCollection((String) rowObjects[0]);
cc_list.add(cc);
cc.add(rowObjects);
}
}
for (int i = 0, j = cc_list.size(); i < j; i++) {
new MigratorThread(this.m_callList, (CallCollection) cc_list.get(i)).run();
}
fis.close();
} catch (FileNotFoundException ex) {
this.m_logger.warning("Cannot find call file " + m_filename);
return this.m_callList;
} catch (IOException ex) {
this.m_logger.severe("IOException on file " + m_filename);
return this.m_callList;
}
long endDate = System.currentTimeMillis();
this.m_logger.info("Successfully imported call file " + m_filename);
this.m_logger.info("Found " + new Integer(this.m_callList.size()).toString() + " call items in " + new Float((endDate - startDate) / 1000).toString() + " secs.");
return m_callList;
}
use of com.linuxense.javadbf.DBFReader in project janrufmonitor by tbrandt77.
the class FritzXCallImporter2 method doImport.
public ICallList doImport() {
long startDate = System.currentTimeMillis();
try {
File fritzxfile = new File(m_filename);
FileInputStream fis = new FileInputStream(fritzxfile);
DBFReader dbfReader = new DBFReader(fis);
int size = dbfReader.getRecordCount();
size = Math.abs(size);
m_callList = getRuntime().getCallFactory().createCallList(size);
Object[] rowObjects = null;
CallCollection cc = null;
List cc_list = new ArrayList();
while ((rowObjects = dbfReader.nextRecord()) != null) {
if (cc != null && cc.getId().equalsIgnoreCase((String) rowObjects[0])) {
cc.add(rowObjects);
} else {
cc = new CallCollection((String) rowObjects[0]);
cc_list.add(cc);
cc.add(rowObjects);
}
}
for (int i = 0, j = cc_list.size(); i < j; i++) {
new MigratorThread(this.m_callList, (CallCollection) cc_list.get(i)).run();
}
fis.close();
} catch (FileNotFoundException ex) {
this.m_logger.warning("Cannot find call file " + m_filename);
return this.m_callList;
} catch (IOException ex) {
this.m_logger.severe("IOException on file " + m_filename);
return this.m_callList;
}
long endDate = System.currentTimeMillis();
this.m_logger.info("Successfully imported call file " + m_filename);
this.m_logger.info("Found " + new Integer(this.m_callList.size()).toString() + " call items in " + new Float((endDate - startDate) / 1000).toString() + " secs.");
return m_callList;
}
Aggregations