Coverage report

  %line %branch
be.dvw.administration.services.scores.ScoreServiceCastorImpl
56% 
100% 

 1  
 package be.dvw.administration.services.scores;
 2  
 
 3  
 import org.exolab.castor.xml.Unmarshaller;
 4  
 import org.exolab.castor.xml.MarshalException;
 5  
 import org.exolab.castor.xml.ValidationException;
 6  
 import org.exolab.castor.xml.Marshaller;
 7  
 import org.apache.commons.logging.Log;
 8  
 import org.apache.commons.logging.LogFactory;
 9  
 
 10  
 import java.util.List;
 11  
 import java.util.Vector;
 12  
 import java.io.*;
 13  
 
 14  
 import be.dvw.administration.model.Score;
 15  
 import be.dvw.administration.mvc.actions.ScoreAction;
 16  
 import be.dvw.administration.util.FileUtils;
 17  
 import be.dvw.administration.services.scores.ScoreService;
 18  
 
 19  
 /**
 20  
  * User: Toon
 21  
  * Date: 4-jul-2005
 22  
  * Time: 19:31:26
 23  
  */
 24  18
 public class ScoreServiceCastorImpl implements ScoreService
 25  
 {
 26  
 
 27  24
     private static Log LOG = LogFactory.getLog(ScoreServiceCastorImpl.class);
 28  
 
 29  
     public List getAll()
 30  
             throws Exception
 31  
     {
 32  
         try
 33  
         {
 34  6
             LOG.debug("Getting all scores");
 35  
             // Create a Reader to the file to unmarshal from
 36  6
             InputStreamReader reader = FileUtils.getInputStreamReader("etc/partituurlijst-all.xml");
 37  
             // Marshal the person object
 38  6
             List list = (List)Unmarshaller.unmarshal(List.class, reader);
 39  6
             LOG.debug("Returning all scores");
 40  6
             return list;
 41  
         }
 42  0
         catch (Exception e)
 43  
         {
 44  0
             throw new Exception("STOP!!!", e);
 45  
         }
 46  
     }
 47  
 
 48  
     public Score load(int id) throws IOException, ValidationException, MarshalException
 49  
     {
 50  6
         LOG.debug("Loading partituur with id [" + id  + "]");
 51  
         // Create a Reader to the file to unmarshal from
 52  6
         String fileName = new StringBuffer ("etc/partituur_").append(id).append(".xml").toString();
 53  6
         InputStreamReader reader = FileUtils.getInputStreamReader(fileName);
 54  
         // Marshal the person object
 55  6
         Score p = (Score)Unmarshaller.unmarshal(Score.class, reader);
 56  6
         LOG.debug(new StringBuffer().
 57  
                 append("\n=========================\n").
 58  
                 append(p.toString()).
 59  
                 append("\n=========================\n loaded").toString());
 60  
 
 61  6
         return p;
 62  
     }
 63  
 
 64  
     public List search(String searchString) throws Exception {
 65  
         try
 66  
         {
 67  0
             LOG.debug("Getting all scores");
 68  
             // Create a Reader to the file to unmarshal from
 69  0
             InputStreamReader reader = FileUtils.getInputStreamReader("etc/partituurlijst-search.xml");
 70  
             // Marshal the list object
 71  0
             List list = (List) Unmarshaller.unmarshal(List.class, reader);
 72  0
             LOG.debug("Returning " + list.size() + " search results ");
 73  0
             return list;
 74  
         }
 75  0
         catch (Exception e)
 76  
         {
 77  0
             throw new Exception("STOP!!!", e);
 78  
         }
 79  
     }
 80  
 
 81  
     public float getPurchaseValue()
 82  
     {
 83  0
         return 1000;  //To change body of implemented methods use File | Settings | File Templates.
 84  
     }
 85  
 
 86  
     public int getTotalNumber() {
 87  0
         return 365;  //To change body of implemented methods use File | Settings | File Templates.
 88  
     }
 89  
 
 90  
     public float getCurrentValue() {
 91  0
         return 876;  //To change body of implemented methods use File | Settings | File Templates.
 92  
     }
 93  
 
 94  
     public Score save(Score score, boolean newScore)
 95  
             throws MarshalException, ValidationException, IOException
 96  
     {
 97  6
         LOG.debug("Creating new score? " + newScore);
 98  6
         LOG.debug(new StringBuffer().
 99  
                 append("\n=========================\n").
 100  
                 append(score.toString()).
 101  
                 append("\n=========================\n should be saved").toString());
 102  6
         if (newScore)
 103  6
             score.setId(1111);
 104  6
         return score;
 105  
     }
 106  
 
 107  
     public void delete(int id) throws Exception {
 108  0
         LOG.debug("Deleted score " + id);
 109  0
     }
 110  
 
 111  
 
 112  
 }

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