use of io.jawg.osmcontributor.model.entities.PoiNodeRef in project osm-contributor by jawg.
the class EditPoiManager method saveOldVersionOfPoiNodeRef.
private Long saveOldVersionOfPoiNodeRef(PoiNodeRef poiNodeRef) {
if (poiNodeRefDao.countForBackendId(poiNodeRef.getNodeBackendId()) == 1) {
PoiNodeRef old = poiNodeRef.getCopy();
old.setOld(true);
poiNodeRefDao.createOrUpdate(old);
return old.getId();
}
return poiNodeRef.getOldPoiId();
}
use of io.jawg.osmcontributor.model.entities.PoiNodeRef in project osm-contributor by jawg.
the class PoiManager method onPleaseRevertPoiNodeRefEvent.
@Subscribe(threadMode = ThreadMode.ASYNC)
public void onPleaseRevertPoiNodeRefEvent(PleaseRevertPoiNodeRefEvent event) {
PoiNodeRef poiNodeRef = revertPoiNodeRef(event.getIdToRevert());
bus.post(new RevertFinishedEvent(poiNodeRef, LocationMarkerView.MarkerType.NODE_REF));
}
use of io.jawg.osmcontributor.model.entities.PoiNodeRef in project osm-contributor by jawg.
the class OSMSyncWayManager method downloadPoiForWayEdition.
/**
* {@inheritDoc}
*/
@Override
public List<Poi> downloadPoiForWayEdition(List<Long> ids) {
// get noderefs to update
List<PoiNodeRef> poiNodeRefs = poiNodeRefDao.queryByPoiNodeRefIds(ids);
// get Pois corresponding to noderefs to update
List<Poi> pois = getPoiWaysToUpdate();
List<PoiNodeRef> poiNodeRefsToSave = new ArrayList<>();
Map<String, PoiNodeRef> poiNodeRefMap = new HashMap<>();
for (PoiNodeRef poiNodeRef : poiNodeRefs) {
poiNodeRefMap.put(poiNodeRef.getNodeBackendId(), poiNodeRef);
}
// apply new lat lng to poi
for (Poi poi : pois) {
PoiNodeRef poiNodeRef = poiNodeRefMap.get(poi.getBackendId());
if (poiNodeRef != null) {
poi.setLatitude(poiNodeRef.getLatitude());
poi.setLongitude(poiNodeRef.getLongitude());
poi.setUpdated(true);
poiNodeRef.setUpdated(false);
Long oldId = poiNodeRef.getOldPoiId();
if (oldId != null) {
poiNodeRefDao.deleteById(oldId);
}
poiNodeRef.setOldPoiId(null);
poiNodeRefsToSave.add(poiNodeRef);
}
}
// save changes
pois = poiManager.savePois(pois);
poiManager.savePoiNodeRefs(poiNodeRefsToSave);
return pois;
}
Aggregations