1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.kpme.core.assignment.validation;
17
18 import org.kuali.kpme.core.assignment.Assignment;
19 import org.kuali.kpme.core.assignment.AssignmentDescriptionKey;
20 import org.kuali.kpme.core.service.HrServiceLocator;
21 import org.kuali.kpme.core.util.TKUtils;
22 import org.kuali.kpme.core.web.KpmeEffectiveDatePromptBase;
23 import org.kuali.rice.krad.bo.PersistableBusinessObject;
24
25 public class AssignmentEffectiveDatePrompt extends KpmeEffectiveDatePromptBase {
26
27 @Override
28 protected boolean futureEffectiveDateExists(PersistableBusinessObject pbo) {
29 boolean futureEffectiveDateExists = false;
30
31 Assignment assignment = (Assignment) pbo;
32 AssignmentDescriptionKey key = new AssignmentDescriptionKey(assignment);
33 Assignment lastAssignment = HrServiceLocator.getAssignmentService().getAssignment(assignment.getPrincipalId(), key, TKUtils.END_OF_TIME);
34 if (lastAssignment != null && lastAssignment.getEffectiveLocalDate() != null && assignment.getEffectiveLocalDate() != null) {
35 futureEffectiveDateExists = lastAssignment.getEffectiveLocalDate().isAfter(assignment.getEffectiveLocalDate());
36 }
37
38 return futureEffectiveDateExists;
39 }
40
41 }