1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.kpme.core.department.validation;
17
18 import org.kuali.kpme.core.api.department.Department;
19 import org.kuali.kpme.core.bo.HrBusinessObject;
20 import org.kuali.kpme.core.department.DepartmentBo;
21 import org.kuali.kpme.core.service.HrServiceLocator;
22 import org.kuali.kpme.core.util.TKUtils;
23 import org.kuali.kpme.core.web.KPMEHrObjectNewerVersionPromptBase;
24
25 public class DepartmentEffectiveDatePrompt extends KPMEHrObjectNewerVersionPromptBase {
26
27 @Override
28 protected boolean doesNewerVersionExist(HrBusinessObject pbo) {
29 boolean futureEffectiveDateExists = false;
30
31 DepartmentBo department = (DepartmentBo) pbo;
32 Department lastDepartment = HrServiceLocator.getDepartmentService().getDepartment(department.getDept(), department.getGroupKeyCode(), TKUtils.END_OF_TIME);
33 if (lastDepartment != null && lastDepartment.getEffectiveLocalDate() != null && department.getEffectiveLocalDate() != null) {
34 futureEffectiveDateExists = lastDepartment.getEffectiveLocalDate().isAfter(department.getEffectiveLocalDate());
35 }
36
37 return futureEffectiveDateExists;
38 }
39
40 }