1 | |
package org.kuali.student.r2.core.class1.atp.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.dao.GenericEntityDao; |
9 | |
import org.kuali.student.r2.core.class1.atp.model.AtpEntity; |
10 | |
|
11 | 0 | public class AtpDao extends GenericEntityDao<AtpEntity> { |
12 | |
|
13 | |
@SuppressWarnings("unchecked") |
14 | |
public List<AtpEntity> getByAtpTypeId(String atpType) { |
15 | 0 | return em.createQuery("from AtpEntity a where a.atpType=:atpType").setParameter("atpType", atpType) |
16 | |
.getResultList(); |
17 | |
} |
18 | |
|
19 | |
public List<AtpEntity> getByDate(Date searchDate) { |
20 | 0 | return em.createQuery("from AtpEntity a where :searchDate between a.startDate and a.endDate") |
21 | |
.setParameter("searchDate", searchDate, DATE).getResultList(); |
22 | |
} |
23 | |
|
24 | |
public List<AtpEntity> getByDates(Date startDate, Date endDate) { |
25 | 0 | return em.createQuery("from AtpEntity a where a.startDate >= :startDate and a.endDate <= :endDate") |
26 | |
.setParameter("startDate", startDate, DATE).setParameter("endDate", endDate).getResultList(); |
27 | |
} |
28 | |
|
29 | |
public List<AtpEntity> getByStartDateRange(Date searchDateRangeStart, Date searchDateRangeEnd) { |
30 | 0 | return em |
31 | |
.createQuery( |
32 | |
"from AtpEntity a where (a.startDate between :searchDateRangeStart and :searchDateRangeEnd)") |
33 | |
.setParameter("searchDateRangeStart", searchDateRangeStart, DATE) |
34 | |
.setParameter("searchDateRangeEnd", searchDateRangeEnd, DATE) |
35 | |
.getResultList(); |
36 | |
} |
37 | |
|
38 | |
public List<AtpEntity> getByStartDateRangeAndType(Date searchDateRangeStart, Date searchDateRangeEnd, |
39 | |
String searchType) { |
40 | 0 | return em |
41 | |
.createQuery( |
42 | |
"from AtpEntity a where (a.startDate between :searchDateRangeStart and :searchDateRangeEnd) and (a.atpType = :searchType)") |
43 | |
.setParameter("searchDateRangeStart", searchDateRangeStart, DATE) |
44 | |
.setParameter("searchDateRangeEnd", searchDateRangeEnd, DATE) |
45 | |
.setParameter("searchType", searchType) |
46 | |
.getResultList(); |
47 | |
} |
48 | |
} |