Coverage Report - org.kuali.rice.kew.doctype.LazyLoadSecurityAttribute
 
Classes in this File Line Coverage Branch Coverage Complexity
LazyLoadSecurityAttribute
0%
0/8
N/A
1
 
 1  
 /*
 2  
  * Copyright 2010 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.kew.doctype;
 17  
 
 18  
 import org.kuali.rice.core.reflect.ObjectDefinition;
 19  
 import org.kuali.rice.core.resourceloader.GlobalResourceLoader;
 20  
 import org.kuali.rice.kim.bo.Person;
 21  
 
 22  
 /**
 23  
  * This implementation of SecurityAttribute allows for us to lazy load the underlying
 24  
  * SecurityAttribute implementation from the service bus.  This is to address an issue
 25  
  * with DocumentType XML import where it was attempting to load the security attribute
 26  
  * class during ingestion which can cause problems if that application isn't online and
 27  
  * available. 
 28  
  * 
 29  
  * @author Eric Westfall
 30  
  *
 31  
  */
 32  
 public class LazyLoadSecurityAttribute implements SecurityAttribute {
 33  
 
 34  
         private static final long serialVersionUID = 8194757786570696656L;
 35  
 
 36  
         private String className;
 37  
         private String serviceNamespace;
 38  
         
 39  0
         public LazyLoadSecurityAttribute(String className, String serviceNamespace) {
 40  0
                 this.className = className;
 41  0
                 this.serviceNamespace = serviceNamespace;
 42  0
         }
 43  
 
 44  
         public Boolean docSearchAuthorized(Person currentUser, String docTypeName,
 45  
                         Long documentId, String initiatorPrincipalId) {
 46  0
                 return getSecurityAttribute().docSearchAuthorized(currentUser, docTypeName, documentId, initiatorPrincipalId);
 47  
         }
 48  
 
 49  
         public Boolean routeLogAuthorized(Person currentUser, String docTypeName,
 50  
                         Long documentId, String initiatorPrincipalId) {
 51  0
                 return getSecurityAttribute().routeLogAuthorized(currentUser, docTypeName, documentId, initiatorPrincipalId);
 52  
         }
 53  
         
 54  
         protected SecurityAttribute getSecurityAttribute() {
 55  0
                 ObjectDefinition objDef = new ObjectDefinition(className, serviceNamespace);
 56  0
                 return (SecurityAttribute)GlobalResourceLoader.getObject(objDef);
 57  
         }
 58  
 
 59  
 }