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