@Override @Transactional public Boolean deleteBookToKeyword(int bookId, int authorId) throws NoSuchEntityException, ForbiddenException { bookAvailabilityService.isCurrentUsersBook(bookDao.getNotNull(bookId)); return bookKeywordDao.delete(bookId, authorId); }
@Override @Transactional(propagation = Propagation.REQUIRED) public Integer update(BookEntity book) throws ValidationException, IllegalDatabaseStateException, ForbiddenException, NoSuchEntityException, AuthRequiredException { bookAvailabilityService.isCurrentUsersBook(book); BookEntity bookEntity = bookDao.update(book); return bookEntity.getId(); }
@Override @Transactional(propagation = Propagation.REQUIRED) public Set<BookOnPortalEntity> getBookPortals(int bookId) throws NoSuchEntityException { BookEntity book = bookDao.getNotNull(bookId); try { bookAvailabilityService.isCurrentUsersBook(book); return book.getBookPortals(); } catch (ForbiddenException e) { if (book.getBookPortals() == null || book.getBookPortals().size() == 0) return null; Set<BookOnPortalEntity> list = new HashSet<BookOnPortalEntity>(); for (BookOnPortalEntity portal : book.getBookPortals()) if (BookPortalStatusEnum.ACTIVE.equals(portal.getStatus())) list.add(portal); return list; } }