Coverage Report - org.kuali.rice.kns.rule.event.ApproveDocumentEvent
 
Classes in this File Line Coverage Branch Coverage Complexity
ApproveDocumentEvent
0%
0/11
N/A
1
 
 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 java.util.ArrayList;
 19  
 import java.util.List;
 20  
 
 21  
 import org.kuali.rice.kns.document.Document;
 22  
 import org.kuali.rice.kns.rule.ApproveDocumentRule;
 23  
 import org.kuali.rice.kns.rule.BusinessRule;
 24  
 
 25  
 /**
 26  
  * This class represents the approve event that is part of an eDoc in Kuali. This could be triggered when a user presses the approve
 27  
  * button for a given document enroute or it could happen when another piece of code calls the approve method in the document
 28  
  * service.
 29  
  * 
 30  
  * 
 31  
  */
 32  
 public class ApproveDocumentEvent extends KualiDocumentEventBase {
 33  
     /**
 34  
      * Constructs an ApproveDocumentEvent with the specified errorPathPrefix and document
 35  
      * 
 36  
      * @param errorPathPrefix
 37  
      * @param document
 38  
      */
 39  
     public ApproveDocumentEvent(String errorPathPrefix, Document document) {
 40  0
         this("approve", errorPathPrefix, document);
 41  0
     }
 42  
 
 43  
     /**
 44  
      * Constructs an ApproveDocumentEvent with the given document
 45  
      * 
 46  
      * @param document
 47  
      */
 48  
     public ApproveDocumentEvent(Document document) {
 49  0
         this("approve", "", document);
 50  0
     }
 51  
 
 52  
     /**
 53  
      * Constructs a ApproveDocumentEvent, allowing the eventType to be passed in so that subclasses can specify a more accurate
 54  
      * message.
 55  
      * 
 56  
      * @param eventType
 57  
      * @param errorPathPrefix
 58  
      * @param document
 59  
      */
 60  
     protected ApproveDocumentEvent(String eventType, String errorPathPrefix, Document document) {
 61  0
         super("creating " + eventType + " event for document " + KualiDocumentEventBase.getDocumentId(document), errorPathPrefix, document);
 62  0
     }
 63  
 
 64  
 
 65  
     /**
 66  
      * @see org.kuali.rice.kns.rule.event.KualiDocumentEvent#getRuleInterfaceClass()
 67  
      */
 68  
     public Class<? extends BusinessRule> getRuleInterfaceClass() {
 69  0
         return ApproveDocumentRule.class;
 70  
     }
 71  
 
 72  
     /**
 73  
      * @see org.kuali.rice.kns.rule.event.KualiDocumentEvent#invokeRuleMethod(org.kuali.rice.kns.rule.BusinessRule)
 74  
      */
 75  
     public boolean invokeRuleMethod(BusinessRule rule) {
 76  0
         return ((ApproveDocumentRule) rule).processApproveDocument(this);
 77  
     }
 78  
 
 79  
     /**
 80  
      * @see org.kuali.rice.kns.rule.event.KualiDocumentEvent#generateEvents()
 81  
      */
 82  
     @Override
 83  
     public List<KualiDocumentEvent> generateEvents() {
 84  0
         List<KualiDocumentEvent> events = new ArrayList<KualiDocumentEvent>();
 85  0
         events.add(new RouteDocumentEvent(getDocument()));
 86  0
         return events;
 87  
     }
 88  
 }