Update of /cvsroot/oscarmcmaster/oscar_mcmaster/web/WEB-INF/classes/src/oscar/form/pageUtil
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3009
Modified Files:
FrmFormAction.java
Log Message:
Added Current Memory Left Statements for debugging
Index: FrmFormAction.java
===================================================================
RCS file: /cvsroot/oscarmcmaster/oscar_mcmaster/web/WEB-INF/classes/src/oscar/form/pageUtil/FrmFormAction.java,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -d -r1.14 -r1.15
*** FrmFormAction.java 10 Dec 2004 20:29:36 -0000 1.14
--- FrmFormAction.java 15 Dec 2004 14:26:37 -0000 1.15
***************
*** 65,77 ****
private String _dateFormat = "yyyy/MM/dd";
! ActionErrors errors = new ActionErrors();
! boolean valid = true;
public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
! throws ServletException, IOException
! {
! System.out.println("FrmFormAction is called");
System.gc();
FrmFormForm frm = (FrmFormForm) form;
--- 65,78 ----
private String _dateFormat = "yyyy/MM/dd";
!
public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
! throws ServletException, IOException{
! ActionErrors errors = new ActionErrors();
! boolean valid = true;
! System.out.println("FrmFormAction is called "+currentMem());
System.gc();
+ System.out.println("current mem 1 "+currentMem());
FrmFormForm frm = (FrmFormForm) form;
***************
*** 80,84 ****
request.getSession().setAttribute("EctSessionBean", bean);
! String formName = (String) frm.getValue("formName");
String formId = (String) frm.getValue("formId");
String dateEntered = UtilDateUtilities.DateToString(UtilDateUtilities.Today(),_dateFormat);
--- 81,86 ----
request.getSession().setAttribute("EctSessionBean", bean);
! String formName = (String) frm.getValue("formName");
! System.out.println("formNme Top "+formName);
String formId = (String) frm.getValue("formId");
String dateEntered = UtilDateUtilities.DateToString(UtilDateUtilities.Today(),_dateFormat);
***************
*** 86,92 ****
--- 88,97 ----
String visitCod = UtilDateUtilities.DateToString(UtilDateUtilities.Today(),"yyyyMMdd");
+ System.out.println("current mem 2 "+currentMem());
+
Properties props = new Properties();
EctFormProp formProp = EctFormProp.getInstance();
Vector measurementTypes = formProp.getMeasurementTypes();
+ System.out.println("num measurements "+measurementTypes.size());
String demographicNo = null;
String providerNo = (String) session.getValue("user");
***************
*** 94,100 ****
--- 99,109 ----
demographicNo = bean.getDemographicNo();
+ System.out.println("current mem 3 "+currentMem());
+
errors.clear();
valid = true;
+ System.out.println("current mem 4 "+currentMem());
+
String submit = request.getParameter("submit");
***************
*** 105,108 ****
--- 114,118 ----
long startTime = System.currentTimeMillis();
+ System.out.println("current mem 5 "+currentMem());
for(int i=0; i<measurementTypes.size(); i++){
mt = (EctMeasurementTypesBean) measurementTypes.elementAt(i);
***************
*** 115,121 ****
//validate
! valid = validate( inputValue, observationDate, mt, validation, request);
}
!
long endTime = System.currentTimeMillis();
long delTime = endTime - startTime;
--- 125,131 ----
//validate
! valid = validate( inputValue, observationDate, mt, validation, request,errors);
}
! System.out.println("current mem 6 "+currentMem());
long endTime = System.currentTimeMillis();
long delTime = endTime - startTime;
***************
*** 135,138 ****
--- 145,149 ----
startTime = System.currentTimeMillis();
for(int i=0; i<measurementTypes.size(); i++){
+ System.out.println("current mem 7.1."+i+" "+currentMem());
mt = (EctMeasurementTypesBean) measurementTypes.elementAt(i);
validation = (EctValidationsBean) mt.getValidationRules().elementAt(0);
***************
*** 158,166 ****
props.setProperty(type+"LastDataEnteredDate", lastDataEnteredDate);
System.out.println("type: " + type + " input: " + inputValue);
! org.apache.commons.validator.GenericValidator gValidator = new org.apache.commons.validator.GenericValidator();
props.setProperty(type+"Date", observationDate);
props.setProperty(type+"Comments", comments);
! if(!gValidator.isBlankOrNull(inputValue)){
props.setProperty(type+"Value", inputValue);
--- 169,177 ----
props.setProperty(type+"LastDataEnteredDate", lastDataEnteredDate);
System.out.println("type: " + type + " input: " + inputValue);
!
props.setProperty(type+"Date", observationDate);
props.setProperty(type+"Comments", comments);
! if(!GenericValidator.isBlankOrNull(inputValue)){
props.setProperty(type+"Value", inputValue);
***************
*** 179,182 ****
--- 190,194 ----
}
}
+ System.out.println("current mem 7.2."+i+" "+currentMem());
}
endTime = System.currentTimeMillis();
***************
*** 185,188 ****
--- 197,201 ----
//Store the the form table for keeping the current record
+ System.out.println("current mem 8 "+currentMem());
try{
String sql = "SELECT * FROM form"+formName + " WHERE demographic_no='"+demographicNo + "' AND ID=0";
***************
*** 190,199 ****
frh.setDateFormat(_dateFormat);
(frh).saveFormRecord(props, sql);
! }
! catch(SQLException e){
System.out.println(e.getMessage());
}
!
//Send to Mils thru xml-rpc
Properties nameProps = convertName(formName);
--- 203,211 ----
frh.setDateFormat(_dateFormat);
(frh).saveFormRecord(props, sql);
! }catch(SQLException e){
System.out.println(e.getMessage());
}
! System.out.println("current mem 9 "+currentMem());
//Send to Mils thru xml-rpc
Properties nameProps = convertName(formName);
***************
*** 201,207 ****
String decisionSupportURL = connect2OSDSF(xmlData);
request.setAttribute("decisionSupportURL", decisionSupportURL);
!
! }
! else{
//return to the orignal form
return (new ActionForward("/form/SetupForm.do?formName="+formName+"&formId=0"));
--- 213,218 ----
String decisionSupportURL = connect2OSDSF(xmlData);
request.setAttribute("decisionSupportURL", decisionSupportURL);
! System.out.println("current mem 9 "+currentMem());
! }else{
//return to the orignal form
return (new ActionForward("/form/SetupForm.do?formName="+formName+"&formId=0"));
***************
*** 219,228 ****
}
EctFormData fData = new EctFormData();
String formNameByFormTable = fData.getFormNameByFormTable("../form/SetupForm.do?formName="+formName+"&demographic_no=");
String[] formPath = {"","0"};
try{
formPath = (new FrmData()).getShortcutFormValue(demographicNo, formNameByFormTable);
! }
! catch(SQLException e){
e.printStackTrace();
}
--- 230,240 ----
}
EctFormData fData = new EctFormData();
+ System.out.println("formName from Frm ForamAction"+formName);
String formNameByFormTable = fData.getFormNameByFormTable("../form/SetupForm.do?formName="+formName+"&demographic_no=");
+ System.out.println("formNameByFormTable"+formNameByFormTable);
String[] formPath = {"","0"};
try{
formPath = (new FrmData()).getShortcutFormValue(demographicNo, formNameByFormTable);
! }catch(SQLException e){
e.printStackTrace();
}
***************
*** 234,239 ****
! private boolean validate(String inputValue, String observationDate, EctMeasurementTypesBean mt, EctValidationsBean validation, HttpServletRequest request ){
! EctValidation ectValidation = new EctValidation();
String inputTypeDisplay = mt.getTypeDesc();
--- 246,252 ----
! private boolean validate(String inputValue, String observationDate, EctMeasurementTypesBean mt, EctValidationsBean validation, HttpServletRequest request,ActionErrors errors ){
! EctValidation ectValidation = new EctValidation();
! boolean valid = true;
String inputTypeDisplay = mt.getTypeDesc();
***************
*** 250,255 ****
int iIsNumeric = Integer.parseInt(validation.getIsNumeric()==null?"0":validation.getIsNumeric());
! org.apache.commons.validator.GenericValidator gValidator = new org.apache.commons.validator.GenericValidator();
! if(!gValidator.isBlankOrNull(inputValue)){
if(iIsNumeric==1 && !ectValidation.isInRange(dMax, dMin, inputValue)){
errors.add(inputValueName, new ActionError("errors.range", inputTypeDisplay, Double.toString(dMin), Double.toString(dMax)));
--- 263,268 ----
int iIsNumeric = Integer.parseInt(validation.getIsNumeric()==null?"0":validation.getIsNumeric());
!
! if(!GenericValidator.isBlankOrNull(inputValue)){
if(iIsNumeric==1 && !ectValidation.isInRange(dMax, dMin, inputValue)){
errors.add(inputValueName, new ActionError("errors.range", inputTypeDisplay, Double.toString(dMin), Double.toString(dMax)));
***************
*** 387,389 ****
--- 400,406 ----
}
+ public String currentMem(){
+ long Used = Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory();
+ return ""+Used;
+ }
}
|