Coverage Report - org.kuali.rice.kim.inquiry.RoleInquirableImpl
 
Classes in this File Line Coverage Branch Coverage Complexity
RoleInquirableImpl
0%
0/22
0%
0/6
7
 
 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.inquiry;
 17  
 
 18  
 import java.util.ArrayList;
 19  
 import java.util.Collections;
 20  
 import java.util.List;
 21  
 
 22  
 import org.kuali.rice.kim.bo.impl.RoleImpl;
 23  
 import org.kuali.rice.kim.bo.types.impl.KimTypeImpl;
 24  
 import org.kuali.rice.kim.lookup.RoleLookupableHelperServiceImpl;
 25  
 import org.kuali.rice.kim.util.KimConstants;
 26  
 import org.kuali.rice.kns.bo.BusinessObject;
 27  
 import org.kuali.rice.kns.bo.Namespace;
 28  
 import org.kuali.rice.kns.inquiry.KualiInquirableImpl;
 29  
 import org.kuali.rice.kns.lookup.HtmlData;
 30  
 import org.kuali.rice.kns.lookup.HtmlData.AnchorHtmlData;
 31  
 import org.kuali.rice.kns.util.ObjectUtils;
 32  
 
 33  
 /**
 34  
  * This is a description of what this class does - bhargavp don't forget to fill this in. 
 35  
  * 
 36  
  * @author Kuali Rice Team (rice.collab@kuali.org)
 37  
  *
 38  
  */
 39  0
 public class RoleInquirableImpl extends KualiInquirableImpl {
 40  
 
 41  0
         protected final String ROLE_NAME = "roleName";
 42  0
         protected final String ROLE_ID = "roleId";
 43  0
         protected final String NAMESPACE_CODE = "namespaceCode";
 44  
         
 45  
     /**
 46  
      * @see org.kuali.kfs.sys.businessobject.inquiry.KfsInquirableImpl#getInquiryUrl(org.kuali.rice.kns.bo.BusinessObject,
 47  
      *      java.lang.String, boolean)
 48  
      */
 49  
     @Override
 50  
     public HtmlData getInquiryUrl(BusinessObject businessObject, String attributeName, boolean forceInquiry) {
 51  0
                 if(ROLE_NAME.equals(attributeName)){
 52  0
                         List<String> primaryKeys = new ArrayList<String>();
 53  0
                         primaryKeys.add(ROLE_ID);
 54  
                     //((AnchorHtmlData)inqUrl).setHref("../kim/identityManagementRoleDocument.do?methodToCall=inquiry&command=initiate&docTypeName=IdentityManagementRoleDocument"+href.substring(idx1, idx2));
 55  0
                     String href = (getInquiryUrlForPrimaryKeys(RoleImpl.class, businessObject, primaryKeys, null)).getHref();
 56  0
                     AnchorHtmlData htmlData = new AnchorHtmlData();
 57  0
                     htmlData.setHref(RoleLookupableHelperServiceImpl.getCustomRoleInquiryHref(href));
 58  0
                         return htmlData;
 59  0
                 } else if(NAMESPACE_CODE.equals(attributeName)){
 60  0
                         List<String> primaryKeys = new ArrayList<String>();
 61  0
                         primaryKeys.add("code");
 62  0
                         Namespace parameterNamespace = new Namespace();
 63  0
                         parameterNamespace.setCode((String)ObjectUtils.getPropertyValue(businessObject, attributeName));
 64  0
                         return getInquiryUrlForPrimaryKeys(Namespace.class, parameterNamespace, primaryKeys, null);
 65  0
                 } else if("kimRoleType.name".equals(attributeName)){
 66  0
                         KimTypeImpl kimType = new KimTypeImpl();
 67  0
                         kimType.setKimTypeId( ((RoleImpl)businessObject).getKimTypeId() );
 68  0
                         return getInquiryUrlForPrimaryKeys(KimTypeImpl.class, kimType, Collections.singletonList( KimConstants.PrimaryKeyConstants.KIM_TYPE_ID ), null);
 69  
         }
 70  
                 
 71  0
         return super.getInquiryUrl(businessObject, attributeName, forceInquiry);
 72  
     }
 73  
 
 74  
 }