Coverage Report - org.jtheque.films.view.impl.choiceActions.ReturnChoiceAction
 
Classes in this File Line Coverage Branch Coverage Complexity
ReturnChoiceAction
0 %
0/6
0 %
0/2
1.5
 
 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.persistence.od.able.Film;
 20  
 import org.jtheque.primary.services.able.ILendingsService;
 21  
 import org.jtheque.primary.view.impl.choice.AbstractChoiceAction;
 22  
 
 23  
 import javax.annotation.Resource;
 24  
 
 25  
 /**
 26  
  * An action to return a film.
 27  
  *
 28  
  * @author Baptiste Wicht
 29  
  */
 30  0
 public final class ReturnChoiceAction extends AbstractChoiceAction {
 31  
     @Resource
 32  
     private ILendingsService lendingsService;
 33  
 
 34  
     @Override
 35  
     public boolean canDoAction(String action) {
 36  0
         return "return".equals(action);
 37  
     }
 38  
 
 39  
     @Override
 40  
     public void execute() {
 41  0
         Film film = (Film) getSelectedItem();
 42  
 
 43  0
         if (film.getTheLending() != null) {
 44  0
             lendingsService.delete(film.getTheLending());
 45  
         }
 46  0
     }
 47  
 }