View Javadoc

1   /**
2    * Copyright 2005-2012 The Kuali Foundation
3    *
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.opensource.org/licenses/ecl2.php
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.kuali.rice.kim.web.struts.action;
17  
18  import org.apache.log4j.Logger;
19  import org.kuali.rice.core.api.util.RiceKeyConstants;
20  import org.kuali.rice.kim.api.KimConstants;
21  import org.kuali.rice.kim.api.role.Role;
22  import org.kuali.rice.kim.api.services.KimApiServiceLocator;
23  import org.kuali.rice.kim.web.struts.form.IdentityManagementDocumentFormBase;
24  import org.kuali.rice.kim.web.struts.form.IdentityManagementRoleDocumentForm;
25  import org.kuali.rice.krad.util.GlobalVariables;
26  import org.kuali.rice.krad.util.KRADConstants;
27  
28  import javax.servlet.http.HttpServletRequest;
29  
30  /**
31   * This is a description of what this class does - jonathan don't forget to fill this in. 
32   * 
33   * @author Kuali Rice Team (rice.collab@kuali.org)
34   *
35   */
36  public class IdentityManagementRoleInquiry extends IdentityManagementBaseInquiryAction {
37  	private static final Logger LOG = Logger.getLogger(IdentityManagementRoleInquiry.class);	
38  	
39  	/**
40  	 * This overridden method ...
41  	 * 
42  	 * @see org.kuali.rice.kim.web.struts.action.IdentityManagementBaseInquiryAction#loadKimObject(javax.servlet.http.HttpServletRequest, org.kuali.rice.kim.web.struts.form.IdentityManagementDocumentFormBase)
43  	 */
44  	@Override
45  	protected void loadKimObject(HttpServletRequest request,
46  			IdentityManagementDocumentFormBase form) {
47          IdentityManagementRoleDocumentForm roleDocumentForm = (IdentityManagementRoleDocumentForm) form;
48          String roleId = request.getParameter(KimConstants.PrimaryKeyConstants.ROLE_ID);
49          Role role = KimApiServiceLocator.getRoleService().getRole(roleId);
50          if (role != null) {
51          	getUiDocumentService().loadRoleDoc(roleDocumentForm.getRoleDocument(), role);
52          } else {
53          	LOG.error("No records found for Role Inquiry.");
54              GlobalVariables.getMessageMap().putError(KRADConstants.GLOBAL_ERRORS, RiceKeyConstants.ERROR_INQUIRY);
55          }
56  	}
57  	
58  }