Search in sources :

Example 1 with NoteSavedEvent

use of io.jawg.osmcontributor.model.events.NoteSavedEvent in project osm-contributor by jawg.

the class NoteManager method saveNoteNoTransactionMgmt.

/**
 * Method saving a note and the associated foreign collection (comments) without transaction management.
 * <p/>
 * Do not call the DAO directly to save a note, use this method.
 *
 * @param note The note to save.
 * @return The saved note.
 * @see #saveNote(Note)
 */
private Note saveNoteNoTransactionMgmt(Note note) {
    commentDao.deleteByNoteIdAndUpdated(note.getId(), false);
    noteDao.createOrUpdate(note);
    if (note.getComments() != null) {
        for (Comment comment : note.getComments()) {
            commentDao.createOrUpdate(comment);
        }
    }
    bus.post(new NoteSavedEvent(note));
    return note;
}
Also used : Comment(io.jawg.osmcontributor.model.entities.Comment) PleaseApplyNewComment(io.jawg.osmcontributor.ui.events.map.PleaseApplyNewComment) NoteSavedEvent(io.jawg.osmcontributor.model.events.NoteSavedEvent)

Aggregations

Comment (io.jawg.osmcontributor.model.entities.Comment)1 NoteSavedEvent (io.jawg.osmcontributor.model.events.NoteSavedEvent)1 PleaseApplyNewComment (io.jawg.osmcontributor.ui.events.map.PleaseApplyNewComment)1