Coverage Report - org.kuali.student.enrollment.class2.courseofferingset.service.decorators.CourseOfferingSetServiceValidationDecorator
 
Classes in this File Line Coverage Branch Coverage Complexity
CourseOfferingSetServiceValidationDecorator
0%
0/67
0%
0/12
3.727
 
 1  
 /*
 2  
  * Copyright 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.osedu.org/licenses/ECL-2.0
 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.student.enrollment.class2.courseofferingset.service.decorators;
 17  
 
 18  
 import java.util.List;
 19  
 import org.kuali.student.enrollment.courseofferingset.dto.SocInfo;
 20  
 import org.kuali.student.enrollment.courseofferingset.dto.SocRolloverResultInfo;
 21  
 import org.kuali.student.enrollment.courseofferingset.dto.SocRolloverResultItemInfo;
 22  
 import org.kuali.student.r2.common.datadictionary.DataDictionaryValidator;
 23  
 import org.kuali.student.r2.common.dto.ContextInfo;
 24  
 import org.kuali.student.r2.common.dto.ValidationResultInfo;
 25  
 import org.kuali.student.r2.common.exceptions.DataValidationErrorException;
 26  
 import org.kuali.student.r2.common.exceptions.DoesNotExistException;
 27  
 import org.kuali.student.r2.common.exceptions.InvalidParameterException;
 28  
 import org.kuali.student.r2.common.exceptions.MissingParameterException;
 29  
 import org.kuali.student.r2.common.exceptions.OperationFailedException;
 30  
 import org.kuali.student.r2.common.exceptions.PermissionDeniedException;
 31  
 import org.kuali.student.r2.common.exceptions.ReadOnlyException;
 32  
 import org.kuali.student.r2.common.exceptions.VersionMismatchException;
 33  
 import org.kuali.student.r2.common.util.constants.CourseOfferingSetServiceConstants;
 34  
 import org.kuali.student.r2.core.class1.util.ValidationUtils;
 35  
 
 36  0
 public class CourseOfferingSetServiceValidationDecorator extends CourseOfferingSetServiceDecorator {
 37  
     // validator property w/getter & setter
 38  
 
 39  
     private DataDictionaryValidator validator;
 40  
 
 41  
     public DataDictionaryValidator getValidator() {
 42  0
         return validator;
 43  
     }
 44  
 
 45  
     public void setValidator(DataDictionaryValidator validator) {
 46  0
         this.validator = validator;
 47  0
     }
 48  
 
 49  
     @Override
 50  
     public SocInfo createSoc(String termId, String socTypeKey, SocInfo socInfo, ContextInfo context)
 51  
             throws DoesNotExistException, DataValidationErrorException, InvalidParameterException, MissingParameterException,
 52  
             OperationFailedException, PermissionDeniedException, ReadOnlyException {
 53  
         // create 
 54  
         try {
 55  0
             List<ValidationResultInfo> errors =
 56  
                     this.validateSoc(DataDictionaryValidator.ValidationType.FULL_VALIDATION.toString(), socInfo, context);
 57  0
             if (!errors.isEmpty()) {
 58  0
                 throw new DataValidationErrorException("Error(s) occurred validating", errors);
 59  
             }
 60  0
         } catch (DoesNotExistException ex) {
 61  0
             throw new OperationFailedException("Error validating", ex);
 62  0
         }
 63  0
         return getNextDecorator().createSoc(termId, socTypeKey, socInfo, context);
 64  
     }
 65  
 
 66  
     @Override
 67  
     public SocInfo updateSoc(String socId, SocInfo socInfo, ContextInfo context)
 68  
             throws DataValidationErrorException, DoesNotExistException, InvalidParameterException, MissingParameterException,
 69  
             OperationFailedException, PermissionDeniedException, ReadOnlyException, VersionMismatchException {
 70  
         // update
 71  
         try {
 72  0
             List<ValidationResultInfo> errors =
 73  
                     this.validateSoc(DataDictionaryValidator.ValidationType.FULL_VALIDATION.toString(), socInfo, context);
 74  0
             if (!errors.isEmpty()) {
 75  0
                 throw new DataValidationErrorException("Error(s) occurred validating", errors);
 76  
             }
 77  0
         } catch (DoesNotExistException ex) {
 78  0
             throw new OperationFailedException("Error validating", ex);
 79  0
         }
 80  0
         return getNextDecorator().updateSoc(socId, socInfo, context);
 81  
     }
 82  
 
 83  
     @Override
 84  
     public List<ValidationResultInfo> validateSoc(String validationType, SocInfo socInfo, ContextInfo context)
 85  
             throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException {
 86  
         // validate
 87  
         List<ValidationResultInfo> errors;
 88  
         try {
 89  0
             errors = ValidationUtils.validateInfo(validator, validationType, socInfo, context);
 90  0
             List<ValidationResultInfo> nextDecoratorErrors = getNextDecorator().validateSoc(validationType, socInfo, context);
 91  0
             errors.addAll(nextDecoratorErrors);
 92  0
         } catch (DoesNotExistException ex) {
 93  0
             throw new OperationFailedException("Error validating", ex);
 94  0
         }
 95  0
         return errors;
 96  
     }
 97  
 
 98  
     @Override
 99  
     public SocRolloverResultInfo createSocRolloverResult(String socRolloverResultTypeKey, SocRolloverResultInfo socRolloverResultInfo, ContextInfo context)
 100  
             throws DoesNotExistException, DataValidationErrorException, InvalidParameterException, MissingParameterException,
 101  
             OperationFailedException, PermissionDeniedException, ReadOnlyException {
 102  
         // create 
 103  
         try {
 104  0
             List<ValidationResultInfo> errors =
 105  
                     this.validateSocRolloverResult(DataDictionaryValidator.ValidationType.FULL_VALIDATION.toString(),
 106  
                     socRolloverResultInfo, context);
 107  0
             if (!errors.isEmpty()) {
 108  0
                 throw new DataValidationErrorException("Error(s) occurred validating", errors);
 109  
             }
 110  0
         } catch (DoesNotExistException ex) {
 111  0
             throw new OperationFailedException("Error validating", ex);
 112  0
         }
 113  0
         return getNextDecorator().createSocRolloverResult(socRolloverResultTypeKey, socRolloverResultInfo, context);
 114  
     }
 115  
 
 116  
     @Override
 117  
     public SocRolloverResultInfo updateSocRolloverResult(String socRolloverResultId, SocRolloverResultInfo socRolloverResultInfo, ContextInfo context)
 118  
             throws DataValidationErrorException, DoesNotExistException, InvalidParameterException, MissingParameterException,
 119  
             OperationFailedException, PermissionDeniedException, ReadOnlyException, VersionMismatchException {
 120  
         // update
 121  
         try {
 122  0
             List<ValidationResultInfo> errors =
 123  
                     this.validateSocRolloverResult(DataDictionaryValidator.ValidationType.FULL_VALIDATION.toString(),
 124  
                     socRolloverResultInfo, context);
 125  0
             if (!errors.isEmpty()) {
 126  0
                 throw new DataValidationErrorException("Error(s) occurred validating", errors);
 127  
             }
 128  0
         } catch (DoesNotExistException ex) {
 129  0
             throw new OperationFailedException("Error validating", ex);
 130  0
         }
 131  0
         return getNextDecorator().updateSocRolloverResult(socRolloverResultId, socRolloverResultInfo, context);
 132  
     }
 133  
 
 134  
     @Override
 135  
     public List<ValidationResultInfo> validateSocRolloverResult(String validationType, SocRolloverResultInfo socRolloverResultInfo, ContextInfo context)
 136  
             throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException {
 137  
         // validate
 138  
         List<ValidationResultInfo> errors;
 139  
         try {
 140  0
             errors = ValidationUtils.validateInfo(validator, validationType, socRolloverResultInfo, context);
 141  0
             List<ValidationResultInfo> nextDecoratorErrors = getNextDecorator().validateSocRolloverResult(validationType,
 142  
                     socRolloverResultInfo, context);
 143  0
             errors.addAll(nextDecoratorErrors);
 144  0
         } catch (DoesNotExistException ex) {
 145  0
             throw new OperationFailedException("Error validating", ex);
 146  0
         }
 147  0
         return errors;
 148  
     }
 149  
 
 150  
     @Override
 151  
     public SocRolloverResultItemInfo createSocRolloverResultItem(String socRolloverResultId, String socRolloverResultItemTypeKey, SocRolloverResultItemInfo socRolloverResultItemInfo, ContextInfo context)
 152  
             throws DoesNotExistException, DataValidationErrorException, InvalidParameterException, MissingParameterException,
 153  
             OperationFailedException, PermissionDeniedException, ReadOnlyException {
 154  
         // create 
 155  
         try {
 156  0
             List<ValidationResultInfo> errors =
 157  
                     this.validateSocRolloverResultItem(DataDictionaryValidator.ValidationType.FULL_VALIDATION.toString(),
 158  
                     socRolloverResultItemInfo, context);
 159  0
             if (!errors.isEmpty()) {
 160  0
                 throw new DataValidationErrorException("Error(s) occurred validating", errors);
 161  
             }
 162  0
         } catch (DoesNotExistException ex) {
 163  0
             throw new OperationFailedException("Error validating", ex);
 164  0
         }
 165  0
         return getNextDecorator().createSocRolloverResultItem(socRolloverResultId, socRolloverResultItemTypeKey,
 166  
                 socRolloverResultItemInfo, context);
 167  
     }
 168  
 
 169  
     @Override
 170  
     public SocRolloverResultItemInfo updateSocRolloverResultItem(String socRolloverResultItemId, SocRolloverResultItemInfo socRolloverResultItemInfo, ContextInfo context)
 171  
             throws DataValidationErrorException, DoesNotExistException, InvalidParameterException, MissingParameterException,
 172  
             OperationFailedException, PermissionDeniedException, ReadOnlyException, VersionMismatchException {
 173  
         // update
 174  
         try {
 175  0
             List<ValidationResultInfo> errors =
 176  
                     this.validateSocRolloverResultItem(DataDictionaryValidator.ValidationType.FULL_VALIDATION.toString(),
 177  
                     socRolloverResultItemInfo, context);
 178  0
             if (!errors.isEmpty()) {
 179  0
                 throw new DataValidationErrorException("Error(s) occurred validating", errors);
 180  
             }
 181  0
         } catch (DoesNotExistException ex) {
 182  0
             throw new OperationFailedException("Error validating", ex);
 183  0
         }
 184  0
         return getNextDecorator().updateSocRolloverResultItem(socRolloverResultItemId, socRolloverResultItemInfo, context);
 185  
     }
 186  
 
 187  
     @Override
 188  
     public List<ValidationResultInfo> validateSocRolloverResultItem(String validationType, SocRolloverResultItemInfo socRolloverResultItemInfo, ContextInfo context)
 189  
             throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException {
 190  
         // validate
 191  
         List<ValidationResultInfo> errors;
 192  
         try {
 193  0
             errors = ValidationUtils.validateInfo(validator, validationType, socRolloverResultItemInfo, context);
 194  0
             List<ValidationResultInfo> nextDecoratorErrors = getNextDecorator().validateSocRolloverResultItem(validationType,
 195  
                     socRolloverResultItemInfo, context);
 196  0
             errors.addAll(nextDecoratorErrors);
 197  0
         } catch (DoesNotExistException ex) {
 198  0
             throw new OperationFailedException("Error validating", ex);
 199  0
         }
 200  0
         return errors;
 201  
     }
 202  
 
 203  
    
 204  
 }