Coverage Report - org.kuali.rice.kns.rule.event.SaveDocumentEvent
 
Classes in this File Line Coverage Branch Coverage Complexity
SaveDocumentEvent
0%
0/14
N/A
1
 
 1  
 /*
 2  
  * Copyright 2005-2007 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 java.util.ArrayList;
 19  
 import java.util.List;
 20  
 
 21  
 import org.kuali.rice.kns.document.Document;
 22  
 import org.kuali.rice.kns.rule.BusinessRule;
 23  
 import org.kuali.rice.kns.rule.SaveDocumentRule;
 24  
 import org.kuali.rice.kns.service.KNSServiceLocatorWeb;
 25  
 import org.kuali.rice.kns.service.KualiRuleService;
 26  
 
 27  
 /**
 28  
  * This class represents the save event that is part of an eDoc in Kuali. This could be triggered when a user presses the save
 29  
  * button for a given document or it could happen when another piece of code calls the save method in the document service.
 30  
  * 
 31  
  * 
 32  
  */
 33  
 public class SaveDocumentEvent extends KualiDocumentEventBase implements SaveEvent {
 34  
     /**
 35  
      * Constructs a SaveDocumentEvent with the specified errorPathPrefix and document
 36  
      * 
 37  
      * @param document
 38  
      * @param errorPathPrefix
 39  
      */
 40  
     public SaveDocumentEvent(String errorPathPrefix, Document document) {
 41  0
         this("creating save event for document " + getDocumentId(document), errorPathPrefix, document);
 42  0
     }
 43  
 
 44  
     /**
 45  
      * Constructs a SaveDocumentEvent with the given document
 46  
      * 
 47  
      * @param document
 48  
      */
 49  
     public SaveDocumentEvent(Document document) {
 50  0
         this("", document);
 51  0
     }
 52  
     
 53  
     /**
 54  
      * @see org.kuali.rice.kns.rule.event.KualiDocumentEventBase#KualiDocumentEventBase(java.lang.String, java.lang.String, org.kuali.rice.kns.document.Document)
 55  
      */
 56  
     public SaveDocumentEvent(String description, String errorPathPrefix, Document document) {
 57  0
         super(description, errorPathPrefix, document);
 58  0
     }
 59  
     
 60  
     /**
 61  
      * @see org.kuali.rice.kns.rule.event.KualiDocumentEvent#getRuleInterfaceClass()
 62  
      */
 63  
     public Class<? extends BusinessRule> getRuleInterfaceClass() {
 64  0
         return SaveDocumentRule.class;
 65  
     }
 66  
 
 67  
     /**
 68  
      * @see org.kuali.rice.kns.rule.event.KualiDocumentEvent#invokeRuleMethod(org.kuali.rice.kns.rule.BusinessRule)
 69  
      */
 70  
     public boolean invokeRuleMethod(BusinessRule rule) {
 71  0
         return ((SaveDocumentRule) rule).processSaveDocument(document);
 72  
     }
 73  
 
 74  
     /**
 75  
      * @see org.kuali.rice.kns.rule.event.KualiDocumentEvent#generateEvents()
 76  
      */
 77  
     @Override
 78  
     public List<KualiDocumentEvent> generateEvents() {
 79  0
         KualiRuleService ruleService = KNSServiceLocatorWeb.getKualiRuleService();
 80  
 
 81  0
         List<KualiDocumentEvent> events = new ArrayList<KualiDocumentEvent>();
 82  0
         events.addAll(ruleService.generateAdHocRoutePersonEvents(getDocument()));
 83  0
         events.addAll(ruleService.generateAdHocRouteWorkgroupEvents(getDocument()));
 84  
         
 85  0
         events.addAll(getDocument().generateSaveEvents());
 86  
 
 87  
         /*
 88  
         if (getDocument() instanceof CashReceiptDocument) {
 89  
             events.addAll(ruleService.generateCheckEvents((CashReceiptDocument) getDocument()));
 90  
         }
 91  
 
 92  
         if (getDocument() instanceof AccountingDocument) {
 93  
             events.addAll(ruleService.generateAccountingLineEvents((AccountingDocument) getDocument()));
 94  
         }
 95  
         */
 96  0
         return events;
 97  
     }
 98  
 }