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