1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.kim.web.struts.action;
17
18 import org.apache.commons.lang.StringUtils;
19 import org.apache.log4j.Logger;
20 import org.kuali.rice.core.api.util.RiceKeyConstants;
21 import org.kuali.rice.kim.api.KimConstants;
22 import org.kuali.rice.kim.api.role.Role;
23 import org.kuali.rice.kim.api.services.KimApiServiceLocator;
24 import org.kuali.rice.kim.web.struts.form.IdentityManagementDocumentFormBase;
25 import org.kuali.rice.kim.web.struts.form.IdentityManagementRoleDocumentForm;
26 import org.kuali.rice.krad.util.GlobalVariables;
27 import org.kuali.rice.krad.util.KRADConstants;
28
29 import javax.servlet.http.HttpServletRequest;
30
31
32
33
34
35
36
37 public class IdentityManagementRoleInquiry extends IdentityManagementBaseInquiryAction {
38 private static final Logger LOG = Logger.getLogger(IdentityManagementRoleInquiry.class);
39
40
41
42
43
44
45 @Override
46 protected void loadKimObject(HttpServletRequest request,
47 IdentityManagementDocumentFormBase form) {
48 IdentityManagementRoleDocumentForm roleDocumentForm = (IdentityManagementRoleDocumentForm) form;
49 String id = request.getParameter(KimConstants.PrimaryKeyConstants.ROLE_ID);
50 String altId = request.getParameter(KimConstants.PrimaryKeyConstants.SUB_ROLE_ID);
51
52 String roleId = StringUtils.isNotEmpty(id) ? id : altId;
53 Role role = KimApiServiceLocator.getRoleService().getRole(roleId);
54 if (role != null) {
55 getUiDocumentService().loadRoleDoc(roleDocumentForm.getRoleDocument(), role);
56 } else {
57 LOG.error("No records found for Role Inquiry.");
58 GlobalVariables.getMessageMap().putError(KRADConstants.GLOBAL_ERRORS, RiceKeyConstants.ERROR_INQUIRY);
59 }
60 }
61
62 }