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.group.Group;
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.IdentityManagementGroupDocumentForm;
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 IdentityManagementGroupInquiry extends IdentityManagementBaseInquiryAction {
38 private static final Logger LOG = Logger.getLogger(IdentityManagementGroupInquiry.class);
39
40
41
42
43
44
45 @Override
46 protected void loadKimObject(HttpServletRequest request, IdentityManagementDocumentFormBase form) {
47 IdentityManagementGroupDocumentForm groupDocumentForm = (IdentityManagementGroupDocumentForm) form;
48 String id = request.getParameter(KimConstants.PrimaryKeyConstants.GROUP_ID);
49 String altId = request.getParameter(KimConstants.AttributeConstants.GROUP_ID);
50
51 String groupId = StringUtils.isNotEmpty(id) ? id : altId;
52 Group group = null;
53 if (StringUtils.isNotEmpty(groupId)) {
54 group = KimApiServiceLocator.getGroupService().getGroup(groupId);
55 } else {
56 String namespaceCode = request.getParameter(KimConstants.UniqueKeyConstants.NAMESPACE_CODE);
57 String groupName = request.getParameter(KimConstants.UniqueKeyConstants.GROUP_NAME);
58
59 if (!StringUtils.isBlank(namespaceCode) && !StringUtils.isBlank(groupName)) {
60 group = KimApiServiceLocator.getGroupService().getGroupByNamespaceCodeAndName(namespaceCode, groupName);
61 }
62 }
63 if (group != null) {
64 getUiDocumentService().loadGroupDoc(groupDocumentForm.getGroupDocument(), group);
65 } else {
66 LOG.error("No records found for Group Inquiry.");
67 GlobalVariables.getMessageMap().putError(KRADConstants.GLOBAL_ERRORS, RiceKeyConstants.ERROR_INQUIRY);
68 }
69 }
70
71 }