use of de.westnordost.osmapi.common.SingleElementHandler in project StreetComplete by westnordost.
the class CreateNoteUpload method findAlreadyExistingNoteWithSameAssociatedElement.
private Note findAlreadyExistingNoteWithSameAssociatedElement(final CreateNote newNote) {
SingleElementHandler<Note> handler = new SingleElementHandler<Note>() {
@Override
public void handle(Note oldNote) {
if (newNote.hasAssociatedElement()) {
String firstCommentText = oldNote.comments.get(0).text;
String newNoteRegex = getAssociatedElementRegex(newNote);
if (firstCommentText.matches(newNoteRegex)) {
super.handle(oldNote);
}
}
}
};
final int hideClosedNoteAfter = 7;
osmDao.getAll(new BoundingBox(newNote.position.getLatitude(), newNote.position.getLongitude(), newNote.position.getLatitude(), newNote.position.getLongitude()), handler, 10, hideClosedNoteAfter);
return handler.get();
}
Aggregations