super.run();
switch(type){
case FROM_LATLNG_COLUMNS:
if(connection.getClass() == OracleConnection.class){
OracleConnection oracle = (OracleConnection)connection;
try{
String addColumnQuery = "alter table "+
tblName+
" add "+
"( "+
streetColumnName+" varchar(64)"+
" )";
oracle.executeSQLQuery(addColumnQuery);
logger.info("Column inserted");
}
catch(Exception e){
logger.error("the column is already created");
}
String getTotal = "SELECT count(*) as total "+
"FROM "+tblName+" "+
"WHERE "+streetColumnName+" IS NULL";
ResultSet rset = oracle.getSQLQueryResults(getTotal);
int total = 0;
if(rset.next())total = rset.getInt("total");
String query = "SELECT "+id+", "+latColumn+", "+lngColumn+" "+
"FROM "+tblName+" "+
"WHERE "+streetColumnName+" IS NULL";
rset = oracle.getSQLQueryResults(query);
logger.info("Dataset retrieved");
int i = 0;
double lastStatus = 0;
DecimalFormat twoPlaces = new DecimalFormat("0.00");
while (rset.next()){
String idValue = rset.getString(id);
double latValue = rset.getDouble(latColumn);
double lngValue = rset.getDouble(lngColumn);
String address = geocoder.getGoogleAddress(latValue, lngValue);
logger.info(address);
String insertQuery = "UPDATE "+tblName+
" SET "+streetColumnName+" = '"+address+
"' WHERE "+id+" = "+idValue;
oracle.executeSQLQuery(insertQuery);
i++;
//logger.info(i+"-th row updated");
step(100000000/total);
if(getStatus() > lastStatus + 0.01){