public Bookmark save(Bookmark bookmark) { List<Label> retrievedLabels = new ArrayList<Label>(); for (Label label : bookmark.getLabels()) { Label retrievedLabel = labelRepository.findByNameIgnoreCase(label.getName()); if (retrievedLabel == null) { retrievedLabel = labelRepository.save(label); } retrievedLabels.add(retrievedLabel); } bookmark.setLabels(retrievedLabels); bookmark.setCreatedDate(new Date()); return bookmarkRepository.save(bookmark); }
public Iterable<Bookmark> findByUserId(Long userId) { return bookmarkRepository.findByUserId(userId); }
public Bookmark findOne(Long id) { return bookmarkRepository.findOne(id); }
public Iterable<Bookmark> findAll() { return bookmarkRepository.findAll(); }