Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
ModifyChoiceActionUtils |
|
| 7.0;7 |
1 | package org.jtheque.primary.view.impl.choice; | |
2 | ||
3 | import org.jtheque.core.utils.CoreUtils; | |
4 | import org.jtheque.primary.PrimaryConstants; | |
5 | import org.jtheque.primary.controller.able.IBorrowerController; | |
6 | import org.jtheque.primary.controller.able.ISimpleController; | |
7 | import org.jtheque.primary.od.able.Person; | |
8 | import org.jtheque.primary.od.able.SimpleData; | |
9 | ||
10 | /* | |
11 | * This file is part of JTheque. | |
12 | * | |
13 | * JTheque is free software: you can redistribute it and/or modify | |
14 | * it under the terms of the GNU General Public License as published by | |
15 | * the Free Software Foundation, either version 3 of the License. | |
16 | * | |
17 | * JTheque is distributed in the hope that it will be useful, | |
18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
20 | * GNU General Public License for more details. | |
21 | * | |
22 | * You should have received a copy of the GNU General Public License | |
23 | * along with JTheque. If not, see <http://www.gnu.org/licenses/>. | |
24 | */ | |
25 | ||
26 | /** | |
27 | * An utility class for modify choice actions. | |
28 | * | |
29 | * @author Baptiste Wicht | |
30 | */ | |
31 | public final class ModifyChoiceActionUtils { | |
32 | /** | |
33 | * Utility class, not instanciable. | |
34 | */ | |
35 | private ModifyChoiceActionUtils(){ | |
36 | 0 | super(); |
37 | 0 | } |
38 | ||
39 | /** | |
40 | * Execute the action for the datas of the primary utils. | |
41 | * | |
42 | * @param item The item to execute the action on. | |
43 | * @param content The current content. | |
44 | * | |
45 | * @return <code>true</code> if the primary choice action can execute this action on this | |
46 | * content else <code>false</code>. | |
47 | */ | |
48 | public static boolean execute(Object item, String content) { | |
49 | 0 | if (SimpleData.DataType.KIND.getDataType().equals(content)){ |
50 | 0 | CoreUtils.<ISimpleController>getBean("kindController").edit((SimpleData) item); |
51 | ||
52 | 0 | return true; |
53 | 0 | } else if (SimpleData.DataType.TYPE.getDataType().equals(content)) { |
54 | 0 | CoreUtils.<ISimpleController>getBean("typeController").edit((SimpleData) item); |
55 | ||
56 | 0 | return true; |
57 | 0 | } else if (SimpleData.DataType.LANGUAGE.getDataType().equals(content)) { |
58 | 0 | CoreUtils.<ISimpleController>getBean("languageController").edit((SimpleData) item); |
59 | ||
60 | 0 | return true; |
61 | 0 | } else if (SimpleData.DataType.COUNTRY.getDataType().equals(content)) { |
62 | 0 | CoreUtils.<ISimpleController>getBean("countryController").edit((SimpleData) item); |
63 | ||
64 | 0 | return true; |
65 | 0 | } else if (PrimaryConstants.BORROWERS.equals(content)) { |
66 | 0 | CoreUtils.<IBorrowerController>getBean("borrowerController").editBorrower((Person) item); |
67 | ||
68 | 0 | return true; |
69 | 0 | } else if (SimpleData.DataType.SAGA.getDataType().equals(content)) { |
70 | 0 | CoreUtils.<ISimpleController>getBean("sagaController").edit((SimpleData) item); |
71 | ||
72 | 0 | return true; |
73 | } | |
74 | ||
75 | 0 | return false; |
76 | } | |
77 | } |