Coverage Report - org.kuali.rice.krad.service.impl.DocumentHeaderServiceImpl
 
Classes in this File Line Coverage Branch Coverage Complexity
DocumentHeaderServiceImpl
0%
0/15
0%
0/6
2
 
 1  
 /**
 2  
  * Copyright 2005-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.krad.service.impl;
 17  
 
 18  
 import org.apache.commons.lang.StringUtils;
 19  
 import org.kuali.rice.krad.bo.DocumentHeader;
 20  
 import org.kuali.rice.krad.dao.DocumentHeaderDao;
 21  
 import org.kuali.rice.krad.service.DocumentHeaderService;
 22  
 import org.kuali.rice.krad.service.KRADServiceLocator;
 23  
 import org.springframework.transaction.annotation.Transactional;
 24  
 
 25  
 /**
 26  
  * This is an implementation of {@link DocumentHeaderService} that facilitates
 27  
  * document header management and customization
 28  
  * 
 29  
  * @author Kuali Rice Team (rice.collab@kuali.org)
 30  
  * 
 31  
  */
 32  
 @Transactional
 33  0
 public class DocumentHeaderServiceImpl implements DocumentHeaderService {
 34  0
     private static org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(DocumentHeaderServiceImpl.class);
 35  
     private DocumentHeaderDao documentHeaderDao;
 36  
 
 37  
     /**
 38  
      * @see org.kuali.rice.krad.service.DocumentHeaderService#getDocumentHeaderBaseClass()
 39  
      */
 40  
     public Class<? extends DocumentHeader> getDocumentHeaderBaseClass() {
 41  0
         Class documentHeaderClass = documentHeaderDao.getDocumentHeaderBaseClass();
 42  0
         if ( (documentHeaderClass == null) || (!DocumentHeader.class.isAssignableFrom(documentHeaderClass)) ) {
 43  0
             throw new RuntimeException("invalid document header base class '" + documentHeaderClass + "' returned by dao '" + documentHeaderDao.getClass().getName() + "'");
 44  
         }
 45  0
         return documentHeaderClass;
 46  
     }
 47  
 
 48  
     /**
 49  
      * @see org.kuali.rice.krad.service.DocumentHeaderService#getDocumentHeaderById(java.lang.String)
 50  
      */
 51  
     public DocumentHeader getDocumentHeaderById(String documentHeaderId) {
 52  0
         if (StringUtils.isBlank(documentHeaderId)) {
 53  0
             throw new IllegalArgumentException("document header id given is blank");
 54  
         }
 55  0
         return documentHeaderDao.getByDocumentHeaderId(documentHeaderId);
 56  
     }
 57  
 
 58  
     /**
 59  
      * @see org.kuali.rice.krad.service.DocumentHeaderService#saveDocumentHeader(org.kuali.rice.krad.bo.DocumentHeader)
 60  
      */
 61  
     public void saveDocumentHeader(DocumentHeader documentHeader) {
 62  0
         KRADServiceLocator.getBusinessObjectService().save(documentHeader);
 63  0
     }
 64  
     
 65  
     /**
 66  
      * @see org.kuali.rice.krad.service.DocumentHeaderService#deleteDocumentHeader(org.kuali.rice.krad.bo.DocumentHeader)
 67  
      */
 68  
     public void deleteDocumentHeader(DocumentHeader documentHeader) {
 69  0
         KRADServiceLocator.getBusinessObjectService().delete(documentHeader);
 70  0
     }
 71  
 
 72  
     /**
 73  
      * dao injected by spring
 74  
      * 
 75  
      * @param documentHeaderDao
 76  
      */
 77  
     public void setDocumentHeaderDao(DocumentHeaderDao documentHeaderDao) {
 78  0
         this.documentHeaderDao = documentHeaderDao;
 79  0
     }
 80  
 
 81  
 }