View Javadoc
1   /*
2    * Copyright 2006 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  
17  package org.kuali.ole.module.purap.businessobject;
18  
19  import org.kuali.ole.module.purap.util.PurApObjectUtils;
20  import org.kuali.ole.sys.businessobject.AccountingLineBase;
21  import org.kuali.rice.core.api.util.type.KualiDecimal;
22  
23  /**
24   * Payment Request Account Business Object.
25   */
26  public class PaymentRequestAccount extends PurApAccountingLineBase {
27  
28      private KualiDecimal disencumberedAmount = KualiDecimal.ZERO;
29      private KualiDecimal existingAmount;
30      /**
31       * Default constructor.
32       */
33      public PaymentRequestAccount() {
34          this.setAmount(null);
35          this.setAccountLinePercent(null);
36          this.setSequenceNumber(0);
37      }
38  
39      /**
40       * Constructor.
41       *
42       * @param item - payment request item
43       * @param poa  - purchase order account
44       */
45      public PaymentRequestAccount(PaymentRequestItem item, PurchaseOrderAccount poa) {
46          this();
47          // copy base attributes
48          PurApObjectUtils.populateFromBaseClass(AccountingLineBase.class, poa, this);
49          // copy percent
50          this.setSequenceNumber(poa.getSequenceNumber());
51          this.setAccountLinePercent(poa.getAccountLinePercent());
52          setItemIdentifier(item.getItemIdentifier());
53          setPaymentRequestItem(item);
54      }
55  
56      /**
57       * Constructor.
58       *
59       * @param item - payment request item
60       * @param poa  - purchase order account
61       */
62      public PaymentRequestAccount(PaymentRequestItem item, InvoiceAccount poa) {
63          this();
64          // copy base attributes
65          PurApObjectUtils.populateFromBaseClass(AccountingLineBase.class, poa, this);
66          // copy percent
67          this.setSequenceNumber(poa.getSequenceNumber());
68          this.setAccountLinePercent(poa.getAccountLinePercent());
69          setItemIdentifier(item.getItemIdentifier());
70          setPaymentRequestItem(item);
71      }
72  
73      public KualiDecimal getExistingAmount() {
74          return existingAmount;
75      }
76  
77      public void setExistingAmount(KualiDecimal existingAmount) {
78          this.existingAmount = existingAmount;
79      }
80      public KualiDecimal getDisencumberedAmount() {
81          return disencumberedAmount;
82      }
83  
84      public void setDisencumberedAmount(KualiDecimal disencumberedAmount) {
85          this.disencumberedAmount = disencumberedAmount;
86      }
87  
88      public PaymentRequestItem getPaymentRequestItem() {
89          return super.getPurapItem();
90      }
91  
92      public void setPaymentRequestItem(PaymentRequestItem paymentRequestItem) {
93          super.setPurapItem(paymentRequestItem);
94      }
95  
96      /**
97       * Caller of this method should take care of creating PaymentRequestItems
98       */
99      public void copyFrom(PaymentRequestAccount other) {
100         super.copyFrom(other);
101         setDisencumberedAmount(other.getDisencumberedAmount());
102     }
103 
104 }