Files
HRMS/hrmsEjb/wenrgise/hrms/webtier/form/JasperReportForm.java
2025-07-28 13:56:49 +05:30

45 lines
1.4 KiB
Java

package wenrgise.hrms.webtier.form;
import java.io.Serializable;
import java.lang.reflect.Method;
import java.util.HashMap;
import javax.servlet.http.HttpServletRequest;
public class JasperReportForm extends HrmBaseForm {
private static final long serialVersionUID = 19981017L;
private String downloadOption;
public String getDownloadOption() {
return this.downloadOption;
}
public void setDownloadOption(String newDownloadOption) {
this.downloadOption = newDownloadOption;
}
public Serializable getData(HttpServletRequest req) {
HashMap data = new HashMap();
Class formBeanClass = getClass();
Method[] methods = formBeanClass.getDeclaredMethods();
StringBuffer fieldName = new StringBuffer();
for (int i = 0; i < methods.length; i++) {
String methodName = methods[i].getName();
if (methodName.startsWith("get") && (
methods[i].getParameterTypes()).length <= 0)
try {
Object val = methods[i].invoke(this, null);
if (null != val && val instanceof String && ((String)val).trim().length() == 0)
val = null;
fieldName.append(methodName.substring(3, 4).toLowerCase());
fieldName.append(methodName.substring(4));
data.put(fieldName.toString(), val);
fieldName.delete(0, fieldName.length());
} catch (Exception e) {
e.printStackTrace();
}
}
return data;
}
}