/*
 * Copyright 2006-2007 The Kuali Foundation.
 * 
 * Licensed under the Educational Community License, Version 1.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 * http://www.opensource.org/licenses/ecl1.php
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.kuali.module.purap.bo;

import java.util.LinkedHashMap;

import org.kuali.core.util.KualiDecimal;
import org.kuali.kfs.bo.AccountingLineBase;
import org.kuali.module.purap.util.PurApObjectUtils;

/**
 * 
 */
public class PaymentRequestAccount extends PurApAccountingLineBase {

	private KualiDecimal itemAccountTotalAmount = KualiDecimal.ZERO;
	private KualiDecimal disencumberedAmount = KualiDecimal.ZERO;

    private PaymentRequestItem paymentRequestItem;
    
	/**
	 * Default constructor.
	 */
	public PaymentRequestAccount() {

	}

    /**
     * Default constructor.
     */
    public PaymentRequestAccount(PaymentRequestItem item, PurchaseOrderAccount poa) {
//      copy base attributes
        PurApObjectUtils.populateFromBaseClass(AccountingLineBase.class, poa, this);
        //copy percent
        this.setAccountLinePercent(poa.getAccountLinePercent());
        setPaymentRequestItem(item);
    }

    
    /**
     * Gets the disencumberedAmount attribute. 
     * @return Returns the disencumberedAmount.
     */
    public KualiDecimal getDisencumberedAmount() {
        return disencumberedAmount;
    }

    /**
     * Sets the disencumberedAmount attribute value.
     * @param disencumberedAmount The disencumberedAmount to set.
     */
    public void setDisencumberedAmount(KualiDecimal disencumberedAmount) {
        this.disencumberedAmount = disencumberedAmount;
    }

    /**
     * Gets the itemAccountTotalAmount attribute. 
     * @return Returns the itemAccountTotalAmount.
     */
    public KualiDecimal getItemAccountTotalAmount() {
        return itemAccountTotalAmount;
    }

    /**
     * Sets the itemAccountTotalAmount attribute value.
     * @param itemAccountTotalAmount The itemAccountTotalAmount to set.
     */
    public void setItemAccountTotalAmount(KualiDecimal itemAccountTotalAmount) {
        this.itemAccountTotalAmount = itemAccountTotalAmount;
    }

    /**
     * Gets the paymentRequestItem attribute. 
     * @return Returns the paymentRequestItem.
     */
    public PaymentRequestItem getPaymentRequestItem() {
        return paymentRequestItem;
    }

    /**
     * Sets the paymentRequestItem attribute value.
     * @param paymentRequestItem The paymentRequestItem to set.
     */
    public void setPaymentRequestItem(PaymentRequestItem paymentRequestItem) {
        this.paymentRequestItem = paymentRequestItem;
    }

    /**
	 * @see org.kuali.core.bo.BusinessObjectBase#toStringMapper()
	 */
	@Override
    protected LinkedHashMap toStringMapper() {
	    LinkedHashMap m = new LinkedHashMap();	    
        if (this.getAccountIdentifier() != null) {
            m.put("paymentRequestAccountIdentifier", this.getAccountIdentifier().toString());
        }
	    return m;
    }
}

@@ -3021,24 +3021,26 @@
 %0A    %7D%0A%0A
+//
     /**%0A
 %09 * @see
@@ -3027,24 +3027,26 @@
 %0A%0A//    /**%0A
+//
 %09 * @see org
@@ -3096,21 +3096,25 @@
 apper()%0A
+//
 %09 */%0A
+//
 %09@Overri
@@ -3116,16 +3116,18 @@
 verride%0A
+//
     prot
@@ -3165,16 +3165,18 @@
 per() %7B%0A
+//
 %09    Lin
@@ -3212,24 +3212,26 @@
 Map();%09    %0A
+//
         if (
@@ -3265,24 +3265,26 @@
  != null) %7B%0A
+//
             
@@ -3361,24 +3361,26 @@
 oString());%0A
+//
         %7D%0A%09 
@@ -3377,16 +3377,18 @@
       %7D%0A
+//
 %09    ret
@@ -3394,16 +3394,18 @@
 turn m;%0A
+//
     %7D%0A%7D%0A

validate unique accounting string, part of KULPURAP-818