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.cg.web.struts;
017    
018    import java.util.Date;
019    
020    import org.kuali.kfs.module.cg.document.ProposalAwardCloseDocument;
021    import org.kuali.kfs.module.cg.service.CloseService;
022    import org.kuali.kfs.sys.context.SpringContext;
023    import org.kuali.kfs.sys.document.web.struts.FinancialSystemTransactionalDocumentFormBase;
024    import org.kuali.rice.kns.web.format.DateFormatter;
025    
026    public class CloseForm extends FinancialSystemTransactionalDocumentFormBase {
027    
028        public CloseForm() {
029            super();
030            setFormatterType("document.userInitiatedCloseDate", DateFormatter.class);
031            setFormatterType("document.closeOnOrBeforeDate", DateFormatter.class);
032        }
033    
034        @Override
035        protected String getDefaultDocumentTypeName() {
036            return "CLOS";
037        }
038        
039        public ProposalAwardCloseDocument getMostRecentClose() {
040            return SpringContext.getBean(CloseService.class).getMostRecentClose();
041        }
042    
043        public ProposalAwardCloseDocument getCloseDocument() {
044            return (ProposalAwardCloseDocument) getDocument();
045        }
046    
047        public void setClose(ProposalAwardCloseDocument document) {
048            setDocument(document);
049        }
050    
051        public Date getUserInitiatedCloseDate() {
052            return getCloseDocument().getUserInitiatedCloseDate();
053        }
054    
055        public void setUserInitiatedCloseDate(Date date) {
056            getCloseDocument().setUserInitiatedCloseDate(new java.sql.Date(date.getTime()));
057        }
058    
059        public Date getCloseOnOrBeforeDate() {
060            return getCloseDocument().getCloseOnOrBeforeDate();
061        }
062    
063        public void setCloseOnOrBeforeDate(Date date) {
064            getCloseDocument().setCloseOnOrBeforeDate(new java.sql.Date(date.getTime()));
065        }
066    
067    }