1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.kpme.tklm.time.missedpunch.dao;
17
18 import java.util.ArrayList;
19 import java.util.List;
20
21 import org.apache.ojb.broker.query.Criteria;
22 import org.apache.ojb.broker.query.Query;
23 import org.apache.ojb.broker.query.QueryFactory;
24 import org.kuali.kpme.tklm.time.missedpunch.MissedPunch;
25 import org.kuali.kpme.tklm.time.missedpunch.MissedPunchDocument;
26 import org.kuali.rice.core.framework.persistence.ojb.dao.PlatformAwareDaoBaseOjb;
27
28 public class MissedPunchDaoOjbImpl extends PlatformAwareDaoBaseOjb implements MissedPunchDao {
29
30 @Override
31 public MissedPunchDocument getMissedPunchDocument(String tkMissedPunchId) {
32 Criteria root = new Criteria();
33 root.addEqualTo("tkMissedPunchId", tkMissedPunchId);
34 Query query = QueryFactory.newQuery(MissedPunchDocument.class, root);
35 return (MissedPunchDocument) getPersistenceBrokerTemplate().getObjectByQuery(query);
36 }
37
38 @Override
39 @SuppressWarnings("unchecked")
40 public List<MissedPunch> getMissedPunchesByTimesheetDocumentId(String timesheetDocumentId) {
41 List<MissedPunch> missedPunches = new ArrayList<MissedPunch>();
42
43 Criteria root = new Criteria();
44 root.addEqualTo("timesheetDocumentId", timesheetDocumentId);
45 Query query = QueryFactory.newQuery(MissedPunch.class, root);
46 missedPunches.addAll(getPersistenceBrokerTemplate().getCollectionByQuery(query));
47
48 return missedPunches;
49 }
50
51 @Override
52 public MissedPunch getMissedPunchByClockLogId(String tkClockLogId) {
53 Criteria root = new Criteria();
54 root.addEqualTo("tkClockLogId", tkClockLogId);
55 Query query = QueryFactory.newQuery(MissedPunch.class, root);
56 return (MissedPunch) getPersistenceBrokerTemplate().getObjectByQuery(query);
57 }
58
59 }