1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.kpme.tklm.time.timeblock.service;
17
18 import java.util.ArrayList;
19 import java.util.List;
20
21 import org.joda.time.LocalDate;
22 import org.kuali.kpme.tklm.time.timeblock.TimeBlockBo;
23 import org.kuali.kpme.tklm.time.timeblock.TimeBlockHistory;
24 import org.kuali.kpme.tklm.time.timeblock.TimeBlockHistoryDetail;
25 import org.kuali.kpme.tklm.time.timeblock.dao.TimeBlockHistoryDao;
26 import org.kuali.kpme.tklm.time.timehourdetail.TimeHourDetailBo;
27
28 public class TimeBlockHistoryServiceImpl implements TimeBlockHistoryService {
29
30 private TimeBlockHistoryDao timeBlockHistoryDao;
31
32 public void saveTimeBlockHistory(TimeBlockHistory tbh) {
33 timeBlockHistoryDao.saveOrUpdate(tbh);
34 }
35
36 public List<TimeBlockHistory> saveTimeBlockHistoryList(List<TimeBlockHistory> tbhs) {
37 return tbhs;
38 }
39
40 public void setTimeBlockHistoryDao(TimeBlockHistoryDao timeBlockHistoryDao) {
41 this.timeBlockHistoryDao = timeBlockHistoryDao;
42 }
43
44 public List<TimeBlockHistory> getTimeBlockHistoryByTkTimeBlockId(String tkTimeBlockId) {
45 return timeBlockHistoryDao.getTimeBlockHistoryByTkTimeBlockId(tkTimeBlockId);
46 }
47
48 public void addTimeBlockHistoryDetails(TimeBlockHistory timeBlockHistory, TimeBlockBo timeBlock) {
49 List<TimeHourDetailBo> details = timeBlock.getTimeHourDetails();
50 if(!details.isEmpty()) {
51 List<TimeBlockHistoryDetail> tbhds = new ArrayList<TimeBlockHistoryDetail>();
52 for(TimeHourDetailBo thd : details) {
53 TimeBlockHistoryDetail tbhd = new TimeBlockHistoryDetail(thd);
54 tbhds.add(tbhd);
55 }
56 timeBlockHistory.setTimeBlockHistoryDetails(tbhds);
57 }
58 }
59
60 @Override
61 public List<TimeBlockHistory> getTimeBlockHistoriesForLookup(String documentId,
62 String principalId, String userPrincipalId, LocalDate fromDate,
63 LocalDate toDate) {
64 return timeBlockHistoryDao.getTimeBlockHistoriesForLookup(documentId,principalId,userPrincipalId,fromDate,toDate);
65 }
66
67 }