Coverage Report - org.kuali.student.enrollment.class1.lpr.dao.LprTransactionDao
 
Classes in this File Line Coverage Branch Coverage Complexity
LprTransactionDao
0%
0/8
0%
0/2
1.25
 
 1  
 package org.kuali.student.enrollment.class1.lpr.dao;
 2  
 
 3  
 import static javax.persistence.TemporalType.DATE;
 4  
 
 5  
 import java.util.Date;
 6  
 import java.util.List;
 7  
 
 8  
 import org.kuali.student.enrollment.class1.lpr.model.LprTransactionEntity;
 9  
 import org.kuali.student.enrollment.dao.GenericEntityDao;
 10  
 import org.kuali.student.enrollment.lpr.dto.LprTransactionInfo;
 11  
 import org.kuali.student.r2.common.exceptions.DoesNotExistException;
 12  
 
 13  0
 public class LprTransactionDao extends GenericEntityDao<LprTransactionEntity> {
 14  
 
 15  
     public List<LprTransactionEntity> getByDate(Date searchDate) {
 16  0
         return em.createQuery("from AtpEntity a where :searchDate between a.startDate and a.endDate")
 17  
                 .setParameter("searchDate", searchDate, DATE).getResultList();
 18  
     }
 19  
 
 20  
     public List<LprTransactionEntity> getByDates(Date startDate, Date endDate) {
 21  0
         return em.createQuery("from AtpEntity a where a.startDate >= :startDate and a.endDate <= :endDate")
 22  
                 .setParameter("startDate", startDate, DATE).setParameter("endDate", endDate).getResultList();
 23  
     }
 24  
     public LprTransactionEntity getByLprTransactionItemId(String lprTransactionItemId) {
 25  0
         return (LprTransactionEntity) ( em.createQuery("select distinct a from LprTransactionEntity a, IN (a.lprTransactionItems) item where item.id=:lprTransactionItemId")
 26  
                 .setParameter("lprTransactionItemId", lprTransactionItemId).getSingleResult()) ;
 27  
     }
 28  
 
 29  
     /**
 30  
      * Merge the provided info object into the lpr object loaded from the database.
 31  
      * 
 32  
      * @param lprId
 33  
      * @param info
 34  
      * @return
 35  
      * @throws DoesNotExistException 
 36  
      */
 37  
     public void mergeFromDto(LprTransactionEntity entity, LprTransactionInfo info) throws DoesNotExistException {
 38  
             
 39  0
             List<Object> orphanedData = entity.fromDto(info);
 40  
             
 41  0
             for (Object orphan : orphanedData) {
 42  
                         
 43  0
                     em.remove(orphan);
 44  
                 }
 45  
             
 46  0
     }
 47  
 }