1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.hr.time.task.service;
17
18 import java.sql.Date;
19 import java.util.List;
20
21 import org.apache.commons.lang.StringUtils;
22 import org.kuali.hr.time.task.Task;
23 import org.kuali.hr.time.task.dao.TaskDao;
24 import org.kuali.hr.time.util.TkConstants;
25 import org.kuali.hr.time.workarea.WorkArea;
26
27 public class TaskServiceImpl implements TaskService {
28
29 private TaskDao taskDao;
30
31 @Override
32 public Task getTask(String tkTaskId) {
33 return taskDao.getTask(tkTaskId);
34 }
35
36 @Override
37 public Task getTask(Long task, Date asOfDate) {
38 Task taskObj = taskDao.getTask(task, asOfDate);
39 if(taskObj == null){
40 taskObj = new Task();
41 taskObj.setActive(true);
42 taskObj.setEffectiveDate(asOfDate);
43 taskObj.setTask(task);
44 taskObj.setDescription(TkConstants.TASK_DEFAULT_DESP);
45 taskObj.setTkTaskId("0");
46 }
47 return taskObj;
48 }
49
50 @Override
51 public void saveTask(Task task) {
52 taskDao.saveOrUpdate(task);
53 }
54
55 @Override
56 public void saveTasks(List<Task> tasks) {
57 taskDao.saveOrUpdate(tasks);
58 }
59
60 public void setTaskDao(TaskDao taskDao) {
61 this.taskDao = taskDao;
62 }
63
64 @Override
65 public Task getMaxTask(){
66 return taskDao.getMaxTask();
67 }
68
69 @Override
70 public List<Task> getTasks(String task, String description, String workArea, Date fromEffdt, Date toEffdt) {
71 Long taskNumber = StringUtils.isEmpty(task) ? null : Long.parseLong(task);
72 Long workAreaNumber = StringUtils.isEmpty(workArea) ? null : Long.parseLong(workArea);
73
74 return taskDao.getTasks(taskNumber, description, workAreaNumber, fromEffdt, toEffdt);
75 }
76
77 @Override
78 public int getTaskCount(Long task) {
79 return taskDao.getTaskCount(task);
80 }
81 }