Coverage Report - org.kuali.rice.kim.lookup.KimLookupableHelperServiceImpl
 
Classes in this File Line Coverage Branch Coverage Complexity
KimLookupableHelperServiceImpl
0%
0/11
0%
0/8
2
 
 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.lookup;
 17  
 
 18  
 import org.kuali.rice.kim.bo.Person;
 19  
 import org.kuali.rice.kim.service.KIMServiceLocator;
 20  
 import org.kuali.rice.kim.service.KimTypeInfoService;
 21  
 import org.kuali.rice.kns.document.authorization.DocumentAuthorizer;
 22  
 import org.kuali.rice.kns.document.authorization.DocumentPresentationController;
 23  
 import org.kuali.rice.kns.lookup.KualiLookupableHelperServiceImpl;
 24  
 import org.kuali.rice.kns.service.DocumentHelperService;
 25  
 import org.kuali.rice.kns.service.KNSServiceLocator;
 26  
 import org.kuali.rice.kns.util.GlobalVariables;
 27  
 
 28  
 /**
 29  
  * This is a description of what this class does - shyu don't forget to fill this in.
 30  
  *
 31  
  * @author Kuali Rice Team (rice.collab@kuali.org)
 32  
  *
 33  
  */
 34  0
 public class KimLookupableHelperServiceImpl extends KualiLookupableHelperServiceImpl {
 35  
 
 36  
         private static final long serialVersionUID = 1L;
 37  
         
 38  
         private static DocumentHelperService documentHelperService;
 39  
         private static KimTypeInfoService typeInfoService;
 40  
         
 41  
     @Override
 42  
         public boolean allowsNewOrCopyAction(String documentTypeName) {
 43  
                 // TODO : to let it rendering 'create new' and 'edit'/'copy' button
 44  0
         DocumentAuthorizer documentAuthorizer = getDocumentHelperService().getDocumentAuthorizer(documentTypeName);
 45  0
         DocumentPresentationController documentPresentationController = getDocumentHelperService().getDocumentPresentationController(documentTypeName);
 46  
         // make sure this person is authorized to initiate
 47  0
         Person currentUser = GlobalVariables.getUserSession().getPerson();
 48  0
         return documentPresentationController.canInitiate(documentTypeName) && documentAuthorizer.canInitiate(documentTypeName, currentUser);
 49  
 
 50  
         }
 51  
 
 52  
         protected DocumentHelperService getDocumentHelperService() {
 53  0
             if ( documentHelperService == null ) {
 54  0
                 documentHelperService = KNSServiceLocator.getDocumentHelperService();
 55  
                 }
 56  0
             return documentHelperService;
 57  
         }
 58  
 
 59  
         protected KimTypeInfoService getTypeInfoService() {
 60  0
             if ( typeInfoService == null ) {
 61  0
                     typeInfoService = KIMServiceLocator.getTypeInfoService();
 62  
                 }
 63  0
             return typeInfoService;
 64  
         }
 65  
 }