cst.execute();
ResultSet rs1 = cst.getResultSet();
CachedRowSetImpl crs = new CachedRowSetImpl();
crs.populate(rs1);
int TotalRecords = crs.size();
if (TotalRecords > 0) {
try {
pg = Functions.definePage(TotalRecords, rr.getRecordsPerPage(), rr.getPageIndex());
DistrictLocation[] dl;
if (pg.getRecordsInitial() <= TotalRecords) {
dl = new DistrictLocation[(pg.getRecordsFinal() - pg.getRecordsInitial()) + 1];
for (int intI = pg.getRecordsInitial(); intI <= pg.getRecordsFinal(); intI++) {
// classe district
if (rs1.absolute(intI)) {
dl[iCount] = new DistrictLocation();
dl[iCount].setDistrict(new District());
dl[iCount].getDistrict().setName(rs1.getString("NOME"));
dl[iCount].getDistrict().setCity(new City());
dl[iCount].getDistrict().getCity().setName(rs1.getString("CIDADE"));
dl[iCount].getDistrict().getCity().setState(rs1.getString("UF"));
dl[iCount].setPoint(new Point());
dl[iCount].getPoint().setX(Double.parseDouble(rs1.getString("X")));
dl[iCount].getPoint().setY(Double.parseDouble(rs1.getString("Y")));
dl[iCount].getDistrict().setZone(rs1.getString("REGIAO"));
iCount++;
}
}
ri.setRecordCount((int) pg.getRecordCount());
ri.setPageCount(pg.getPageCount());
} else {
dl = new DistrictLocation[0];
}
ri.setDistrictLocation(dl);
} catch (Exception ex) {
throw (new Exception("Registro n�o encontrado."));
}
} else {
DistrictLocation[] rl = new DistrictLocation[0];
ri.setDistrictLocation(rl);
}
con.close();
rs1.close();
crs.close();
cst.close();
} catch (Exception ex) {
Utils.LogError("CC","findDistrict - IdWebservice : 50", "district.city.name-> " + district.getCity().getName() + " | "
+ "district.city.state -> " + district.getCity().getState() + " | " + "district.name-> " + district.getName() + " | "
+ ex.getMessage() + "|" + ex.getStackTrace());