Coverage Report - org.kuali.student.r2.core.fee.service.impl.FeeServiceImpl
 
Classes in this File Line Coverage Branch Coverage Complexity
FeeServiceImpl
0%
0/37
0%
0/10
1.75
 
 1  
 /**
 2  
  * Copyright 2012 The Kuali Foundation Licensed under the
 3  
  * Educational Community License, Version 2.0 (the "License"); you may
 4  
  * not use this file except in compliance with the License. You may
 5  
  * obtain a copy of the License at
 6  
  *
 7  
  * http://www.osedu.org/licenses/ECL-2.0
 8  
  *
 9  
  * Unless required by applicable law or agreed to in writing,
 10  
  * software distributed under the License is distributed on an "AS IS"
 11  
  * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
 12  
  * or implied. See the License for the specific language governing
 13  
  * permissions and limitations under the License.
 14  
  *
 15  
  * Created by Charles on 4/25/12
 16  
  */
 17  
 package org.kuali.student.r2.core.fee.service.impl;
 18  
 
 19  
 import org.kuali.rice.core.api.criteria.QueryByCriteria;
 20  
 import org.kuali.student.r2.common.dto.ContextInfo;
 21  
 import org.kuali.student.r2.common.dto.StatusInfo;
 22  
 import org.kuali.student.r2.common.dto.ValidationResultInfo;
 23  
 import org.kuali.student.r2.common.exceptions.*;
 24  
 import org.kuali.student.r2.core.fee.dao.EnrollmentFeeDao;
 25  
 import org.kuali.student.r2.core.fee.dto.EnrollmentFeeInfo;
 26  
 import org.kuali.student.r2.core.fee.model.EnrollmentFeeEntity;
 27  
 import org.kuali.student.r2.core.fee.service.FeeService;
 28  
 import org.springframework.transaction.annotation.Transactional;
 29  
 
 30  
 import javax.annotation.Resource;
 31  
 import javax.jws.WebParam;
 32  
 import java.util.ArrayList;
 33  
 import java.util.List;
 34  
 
 35  
 /**
 36  
  * This class implements the Fee Service
 37  
  *
 38  
  * @author Kuali Student Team
 39  
  */
 40  0
 public class FeeServiceImpl implements FeeService {
 41  
     @Resource
 42  
     private EnrollmentFeeDao enrollmentFeeDao;
 43  
 
 44  
     public EnrollmentFeeDao getEnrollmentFeeDao() {
 45  0
         return enrollmentFeeDao;
 46  
     }
 47  
 
 48  
     public void setEnrollmentFeeDao(EnrollmentFeeDao enrollmentFeeDao) {
 49  0
         this.enrollmentFeeDao = enrollmentFeeDao;
 50  0
     }
 51  
 
 52  
     @Override
 53  
     @Transactional(readOnly = true)
 54  
     public EnrollmentFeeInfo getFee(String feeId, ContextInfo contextInfo) throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException {
 55  0
         EnrollmentFeeEntity feeEntity = enrollmentFeeDao.find(feeId);
 56  0
         if (null == feeEntity) {
 57  0
             throw new DoesNotExistException(feeId);
 58  
         }
 59  0
         return feeEntity.toDto();
 60  
     }
 61  
 
 62  
     @Override
 63  
     public List<EnrollmentFeeInfo> getFeesByIds(@WebParam(name = "feeIds") List<String> feeIds, @WebParam(name = "contextInfo") ContextInfo contextInfo) throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException {
 64  0
         return null;  //To change body of implemented methods use File | Settings | File Templates.
 65  
     }
 66  
 
 67  
     @Override
 68  
     public List<String> getFeeIdsByType(@WebParam(name = "feeTypeKey") String feeTypeKey, @WebParam(name = "contextInfo") ContextInfo contextInfo) throws InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException {
 69  0
         return null;  //To change body of implemented methods use File | Settings | File Templates.
 70  
     }
 71  
 
 72  
     @Override
 73  
     public List<EnrollmentFeeInfo> getFeesByReference(String refObjectURI, String refObjectId, ContextInfo contextInfo)
 74  
             throws InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException {
 75  0
         List<EnrollmentFeeEntity> entityList = enrollmentFeeDao.getFeesByRefObjectURIAndId(refObjectURI, refObjectId);
 76  0
         List<EnrollmentFeeInfo> infoList = new ArrayList<EnrollmentFeeInfo>();
 77  0
         if (entityList != null) {
 78  0
             for (EnrollmentFeeEntity entity: entityList) {
 79  0
                 infoList.add(entity.toDto());
 80  
             }
 81  
         }
 82  0
         return infoList;
 83  
     }
 84  
 
 85  
     @Override
 86  
     public List<String> searchForFeeIds(@WebParam(name = "criteria") QueryByCriteria criteria, @WebParam(name = "contextInfo") ContextInfo contextInfo) throws InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException {
 87  0
         return null;  //To change body of implemented methods use File | Settings | File Templates.
 88  
     }
 89  
 
 90  
     @Override
 91  
     public List<EnrollmentFeeInfo> searchForFees(@WebParam(name = "criteria") QueryByCriteria criteria, @WebParam(name = "contextInfo") ContextInfo contextInfo) throws InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException {
 92  0
         return null;
 93  
     }
 94  
 
 95  
     @Override
 96  
     public List<ValidationResultInfo> validateFee(@WebParam(name = "validationTypeKey") String validationTypeKey, @WebParam(name = "feeTypeKey") String feeTypeKey, @WebParam(name = "feeInfo") EnrollmentFeeInfo feeInfo, @WebParam(name = "contextInfo") ContextInfo contextInfo) throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException {
 97  0
         return null;  //To change body of implemented methods use File | Settings | File Templates.
 98  
     }
 99  
 
 100  
     @Override
 101  
     @Transactional(readOnly = false, noRollbackFor = {DoesNotExistException.class}, rollbackFor = {Throwable.class})
 102  
     public EnrollmentFeeInfo createFee(String feeTypeKey, EnrollmentFeeInfo feeInfo, ContextInfo contextInfo) throws DataValidationErrorException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException, ReadOnlyException {
 103  0
         EnrollmentFeeEntity feeEntity = new EnrollmentFeeEntity(feeInfo);
 104  
        
 105  0
         feeEntity.setEntityCreated(contextInfo);
 106  
         
 107  0
         enrollmentFeeDao.persist(feeEntity);
 108  0
         return feeEntity.toDto();
 109  
     }
 110  
 
 111  
     @Override
 112  
     @Transactional(readOnly = false, noRollbackFor = {DoesNotExistException.class}, rollbackFor = {Throwable.class})
 113  
     public EnrollmentFeeInfo updateFee(String feeId, EnrollmentFeeInfo feeInfo, ContextInfo contextInfo)
 114  
             throws DataValidationErrorException, DoesNotExistException, InvalidParameterException,
 115  
                    MissingParameterException, OperationFailedException, PermissionDeniedException,
 116  
                    ReadOnlyException, VersionMismatchException {
 117  0
         EnrollmentFeeEntity feeEntity = enrollmentFeeDao.find(feeId);
 118  0
         if (null != feeEntity) {
 119  0
             feeEntity.fromDto(feeInfo);
 120  
             
 121  0
             feeEntity.setEntityUpdated(contextInfo);
 122  
             
 123  0
             enrollmentFeeDao.merge(feeEntity);
 124  0
             return feeEntity.toDto();
 125  
         } else {
 126  0
             throw new DoesNotExistException(feeId);
 127  
         }
 128  
     }
 129  
 
 130  
     @Override
 131  
     @Transactional(readOnly = false, noRollbackFor = {DoesNotExistException.class}, rollbackFor = {Throwable.class})
 132  
     public StatusInfo deleteFee(String feeId, ContextInfo contextInfo)
 133  
             throws DoesNotExistException, InvalidParameterException, MissingParameterException,
 134  
                    OperationFailedException, PermissionDeniedException {
 135  0
         StatusInfo status = new StatusInfo();
 136  0
         status.setSuccess(Boolean.TRUE);
 137  
 
 138  0
         EnrollmentFeeEntity feeEntity = enrollmentFeeDao.find(feeId);
 139  0
         if (null != feeEntity) {
 140  0
             enrollmentFeeDao.remove(feeEntity);
 141  
         } else {
 142  0
             throw new DoesNotExistException(feeId);
 143  
         }
 144  0
         return status;
 145  
     }
 146  
 }