Coverage Report - org.kuali.student.enrollment.class1.lpr.service.aspect.ServiceAspects
 
Classes in this File Line Coverage Branch Coverage Complexity
ServiceAspects
0%
0/11
0%
0/6
2.667
 
 1  
 package org.kuali.student.enrollment.class1.lpr.service.aspect;
 2  
 
 3  
 
 4  
 import java.util.List;
 5  
 
 6  
 
 7  
 import org.aspectj.lang.JoinPoint;
 8  
 import org.kuali.student.common.exceptions.MissingParameterException;
 9  
 import org.kuali.student.common.exceptions.OperationFailedException;
 10  
 
 11  
 /**
 12  
  * 
 13  
  * @author sambit
 14  
  * 
 15  
  * @param <T> the service this aspect is operating on
 16  
  */
 17  0
 public class ServiceAspects<T>  {
 18  
 
 19  
         List<Throwable> includeThrowableClassList ;
 20  
 
 21  
 
 22  
         public void setIncludeThrowableClassList(List <Throwable> serviceExceptionTypes) {
 23  0
                 this.includeThrowableClassList = serviceExceptionTypes;
 24  0
         }
 25  
 
 26  
         /**
 27  
          * @param join
 28  
          */
 29  
         public void beforeInvokingService(JoinPoint join) throws Throwable{
 30  
 
 31  0
                 Object[] argValues =  join.getArgs();
 32  
 
 33  0
                 for(Object argValue:argValues){
 34  
 
 35  0
                         if(argValue==null){
 36  
                         
 37  0
                                 throw new MissingParameterException("Input parameters cannot be null, one of the parameters had null value:"+argValue);
 38  
                                 
 39  
                         }
 40  
                 }
 41  0
         }
 42  
 
 43  
         /**
 44  
          * 
 45  
          * @param ex
 46  
          * @return
 47  
          * @throws Throwable
 48  
          */
 49  
         public void handleExceptions(Throwable ex) throws OperationFailedException{
 50  
 
 51  0
                 if (!includeThrowableClassList.contains(ex)) {
 52  0
                         throw new OperationFailedException(ex.getMessage(), ex);
 53  
                 }
 54  0
         }
 55  
 
 56  
 }
 57