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.sys.businessobject;
017    
018    import java.sql.Date;
019    
020    import org.apache.commons.lang.StringUtils;
021    import org.kuali.kfs.sys.KFSConstants;
022    import org.kuali.rice.kns.bo.DocumentHeader;
023    import org.kuali.rice.kns.util.KualiDecimal;
024    import org.kuali.rice.core.util.KeyLabelPair;
025    
026    /**
027     * This class is a custom {@link DocumentHeader} class used by KFS to facilitate custom data fields and a few UI fields
028     */
029    public class FinancialSystemDocumentHeader extends DocumentHeader {
030        
031        private KualiDecimal financialDocumentTotalAmount;
032        private String correctedByDocumentId;
033        private String financialDocumentInErrorNumber;
034        private String financialDocumentStatusCode;
035        
036        /**
037         * Constructor - creates empty instances of dependent objects
038         * 
039         */
040        public FinancialSystemDocumentHeader() {
041            super();
042            financialDocumentStatusCode = KFSConstants.DocumentStatusCodes.INITIATED;
043        }
044    
045    //    /**
046    //     * @return null if {@link #getDocumentTemplateNumber()} returns a non-blank value
047    //     */
048    //    public KeyLabelPair getAdditionalDocId1() {
049    //        if (StringUtils.isNotBlank(getFinancialDocumentInErrorNumber())) {
050    //            return new KeyLabelPair("DataDictionary.FinancialSystemDocumentHeader.attributes.financialDocumentInErrorNumber", getFinancialDocumentInErrorNumber());
051    //        }
052    //        return super.getAdditionalDocId1();
053    //    }
054    //
055    //    /**
056    //     * @return null
057    //     */
058    //    public KeyLabelPair getAdditionalDocId2() {
059    //        if (StringUtils.isNotBlank(getCorrectedByDocumentId())) {
060    //            return new KeyLabelPair("DataDictionary.FinancialSystemDocumentHeader.attributes.correctedByDocumentId", getCorrectedByDocumentId());
061    //        }
062    //        return super.getAdditionalDocId2();
063    //    }
064    
065        /**
066         * Gets the financialDocumentTotalAmount attribute. 
067         * @return Returns the financialDocumentTotalAmount.
068         */
069        public KualiDecimal getFinancialDocumentTotalAmount() {
070            return financialDocumentTotalAmount;
071        }
072    
073        /**
074         * Sets the financialDocumentTotalAmount attribute value.
075         * @param financialDocumentTotalAmount The financialDocumentTotalAmount to set.
076         */
077        public void setFinancialDocumentTotalAmount(KualiDecimal financialDocumentTotalAmount) {
078            this.financialDocumentTotalAmount = financialDocumentTotalAmount;
079        }
080    
081        /**
082         * Gets the correctedByDocumentId attribute. 
083         * @return Returns the correctedByDocumentId.
084         */
085        public String getCorrectedByDocumentId() {
086            return correctedByDocumentId;
087        }
088    
089        /**
090         * Sets the correctedByDocumentId attribute value.
091         * @param correctedByDocumentId The correctedByDocumentId to set.
092         */
093        public void setCorrectedByDocumentId(String correctedByDocumentId) {
094            this.correctedByDocumentId = correctedByDocumentId;
095        }
096    
097        /**
098         * Gets the financialDocumentInErrorNumber attribute. 
099         * @return Returns the financialDocumentInErrorNumber.
100         */
101        public String getFinancialDocumentInErrorNumber() {
102            return financialDocumentInErrorNumber;
103        }
104    
105        /**
106         * Sets the financialDocumentInErrorNumber attribute value.
107         * @param financialDocumentInErrorNumber The financialDocumentInErrorNumber to set.
108         */
109        public void setFinancialDocumentInErrorNumber(String financialDocumentInErrorNumber) {
110            this.financialDocumentInErrorNumber = financialDocumentInErrorNumber;
111        }
112    
113        /**
114         * Gets the financialDocumentStatusCode attribute. 
115         * @return Returns the financialDocumentStatusCode.
116         */
117        public String getFinancialDocumentStatusCode() {
118            return financialDocumentStatusCode;
119        }
120    
121        /**
122         * Sets the financialDocumentStatusCode attribute value.
123         * @param financialDocumentStatusCode The financialDocumentStatusCode to set.
124         */
125        public void setFinancialDocumentStatusCode(String financialDocumentStatusCode) {
126            this.financialDocumentStatusCode = financialDocumentStatusCode;
127        }
128    
129        /**
130         * Gets the documentFinalDate attribute. 
131         * @return Returns the documentFinalDate.
132         */
133        public Date getDocumentFinalDate() {
134            return  new java.sql.Date(this.getWorkflowDocument().getRouteHeader().getDateFinalized().getTime().getTime());
135        }
136    
137    }