001/*
002 * Copyright 2007-2008 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 */
016package org.kuali.ole.module.purap.businessobject;
017
018import org.kuali.ole.module.purap.PurapConstants.PurapDocTypeCodes;
019import org.kuali.ole.sys.businessobject.SourceAccountingLine;
020import org.kuali.ole.sys.context.SpringContext;
021import org.kuali.rice.core.api.datetime.DateTimeService;
022
023import java.sql.Timestamp;
024
025/**
026 * Payment Request Summary Account Business Object.
027 */
028public class AccountsPayableSummaryAccount extends PaymentRequestAccount {
029
030    private Integer paymentRequestIdentifier;
031    private Integer creditMemoIdentifier;
032    private Timestamp updateTimestamp;
033    private Integer invoiceIdentifier;
034
035    public AccountsPayableSummaryAccount() {
036    }
037
038    public AccountsPayableSummaryAccount(SourceAccountingLine account, Integer purapDocumentIdentifier, String docType) {
039        if (PurapDocTypeCodes.PAYMENT_REQUEST_DOCUMENT.equals(docType)) {
040            this.setPaymentRequestIdentifier(purapDocumentIdentifier);
041        } else if (PurapDocTypeCodes.INVOICE_DOCUMENT.equals(docType)) {
042            this.setInvoiceIdentifier(purapDocumentIdentifier);
043        } else if (PurapDocTypeCodes.CREDIT_MEMO_DOCUMENT.equals(docType)) {
044            this.setCreditMemoIdentifier(purapDocumentIdentifier);
045        }
046        this.setChartOfAccountsCode(account.getChartOfAccountsCode());
047        this.setAccountNumber(account.getAccountNumber());
048        this.setSubAccountNumber(account.getSubAccountNumber());
049        this.setFinancialObjectCode(account.getFinancialObjectCode());
050        this.setFinancialSubObjectCode(account.getFinancialSubObjectCode());
051        this.setProjectCode(account.getProjectCode());
052        this.setOrganizationReferenceId(account.getOrganizationReferenceId());
053        this.setAmount(account.getAmount());
054        this.setSequenceNumber(account.getSequenceNumber());
055        this.setUpdateTimestamp(SpringContext.getBean(DateTimeService.class).getCurrentTimestamp());
056    }
057
058    /**
059     * ItemIdentifier is not a valid field in this table because it is the summary of accounts for the document, not per item
060     *
061     * @deprecated
062     */
063    @Override
064    public Integer getItemIdentifier() {
065        return super.getItemIdentifier();
066    }
067
068    /**
069     * ItemIdentifier is not a valid field in this table because it is the summary of accounts for the document, not per item
070     *
071     * @deprecated
072     */
073    @Override
074    public void setItemIdentifier(Integer itemIdentifier) {
075        super.setItemIdentifier(itemIdentifier);
076    }
077
078    public Integer getPaymentRequestIdentifier() {
079        return paymentRequestIdentifier;
080    }
081
082    public void setPaymentRequestIdentifier(Integer paymentRequestIdentifier) {
083        this.paymentRequestIdentifier = paymentRequestIdentifier;
084    }
085
086    public Integer getInvoiceIdentifier() {
087        return invoiceIdentifier;
088    }
089
090    public void setInvoiceIdentifier(Integer invoiceIdentifier) {
091        this.invoiceIdentifier = invoiceIdentifier;
092    }
093
094
095    public Integer getCreditMemoIdentifier() {
096        return creditMemoIdentifier;
097    }
098
099    public void setCreditMemoIdentifier(Integer creditMemoIdentifier) {
100        this.creditMemoIdentifier = creditMemoIdentifier;
101    }
102
103    public Timestamp getUpdateTimestamp() {
104        return updateTimestamp;
105    }
106
107    public void setUpdateTimestamp(Timestamp updateTimestamp) {
108        this.updateTimestamp = updateTimestamp;
109    }
110
111}