1   
2   
3   
4   
5   
6   
7   
8   
9   
10  
11  
12  
13  
14  
15  
16  package org.kuali.kpme.tklm.time.rules.clocklocation.validation;
17  
18  import java.util.List;
19  
20  import org.apache.commons.collections.CollectionUtils;
21  import org.kuali.kpme.core.bo.HrBusinessObject;
22  import org.kuali.kpme.core.web.KPMEHrObjectNewerVersionPromptBase;
23  import org.kuali.kpme.tklm.time.rules.clocklocation.ClockLocationRule;
24  import org.kuali.kpme.tklm.time.service.TkServiceLocator;
25  
26  public class ClockLocationRuleEffectiveDatePrompt extends KPMEHrObjectNewerVersionPromptBase {
27      
28  	@Override
29      protected boolean doesNewerVersionExist(HrBusinessObject pbo) {
30  		boolean futureEffectiveDateExists = false;
31          ClockLocationRule clr = (ClockLocationRule) pbo;
32          if(clr.getEffectiveLocalDate() != null) {
33  	        List<ClockLocationRule> lastClr = TkServiceLocator.getClockLocationRuleService().getNewerVersionClockLocationRule(clr.getGroupKeyCode(), clr.getDept(), clr.getWorkArea(), clr.getPrincipalId(), clr.getJobNumber(), clr.getEffectiveLocalDate());
34  	   		futureEffectiveDateExists = CollectionUtils.isNotEmpty(lastClr);
35          }
36     		return futureEffectiveDateExists;
37      }
38  	
39  }