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.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 | 0 | public class AtpDaoImpl extends AbstractSearchableCrudDaoImpl implements AtpDao { |
34 | |
|
35 | |
@PersistenceContext(unitName = "Atp") |
36 | |
@Override |
37 | |
public void setEm(EntityManager em) { |
38 | 0 | super.setEm(em); |
39 | 0 | } |
40 | |
|
41 | |
@Override |
42 | |
public List<Atp> findAtpsByAtpType(String atpTypeId) { |
43 | |
|
44 | 0 | Query q = em.createNamedQuery("Atp.findAtpsByAtpType"); |
45 | 0 | q.setParameter("atpTypeId", atpTypeId); |
46 | |
|
47 | |
@SuppressWarnings("unchecked") |
48 | 0 | List<Atp> results = q.getResultList(); |
49 | 0 | return results; |
50 | |
} |
51 | |
|
52 | |
|
53 | |
@Override |
54 | |
public List<Atp> findAtpsByDate(Date searchDate) { |
55 | |
|
56 | 0 | Query q = em.createNamedQuery("Atp.findAtpsByDate"); |
57 | 0 | q.setParameter("searchDate", searchDate); |
58 | |
|
59 | |
@SuppressWarnings("unchecked") |
60 | 0 | List<Atp> results = q.getResultList(); |
61 | 0 | return results; |
62 | |
} |
63 | |
|
64 | |
@Override |
65 | |
public List<Atp> findAtpsByDates(Date startDate, Date endDate) { |
66 | 0 | Query q = em.createNamedQuery("Atp.findAtpsByDates"); |
67 | 0 | q.setParameter("startDate", startDate); |
68 | 0 | q.setParameter("endDate", endDate); |
69 | |
|
70 | |
@SuppressWarnings("unchecked") |
71 | 0 | List<Atp> results = q.getResultList(); |
72 | 0 | return results; |
73 | |
} |
74 | |
|
75 | |
@Override |
76 | |
public List<DateRange> findDateRangesByAtp(String atpId) { |
77 | |
|
78 | 0 | Query q = em.createNamedQuery("DateRange.findDateRangesByAtp"); |
79 | 0 | q.setParameter("atpId", atpId); |
80 | |
|
81 | |
@SuppressWarnings("unchecked") |
82 | 0 | List<DateRange> results = q.getResultList(); |
83 | 0 | return results; |
84 | |
} |
85 | |
|
86 | |
@SuppressWarnings("unchecked") |
87 | |
@Override |
88 | |
public List<DateRange> findDateRangesByDate(Date searchDate) { |
89 | |
|
90 | 0 | Query q = em.createNamedQuery("DateRange.findDateRangesByDate"); |
91 | |
|
92 | 0 | q.setParameter("searchDate", searchDate); |
93 | |
|
94 | 0 | return q.getResultList(); |
95 | |
} |
96 | |
|
97 | |
@Override |
98 | |
public List<MilestoneType> findMilestoneTypesForAtpType(String atpTypeId) { |
99 | |
|
100 | 0 | Query q = em.createNamedQuery("MilestoneType.findMilestoneTypesForAtpType"); |
101 | 0 | q.setParameter("atpTypeId", atpTypeId); |
102 | |
|
103 | |
@SuppressWarnings("unchecked") |
104 | 0 | List<MilestoneType> results = q.getResultList(); |
105 | 0 | return results; |
106 | |
} |
107 | |
|
108 | |
@Override |
109 | |
public List<DateRangeType> findDateRangeTypesForAtpType(String atpTypeId) { |
110 | |
|
111 | 0 | Query q = em.createNamedQuery("DateRangeType.findDateRangeTypesForAtpType"); |
112 | 0 | q.setParameter("atpTypeId", atpTypeId); |
113 | |
|
114 | |
@SuppressWarnings("unchecked") |
115 | 0 | List<DateRangeType> results = q.getResultList(); |
116 | 0 | return results; |
117 | |
} |
118 | |
|
119 | |
@Override |
120 | |
public List<Milestone> findMilestonesByAtp(String atpId) { |
121 | |
|
122 | 0 | Query q = em.createNamedQuery("Milestone.findMilestonesByAtp"); |
123 | 0 | q.setParameter("atpId", atpId); |
124 | |
|
125 | |
@SuppressWarnings("unchecked") |
126 | 0 | List<Milestone> results = q.getResultList(); |
127 | 0 | return results; |
128 | |
} |
129 | |
|
130 | |
@Override |
131 | |
public List<Milestone> findMilestonesByDates(Date startDate, Date endDate) { |
132 | 0 | Query q = em.createNamedQuery("Milestone.findMilestonesByDates"); |
133 | |
|
134 | 0 | q.setParameter("startDate", startDate); |
135 | 0 | q.setParameter("endDate", endDate); |
136 | |
|
137 | |
@SuppressWarnings("unchecked") |
138 | 0 | List<Milestone> results = q.getResultList(); |
139 | 0 | return results; |
140 | |
} |
141 | |
|
142 | |
@Override |
143 | |
public List<Milestone> findMilestonesByDatesAndType( |
144 | |
String milestoneTypeId, Date startDate, Date endDate) { |
145 | 0 | Query q = em.createNamedQuery("Milestone.findMilestonesByDatesAndType"); |
146 | |
|
147 | 0 | q.setParameter("milestoneTypeId", milestoneTypeId); |
148 | 0 | q.setParameter("startDate", startDate); |
149 | 0 | q.setParameter("endDate", endDate); |
150 | |
|
151 | |
@SuppressWarnings("unchecked") |
152 | 0 | List<Milestone> results = q.getResultList(); |
153 | 0 | return results; |
154 | |
} |
155 | |
|
156 | |
} |