1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.kpme.core.position.validation;
17
18 import org.kuali.kpme.core.api.position.PositionBaseContract;
19 import org.kuali.kpme.core.bo.HrBusinessObject;
20 import org.kuali.kpme.core.position.PositionBaseBo;
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 PositionEffectiveDatePrompt extends KPMEHrObjectNewerVersionPromptBase {
26
27 @Override
28 protected boolean doesNewerVersionExist(HrBusinessObject pbo) {
29 boolean futureEffectiveDateExists = false;
30
31 PositionBaseBo position = (PositionBaseBo) pbo;
32 PositionBaseContract lastPosition = HrServiceLocator.getPositionService().getPosition(position.getPositionNumber(), TKUtils.END_OF_TIME);
33 if (lastPosition != null && lastPosition.getEffectiveLocalDate() != null && position.getEffectiveLocalDate() != null) {
34 futureEffectiveDateExists = lastPosition.getEffectiveLocalDate().isAfter(position.getEffectiveLocalDate());
35 }
36
37 return futureEffectiveDateExists;
38 }
39
40 }