Coverage Report - org.jtheque.films.view.impl.choiceActions.ModifyChoiceAction
 
Classes in this File Line Coverage Branch Coverage Complexity
ModifyChoiceAction
0 %
0/15
0 %
0/12
4
 
 1  
 package org.jtheque.films.view.impl.choiceActions;
 2  
 
 3  
 /*
 4  
  * This file is part of JTheque.
 5  
  *
 6  
  * JTheque is free software: you can redistribute it and/or modify
 7  
  * it under the terms of the GNU General Public License as published by
 8  
  * the Free Software Foundation, either version 3 of the License.
 9  
  *
 10  
  * JTheque is distributed in the hope that it will be useful,
 11  
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
 12  
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 13  
  * GNU General Public License for more details.
 14  
  *
 15  
  * You should have received a copy of the GNU General Public License
 16  
  * along with JTheque.  If not, see <http://www.gnu.org/licenses/>.
 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  
  * An action to modify the selected item.
 43  
  *
 44  
  * @author Baptiste Wicht
 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  
 }