// In the controller public void processFormRequest(OAPageContext pageContext, OAWebBean webBean) { super.processFormRequest(webBean); ForumsAMImpl am1 = (ForumsAMImpl)pageContext.getApplicationModule(webBean); if(pageContext.getParameter("submit") != null) { pageContext.writeDiagnostics("Anil", "Calling Execute Method ", 1); am1.ExecuteQuery(pageContext, webBean); } }
ApplicationModule Code
public void ExecuteQuery(OAPageContext pageContext, OAWebBean webBean) { String supID = pageContext.getParameter("SuppID1")+""; String supName = pageContext.getParameter("SupplierName")+""; String supSite = pageContext.getParameter("SupplierSiteID")+""; XXSupplierSiteVOImpl vo = getXXSupplierSiteVO1(); Debug.log(pageContext, "SearchAMImpl", "SuppID1 = " + supID, 1); Debug.log(pageContext, "SearchAMImpl", "SupplierName = " + supName, 1); Debug.log(pageContext, "SearchAMImpl", "SupplierSiteID = " + supSite, 1); String strWhereClause = ""; Object paramArray[] = new Object[10]; int i = 1; if(!StringUtils.isNullOrEmpty(supName)) { if(StringUtils.isNullOrEmpty(strWhereClause)) { Debug.log(pageContext, "SearchAMImpl", "supName = " + supName, 1); strWhereClause = " SITE_NAME like :" + i; Debug.log(pageContext, "SearchAMImpl", " strWhereClause = " + strWhereClause, 1); paramArray[i] = supName+ "%"; } else { i++; strWhereClause = strWhereClause + "AND SITE_NAME like :" + i; Debug.log(pageContext, "SearchAMImpl", "supName in else = " + i, 1); paramArray[i] = supName; } } Debug.log(pageContext, "SearchAMImpl", "Above SupplierID Check " + supID, 1); if(!StringUtils.isNullOrEmpty(supID)) { Debug.log(pageContext, "SearchAMImpl", "Inside SupplierID Check " + supID, 1); if(StringUtils.isNullOrEmpty(strWhereClause)) { strWhereClause = " SUPPLIER_ID = :" + i; Debug.log(pageContext, "SearchAMImpl", " strWhereClause = " + strWhereClause, 1); paramArray[i] = supID; Debug.log(pageContext, "SearchAMImpl", " supID is = " + supID, 1); } else { Debug.log(pageContext, "SearchAMImpl", "SUPPLIER_ID WhereClause ELSE " + supID, 1); i++; strWhereClause = strWhereClause + " and SUPPLIER_ID like :" + i; paramArray[i] = supID; Debug.log(pageContext, "SearchAMImpl", "paramArrayE " + paramArray[i], 1); } } Debug.log(pageContext, "SearchAMImpl", "Above supSite Check " + supSite, 1); if(!StringUtils.isNullOrEmpty(supSite)) { Debug.log(pageContext, "SearchAMImpl", "Below supSite Check " + supSite, 1); if(StringUtils.isNullOrEmpty(strWhereClause)) { strWhereClause = " SUPPLIER_SITE_ID = :" + i; paramArray[i] = supSite; } else { Debug.log(pageContext, "SearchAMImpl", "SUPPLIER_SITE_ID WhereClause ELSE " + supSite, 1); i++; strWhereClause = strWhereClause + " AND SUPPLIER_SITE_ID = :" + i; paramArray[i] = supSite; Debug.log(pageContext, "SearchAMImpl", "paramArray " + paramArray[i], 1); } } vo.setWhereClause(null); vo.setWhereClauseParams(null); Debug.log(pageContext, "SearchAMImpl", "Anil SetWhereClause" + strWhereClause, 1); Debug.log(pageContext, "SearchAMImpl", "i value is " + i, 1); vo.setWhereClause(strWhereClause); for(int j = 0; j < i; j++) { Debug.log(pageContext, "SearchAMImpl", "bind index " + j, 1); if(paramArray[j + 1] != null) { vo.setWhereClauseParam(j, paramArray[j + 1]); Debug.log(pageContext, "SearchAMImpl", "bind values from Array " + paramArray[j + 1], 1); } } Debug.log(pageContext, "SearchAMImpl", " **** Query 2 = " + vo.getQuery(), 1); vo.executeQuery(); }
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.