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