001/*
002 * Copyright 2006 The Kuali Foundation
003 * 
004 * Licensed under the Educational Community License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 * 
008 * http://www.opensource.org/licenses/ecl2.php
009 * 
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016
017package org.kuali.ole.module.purap.businessobject;
018
019
020import org.kuali.ole.module.purap.util.PurApObjectUtils;
021import org.kuali.ole.sys.businessobject.AccountingLineBase;
022
023/**
024 * Accounting line Business Object for a credit memo item line.
025 */
026public class CreditMemoAccount extends PurApAccountingLineBase {
027
028    /**
029     * Default constructor.
030     */
031    public CreditMemoAccount() {
032
033    }
034
035    /**
036     * Constructs a Credit Memo Account object from an existing PurAp Accounting Line object.
037     *
038     * @param accountingLine the accounting line to copy from.
039     */
040    public CreditMemoAccount(PurApAccountingLineBase accountingLine) {
041        super();
042
043        setChartOfAccountsCode(accountingLine.getChartOfAccountsCode());
044        setAccountNumber(accountingLine.getAccountNumber());
045        setSubAccountNumber(accountingLine.getSubAccountNumber());
046        setFinancialObjectCode(accountingLine.getFinancialObjectCode());
047        setFinancialSubObjectCode(accountingLine.getFinancialSubObjectCode());
048        setProjectCode(accountingLine.getProjectCode());
049        setOrganizationReferenceId(accountingLine.getOrganizationReferenceId());
050        setAmount(accountingLine.getAmount());
051        setAccountLinePercent(accountingLine.getAccountLinePercent());
052        this.setSequenceNumber(accountingLine.getSequenceNumber());
053    }
054
055    /**
056     * Constructor.
057     *
058     * @param item           - credit request item
059     * @param invoiceAccount - credit account
060     */
061    public CreditMemoAccount(CreditMemoItem item, InvoiceAccount invoiceAccount) {
062        this();
063        // copy base attributes
064        PurApObjectUtils.populateFromBaseClass(AccountingLineBase.class, invoiceAccount, this);
065        // copy percent
066        this.setSequenceNumber(invoiceAccount.getSequenceNumber());
067        this.setAccountLinePercent(invoiceAccount.getAccountLinePercent());
068        setItemIdentifier(item.getItemIdentifier());
069        setCreditMemoItem(item);
070    }
071
072    public CreditMemoItem getCreditMemoItem() {
073        return super.getPurapItem();
074    }
075
076    /**
077     * @deprecated
078     */
079    public void setCreditMemoItem(CreditMemoItem creditMemoItem) {
080        super.setPurapItem(creditMemoItem);
081    }
082}