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.kim.bo.ui.RoleDocumentDelegationMember;
20 import org.kuali.rice.kim.document.IdentityManagementPersonDocument;
21 import org.kuali.rice.kim.document.rule.AttributeValidationHelper;
22 import org.kuali.rice.kim.rule.event.ui.AddPersonDelegationMemberEvent;
23 import org.kuali.rice.kim.rule.ui.AddPersonDelegationMemberRule;
24 import org.kuali.rice.kns.rules.DocumentRuleBase;
25 import org.kuali.rice.kns.util.GlobalVariables;
26 import org.kuali.rice.kns.util.RiceKeyConstants;
27
28
29
30
31
32
33
34 public class PersonDocumentDelegationMemberRule extends DocumentRuleBase implements AddPersonDelegationMemberRule {
35
36 public static final String ERROR_PATH = "document.newDelegationMember";
37
38 protected AttributeValidationHelper attributeValidationHelper = new AttributeValidationHelper();
39
40 public boolean processAddPersonDelegationMember(AddPersonDelegationMemberEvent addPersonDelegationMemberEvent){
41 RoleDocumentDelegationMember newDelegationMember = addPersonDelegationMemberEvent.getDelegationMember();
42 IdentityManagementPersonDocument document = (IdentityManagementPersonDocument)addPersonDelegationMemberEvent.getDocument();
43 boolean rulePassed = true;
44 if(newDelegationMember == null){
45 GlobalVariables.getMessageMap().putError(ERROR_PATH, RiceKeyConstants.ERROR_EMPTY_ENTRY, new String[] {"Delegation Member"});
46 return false;
47 }
48 if(StringUtils.isBlank(newDelegationMember.getRoleMemberId())){
49 GlobalVariables.getMessageMap().putError(ERROR_PATH, RiceKeyConstants.ERROR_EMPTY_ENTRY, new String[] {"Role Member"});
50 return false;
51 }
52 return rulePassed;
53 }
54
55 }