Coverage Report - org.kuali.rice.kew.exception.WorkflowServiceErrorException
 
Classes in this File Line Coverage Branch Coverage Complexity
WorkflowServiceErrorException
0%
0/22
0%
0/2
1.25
 
 1  
 /*
 2  
  * Copyright 2006-2011 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.exception;
 17  
 
 18  
 import java.util.ArrayList;
 19  
 import java.util.Collection;
 20  
 
 21  
 /**
 22  
  * RuntimeException thrown from Service level classes when business rule validation
 23  
  * fails.  This exception is caught by StrutsExceptionHandler.  If any service errors
 24  
  * have been set on in the serviceErrors collection these are stripped off of the 
 25  
  * exception put into ActionMessages in the Error que and the request is directed back to 
 26  
  * the original ActionMapping input page.
 27  
  */
 28  
 public class WorkflowServiceErrorException extends RuntimeException {
 29  
 
 30  
 
 31  
         private static final long serialVersionUID = 2457592489303923040L;
 32  
         private Collection serviceErrors;
 33  
     
 34  
     public WorkflowServiceErrorException(String message) {
 35  0
         this(message, (Throwable)null);
 36  0
     }
 37  
     
 38  
     public WorkflowServiceErrorException(String message, Throwable throwable) {
 39  0
         super(message, throwable);
 40  0
         serviceErrors = new ArrayList();
 41  0
     }
 42  
     
 43  
     public WorkflowServiceErrorException(String msg, WorkflowServiceError error) {
 44  0
         super(msg);
 45  0
         serviceErrors = new ArrayList();
 46  0
         serviceErrors.add(error);
 47  0
     }
 48  
 
 49  
         public WorkflowServiceErrorException(String msg, Throwable t, WorkflowServiceError error) {
 50  0
         super(msg, t);
 51  0
         serviceErrors = new ArrayList();
 52  0
         serviceErrors.add(error);
 53  0
     }
 54  
     
 55  
     
 56  
     public WorkflowServiceErrorException(String msg, Collection errors) {
 57  0
         super(msg);
 58  0
         setServiceErrors(errors);
 59  0
     }
 60  
     
 61  
     public Collection getServiceErrors() {
 62  0
         return serviceErrors;
 63  
     }
 64  
 
 65  
     public void setServiceErrors(Collection serviceErrors) {
 66  0
         this.serviceErrors = serviceErrors;
 67  0
     }
 68  
 
 69  
     public String toString() {
 70  0
         if (serviceErrors != null) {
 71  0
             return super.toString() + " " + serviceErrors;    
 72  
         } else {
 73  0
             return super.toString() + " (no service errors)";
 74  
         }
 75  
     }
 76  
 }