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.rice.core.api.util.type.KualiDecimal;
20  import org.kuali.rice.krad.util.ObjectUtils;
21  
22  /**
23   * Purchase Order Account Business Object.
24   */
25  public class PurchaseOrderAccount extends PurApAccountingLineBase {
26  
27      /**
28       * NOTE FOR POTENTIAL ACCOUNTING LINE REFACTORING documentNumber is needed for PO accounts and not for other PURAP docs, however
29       * it is already defined in AccountingLineBase so we don't need to add it here
30       */
31      // private String documentNumber;
32      private KualiDecimal itemAccountOutstandingEncumbranceAmount;
33  
34      /**
35       * Default constructor.
36       */
37      public PurchaseOrderAccount() {
38      }
39  
40      public PurchaseOrderAccount(PurApAccountingLine ra) {
41          this.setAccountLinePercent(ra.getAccountLinePercent());
42          this.setAccountNumber(ra.getAccountNumber());
43          this.setChartOfAccountsCode(ra.getChartOfAccountsCode());
44          this.setFinancialObjectCode(ra.getFinancialObjectCode());
45          this.setFinancialSubObjectCode(ra.getFinancialSubObjectCode());
46          this.setOrganizationReferenceId(ra.getOrganizationReferenceId());
47          this.setProjectCode(ra.getProjectCode());
48          this.setSubAccountNumber(ra.getSubAccountNumber());
49          this.setSequenceNumber(ra.getSequenceNumber());
50          this.setAmount(ra.getAmount());
51          this.setAccountLinePercent(ra.getAccountLinePercent());
52      }
53  
54      /**
55       * @see org.kuali.ole.module.purap.businessobject.PurApAccountingLine#getAlternateAmountForGLEntryCreation()
56       */
57      @Override
58      public KualiDecimal getAlternateAmountForGLEntryCreation() {
59          if (ObjectUtils.isNull(super.getAlternateAmountForGLEntryCreation())) {
60              return getItemAccountOutstandingEncumbranceAmount();
61          }
62          return super.getAlternateAmountForGLEntryCreation();
63      }
64  
65      public KualiDecimal getItemAccountOutstandingEncumbranceAmount() {
66          return itemAccountOutstandingEncumbranceAmount;
67      }
68  
69      public void setItemAccountOutstandingEncumbranceAmount(KualiDecimal itemAccountOutstandingEncumbranceAmount) {
70          this.itemAccountOutstandingEncumbranceAmount = itemAccountOutstandingEncumbranceAmount;
71      }
72  
73      public PurchaseOrderItem getPurchaseOrderItem() {
74          return super.getPurapItem();
75      }
76  
77      /**
78       * Sets the purchaseOrderItem attribute value.
79       *
80       * @param purchaseOrderItem The purchaseOrderItem to set.
81       * @deprecated
82       */
83      @Deprecated
84      public void setPurchaseOrderItem(PurchaseOrderItem purchaseOrderItem) {
85          super.setPurapItem(purchaseOrderItem);
86      }
87  
88      /**
89       * Caller of this method should take care of creating PurchaseOrderItems
90       */
91      public void copyFrom(PurchaseOrderAccount other) {
92          super.copyFrom(other);
93          setItemAccountOutstandingEncumbranceAmount(other.getItemAccountOutstandingEncumbranceAmount());
94      }
95  }