1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.kpme.tklm.time.timeblock.dao;
17
18 import java.util.List;
19
20 import org.apache.log4j.Logger;
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.joda.time.LocalDate;
25 import org.kuali.kpme.tklm.time.timeblock.TimeBlock;
26 import org.kuali.kpme.tklm.time.timeblock.TimeBlockHistory;
27 import org.kuali.rice.core.framework.persistence.ojb.dao.PlatformAwareDaoBaseOjb;
28
29 public class TimeBlockHistoryDaoOjbImpl extends PlatformAwareDaoBaseOjb implements TimeBlockHistoryDao {
30
31 private static final Logger LOG = Logger.getLogger(TimeBlockHistoryDaoOjbImpl.class);
32
33 public void saveOrUpdate(TimeBlockHistory timeBlockHistory) {
34 this.getPersistenceBrokerTemplate().store(timeBlockHistory);
35 }
36
37 public void saveOrUpdate(List<TimeBlockHistory> timeBlockHistoryList) {
38 if (timeBlockHistoryList != null) {
39 for (TimeBlockHistory timeBlockHistory : timeBlockHistoryList) {
40 this.getPersistenceBrokerTemplate().store(timeBlockHistory);
41 }
42 }
43 }
44
45 @Override
46 public List<TimeBlockHistory> getTimeBlockHistoryByTkTimeBlockId(String tkTimeBlockId) {
47 Criteria currentRecordCriteria = new Criteria();
48 currentRecordCriteria.addEqualTo("tkTimeBlockId", tkTimeBlockId);
49 Query query = QueryFactory.newQuery(TimeBlockHistory.class, currentRecordCriteria);
50
51 return (List<TimeBlockHistory>)this.getPersistenceBrokerTemplate().getCollectionByQuery(query);
52 }
53
54 @Override
55 public List<TimeBlock> getTimeBlockHistoriesForLookup(String documentId,
56 String principalId, String userPrincipalId, LocalDate fromDate,
57 LocalDate toDate) {
58
59 return null;
60 }
61 }