Coverage Report - org.paneris.jammyjoes.mvp.HitsSelection
 
Classes in this File Line Coverage Branch Coverage Complexity
HitsSelection
0%
0/15
0%
0/6
2.5
 
 1  
 package org.paneris.jammyjoes.mvp;
 2  
 
 3  
 import java.util.Date;
 4  
 import java.util.Enumeration;
 5  
 
 6  
 import org.melati.poem.Table;
 7  
 import org.paneris.jammyjoes.model.Affiliate;
 8  
 import org.paneris.jammyjoes.util.JammyJoesUtil;
 9  
 
 10  
 public class HitsSelection implements Selection {
 11  
 
 12  
   private Table _hits;
 13  
   private Affiliate _affiliate;
 14  
   private Date _startDate;
 15  
   private final Date endDate;
 16  
 
 17  0
   public HitsSelection(Table hits, Affiliate affiliate, Date startDate, Date endDate) {
 18  0
     _hits = hits;
 19  0
     _affiliate = affiliate;
 20  0
     _startDate = startDate;
 21  0
     this.endDate = endDate;
 22  0
   }
 23  
 
 24  
   public void visitEach(Command command) {
 25  0
     String selection = "affiliate="+ _affiliate.getTroid();
 26  0
     if (_startDate != null) {
 27  0
       selection += " and hit >= " + JammyJoesUtil.formatDateForPostgresSQL(_startDate);
 28  
     }
 29  0
     if (endDate != null) {
 30  0
       selection += " and hit < " + JammyJoesUtil.formatDateForPostgresSQL(endDate);
 31  
     }
 32  0
     Enumeration enumeration = _hits.selection(selection);
 33  0
     while (enumeration.hasMoreElements()) {
 34  0
       command.visit(enumeration.nextElement());
 35  
     }
 36  
 
 37  0
   }
 38  
 }