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