Coverage Report - org.kuali.rice.kns.rule.event.KualiAddLineEvent
 
Classes in this File Line Coverage Branch Coverage Complexity
KualiAddLineEvent
0%
0/15
0%
0/4
1.5
 
 1  
 /*
 2  
  * Copyright 2006-2008 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.kns.rule.event;
 17  
 
 18  
 import org.apache.commons.lang.StringUtils;
 19  
 import org.apache.log4j.Logger;
 20  
 import org.kuali.rice.kns.bo.PersistableBusinessObject;
 21  
 import org.kuali.rice.kns.document.Document;
 22  
 import org.kuali.rice.kns.document.MaintenanceDocument;
 23  
 import org.kuali.rice.kns.rule.AddCollectionLineRule;
 24  
 import org.kuali.rice.kns.rule.BusinessRule;
 25  
 
 26  
 public class KualiAddLineEvent extends KualiDocumentEventBase {
 27  0
     private static final Logger LOG = Logger.getLogger(KualiAddLineEvent.class);
 28  
 
 29  
     private PersistableBusinessObject bo;
 30  
     private String collectionName;
 31  
 
 32  
     public KualiAddLineEvent( Document document, String collectionName, PersistableBusinessObject addLine ) {
 33  0
         super("adding bo to document collection " + getDocumentId(document), "", document);
 34  
         
 35  0
         this.bo = addLine;//(BusinessObject)ObjectUtils.deepCopy( addLine );
 36  0
         this.collectionName = collectionName;
 37  0
     }
 38  
 
 39  
     public boolean invokeRuleMethod(BusinessRule rule) {
 40  0
         return ((AddCollectionLineRule)rule).processAddCollectionLineBusinessRules( (MaintenanceDocument)getDocument(), collectionName, bo );
 41  
     }
 42  
 
 43  
     /**
 44  
      * Logs the event type and some information about the associated accountingLine
 45  
      */
 46  
     private void logEvent() {
 47  0
         if ( LOG.isDebugEnabled() ) {
 48  0
             StringBuffer logMessage = new StringBuffer(StringUtils.substringAfterLast(this.getClass().getName(), "."));
 49  0
             logMessage.append(" with ");
 50  
     
 51  
             // vary logging detail as needed
 52  0
             if (bo == null) {
 53  0
                 logMessage.append("null new bo");
 54  
             } else {
 55  0
                 logMessage.append( StringUtils.substringAfterLast(bo.getObjectId(), ".") );
 56  
             }
 57  
     
 58  0
             LOG.debug(logMessage);
 59  
         }
 60  0
     }
 61  
 
 62  
     public Class getRuleInterfaceClass() {
 63  0
         return AddCollectionLineRule.class;
 64  
     }
 65  
 }