1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
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.common.dao.impl.AbstractSearchableCrudDaoImpl; |
26 | |
import org.kuali.student.core.atp.dao.AtpDao; |
27 | |
import org.kuali.student.core.atp.entity.Atp; |
28 | |
import org.kuali.student.core.atp.entity.DateRange; |
29 | |
import org.kuali.student.core.atp.entity.DateRangeType; |
30 | |
import org.kuali.student.core.atp.entity.Milestone; |
31 | |
import org.kuali.student.core.atp.entity.MilestoneType; |
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 | |
} |