View Javadoc
1   /*
2    * Copyright 2009 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.ole.module.purap.document.validation.event;
17  
18  import org.kuali.ole.module.purap.businessobject.LineItemReceivingItem;
19  import org.kuali.ole.module.purap.businessobject.ReceivingItem;
20  import org.kuali.ole.module.purap.document.ReceivingDocument;
21  import org.kuali.ole.module.purap.document.validation.AddReceivingItemRule;
22  import org.kuali.ole.sys.OLEConstants;
23  import org.kuali.rice.krad.document.Document;
24  import org.kuali.rice.krad.rules.rule.BusinessRule;
25  import org.kuali.rice.krad.rules.rule.event.KualiDocumentEvent;
26  import org.kuali.rice.krad.rules.rule.event.KualiDocumentEventBase;
27  
28  public class AddReceivingItemEvent extends KualiDocumentEventBase implements KualiDocumentEvent {
29  
30      private LineItemReceivingItem item;
31  
32      public AddReceivingItemEvent(String errorPathPrefix, Document document, LineItemReceivingItem item) {
33  
34          super("adding item to document " + getDocumentId(document), errorPathPrefix, document);
35          this.item = item;
36      }
37  
38      public Class getRuleInterfaceClass() {
39          return AddReceivingItemRule.class;
40      }
41  
42      public boolean invokeRuleMethod(BusinessRule rule) {
43          return ((AddReceivingItemRule) rule).processAddReceivingItemRules((ReceivingDocument) document, item, OLEConstants.EMPTY_STRING);
44      }
45  
46      public ReceivingItem getItem() {
47          return item;
48      }
49  
50      public void setItem(LineItemReceivingItem item) {
51          this.item = item;
52      }
53  
54  }