Coverage report

  %line %branch
be.dvw.administration.mvc.taglibs.SummaryTag
0% 
0% 

 1  
 package be.dvw.administration.mvc.taglibs;
 2  
 
 3  
 import org.apache.commons.logging.Log;
 4  
 import org.apache.commons.logging.LogFactory;
 5  
 import org.dom4j.io.OutputFormat;
 6  
 import org.dom4j.io.XMLWriter;
 7  
 import org.dom4j.DocumentException;
 8  
 
 9  
 import javax.servlet.jsp.JspException;
 10  
 import javax.servlet.jsp.JspWriter;
 11  
 import javax.servlet.jsp.tagext.BodyTagSupport;
 12  
 import javax.xml.transform.TransformerException;
 13  
 
 14  
 import be.dvw.administration.mvc.navigation.LeftMenu;
 15  
 import be.dvw.administration.mvc.navigation.LeftMenuXSLTImpl;
 16  
 import be.dvw.administration.services.scores.ScoreService;
 17  
 import be.dvw.administration.services.scores.ScoreServiceCastorImpl;
 18  
 import be.dvw.administration.services.instruments.InstrumentService;
 19  
 import be.dvw.administration.services.instruments.InstrumentServiceCastorImpl;
 20  
 import be.dvw.administration.Constants;
 21  
 
 22  
 import java.io.UnsupportedEncodingException;
 23  
 import java.io.IOException;
 24  
 import java.io.Writer;
 25  
 
 26  
 /**
 27  
  * Created by IntelliJ IDEA.
 28  
  * User: Toon.Timbermont
 29  
  * Date: Jul 30, 2005
 30  
  * Time: 4:57:00 PM
 31  
  * To change this template use File | Settings | File Templates.
 32  
  */
 33  0
 public class SummaryTag extends BodyTagSupport {
 34  
 
 35  0
     private static Log LOG = LogFactory.getLog(SummaryTag.class);
 36  
     private String page;
 37  
     private JspWriter out;
 38  
 
 39  
     public int doStartTag() throws JspException {
 40  
 
 41  0
         LOG.debug("Executing the SummaryTag for page " + page);
 42  
 
 43  
         try {
 44  0
             out = pageContext.getOut();
 45  
 
 46  0
             if ( Constants.SCORE_PAGE.equals(page) )
 47  0
                 out.println(getScoresSummary());
 48  0
             if ( Constants.INSTRUMENT_PAGE.equals(page))
 49  0
                 out.println(getInstrumentSummary());
 50  0
 			if ( Constants.PERSON_PAGE.equals(page) )
 51  0
 				out.println(getPersonSummary());
 52  
 
 53  0
         } catch (IOException e) {
 54  0
             LOG.error("Exception", e);
 55  0
         }
 56  
 
 57  0
         return SKIP_BODY;
 58  
     }
 59  
 
 60  
 
 61  
     /**
 62  
      * Method giving the scores summary
 63  
      * @return the phrase containing the key information about the scores.
 64  
      * TODO make this phrase template & Il8N based
 65  
      */
 66  
     private String getScoresSummary()
 67  
     {
 68  0
         ScoreService scoreService = new ScoreServiceCastorImpl();
 69  0
         StringBuffer strb = new StringBuffer();
 70  0
         strb.append("Bibliotheek bevat ");
 71  0
         strb.append(scoreService.getTotalNumber());
 72  0
         strb.append(" titels met een huidige waarde van ");
 73  0
         strb.append(scoreService.getCurrentValue());
 74  0
         strb.append(" €");
 75  
 
 76  0
         LOG.debug("Generated summary for scores");
 77  0
         return strb.toString();
 78  
     }
 79  
 
 80  
     /**
 81  
      * Method giving the Instrument summary
 82  
      * @return the phrase containing the key information about the instruments.
 83  
      * TODO make this phrase template & Il8N based
 84  
      */
 85  
     private String getInstrumentSummary()
 86  
     {
 87  0
         InstrumentService instrumentService = new InstrumentServiceCastorImpl();
 88  0
         StringBuffer strb = new StringBuffer();
 89  0
         strb.append("Instrumentarium bevat ");
 90  0
         strb.append(instrumentService.getTotalNumber());
 91  0
         strb.append(" instrumenten met een huidige waarde van ");
 92  0
         strb.append(instrumentService.getCurrentValue());
 93  0
         strb.append(" €");
 94  0
         LOG.debug("Generated summary for instruments");
 95  0
         return strb.toString();
 96  
     }
 97  
 
 98  
 	private String getPersonSummary()
 99  
 	{
 100  0
 		return "Er zijn 214 personen waarvan 103 leden en 35 muzikanten opgeslaan";
 101  
 	}
 102  
 
 103  
 
 104  
 
 105  
 
 106  
 
 107  
 
 108  
 
 109  
 
 110  
     /**
 111  
      * Code executed when the tag reaches its end
 112  
      * @return EVAL_PAGE : the rest of the page must be evaluated as well
 113  
      * @throws JspException
 114  
      */
 115  
     public int doEndTag() throws JspException {
 116  0
         return EVAL_PAGE;
 117  
     }
 118  
 
 119  
     public String getPage() {
 120  0
         return page;
 121  
     }
 122  
 
 123  
     public void setPage(String page) {
 124  0
         this.page = page;
 125  0
     }
 126  
 }

This report is generated by jcoverage, Maven and Maven JCoverage Plugin.