1 | |
package org.jtheque.films.view.impl.choiceActions; |
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
|
17 | |
|
18 | |
|
19 | |
import org.jtheque.films.utils.Constants; |
20 | |
import org.jtheque.primary.controller.able.IBorrowerController; |
21 | |
import org.jtheque.primary.controller.able.ICountryController; |
22 | |
import org.jtheque.primary.controller.able.IKindController; |
23 | |
import org.jtheque.primary.controller.able.ILanguageController; |
24 | |
import org.jtheque.primary.controller.able.ISagaController; |
25 | |
import org.jtheque.primary.controller.able.ITypeController; |
26 | |
import org.jtheque.primary.od.able.Country; |
27 | |
import org.jtheque.primary.od.able.Kind; |
28 | |
import org.jtheque.primary.od.able.Language; |
29 | |
import org.jtheque.primary.od.able.Person; |
30 | |
import org.jtheque.primary.od.able.Saga; |
31 | |
import org.jtheque.primary.od.able.Type; |
32 | |
import org.jtheque.primary.services.able.ICountriesService; |
33 | |
import org.jtheque.primary.services.able.IKindsService; |
34 | |
import org.jtheque.primary.services.able.ILanguagesService; |
35 | |
import org.jtheque.primary.services.able.ISagasService; |
36 | |
import org.jtheque.primary.services.able.ITypesService; |
37 | |
import org.jtheque.primary.view.impl.choice.AbstractChoiceAction; |
38 | |
|
39 | |
import javax.annotation.Resource; |
40 | |
|
41 | |
|
42 | |
|
43 | |
|
44 | |
|
45 | |
|
46 | 0 | public final class ModifyChoiceAction extends AbstractChoiceAction { |
47 | |
@Resource |
48 | |
private IKindController kindController; |
49 | |
|
50 | |
@Resource |
51 | |
private ITypeController typeController; |
52 | |
|
53 | |
@Resource |
54 | |
private ILanguageController languageController; |
55 | |
|
56 | |
@Resource |
57 | |
private ICountryController countryController; |
58 | |
|
59 | |
@Resource |
60 | |
private IBorrowerController borrowerController; |
61 | |
|
62 | |
@Resource |
63 | |
private ISagaController sagaController; |
64 | |
|
65 | |
@Override |
66 | |
public boolean canDoAction(String action) { |
67 | 0 | return "edit".equals(action); |
68 | |
} |
69 | |
|
70 | |
@Override |
71 | |
public void execute() { |
72 | 0 | if (IKindsService.DATA_TYPE.equals(getContent())) { |
73 | 0 | kindController.editKind((Kind) getSelectedItem()); |
74 | 0 | } else if (ITypesService.DATA_TYPE.equals(getContent())) { |
75 | 0 | typeController.editType((Type) getSelectedItem()); |
76 | 0 | } else if (ILanguagesService.DATA_TYPE.equals(getContent())) { |
77 | 0 | languageController.editLanguage((Language) getSelectedItem()); |
78 | 0 | } else if (ICountriesService.DATA_TYPE.equals(getContent())) { |
79 | 0 | countryController.editCountry((Country) getSelectedItem()); |
80 | 0 | } else if (Constants.BORROWERS.equals(getContent())) { |
81 | 0 | borrowerController.editBorrower((Person) getSelectedItem()); |
82 | 0 | } else if (ISagasService.DATA_TYPE.equals(getContent())) { |
83 | 0 | sagaController.editSaga((Saga) getSelectedItem()); |
84 | |
} |
85 | 0 | } |
86 | |
} |