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.ar.web.struts;
017    
018    import java.io.File;
019    import java.util.ArrayList;
020    import java.util.List;
021    
022    import javax.servlet.http.HttpServletRequest;
023    
024    import org.kuali.kfs.sys.KFSConstants;
025    import org.kuali.rice.kns.util.KNSConstants;
026    import org.kuali.rice.kns.web.struts.form.KualiForm;
027    import org.kuali.rice.kns.web.ui.ExtraButton;
028    
029    /**
030     * This class is the action form for Customer Aging Reports.
031     */
032    public class CustomerStatementForm extends KualiForm {
033        private static final long serialVersionUID = 1L;
034    
035        private static final org.apache.commons.logging.Log LOG = org.apache.commons.logging.LogFactory.getLog(CustomerStatementForm.class);
036    
037        private String chartCode;
038        private String orgCode;
039        private String accountNumber;
040        private String customerNumber;
041        private String message;
042        //private File report = new File("");
043       
044    
045        /**
046         * Gets the message attribute. 
047         * @return Returns the message.
048         */
049        public String getMessage() {
050            return message;
051        }
052    
053        /**
054         * Sets the message attribute value.
055         * @param message The message to set.
056         */
057        public void setMessage(String message) {
058            this.message = message;
059        }
060    
061        @Override
062        public void populate(HttpServletRequest request) {
063            super.populate(request);
064        }
065    
066        /**
067         * Gets the chartCode attribute. 
068         * @return Returns the chartCode.
069         */
070        public String getChartCode() {
071            return chartCode;
072        }
073    
074    
075    
076        /**
077         * Sets the chartCode attribute value.
078         * @param chartCode The chartCode to set.
079         */
080        public void setChartCode(String chartCode) {
081            this.chartCode = chartCode;
082        }
083    
084    
085    
086        /**
087         * Gets the orgCode attribute. 
088         * @return Returns the orgCode.
089         */
090        public String getOrgCode() {
091            return orgCode;
092        }
093    
094    
095    
096        /**
097         * Sets the orgCode attribute value.
098         * @param orgCode The orgCode to set.
099         */
100        public void setOrgCode(String orgCode) {
101            this.orgCode = orgCode;
102        }
103    
104        /**
105         * Gets the customerNumber attribute. 
106         * @return Returns the customerNumber.
107         */
108        public String getCustomerNumber() {
109            return customerNumber;
110        }
111    
112        /**
113         * Sets the customerNumber attribute value.
114         * @param customerNumber The customerNumber to set.
115         */
116        public void setCustomerNumber(String customerNumber) {
117            this.customerNumber = customerNumber;
118        }
119    
120        /**
121         * Gets the accountNumber attribute. 
122         * @return Returns the accountNumber.
123         */
124        public String getAccountNumber() {
125            return accountNumber;
126        }
127    
128        /**
129         * Sets the accountNumber attribute value.
130         * @param accountNumber The accountNumber to set.
131         */
132        public void setAccountNumber(String accountNumber) {
133            this.accountNumber = accountNumber;
134        }
135    
136        public void clear() {
137            this.accountNumber = null;
138            this.customerNumber = null;
139            this.chartCode = null;
140            this.orgCode = null;
141            this.message = null;
142        }
143    
144        @Override
145        public List<ExtraButton> getExtraButtons() {
146            List<ExtraButton> buttons = new ArrayList<ExtraButton>();
147         //   HashMap<String, ExtraButton> result = new HashMap<String, ExtraButton>();
148           
149            // Print button
150            ExtraButton printButton = new ExtraButton();
151            printButton.setExtraButtonProperty("methodToCall.print");
152            printButton.setExtraButtonSource("${" + KFSConstants.EXTERNALIZABLE_IMAGES_URL_KEY + "}buttonsmall_genprintfile.gif");
153            printButton.setExtraButtonAltText("Print");
154            buttons.add(printButton);
155            
156            // Clear button
157            ExtraButton clearButton = new ExtraButton();
158            clearButton.setExtraButtonProperty("methodToCall.clear");
159            clearButton.setExtraButtonSource("${" + KFSConstants.RICE_EXTERNALIZABLE_IMAGES_URL_KEY + "}buttonsmall_clear.gif");
160            clearButton.setExtraButtonAltText("Clear");
161            buttons.add(clearButton);
162            
163            // Cancel button
164            ExtraButton cancelButton = new ExtraButton();
165            cancelButton.setExtraButtonProperty("methodToCall.cancel");
166            cancelButton.setExtraButtonSource("${" + KFSConstants.RICE_EXTERNALIZABLE_IMAGES_URL_KEY + "}buttonsmall_cancel.gif");
167            cancelButton.setExtraButtonAltText("Cancel");
168            buttons.add(cancelButton);
169            
170            return buttons;
171        }
172        
173        /**
174         * @see org.kuali.rice.kns.web.struts.form.KualiDocumentFormBase#shouldMethodToCallParameterBeUsed(java.lang.String, java.lang.String, javax.servlet.http.HttpServletRequest)
175         */
176        @Override
177        public boolean shouldMethodToCallParameterBeUsed(String methodToCallParameterName, String methodToCallParameterValue, HttpServletRequest request) {
178            if (KNSConstants.DISPATCH_REQUEST_PARAMETER.equals(methodToCallParameterName) && "printStatementPDF".equals(methodToCallParameterValue)) {
179                return true;
180            }
181            return super.shouldMethodToCallParameterBeUsed(methodToCallParameterName, methodToCallParameterValue, request);
182        }
183    }