1 | |
package org.jtheque.films.controllers.impl; |
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
|
17 | |
|
18 | |
|
19 | |
import org.jtheque.core.managers.view.able.controller.AbstractController; |
20 | |
import org.jtheque.films.controllers.able.ILendController; |
21 | |
import org.jtheque.films.persistence.od.able.Film; |
22 | |
import org.jtheque.films.view.able.ILendFilmView; |
23 | |
import org.jtheque.primary.od.able.Lending; |
24 | |
import org.jtheque.primary.od.able.Person; |
25 | |
import org.jtheque.primary.services.able.ILendingsService; |
26 | |
import org.jtheque.utils.bean.IntDate; |
27 | |
|
28 | |
import javax.annotation.Resource; |
29 | |
|
30 | |
|
31 | |
|
32 | |
|
33 | |
|
34 | |
|
35 | 0 | public final class LendController extends AbstractController implements ILendController { |
36 | |
@Resource |
37 | |
private ILendingsService lendingsService; |
38 | |
|
39 | |
@Resource |
40 | |
private ILendFilmView lendFilmView; |
41 | |
|
42 | |
@Override |
43 | |
public ILendFilmView getView() { |
44 | 0 | return lendFilmView; |
45 | |
} |
46 | |
|
47 | |
@Override |
48 | |
public void newLending(Person borrower, Film film) { |
49 | 0 | Lending lending = lendingsService.getEmptyLending(); |
50 | |
|
51 | 0 | lending.setTheOther(film.getId()); |
52 | 0 | lending.setThePerson(borrower); |
53 | 0 | lending.setDate(IntDate.today()); |
54 | |
|
55 | 0 | lendingsService.create(lending); |
56 | 0 | } |
57 | |
} |