1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.hr.time.workarea.service;
17
18 import org.apache.log4j.Logger;
19 import org.kuali.hr.time.service.base.TkServiceLocator;
20 import org.kuali.hr.time.util.TkConstants;
21 import org.kuali.hr.time.workarea.WorkArea;
22 import org.kuali.hr.time.workarea.dao.WorkAreaDao;
23
24 import java.sql.Date;
25 import java.util.List;
26
27 public class WorkAreaServiceImpl implements WorkAreaService {
28
29 @SuppressWarnings("unused")
30 private static final Logger LOG = Logger.getLogger(WorkAreaServiceImpl.class);
31
32 private WorkAreaDao workAreaDao;
33
34 public WorkAreaServiceImpl() {
35 }
36
37 @Override
38 public List<WorkArea> getWorkAreas(String department, Date asOfDate) {
39 List<WorkArea> wa = workAreaDao.getWorkArea(department, asOfDate);
40
41
42
43
44
45
46
47 return wa;
48 }
49
50 @Override
51 public WorkArea getWorkArea(Long workArea, Date asOfDate) {
52 WorkArea w = workAreaDao.getWorkArea(workArea, asOfDate);
53 populateWorkAreaRoles(w);
54 return w;
55 }
56
57 @Override
58 public void saveOrUpdate(WorkArea workArea) {
59 workAreaDao.saveOrUpdate(workArea);
60 }
61
62 public WorkAreaDao getWorkAreaDao() {
63 return workAreaDao;
64 }
65
66 public void setWorkAreaDao(WorkAreaDao workAreaDao) {
67 this.workAreaDao = workAreaDao;
68 }
69
70 @Override
71 public void populateWorkAreaRoles(WorkArea workArea) {
72 if (workArea != null) {
73 workArea.setRoles(
74 TkServiceLocator.getTkRoleService().getWorkAreaRoles(
75 workArea.getWorkArea(),
76 workArea.getEffectiveDate()
77 )
78 );
79 workArea.setInactiveRoles(
80 TkServiceLocator.getTkRoleService().getInActiveWorkAreaRoles(
81 workArea.getWorkArea(),
82 workArea.getEffectiveDate()
83 )
84 );
85 }
86 }
87
88 @Override
89 public WorkArea getWorkArea(String tkWorkAreaId) {
90 return workAreaDao.getWorkArea(tkWorkAreaId);
91 }
92
93 @Override
94 public Long getNextWorkAreaKey() {
95 return workAreaDao.getNextWorkAreaKey();
96 }
97
98 @Override
99 public List<WorkArea> getWorkAreas(String dept, String workArea,
100 String workAreaDescr, Date fromEffdt, Date toEffdt, String active,
101 String showHistory) {
102 return workAreaDao.getWorkAreas(dept, workArea, workAreaDescr, fromEffdt, toEffdt, active, showHistory);
103 }
104
105 @Override
106 public int getWorkAreaCount(String dept, Long workArea) {
107 return workAreaDao.getWorkAreaCount(dept, workArea);
108 }
109 }