Coverage Report - org.kuali.student.core.atp.dao.impl.AtpDaoImpl
 
Classes in this File Line Coverage Branch Coverage Complexity
AtpDaoImpl
100%
46/46
N/A
1
 
 1  
 /**
 2  
  * Copyright 2010 The Kuali Foundation Licensed under the
 3  
  * Educational Community License, Version 2.0 (the "License"); you may
 4  
  * not use this file except in compliance with the License. You may
 5  
  * obtain a copy of the License at
 6  
  *
 7  
  * http://www.osedu.org/licenses/ECL-2.0
 8  
  *
 9  
  * Unless required by applicable law or agreed to in writing,
 10  
  * software distributed under the License is distributed on an "AS IS"
 11  
  * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
 12  
  * or implied. See the License for the specific language governing
 13  
  * permissions and limitations under the License.
 14  
  */
 15  
 
 16  
 package org.kuali.student.core.atp.dao.impl;
 17  
 
 18  
 import java.util.Date;
 19  
 import java.util.List;
 20  
 
 21  
 import javax.persistence.EntityManager;
 22  
 import javax.persistence.PersistenceContext;
 23  
 import javax.persistence.Query;
 24  
 
 25  
 import org.kuali.student.core.atp.dao.AtpDao;
 26  
 import org.kuali.student.core.atp.entity.Atp;
 27  
 import org.kuali.student.core.atp.entity.DateRange;
 28  
 import org.kuali.student.core.atp.entity.DateRangeType;
 29  
 import org.kuali.student.core.atp.entity.Milestone;
 30  
 import org.kuali.student.core.atp.entity.MilestoneType;
 31  
 import org.kuali.student.core.dao.impl.AbstractSearchableCrudDaoImpl;
 32  
 
 33  2
 public class AtpDaoImpl extends AbstractSearchableCrudDaoImpl implements AtpDao {
 34  
 
 35  
         @PersistenceContext(unitName = "Atp")
 36  
         @Override
 37  
         public void setEm(EntityManager em) {
 38  1
                 super.setEm(em);
 39  1
         }
 40  
 
 41  
         @Override
 42  
         public List<Atp> findAtpsByAtpType(String atpTypeId) {
 43  
                 
 44  1
                 Query q = em.createNamedQuery("Atp.findAtpsByAtpType");
 45  1
                 q.setParameter("atpTypeId", atpTypeId);
 46  
                 
 47  
                 @SuppressWarnings("unchecked")
 48  1
                 List<Atp> results = q.getResultList(); 
 49  1
                 return results;
 50  
         }
 51  
 
 52  
         
 53  
         @Override
 54  
         public List<Atp> findAtpsByDate(Date searchDate) {
 55  
                 
 56  1
                 Query q = em.createNamedQuery("Atp.findAtpsByDate");
 57  1
                 q.setParameter("searchDate", searchDate);
 58  
                 
 59  
                 @SuppressWarnings("unchecked")
 60  1
                 List<Atp> results = q.getResultList(); 
 61  1
                 return results;
 62  
         }
 63  
         
 64  
         @Override
 65  
         public List<Atp> findAtpsByDates(Date startDate, Date endDate) {
 66  1
                 Query q = em.createNamedQuery("Atp.findAtpsByDates");
 67  1
                 q.setParameter("startDate", startDate);
 68  1
                 q.setParameter("endDate", endDate);
 69  
                 
 70  
                 @SuppressWarnings("unchecked")
 71  1
                 List<Atp> results = q.getResultList(); 
 72  1
                 return results;
 73  
         }
 74  
 
 75  
         @Override
 76  
         public List<DateRange> findDateRangesByAtp(String atpId) {
 77  
                 
 78  1
                 Query q = em.createNamedQuery("DateRange.findDateRangesByAtp");
 79  1
                 q.setParameter("atpId", atpId);
 80  
                 
 81  
                 @SuppressWarnings("unchecked")
 82  1
                 List<DateRange> results = q.getResultList(); 
 83  1
                 return results;
 84  
         }
 85  
 
 86  
         @SuppressWarnings("unchecked")
 87  
         @Override
 88  
         public List<DateRange> findDateRangesByDate(Date searchDate) {
 89  
                 
 90  1
                 Query q = em.createNamedQuery("DateRange.findDateRangesByDate");
 91  
                 
 92  1
                 q.setParameter("searchDate", searchDate);
 93  
                 
 94  1
                 return q.getResultList();
 95  
         }
 96  
 
 97  
         @Override
 98  
         public List<MilestoneType> findMilestoneTypesForAtpType(String atpTypeId) {
 99  
                 
 100  1
                 Query q = em.createNamedQuery("MilestoneType.findMilestoneTypesForAtpType");
 101  1
                 q.setParameter("atpTypeId", atpTypeId);
 102  
                 
 103  
                 @SuppressWarnings("unchecked")
 104  1
                 List<MilestoneType> results = q.getResultList(); 
 105  1
                 return results;
 106  
         }
 107  
 
 108  
         @Override
 109  
         public List<DateRangeType> findDateRangeTypesForAtpType(String atpTypeId) {
 110  
                 
 111  1
                 Query q = em.createNamedQuery("DateRangeType.findDateRangeTypesForAtpType");
 112  1
                 q.setParameter("atpTypeId", atpTypeId);
 113  
                 
 114  
                 @SuppressWarnings("unchecked")
 115  1
                 List<DateRangeType> results = q.getResultList(); 
 116  1
                 return results;
 117  
         }
 118  
         
 119  
         @Override
 120  
         public List<Milestone> findMilestonesByAtp(String atpId) {
 121  
                 
 122  1
                 Query q = em.createNamedQuery("Milestone.findMilestonesByAtp");
 123  1
                 q.setParameter("atpId", atpId);
 124  
                 
 125  
                 @SuppressWarnings("unchecked")
 126  1
                 List<Milestone> results = q.getResultList(); 
 127  1
                 return results;
 128  
         }
 129  
 
 130  
         @Override
 131  
         public List<Milestone> findMilestonesByDates(Date startDate, Date endDate) {
 132  1
                 Query q = em.createNamedQuery("Milestone.findMilestonesByDates");
 133  
 
 134  1
                 q.setParameter("startDate", startDate);
 135  1
                 q.setParameter("endDate", endDate);
 136  
                 
 137  
                 @SuppressWarnings("unchecked")
 138  1
                 List<Milestone> results = q.getResultList(); 
 139  1
                 return results;
 140  
         }
 141  
 
 142  
         @Override
 143  
         public List<Milestone> findMilestonesByDatesAndType(
 144  
                         String milestoneTypeId, Date startDate, Date endDate) {
 145  1
                 Query q = em.createNamedQuery("Milestone.findMilestonesByDatesAndType");
 146  
                 
 147  1
                 q.setParameter("milestoneTypeId", milestoneTypeId);
 148  1
                 q.setParameter("startDate", startDate);
 149  1
                 q.setParameter("endDate", endDate);
 150  
                 
 151  
                 @SuppressWarnings("unchecked")
 152  1
                 List<Milestone> results = q.getResultList(); 
 153  1
                 return results;
 154  
         }
 155  
 
 156  
 }