1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.hr.kpme.tklm.time.rules.validation;
17
18 import org.apache.commons.lang.StringUtils;
19 import org.kuali.kpme.core.bo.HrKeyedBusinessObject;
20 import org.kuali.kpme.core.util.ValidationUtils;
21 import org.kuali.rice.kns.maintenance.rules.MaintenanceDocumentRuleBase;
22
23 public abstract class TkKeyedBusinessObjectValidation extends MaintenanceDocumentRuleBase {
24
25 private static final String GROUP_KEY_CODE_PARAM_SUFFIX = "'";
26 private static final String GROUP_KEY_CODE_PARAM_PREFIX = "Group Key Code '";
27 private static final String ERROR_EXISTENCE = "error.existence";
28 private static final String GROUP_KEY_CODE_PROP_NAME = "dataObject.groupKeyCode";
29
30 protected boolean validateGroupKeyCode(HrKeyedBusinessObject keyedBo) {
31 if (StringUtils.isNotEmpty(keyedBo.getGroupKeyCode())) {
32 if(!ValidationUtils.validateGroupKey(keyedBo.getGroupKeyCode(), keyedBo.getEffectiveLocalDate())){
33 this.putFieldError(GROUP_KEY_CODE_PROP_NAME, ERROR_EXISTENCE, GROUP_KEY_CODE_PARAM_PREFIX + keyedBo.getGroupKeyCode() + GROUP_KEY_CODE_PARAM_SUFFIX);
34 return false;
35 }
36 }
37 return true;
38 }
39
40 }