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.Managers; |
20 | |
import org.jtheque.core.managers.undo.IUndoRedoManager; |
21 | |
import org.jtheque.core.managers.view.able.IView; |
22 | |
import org.jtheque.core.managers.view.able.controller.AbstractController; |
23 | |
import org.jtheque.films.controllers.able.ILendingsController; |
24 | |
import org.jtheque.films.view.able.ILendingsView; |
25 | |
import org.jtheque.primary.controller.impl.undo.DeletedLendingEdit; |
26 | |
import org.jtheque.primary.od.able.Lending; |
27 | |
import org.jtheque.primary.services.able.ILendingsService; |
28 | |
|
29 | |
import javax.annotation.Resource; |
30 | |
|
31 | |
|
32 | |
|
33 | |
|
34 | |
|
35 | |
|
36 | 0 | public final class LendingsController extends AbstractController implements ILendingsController { |
37 | |
@Resource |
38 | |
private ILendingsService lendingsService; |
39 | |
|
40 | |
@Resource |
41 | |
private ILendingsView lendingsView; |
42 | |
|
43 | |
@Override |
44 | |
public IView getView() { |
45 | 0 | return lendingsView; |
46 | |
} |
47 | |
|
48 | |
@Override |
49 | |
public void deleteLending(int id) { |
50 | 0 | Lending lending = lendingsService.getLending(id); |
51 | |
|
52 | 0 | boolean deleted = lendingsService.delete(lending); |
53 | |
|
54 | 0 | if (deleted) { |
55 | 0 | Managers.getManager(IUndoRedoManager.class).addEdit(new DeletedLendingEdit(lending)); |
56 | |
} |
57 | 0 | } |
58 | |
} |