use of net.osmand.data.preparation.address.DBStreetDAO.SimpleStreet in project OsmAnd-tools by osmandapp.
the class CachedDBStreetDAO method insertStreet.
@Override
public long insertStreet(String name, Map<String, String> names, LatLon location, City city, String cityPart) throws SQLException {
String langs = constructLangs(names);
// batch the insert
long streetId = fillInsertStreetStatement(name, names, location, city, cityPart, langs);
addBatch(addressStreetStat);
SimpleStreet ss = new SimpleStreet(streetId, name, city.getId(), cityPart, location, langs, Algorithms.encodeMap(names));
addressStreetLocalMap.put(createStreetUniqueName(name, city.getId(), cityPart), ss);
addressStreetLocalMap.put(createStreetUniqueName(name, city.getId()), ss);
return streetId;
}
use of net.osmand.data.preparation.address.DBStreetDAO.SimpleStreet in project OsmAnd-tools by osmandapp.
the class CachedDBStreetDAO method updateStreetCityPart.
@Override
public SimpleStreet updateStreetCityPart(SimpleStreet street, String cityPart) throws SQLException {
// we are doing batch updates, so we must commit before this update
commit();
SimpleStreet updatedSS = super.updateStreetCityPart(street, cityPart);
addressStreetLocalMap.put(createStreetUniqueName(street.getName(), street.getCityId()), updatedSS);
addressStreetLocalMap.put(createStreetUniqueName(street.getName(), street.getCityId(), cityPart), updatedSS);
return updatedSS;
}
use of net.osmand.data.preparation.address.DBStreetDAO.SimpleStreet in project OsmAnd-tools by osmandapp.
the class IndexAddressCreator method getOrRegisterStreetIdForCity.
private long getOrRegisterStreetIdForCity(String name, Map<String, String> names, LatLon location, City city) throws SQLException {
String cityPart = findCityPart(location, city);
SimpleStreet foundStreet = streetDAO.findStreet(name, city, cityPart);
if (foundStreet == null) {
// by default write city with cityPart of the city
if (cityPart == null) {
cityPart = city.getName();
}
if (names != null) {
langAttributes.addAll(names.keySet());
}
return streetDAO.insertStreet(name, names, location, city, cityPart);
} else {
if (names != null) {
Map<String, String> addNames = null;
for (String s : names.keySet()) {
if (!foundStreet.getLangs().contains(s + ";")) {
if (addNames == null) {
addNames = new HashMap<String, String>();
}
addNames.put(s, names.get(s));
}
}
if (addNames != null) {
foundStreet = streetDAO.updateStreetLangs(foundStreet, addNames);
}
}
return foundStreet.getId();
}
}
use of net.osmand.data.preparation.address.DBStreetDAO.SimpleStreet in project OsmAnd-tools by osmandapp.
the class CachedDBStreetDAO method updateStreetLangs.
@Override
public DBStreetDAO.SimpleStreet updateStreetLangs(DBStreetDAO.SimpleStreet street, Map<String, String> newNames) throws SQLException {
// we are doing batch updates, so we must commit before this update
commit();
SimpleStreet updatedSS = super.updateStreetLangs(street, newNames);
addressStreetLocalMap.put(createStreetUniqueName(street.getName(), street.getCityId()), updatedSS);
addressStreetLocalMap.put(createStreetUniqueName(street.getName(), street.getCityId(), street.getCityPart()), updatedSS);
return updatedSS;
}
Aggregations