package cz.muni.fi.pa165.service;

import cz.muni.fi.pa165.dao.BookCollectionDao;
import cz.muni.fi.pa165.entity.BookCollection;
import java.util.List;
import javax.inject.Inject;

import org.springframework.stereotype.Service;

/**
 *
 * @author xkubist
 * @email m.kubistel@gmail.com
 */
@Service
public class BookCollectionServiceImpl implements BookCollectionService {
    @Inject
    BookCollectionDao bookCollectionDao;
    
    @Override
    public void create(BookCollection b){
        bookCollectionDao.create(b);
    }
    
    @Override
    public void delete(BookCollection b){
        bookCollectionDao.delete(b);
    }
     
    @Override
    public List<BookCollection> findAll(){
        return bookCollectionDao.findAll();
    }
   
    @Override
    public BookCollection findById(Long id){
        return bookCollectionDao.findById(id);
    }
}

@@ -75,16 +75,53 @@
 ionDao;%0A
+import cz.muni.fi.pa165.entity.Book;%0A
 import c
@@ -182,16 +182,38 @@
 l.List;%0A
+import java.util.Set;%0A
 import j
@@ -915,10 +915,440 @@
 ;%0A    %7D%0A
+    @Override%0A    public void addBookToCollection(Long id,Book book)%7B%0A        BookCollection coll=bookCollectionDao.findById(id);%0A        coll.addBook(book);%0A        bookCollectionDao.update(coll);%0A        %0A    %7D%0A    %0A    @Override%0A    public void removeBookFromCollection(Long id,Book book)%7B%0A        BookCollection coll=bookCollectionDao.findById(id);%0A        coll.removeBook(book);%0A        bookCollectionDao.update(coll);%0A    %7D%0A
 %7D%0A

add addBook and remove book method to BookCollectionServiceImpl