public void deleteMemory(Memory memoryToDelete, String markerID) { // Update the model Memory memory = Memory.findById(Memory.class, memoryToDelete.getId()); memory.delete(); // Notify the map mMemoryChanged.onMemoryRemoved(memory, markerID); }
public void updateMemory(Memory updatedMemory) { // Update the model Memory memory = Memory.findById(Memory.class, updatedMemory.getId()); if (updatedMemory.getTitle() == null || updatedMemory.getTitle().equals("")) { updatedMemory.setTitle("Untitled"); } else { memory.setTitle(updatedMemory.getTitle()); } memory.setDate(updatedMemory.getDate()); memory.setPeople(updatedMemory.getPeople()); memory.setPhotoURI(updatedMemory.getPhotoURI()); memory.setDescription(updatedMemory.getDescription()); memory.setLatitude(updatedMemory.getLatitude()); memory.setLongitude(updatedMemory.getLongitude()); memory.setPlaceName(updatedMemory.getPlaceName()); memory.save(); // Notify the map mMemoryChanged.onMemoryUpdated(memory); }
public Memory findMemoryByID(Long id) { // get the memory with a given id return Memory.findById(Memory.class, id); }