Coverage Report - org.jtheque.films.utils.ReportUtils
 
Classes in this File Line Coverage Branch Coverage Complexity
ReportUtils
0 %
0/13
N/A
1
 
 1  
 package org.jtheque.films.utils;
 2  
 
 3  
 import net.sf.jasperreports.engine.JRException;
 4  
 import net.sf.jasperreports.engine.JasperFillManager;
 5  
 import net.sf.jasperreports.engine.JasperPrint;
 6  
 import net.sf.jasperreports.engine.JasperReport;
 7  
 import org.jtheque.core.managers.Managers;
 8  
 import org.jtheque.core.managers.language.ILanguageManager;
 9  
 import org.jtheque.films.services.impl.utils.file.exports.datasources.FilmsDatasource;
 10  
 import org.jtheque.films.utils.Constants.Properties.Film;
 11  
 import org.jtheque.films.utils.Constants.Properties.Form001;
 12  
 import org.jtheque.films.utils.Constants.Report.Form001_Parameters;
 13  
 
 14  
 import java.util.Collection;
 15  
 import java.util.HashMap;
 16  
 import java.util.Map;
 17  
 
 18  
 /*
 19  
  * This file is part of JTheque.
 20  
  *
 21  
  * JTheque is free software: you can redistribute it and/or modify
 22  
  * it under the terms of the GNU General Public License as published by
 23  
  * the Free Software Foundation, either version 3 of the License.
 24  
  *
 25  
  * JTheque is distributed in the hope that it will be useful,
 26  
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
 27  
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 28  
  * GNU General Public License for more details.
 29  
  *
 30  
  * You should have received a copy of the GNU General Public License
 31  
  * along with JTheque.  If not, see <http://www.gnu.org/licenses/>.
 32  
  */
 33  
 
 34  
 /**
 35  
  * Utility class for the report generation.
 36  
  *
 37  
  * @author Baptiste Wicht
 38  
  */
 39  
 public final class ReportUtils {
 40  
     /**
 41  
      * Construct a new ReportUtils. This class isn't instanciable.
 42  
      */
 43  
     private ReportUtils() {
 44  0
         super();
 45  0
     }
 46  
 
 47  
     /**
 48  
      * Configure the Form001.
 49  
      *
 50  
      * @param jasperReport The report.
 51  
      * @param films        The films to include.
 52  
      * @return The jasper print.
 53  
      * @throws JRException Jasper could throw this exception.
 54  
      */
 55  
     public static JasperPrint configureForm001(JasperReport jasperReport, Collection<org.jtheque.films.persistence.od.able.Film> films) throws JRException {
 56  0
         Map<String, String> parameters = new HashMap<String, String>(9);
 57  0
         parameters.put(Form001_Parameters.TITLE, Managers.getManager(ILanguageManager.class).getMessage(Form001.TITLE));
 58  0
         parameters.put(Form001_Parameters.KIND, Managers.getManager(ILanguageManager.class).getMessage(Film.KIND));
 59  0
         parameters.put(Form001_Parameters.FILM, Managers.getManager(ILanguageManager.class).getMessage(Film.TITLE));
 60  0
         parameters.put(Form001_Parameters.TYPE, Managers.getManager(ILanguageManager.class).getMessage(Film.TYPE));
 61  0
         parameters.put(Form001_Parameters.REALIZER, Managers.getManager(ILanguageManager.class).getMessage(Film.REALIZER));
 62  0
         parameters.put(Form001_Parameters.YEAR, Managers.getManager(ILanguageManager.class).getMessage(Film.YEAR));
 63  0
         parameters.put(Form001_Parameters.DURATION, Managers.getManager(ILanguageManager.class).getMessage(Film.DURATION));
 64  0
         parameters.put(Form001_Parameters.LANGUAGE, Managers.getManager(ILanguageManager.class).getMessage(Film.LANGUAGE));
 65  0
         parameters.put(Form001_Parameters.ACTORS, Managers.getManager(ILanguageManager.class).getMessage(Film.ACTORS));
 66  
 
 67  0
         return JasperFillManager.fillReport(jasperReport, parameters, new FilmsDatasource(films));
 68  
     }
 69  
 }