LookupLocation lloc = new LookupLocation();
parseLocation(lloc, loc, adsComponent.getLocation());
setLocation(lloc);
} else {
if (loc == null) {
LocationLookupService lookup = LocationLookupService.createLookupByIP();
LookupLocation lloc = lookup.getLocation(new IPAddress(null));
if (lloc.getLookupStatus() == LookupLocation.STATUS_OK) {
setLocation(lloc);
}
} else {
LocationLookupService lookup = LocationLookupService.createLookupByGeocode();
LookupLocation lloc = lookup.getLocation(new Coordinate(loc));
if (lloc.getLookupStatus() != LookupLocation.STATUS_OK) {
lloc.setLatitude(loc.getLatitude());
lloc.setLongtitude(loc.getLongtitude());
}
}