Coverage Report - org.jtheque.films.controllers.impl.LendingsController
 
Classes in this File Line Coverage Branch Coverage Complexity
LendingsController
0 %
0/7
0 %
0/2
1.5
 
 1  
 package org.jtheque.films.controllers.impl;
 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.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  
  * A lendings controller implementation.
 33  
  *
 34  
  * @author Baptiste Wicht
 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  
 }