1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.kim.rules.ui;
17
18 import org.apache.commons.lang.StringUtils;
19 import org.kuali.rice.core.api.util.RiceKeyConstants;
20 import org.kuali.rice.kim.bo.ui.RoleDocumentDelegation;
21 import org.kuali.rice.kim.rule.event.ui.AddDelegationEvent;
22 import org.kuali.rice.kim.rule.ui.AddDelegationRule;
23 import org.kuali.rice.kns.rules.DocumentRuleBase;
24 import org.kuali.rice.krad.util.GlobalVariables;
25
26
27
28
29
30
31
32 public class RoleDocumentDelegationRule extends DocumentRuleBase implements AddDelegationRule {
33
34 protected static final String ERROR_PATH = "permission.permissionId";
35
36 public boolean processAddDelegation(AddDelegationEvent addDelegationEvent) {
37 RoleDocumentDelegation newDelegation = addDelegationEvent.getDelegation();
38 boolean rulePassed = true;
39 if (newDelegation == null || StringUtils.isBlank(newDelegation.getDelegationTypeCode())) {
40 rulePassed = false;
41 GlobalVariables.getMessageMap().putError(ERROR_PATH, RiceKeyConstants.ERROR_EMPTY_ENTRY, new String[] {"Permission"});
42 }
43 return rulePassed;
44 }
45
46 }