1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.kpme.tklm.time.rules.overtime.weekly.web;
17
18 import java.math.BigDecimal;
19 import java.util.HashSet;
20 import java.util.Set;
21
22 import org.kuali.kpme.tklm.time.rules.overtime.weekly.WeeklyOvertimeRule;
23 import org.kuali.kpme.tklm.time.rules.overtime.weekly.WeeklyOvertimeRuleGroup;
24 import org.kuali.rice.kns.maintenance.KualiMaintainableImpl;
25 import org.kuali.rice.krad.util.GlobalVariables;
26 import org.kuali.rice.krad.util.KRADConstants;
27
28 public class WeeklyOvertimeRuleGroupMaintainableImpl extends KualiMaintainableImpl{
29
30
31
32
33 private static final long serialVersionUID = 1L;
34
35
36 @Override
37 public void addNewLineToCollection(String collectionName) {
38 if (collectionName.equals("lstWeeklyOvertimeRules")) {
39 WeeklyOvertimeRule aRule = (WeeklyOvertimeRule)newCollectionLines.get(collectionName );
40 if ( aRule != null ) {
41 WeeklyOvertimeRuleGroup aGroup = (WeeklyOvertimeRuleGroup)this.getBusinessObject();
42 Set<BigDecimal> steps = new HashSet<BigDecimal>();
43 for(WeeklyOvertimeRule wotr : aGroup.getLstWeeklyOvertimeRules()){
44 steps.add(wotr.getStep());
45 }
46 if(steps.contains(aRule.getStep())){
47 GlobalVariables.getMessageMap().putErrorWithoutFullErrorPath(KRADConstants.MAINTENANCE_NEW_MAINTAINABLE +"lstWeeklyOvertimeRules",
48 "weeklyOvertimeRule.duplicate.step",aRule.getStep().toString());
49 return;
50 }
51 }
52 }
53 super.addNewLineToCollection(collectionName);
54 }
55
56 }