-
Notifications
You must be signed in to change notification settings - Fork 0
Feature #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Feature #1
Conversation
|
|
||
| @Override | ||
| public boolean save(SchoolBook book) { | ||
| if (book != null) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (book == null) {
return false;
}
| import com.epam.izh.rd.online.entity.SchoolBook; | ||
| import com.epam.izh.rd.online.repository.BookRepository; | ||
|
|
||
| public class SimpleSchoolBookService implements BookService { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
implements BookService<SchoolBook>, сейчас у тебя репозиторий работает с абстрактными книгами
| public boolean save(Book book) { | ||
| SchoolBook schoolBook = (SchoolBook) book; | ||
|
|
||
| if (authorService.findByFullName(schoolBook.getAuthorName(), schoolBook.getAuthorLastName()) != null) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Такое authorService.findByFullName(schoolBook.getAuthorName(), schoolBook.getAuthorLastName()) лучше в переменную выносить для читаемости
| private BookRepository<SchoolBook> schoolBookBookRepository; | ||
| private AuthorService authorService; | ||
|
|
||
| public SimpleSchoolBookService() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
А какой смысл в этом конструкторе?
| import com.epam.izh.rd.online.entity.Author; | ||
| import com.epam.izh.rd.online.repository.AuthorRepository; | ||
|
|
||
| public class SimpleAuthorService implements AuthorService { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Я бы прикрутил какую-нибудь валидацию, например на save Author != null
No description provided.