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.Date;
019    import java.sql.Timestamp;
020    import java.util.List;
021    
022    import org.apache.commons.lang.StringUtils;
023    import org.kuali.kfs.module.purap.PurapPropertyConstants;
024    import org.kuali.kfs.module.purap.document.PaymentRequestDocument;
025    import org.kuali.kfs.sys.KFSConstants;
026    import org.kuali.kfs.sys.businessobject.FinancialSystemDocumentHeader;
027    import org.kuali.kfs.sys.context.SpringContext;
028    import org.kuali.rice.kns.bo.Note;
029    import org.kuali.rice.kns.service.DataDictionaryService;
030    import org.kuali.rice.kns.util.ObjectUtils;
031    import org.kuali.rice.kns.web.format.CurrencyFormatter;
032    import org.kuali.rice.kns.web.format.DateFormatter;
033    
034    /**
035     * Payment Request View Business Object.
036     */
037    public class PaymentRequestView extends AbstractRelatedView {
038    
039        private String invoiceNumber;
040        private Integer purchaseOrderIdentifier;
041        private String statusCode;
042        private boolean paymentHoldIndicator;
043        private boolean paymentRequestedCancelIndicator;
044        private String vendorName;
045        private String vendorCustomerNumber;
046        private Date paymentRequestPayDate;
047        private Timestamp paymentExtractedTimestamp;
048        private Timestamp paymentPaidTimestamp;
049        
050        // REFERENCE OBJECTS
051        private Status status;
052        private FinancialSystemDocumentHeader documentHeader;
053    
054    
055        // GETTERS & SETTERS
056        public Object getTotalAmount() {
057            return (new CurrencyFormatter()).format(documentHeader.getFinancialDocumentTotalAmount());
058        }
059    
060        public String getInvoiceNumber() {
061            return invoiceNumber;
062        }
063    
064        public void setInvoiceNumber(String invoiceNumber) {
065            this.invoiceNumber = invoiceNumber;
066        }
067    
068        public Timestamp getPaymentExtractedTimestamp() {
069            return paymentExtractedTimestamp;
070        }
071    
072        public void setPaymentExtractedTimestamp(Timestamp paymentExtractedTimestamp) {
073            this.paymentExtractedTimestamp = paymentExtractedTimestamp;
074        }
075    
076        public boolean isPaymentHoldIndicator() {
077            return paymentHoldIndicator;
078        }
079    
080        public void setPaymentHoldIndicator(boolean paymentHoldIndicator) {
081            this.paymentHoldIndicator = paymentHoldIndicator;
082        }
083            
084        public Timestamp getPaymentPaidTimestamp() {
085            return paymentPaidTimestamp;
086        }
087    
088        public void setPaymentPaidTimestamp(Timestamp paymentPaidTimestamp) {
089            this.paymentPaidTimestamp = paymentPaidTimestamp;
090        }
091    
092        public boolean isPaymentRequestedCancelIndicator() {
093            return paymentRequestedCancelIndicator;
094        }
095    
096        public void setPaymentRequestedCancelIndicator(boolean paymentRequestedCancelIndicator) {
097            this.paymentRequestedCancelIndicator = paymentRequestedCancelIndicator;
098        }
099    
100        public Object getPaymentRequestPayDate() {
101            return new DateFormatter().format(paymentRequestPayDate);
102        }
103    
104        public void setPaymentRequestPayDate(Date paymentRequestPayDate) {
105            this.paymentRequestPayDate = paymentRequestPayDate;
106        }
107    
108        public Integer getPurchaseOrderIdentifier() {
109            return purchaseOrderIdentifier;
110        }
111    
112        public void setPurchaseOrderIdentifier(Integer purchaseOrderIdentifier) {
113            this.purchaseOrderIdentifier = purchaseOrderIdentifier;
114        }
115    
116        public String getStatusCode() {
117            return statusCode;
118        }
119    
120        public void setStatusCode(String statusCode) {
121            this.statusCode = statusCode;
122        }
123        
124        public Status getStatus() {
125            if (ObjectUtils.isNull(this.status) && StringUtils.isNotEmpty(this.getStatusCode())) {
126                this.refreshReferenceObject(PurapPropertyConstants.STATUS);
127            }
128            return status;
129        }
130    
131        public void setStatus(Status status) {
132            this.status = status;
133        }
134    
135        public String getVendorCustomerNumber() {
136            return vendorCustomerNumber;
137        }
138    
139        public void setVendorCustomerNumber(String vendorCustomerNumber) {
140            this.vendorCustomerNumber = vendorCustomerNumber;
141        }
142    
143        public String getVendorName() {
144            return vendorName;
145        }
146    
147        public void setVendorName(String vendorName) {
148            this.vendorName = vendorName;
149        }
150        
151        /**
152         * @return workflow document type for the PaymentRequestDocument
153         */
154        public String getDocumentType() {
155            return KFSConstants.FinancialDocumentTypeCodes.PAYMENT_REQUEST;
156        }
157    
158        /**
159         * The next three methods are overridden but shouldnt be! If they arent overridden, they dont show up in the tag, not sure why
160         * at this point! (AAP)
161         */
162        @Override
163        public Integer getPurapDocumentIdentifier() {
164            return super.getPurapDocumentIdentifier();
165        }
166    
167        @Override
168        public String getDocumentIdentifierString() {
169            return super.getDocumentIdentifierString();
170        }
171    
172        /**
173         * @see org.kuali.kfs.module.purap.businessobject.AbstractRelatedView#getNotes()
174         */
175        @Override
176        public List<Note> getNotes() {
177            return super.getNotes();
178        }
179    
180        /**
181         * @see org.kuali.kfs.module.purap.businessobject.AbstractRelatedView#getUrl()
182         */
183        @Override
184        public String getUrl() {
185            return super.getUrl();
186        }
187    }