Coverage Report - org.kuali.rice.kim.web.struts.form.IdentityManagementDocumentFormBase
 
Classes in this File Line Coverage Branch Coverage Complexity
IdentityManagementDocumentFormBase
0%
0/31
0%
0/8
1.75
 
 1  
 /*
 2  
  * Copyright 2007-2009 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.form;
 17  
 
 18  
 import java.util.ArrayList;
 19  
 import java.util.List;
 20  
 import java.util.Map;
 21  
 
 22  
 import javax.servlet.http.HttpServletRequest;
 23  
 
 24  
 import org.apache.commons.lang.StringUtils;
 25  
 import org.apache.log4j.Logger;
 26  
 import org.kuali.rice.kim.util.KimConstants;
 27  
 import org.kuali.rice.kns.bo.Parameter;
 28  
 import org.kuali.rice.kns.service.KNSServiceLocator;
 29  
 import org.kuali.rice.kns.util.KNSConstants;
 30  
 import org.kuali.rice.kns.util.PagingBannerUtils;
 31  
 import org.kuali.rice.kns.web.struts.form.KualiTableRenderFormMetadata;
 32  
 import org.kuali.rice.kns.web.struts.form.KualiTransactionalDocumentFormBase;
 33  
 
 34  
 /**
 35  
  * This is a description of what this class does - kellerj don't forget to fill this in. 
 36  
  * 
 37  
  * @author Kuali Rice Team (rice.collab@kuali.org)
 38  
  *
 39  
  */
 40  
 @SuppressWarnings("serial")
 41  0
 public abstract class IdentityManagementDocumentFormBase extends KualiTransactionalDocumentFormBase {
 42  0
         protected static final Logger LOG = Logger.getLogger(IdentityManagementDocumentFormBase.class);
 43  
     protected static final String MAX_MEMBERS_PER_PAGE_PARM = "MAX_MEMBERS_PER_PAGE";
 44  
         protected transient KualiTableRenderFormMetadata memberTableMetadata;
 45  0
     protected int recordsPerPage = -1;
 46  0
     protected boolean inquiry = false;
 47  
     
 48  
         protected static final String CHANGE_NAMESPACE_METHOD_TO_CALL = "methodToCall.changeNamespace";
 49  
         protected static final String CHANGE_MEMBER_TYPE_CODE_METHOD_TO_CALL = "methodToCall.changeMemberTypeCode";
 50  
         protected static final String CHANGE_DEL_ROLE_MEMBER_METHOD_TO_CALL = "methodToCall.changeDelegationRoleMember";
 51  
 
 52  
     /**
 53  
      * @see org.kuali.rice.kns.web.struts.form.KualiDocumentFormBase#populate(javax.servlet.http.HttpServletRequest)
 54  
      */
 55  
     @SuppressWarnings("unchecked")
 56  
         @Override
 57  
     public void populate(HttpServletRequest request) {
 58  0
         super.populate(request);
 59  
 
 60  0
         memberTableMetadata = new KualiTableRenderFormMetadata();
 61  
 
 62  0
         if (KNSConstants.TableRenderConstants.SWITCH_TO_PAGE_METHOD.equals(getMethodToCall())) {
 63  0
             final String paramPrefix = KNSConstants.DISPATCH_REQUEST_PARAMETER + "." + KNSConstants.TableRenderConstants.SWITCH_TO_PAGE_METHOD + ".";
 64  0
             memberTableMetadata.setSwitchToPageNumber(PagingBannerUtils.getNumbericalValueAfterPrefix(paramPrefix, request.getParameterNames()));
 65  0
             if (memberTableMetadata.getSwitchToPageNumber() == -1) {
 66  0
                 throw new RuntimeException("Couldn't find page number");
 67  
             }
 68  
         }
 69  0
     }
 70  
 
 71  
         public KualiTableRenderFormMetadata getMemberTableMetadata() {
 72  0
                 return this.memberTableMetadata;
 73  
         }
 74  
 
 75  
         public void setMemberTableMetadata(
 76  
                         KualiTableRenderFormMetadata memberTableMetadata) {
 77  0
                 this.memberTableMetadata = memberTableMetadata;
 78  0
         }
 79  
 
 80  
         public int getRecordsPerPage() {
 81  0
                 if ( recordsPerPage == -1 ) {
 82  0
                         Parameter param = KNSServiceLocator.getParameterService().retrieveParameter(KimConstants.NAMESPACE_CODE, KNSConstants.DetailTypes.DOCUMENT_DETAIL_TYPE, MAX_MEMBERS_PER_PAGE_PARM);
 83  0
                         if ( param != null ) {
 84  
                                 try {
 85  0
                                         recordsPerPage = Integer.parseInt( param.getParameterValue() );
 86  0
                                 } catch ( NumberFormatException ex ) {
 87  0
                                         LOG.error( "Unable to parse parameter " + KimConstants.NAMESPACE_CODE+"/"+KNSConstants.DetailTypes.DOCUMENT_DETAIL_TYPE+"/"+MAX_MEMBERS_PER_PAGE_PARM + "(+"+param.getParameterValue()+") as an int - defaulting to 1." );
 88  0
                                         recordsPerPage = 1;
 89  0
                                 }
 90  
                         } else {
 91  0
                                 LOG.error( "Unable to find " + KimConstants.NAMESPACE_CODE+"/"+KNSConstants.DetailTypes.DOCUMENT_DETAIL_TYPE+"/"+MAX_MEMBERS_PER_PAGE_PARM + " - defaulting to 1." );
 92  0
                                 recordsPerPage = 1;
 93  
                         }
 94  
                 }
 95  0
                 return recordsPerPage;
 96  
         }
 97  
 
 98  
         // support for the inquiryControls tag since using same form
 99  
         public boolean isCanExport() {
 100  0
                 return false;
 101  
         }
 102  
         
 103  
         @SuppressWarnings("unchecked")
 104  
         public List getMemberRows() {
 105  0
                 return new ArrayList();
 106  
         }
 107  
 
 108  
         /**
 109  
          * @return the inquiry
 110  
          */
 111  
         public boolean isInquiry() {
 112  0
                 return this.inquiry;
 113  
         }
 114  
 
 115  
         /**
 116  
          * @param inquiry the inquiry to set
 117  
          */
 118  
         public void setInquiry(boolean inquiry) {
 119  0
                 this.inquiry = inquiry;
 120  0
         }
 121  
 }