Suggested case list:
Using timer to refresh a grid
383guest172.69.33.12125nk0uiMay 7, 2020 7:23:47 AMlinkuser model to move item to another listbox
120guest162.158.193.148d0n3krApr 2, 2020 5:28:28 AMlinkDisabled list item row passed to VM-1981
296fatih123160.83.36.13025nk0uiFeb 13, 2018 4:25:44 PMlinkDisabled list item row passed to VM-1981
295fatih123160.83.36.13025nk0uiFeb 13, 2018 4:25:16 PMlinkDisabled list item row passed to VM-1981
294fatih123160.83.36.13225nk0uiFeb 13, 2018 3:30:44 PMlinkgrid sample with ListModel/RowRenderer
816guest80.82.2.1312vah9ajFeb 21, 2017 11:42:21 AMlinkgrid sample with ListModel/RowRenderer
809guest175.98.113.1622vah9ajJan 26, 2017 9:19:33 AMlinkgrid sample with ListModel/RowRenderer
196guest79.185.142.402vah9ajApr 26, 2014 10:53:57 PMlinkgrid sample with ListModel/RowRenderer
195guest79.185.142.402vah9ajApr 26, 2014 10:53:54 PMlinkgrid sample with ListModel/RowRenderer
194guest79.185.142.402vah9ajApr 26, 2014 10:53:51 PMlinkgrid sample with ListModel/RowRenderer
193guest79.185.142.402vah9ajApr 26, 2014 10:53:48 PMlinkgrid sample with ListModel/RowRenderer
192guest79.185.142.402vah9ajApr 26, 2014 10:53:44 PMlinkgrid sample with ListModel/RowRenderer
191guest79.185.142.402vah9ajApr 26, 2014 10:53:40 PMlinkHierarchy table without using ZK PE/EE
1aaknai151.28.135.2131s871daJul 29, 2013 11:02:46 PMlinkgrid sample with ListModel/RowRenderer
128aaknai151.28.135.2132vah9ajJul 29, 2013 7:20:00 PMlinkuser model to move item to another listbox
1TonyQ114.25.109.94d0n3krApr 21, 2012 10:43:27 AMlinkUsing timer to refresh a grid
1TonyQ220.133.44.3725nk0uiFeb 17, 2012 3:17:34 AMlinkFire a event from child iframe
1TonyQ220.133.44.372eupjotFeb 3, 2012 5:04:52 AMlinkTextbox input restriction sample
1TonyQ72.21.245.2431b3nlr0Dec 20, 2011 10:09:10 AMlinkTest web core taglib in ZUL
1TonyQ198.203.175.175ofqkemDec 17, 2011 3:36:08 AMlinkLatest 10 Fiddles :
constraint binding textbox
3guest172.68.151.16220peldaDec 5, 2025 5:08:19 PMlinkAnother new ZK fiddle
2guest172.68.151.16320peldaDec 5, 2025 5:07:51 PMlinkAnother new ZK fiddle
1guest172.68.151.16220peldaDec 5, 2025 5:07:32 PMlinkAnother new ZK fiddle
1peggypeng172.71.154.99364f4neDec 5, 2025 9:24:31 AMlinktooltip example
2guest104.22.23.13rc1ntoDec 4, 2025 2:23:45 PMlinkAnother new ZK fiddle
1guest172.69.134.2277t7602Dec 4, 2025 1:40:46 PMlinkAnother new ZK fiddle
1peggypeng104.22.17.1802df6e3oDec 4, 2025 8:41:29 AMlinkonClose
1peggypeng172.68.87.248j8kd8aDec 3, 2025 4:10:26 AMlinkAnother new ZK fiddle
1peggypeng172.69.134.2271rm7f4eNov 26, 2025 3:31:24 AMlinkZK-5912-Suggestion
2rebeccalai104.22.20.1442qrmiiuNov 26, 2025 2:07:15 AMlinkAnother new ZK fiddle
2guest162.158.86.21838lgabgOct 6, 2023 3:52:19 PMlinkresources
index.zulzul<?page id="nurole" title="Mandate Data Verify" contentType="text/html;charset=UTF-8"?>
<zk>
<window id="wmmsbulklinkedverification" apply ="com.imageinfo.eclear.v2.webapp.ajax.controller.mms_bulk_linked_verification" sclass="expstyle1" width="100%" height="100%" contentStyle="overflow:auto;position:relative">
<style>
.expstyle1 .z-window-modal-tl, .expstyle1 .z-window-modal-tr, .expstyle1 .z-window-modal-tm,
.expstyle1 .z-window-modal-cl, .expstyle1 .z-window-modal-cr, .expstyle1 .z-window-modal-cm,
.expstyle1 .z-window-modal-bl, .expstyle1 .z-window-modal-br, .expstyle1 .z-window-modal-bm,
.expstyle1 .z-window-modal-hl, .expstyle1 .z-window-modal-hr, .expstyle1 .z-window-modal-hm
{
background: #728C00;
}
.expstyle1 .z-window-modal-header
{
background: #728C00;
}
.expstyle1 .z-textbox
{
text-transform:uppercase;
}
.searchbox .z-combobox-content {
max-height: 100px!important;
overflow: hidden!important;
overflow-y: scroll!important;
}
</style>
<borderlayout height="100%" >
<north id="north" maxsize="300" size="100%" visible="true" >
<div id = "filterdiv" height = "null" width="100%" align="center" visible="true">
<grid id="gridmain" width = "50%" align="center" height = "100%">
<columns>
<column width="40%"></column>
<column width="60%"></column>
</columns>
<rows>
<row><label value ="Flow Type:"></label><combobox id="flowtypecb" readonly = "true" width="50%"></combobox></row>
<row><label value ="Mandate Type:"></label><combobox id="mntypecb" readonly = "true" width="50%"></combobox></row>
<row><label value ="Corporate Name"></label><combobox id ="corpselcb" width="50%"></combobox></row>
<row><label value ="File Name"></label><combobox id ="filenamecb" readonly="true" autodrop="true" sclass="searchbox" width="50%"></combobox></row>
</rows>
</grid>
<hbox pack="end" height="2%" width="50%" ></hbox>
<hbox pack="end" height="25%" width="50%" >
<button id="fetch" label="Next" mold = "trendy" width="60px" />
</hbox>
</div>
</north>
<center border="0" >
<div align="center" width="100%" height="100%" >
<grid id="statusgrid" width = "100%" align="center">
<columns>
<column width="10%" >
<checkbox id="allchk">
</checkbox>
</column>
<column width="10%" label="S.No" ></column>
<column width="30%" label="File Name" ></column>
<column width="10%" label="Total Count" ></column>
<column width="10%" label="Accept Count" ></column>
<column width="10%" label="Reject Count" ></column>
<column width="20%" label="Mode" ></column>
</columns>
<rows id ="statusrows" >
</rows>
</grid>
</div>
</center>
<south height = "10%" border = "0" >
<div align = "right" height="100%" width="100%" >
<button id = "verifybtn" label="Verify" width="60px" mold ="trendy"/>
<space spacing="5px" ></space>
<button id = "backbtn" label="Back" width="60px" mold ="trendy"/>
</div>
</south>
</borderlayout>
</window>
</zk>TestComposer.javajavapackage com.imageinfo.eclear.v2.webapp.ajax.controller;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.HashMap;
import java.util.LinkedHashMap;
import javax.naming.InitialContext;
import javax.servlet.http.HttpSession;
import javax.sql.DataSource;
import org.zkoss.zk.ui.Component;
import org.zkoss.zk.ui.Executions;
import org.zkoss.zk.ui.Sessions;
import org.zkoss.zk.ui.event.Event;
import org.zkoss.zk.ui.event.EventListener;
import org.zkoss.zk.ui.util.GenericForwardComposer;
import org.zkoss.zul.Button;
import org.zkoss.zul.Checkbox;
import org.zkoss.zul.Combobox;
import org.zkoss.zul.Div;
import org.zkoss.zul.Grid;
import org.zkoss.zul.Label;
import org.zkoss.zul.North;
import org.zkoss.zul.Row;
import org.zkoss.zul.Rows;
import org.zkoss.zul.Textbox;
import org.zkoss.zul.Window;
import com.imageinfo.eclear.v2.utils.Globals;
@SuppressWarnings({ "unchecked", "rawtypes" })
public class mms_bulk_linked_verification extends GenericForwardComposer
{
private static final long serialVersionUID = 1L;
Window wmmsbulklinkedverification;
Rows statusrows;
North north;
Grid statusgrid;
Grid gridmain;
Div filterdiv;
Combobox filenamecb;
Combobox mntypecb;
Combobox flowtypecb;
Combobox corpselcb;
Checkbox allchk;
Button verifybtn;
Button fetch;
Button backbtn;
Button Rejectbtn;
Textbox backdateremarkautotb;
String transactionDates = "",transaction_date = "",accounttype = "";
String whereclause = "",flowtype = "",SignUrl = "",actiontype = "",amendmandateid = "",condition1 ="";
String batch_id = "";
String locked_userid = "",curDate,sess_usr;
String file_name = "" , date = "";
String corporateName = "";
LinkedHashMap<String, String> utilitymap = new LinkedHashMap<String, String>();
LinkedHashMap<Integer, HashMap> SignDataMap = new LinkedHashMap<Integer, HashMap>();
LinkedHashMap<String, String> freqmap = new LinkedHashMap<String, String>();
LinkedHashMap<String, String> catmap = new LinkedHashMap<String, String>();
ArrayList<String> fileList = new ArrayList<String>();
HttpSession s;
public void doAfterCompose(Component comp) throws Exception
{
super.doAfterCompose(comp);
s = (HttpSession) Sessions.getCurrent().getNativeSession();
try{s.getAttribute("svalid").toString().toUpperCase();}catch (NullPointerException npe) {Executions.sendRedirect("/invalid.zul");return;}
wmmsbulklinkedverification.setBorder("normal");
wmmsbulklinkedverification.setSizable(false);
wmmsbulklinkedverification.setDraggable("false");
wmmsbulklinkedverification.setTitle("Mandate Bulk Linked Verification");
curDate = s.getAttribute("currentdate").toString();
wmmsbulklinkedverification.setCtrlKeys("#f2#f3#f6#f7#f8#f10#f12");
//wmmsbulklinkedverification.addEventListener("onCtrlKey",keylistener);
//wmmsbulklinkedverification.addEventListener("onOK",keylistener);
loaddata();
mntypecb.addEventListener("onChange",corpselectionlistener);
corpselcb.addEventListener("onChange",corpselectionlistener);
allchk.addEventListener("onCheck",allchklistener);
backbtn.addEventListener("onClick", backtofilterevent);
backbtn.addEventListener("onOk", backtofilterevent);
fetch.addEventListener("onClick",fetchlistener);
fetch.addEventListener("onOK",fetchlistener);
verifybtn.addEventListener("onClick",fetchfileverify);
verifybtn.addEventListener("onOK",fetchfileverify);
Rejectbtn.addEventListener("onClick",rejectfilelistener);
Rejectbtn.addEventListener("onOK",rejectfilelistener);
}
EventListener fetchlistener = new EventListener()
{
public void onEvent(Event event) throws Exception
{
if((event.getName().equalsIgnoreCase("onClick") || event.getName().equalsIgnoreCase("onOK"))&& event.getTarget().getId().equalsIgnoreCase("fetch"))
{
//Globals.setLog("Fetching filtered data...");
try
{
if(!(mntypecb.getValue().equalsIgnoreCase("") || mntypecb.getValue()==null) && (!(filenamecb.getValue().equalsIgnoreCase("")|| filenamecb.getValue()==null) || !(corpselcb.getValue().equalsIgnoreCase("") || corpselcb.getValue()==null ) || !(flowtypecb.getValue().equalsIgnoreCase("") || flowtypecb.getValue()==null)))
{
if(!Globals.validateComponentValues(corpselcb, corpselcb.getValue()))
{
try
{
HashMap<String, String> msgparams = new HashMap<String, String>();
msgparams.put("msgstring", "Please select valid corporate name");
Window win = (Window) Executions.createComponents("MessageBox.zul", null, msgparams);
win.doModal();
}
catch(Exception e)
{
Globals.setLog(e);
}
return;
}
whereclause = "";
flowtype = "";
actiontype = "";
condition1 ="";
/*if(!(mntypecb.getValue() == null || "".equalsIgnoreCase(mntypecb.getValue())))
{
whereclause+= " instr(FILE_NAME,'"+mntypecb.getValue().toUpperCase()+"') > 0 and ";
}*/
condition1 = " SELECT DISTINCT ots_mms_zipfile_ref FROM tbl_out_dd_mandate WHERE validation_status = '2' AND chk_flag = '2' and ots_mms_zipfile_ref is not null and mandate_type = 'BULK LINKED' and flow_type = 'MMSSIM' ";
if(mntypecb.getValue().equalsIgnoreCase("CREATE"))
{
condition1 += " and action_type = 'CREATE' ";
}
else if(mntypecb.getValue().equalsIgnoreCase("AMEND"))
{
condition1 += " and action_type = 'AMEND' ";
}
if(!"all".equalsIgnoreCase(corpselcb.getValue()))
{
condition1 += " and UTILITY_CODE ='"+utilitymap.get(corpselcb.getValue())+"' ";
}
else
{
if(corporateName.length()>0)
condition1 += " and UTILITY_CODE in ("+corporateName+")";
}
if(!filenamecb.getValue().equalsIgnoreCase("") && !filenamecb.getValue().equalsIgnoreCase("All") )
{
whereclause+= "FILE_NAME = '"+filenamecb.getValue()+"' and ";
}
whereclause = whereclause +" IMPORT_TYPE = 'MMSLINKED' and file_status = '0' and IMPORTER <> '"+(String)s.getAttribute("usern")+"' ";
Globals.setLog("whereclaus : "+whereclause);
fileList.clear();
loadinitdata();
}
else
{
try
{
HashMap<String, String> msgparams = new HashMap<String, String>();
msgparams.put("msgstring", "Please select valid search criteria!");
Window win = (Window) Executions.createComponents("MessageBox.zul", null, msgparams);
win.doModal();
}
catch(Exception e)
{
Globals.setLog(e);
}
return;
}
}
catch (Exception ex)
{
ex.printStackTrace();
}
}
}
};
EventListener corpselectionlistener = new EventListener()
{
public void onEvent(Event event) throws Exception
{
if(event.getName().equalsIgnoreCase("onChange") )
{
if(event.getTarget().getId().equalsIgnoreCase("mntypecb"))
{
corpselcb.getChildren().clear();
corpselcb.setValue("");
filenamecb.getChildren().clear();
filenamecb.setValue("");
loadcorporate();
corpselcb.setFocus(true);
}
else if(event.getTarget().getId().equalsIgnoreCase("corpselcb"))
{
loadFileNames();
filenamecb.setFocus(true);
}
else if(event.getTarget().getId().equalsIgnoreCase("filenamecb"))
{
fetch.setFocus(true);
}
}
}
};
EventListener backtofilterevent = new EventListener()
{
public void onEvent(Event event) throws Exception
{
if((event.getName().equalsIgnoreCase("onClick") || event.getName().equalsIgnoreCase("onOK"))&& event.getTarget().getId().equalsIgnoreCase("backbtn"))
{
north.setVisible(true);
fileList.clear();
loaddata();
}
}
};
EventListener rejectfilelistener = new EventListener()
{
public void onEvent(Event event) throws Exception
{
Connection conn1 = null;
PreparedStatement pstmt1 = null;
PreparedStatement pstmt2 = null;
PreparedStatement pstmt5 = null;
ResultSet rs = null;
int appliedrecord = 0;
int filestatus = 0;
if((event.getName().equalsIgnoreCase("onClick") || event.getName().equalsIgnoreCase("onOK"))&& event.getTarget().getId().equalsIgnoreCase("Rejectbtn"))
{
if(fileList.size() == 0)
{
try
{
HashMap<String, String> msgparams = new HashMap<String, String>();
msgparams.put("msgstring", "Please select one file to Reject!");
Window win = (Window) Executions.createComponents("MessageBox.zul", null, msgparams);
win.doModal();
}
catch(Exception e)
{
Globals.setLog(e);
}
}
else if(backdateremarkautotb.getValue() == null || "".equalsIgnoreCase(backdateremarkautotb.getValue().trim()) )
{
try
{
HashMap<String, String> msgparams = new HashMap<String, String>();
msgparams.put("msgstring", "Please enter valid discard remark!");
Window win = (Window) Executions.createComponents("MessageBox.zul", null, msgparams);
win.doModal();
}
catch(Exception e)
{
}
backdateremarkautotb.setFocus(true);
return;
}
else if(!Globals.validateInputString(backdateremarkautotb.getValue(), 11))
{
Globals.setLog("backdateremarkautotb.getValue() : "+backdateremarkautotb.getValue());
try
{
HashMap<String, String> msgparams = new HashMap<String, String>();
msgparams.put("msgstring", "Please enter Valid discard remark!");
Window win = (Window) Executions.createComponents("MessageBox.zul", null, msgparams);
win.doModal();
return;
}
catch(Exception e){Globals.setLog("Error:Please enter Valid discard remark!");}
backdateremarkautotb.setFocus(true);
}
else
{
Globals.setLog("fileList"+fileList);
try
{
HashMap<String, String> msgparams = new HashMap<String, String>();
msgparams.put("msgstring", "Do you want to Reject selected files?");
Window win = (Window) Executions.createComponents("MessageBoxWithResponse.zul", null, msgparams);
win.doModal();
}
catch(Exception e)
{
return;
}
if (message_box_response.response.equalsIgnoreCase("yes"))
{
try
{
DataSource ds = (DataSource) new InitialContext(Globals.getICProps()).lookup(Globals.getDSlookup());
conn1 = ds.getConnection();
String selectsql1 = "update tbl_out_dd_mandate set validation_status = '9',chk_flag = '0',mms_locked = '',mms_locker = '',mms_verifier = ?,mms_verify_time = (select systimestamp from dual),PROCESSING_DATE='"+curDate+"' where ots_mms_zipfile_ref = ?";
String selectsql2 = "update tbl_import_file_details set file_status = '9',verifier = ?,verify_date = (select systimestamp from dual),DISCARD_REMARK = ? where file_name= ?";
String selectsql5 = "select file_status from tbl_import_file_details where file_name = ?";
Globals.setLog("Query Execution Start Time:"+(Calendar.getInstance().getTime()));
boolean ret = false;
for(String file : fileList)
{
Globals.setLog("applied count "+((Label)statusrows.getFellowIfAny("R|"+file).getChildren().get(4)).getValue());
appliedrecord = Integer.parseInt(((Label)statusrows.getFellowIfAny("R|"+file).getChildren().get(4)).getValue());
pstmt5 = conn1.prepareStatement(selectsql5,ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_READ_ONLY);
pstmt5.setString(1, file );
rs = pstmt5.executeQuery();
if(rs.next())
{
filestatus = rs.getInt(1);
}
rs.close();
Globals.setLog("filestatus = "+filestatus);
if(filestatus == 3 || filestatus == 9 )
{
try
{
HashMap<String, String> msgparams = new HashMap<String, String>();
msgparams.put("msgstring","Action Already Taken!!");
Window win = (Window) Executions.createComponents("MessageBox.zul", null, msgparams);
win.doModal();
}
catch(Exception e)
{
Globals.setLog(e);
}
return;
}
Globals.setLog("appliedrecord = "+appliedrecord);
conn1.setAutoCommit(false);
Globals.setLog("Query Execution Start Time:"+(Calendar.getInstance().getTime()));
Globals.setLog("selectsql1:update tbl_out_dd_mandate set validation_status = '9',chk_flag = '0',mms_locked = '',mms_locker = '',mms_verifier = '"+s.getAttribute("usern").toString()+"',mms_verify_time = (select systimestamp from dual),PROCESSING_DATE='"+curDate+"' where ots_mms_zipfile_ref = '"+file+"'");
pstmt1 = conn1.prepareStatement(selectsql1,ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE);
pstmt1.setString(1, s.getAttribute("usern").toString());
pstmt1.setString(2, file );
int i = pstmt1.executeUpdate();
Globals.setLog("Query Execution End Time:"+(Calendar.getInstance().getTime()));
Globals.setLog("i = "+i);
if(i == appliedrecord)
{
conn1.commit();
conn1.setAutoCommit(true);
Globals.setLog("Query Execution Start Time:"+(Calendar.getInstance().getTime()));
Globals.setLog("selectsql2:update tbl_import_file_details set file_status = '9',verifier = '"+s.getAttribute("usern").toString()+"',verify_date = (select systimestamp from dual), discard_remark='"+backdateremarkautotb.getValue()+"' where file_name= '"+file+"'");
pstmt2 = conn1.prepareStatement(selectsql2,ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE);
pstmt2.setString(1, s.getAttribute("usern").toString());
pstmt2.setString(2, backdateremarkautotb.getValue());
pstmt2.setString(3, file );
int j = pstmt2.executeUpdate();
Globals.setLog("j = "+j);
Globals.setLog("Query Execution End Time:"+(Calendar.getInstance().getTime()));
if(j>0)
{
ret = true;
}
else
{
ret = false;
}
Globals.auditlogit_tran(file,"Reject",wmmsbulklinkedverification.getId(),"Mandate File : "+file+" Rejected!!","MMS OUTWARD");
}
}
if(ret==true)
{
try
{
HashMap<String, String> msgparams = new HashMap<String, String>();
msgparams.put("msgstring","The selected file(s) are rejected successfully!");
Window win = (Window) Executions.createComponents("MessageBox.zul", null, msgparams);
win.doModal();
}
catch(Exception e)
{
Globals.setLog(e);
}
}
loadinitdata();
}
catch (Exception e)
{
Globals.setLog(e);
}
finally{
try{if(rs!=null){rs.close();rs = null;}}catch (Exception fe){Globals.setLog(fe);}
try{if(pstmt1!=null){pstmt1.close();pstmt1 = null;}}catch (Exception fe){Globals.setLog(fe);}
try{if(pstmt2!=null){pstmt2.close();pstmt2 = null;}}catch (Exception fe){Globals.setLog(fe);}
try{if(pstmt5!=null){pstmt5.close();pstmt5 = null;}}catch (Exception fe){Globals.setLog(fe);}
try{if(conn1!=null){conn1.close();conn1 = null;}}catch (Exception fe){Globals.setLog(fe);}
}
}
}
}
}
};
public void loadinitdata()
{
Connection conn = null;
PreparedStatement pstmt = null;
ResultSet rs = null;
try
{
fileList.clear();
statusrows.getChildren().clear();
allchk.setChecked(false);
DataSource ds = (DataSource) new InitialContext(Globals.getICProps()).lookup(Globals.getDSlookup());
conn = ds.getConnection();
String sql = "SELECT A.FILE_NAME, A.APPLIED_RECORD, A.TOTAL_RECORD, A.NOT_APPLIED_RECORD ,A.FILE_MODE FROM (SELECT FILE_NAME, APPLIED_RECORD, TOTAL_RECORD, NOT_APPLIED_RECORD ,FILE_MODE FROM TBL_IMPORT_FILE_DETAILS WHERE "+whereclause+" )A JOIN ("+condition1+") B ON B.ots_mms_zipfile_ref =A.FILE_NAME";
pstmt = conn.prepareStatement(sql,ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_READ_ONLY);
Globals.setLog("sql:"+sql);
rs = pstmt.executeQuery();
Row r;
Label lbl;
Checkbox chk;
rs.last();
if(rs.getRow() == 0)
{
try
{
HashMap<String, String> msgparams = new HashMap<String, String>();
msgparams.put("msgstring", "No data found!");
Window win = (Window) Executions.createComponents("MessageBox.zul", null, msgparams);
win.doModal();
}
catch(Exception e)
{
Globals.setLog(e);
}
north.setVisible(true);
loaddata();
return;
}
else
{
statusrows.getChildren().clear();
north.setVisible(false);
rs.beforeFirst();
while(rs.next())
{
r = new Row();
r.setId("R|"+rs.getString("FILE_NAME"));
chk = new Checkbox();
chk.setId("CHK|"+rs.getString("FILE_NAME"));
//fileList
chk.addEventListener("onCheck", allchklistener);
chk.setParent(r);
lbl = new Label();
lbl.setValue(""+rs.getRow());
lbl.setParent(r);
lbl = new Label();
lbl.setValue(rs.getString("FILE_NAME"));
lbl.setParent(r);
lbl = new Label();
lbl.setValue(rs.getString("TOTAL_RECORD"));
lbl.setParent(r);
lbl = new Label();
lbl.setValue(rs.getString("APPLIED_RECORD"));
lbl.setParent(r);
lbl = new Label();
lbl.setValue(rs.getString("NOT_APPLIED_RECORD"));
lbl.setParent(r);
lbl = new Label();
lbl.setValue(rs.getString("FILE_MODE"));
lbl.setParent(r);
r.setParent(statusrows);
}
}
rs.close();rs = null;
pstmt.close();pstmt = null;
}
catch (Exception e)
{
Globals.setLog(e);
}
finally{
try{if(rs!=null){rs.close();rs = null;}}catch (Exception fe){Globals.setLog(fe);}
try{if(pstmt!=null){pstmt.close();pstmt = null;}}catch (Exception fe){Globals.setLog(fe);}
try{if(conn!=null){conn.close();conn = null;}}catch (Exception fe){Globals.setLog(fe);}
}
}
private void loaddata()
{
//Globals.setLog("Loading initial data...");
filterdiv.setVisible(true);
mntypecb.getChildren().clear();
mntypecb.appendItem("CREATE");
mntypecb.appendItem("AMEND");
mntypecb.appendItem("CANCEL");
mntypecb.setValue("");
flowtypecb.getChildren().clear();
flowtypecb.appendItem("SPONSOR");
flowtypecb.setValue("");
flowtypecb.setSelectedIndex(0);
filenamecb.getChildren().clear();
filenamecb.setText("");
loadcorporate();
}
private void loadcorporate()
{
Connection conn = null;
PreparedStatement pstmt1 = null;
ResultSet rs1 = null;
if(! (mntypecb.getValue().equalsIgnoreCase("") || mntypecb.getValue()==null) )
{
try
{
String condition = "select distinct UTILITY_CODE from ( select distinct UTILITY_CODE,ots_mms_zipfile_ref from tbl_out_dd_mandate where ";
if(mntypecb.getValue().equalsIgnoreCase("CREATE"))
{
condition += "action_type = 'CREATE' ";
}
else if(mntypecb.getValue().equalsIgnoreCase("AMEND"))
{
condition += "action_type = 'AMEND' ";
}
if (flowtypecb.getValue().equalsIgnoreCase("SPONSOR")) {
condition += " and flow_type = 'MMSSIM'";
}
condition +=" and VALIDATION_STATUS='2' AND CHK_FLAG ='2' and ots_mms_zipfile_ref IS NOT NULL and mandate_type = 'BULK LINKED' ) a join (select file_name from TBL_IMPORT_FILE_DETAILS where IMPORT_TYPE = 'MMSLINKED' and file_status = '0' and IMPORTER <> '"+(String)s.getAttribute("usern")+"' )b on a.ots_mms_zipfile_ref =b.file_name ";
corpselcb.getChildren().clear();
corpselcb.setValue("");
corporateName = "";
utilitymap.clear();
DataSource ds = (DataSource) new InitialContext(Globals.getICProps()).lookup(Globals.getDSlookup());
conn = ds.getConnection();
String sql = "SELECT DISTINCT UTILITY_DESC,UTILITY_CODE FROM TBL_CLIENT_ACCOUNT_MASTER WHERE INSTR(ALLOWED_PRODUCT,'MMSOW') > 0 AND STATUS='E' and UTILITY_CODE in ("+condition+") ";
Globals.setLog("sql::"+sql);
pstmt1 = conn.prepareStatement(sql,ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_READ_ONLY);
rs1 = pstmt1.executeQuery();
while(rs1.next())
{
if(rs1.getRow() == 1)
{
corpselcb.appendItem("ALL");
}
corpselcb.appendItem(rs1.getString("UTILITY_DESC").toUpperCase());
corporateName += "'"+rs1.getString("UTILITY_CODE").toUpperCase()+"',";
utilitymap.put(rs1.getString("UTILITY_DESC"),rs1.getString("UTILITY_CODE"));
}
rs1.close();
pstmt1.close();
if(!"".equalsIgnoreCase(corporateName))
corporateName = corporateName.substring(0,corporateName.length()-1);
}
catch (Exception e)
{
Globals.setLog(e);
}
finally{
try{if(rs1!=null){rs1.close();rs1 = null;}}catch (Exception fe){Globals.setLog(fe);}
try{if(pstmt1!=null){pstmt1.close();pstmt1 = null;}}catch (Exception fe){Globals.setLog(fe);}
try{if(conn!=null){conn.close();conn = null;}}catch (Exception fe){Globals.setLog(fe);}
}
}
}
public void loadFileNames()
{
Connection conn = null;
PreparedStatement pstmt1 = null;
ResultSet rs1 = null;
try
{
DataSource ds = (DataSource) new InitialContext(Globals.getICProps()).lookup(Globals.getDSlookup());
conn = ds.getConnection();
String sql = "";
String condition = " SELECT DISTINCT ots_mms_zipfile_ref FROM tbl_out_dd_mandate WHERE validation_status = '2' AND chk_flag = '2' and ots_mms_zipfile_ref is not null and mandate_type = 'BULK LINKED' and flow_type = 'MMSSIM' ";
if(mntypecb.getValue().equalsIgnoreCase("CREATE"))
{
condition += " and action_type = 'CREATE' ";
}
else if(mntypecb.getValue().equalsIgnoreCase("AMEND"))
{
condition += " and action_type = 'AMEND' ";
}
if(!"all".equalsIgnoreCase(corpselcb.getValue()))
{
condition += " and UTILITY_CODE ='"+utilitymap.get(corpselcb.getValue())+"' ";
}
else
{
if(corporateName.length()>0)
condition += " and UTILITY_CODE in ("+corporateName+")";
}
//condition +=" and VALIDATION_STATUS='2' AND CHK_FLAG ='2' and ots_mms_zipfile_ref IS NOT NULL and mandate_type = 'BULK LINKED' ";
Globals.setLog("condition:"+condition);
//
if(!"all".equalsIgnoreCase(corpselcb.getValue()))
{
//sql = "SELECT FILE_NAME FROM TBL_IMPORT_FILE_DETAILS WHERE FILE_STATUS = '0' AND IMPORT_TYPE = 'MMSLINKED' and UTILITY_NAME = '"+corpselcb.getValue().toUpperCase()+"' ";
sql ="SELECT A.FILE_NAME FROM (SELECT FILE_NAME FROM TBL_IMPORT_FILE_DETAILS WHERE FILE_STATUS = '0' AND IMPORT_TYPE = 'MMSLINKED' and IMPORTER <> '"+(String)s.getAttribute("usern")+"' ) A JOIN ("+condition+" ) b ON b.ots_mms_zipfile_ref = a.file_name";
}
else
{
//sql="SELECT A.FILE_NAME FROM (SELECT FILE_NAME FROM TBL_IMPORT_FILE_DETAILS WHERE FILE_STATUS = '0' AND IMPORT_TYPE = 'MMSLINKED' and UTILITY_NAME in ("+corporateName+") ) A JOIN ( SELECT DISTINCT ots_mms_zipfile_ref FROM tbl_out_dd_mandate WHERE validation_status = '2' AND chk_flag = '2' and ots_mms_zipfile_ref is not null ) b ON b.ots_mms_zipfile_ref = a.file_name";
sql="SELECT A.FILE_NAME FROM (SELECT FILE_NAME FROM TBL_IMPORT_FILE_DETAILS WHERE FILE_STATUS = '0' AND IMPORT_TYPE = 'MMSLINKED' and IMPORTER <> '"+(String)s.getAttribute("usern")+"' ) A JOIN ( "+condition+" ) b ON b.ots_mms_zipfile_ref = a.file_name";
}
Globals.setLog("date sql:"+sql);
pstmt1 = conn.prepareStatement(sql,ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_READ_ONLY);
/*if(!"all".equalsIgnoreCase(corpselcb.getValue()))
{
pstmt1.setString(1, corpselcb.getValue().toUpperCase() );
}
else
{
}*/
rs1 = pstmt1.executeQuery();
filenamecb.getChildren().clear();
filenamecb.setValue("");
//filenamecb.appendItem("ALL");
while(rs1.next())
{
if(rs1.getRow() == 1)
{
filenamecb.appendItem("ALL");
}
filenamecb.appendItem(rs1.getString("FILE_NAME"));
}
rs1.close();
pstmt1.close();
}
catch (Exception e)
{
Globals.setLog(e);
}
finally{
try{if(rs1!=null){rs1.close();rs1 = null;}}catch (Exception fe){Globals.setLog(fe);}
try{if(pstmt1!=null){pstmt1.close();pstmt1 = null;}}catch (Exception fe){Globals.setLog(fe);}
try{if(conn!=null){conn.close();conn = null;}}catch (Exception fe){Globals.setLog(fe);}
}
}
public String getCheckedItems()
{
String checkedFileNames = "";
for(Component comp: statusrows.getChildren())
{
if(comp instanceof Row)
{
Checkbox chk = (Checkbox)((Row)comp).getChildren().get(0);
if(chk.isChecked())
{
chk.setChecked(false);
checkedFileNames = "'"+chk.getId().substring(chk.getId().indexOf("|")+1)+"',";
}
}
}
if(!"".equalsIgnoreCase(checkedFileNames))
checkedFileNames = checkedFileNames.substring(0,checkedFileNames.length()-1);
return checkedFileNames;
}
public void selectFirstItem()
{
if(statusrows.getChildren().size()>0)
{
Row f1=(Row)statusrows.getChildren().get(0);
f1.setFocus(true);
}
}
/*
* EventListener keylistener = new EventListener() { public void onEvent(Event
* event) throws Exception { int k_code = ((KeyEvent)event).getKeyCode(); } };
*/
EventListener allchklistener = new EventListener()
{
public void onEvent(Event event) throws Exception
{
if((event.getName().equalsIgnoreCase("onCheck")))
{
Checkbox chk1 = (Checkbox)event.getTarget();
if(chk1.getId().equalsIgnoreCase("allchk"))
{
fileList.clear();
for(Component comp: statusrows.getChildren())
{
if(comp instanceof Row)
{
Checkbox chk = (Checkbox)((Row)comp).getChildren().get(0);
if(allchk.isChecked())
{
chk.setChecked(true);
fileList.add(chk.getId().substring(chk.getId().indexOf("|")+1));
}
else
{
chk.setChecked(false);
}
}
}
}
else
{
if(chk1.isChecked())
fileList.add(chk1.getId().substring(chk1.getId().indexOf("|")+1));
else
fileList.remove(chk1.getId().substring(chk1.getId().indexOf("|")+1));
if(fileList.size() == statusrows.getChildren().size())
allchk.setChecked(true);
else
allchk.setChecked(false);
}
}
}
};
EventListener fetchfileverify = new EventListener()
{
public void onEvent(Event event) throws Exception
{
if((event.getName().equalsIgnoreCase("onClick") || event.getName().equalsIgnoreCase("onOk")) && event.getTarget().getId().equalsIgnoreCase("verifybtn"))
{
Connection conn1 = null;
PreparedStatement pstmt1 = null;
PreparedStatement pstmt2 = null;
PreparedStatement pstmt3 = null;
PreparedStatement pstmt4 = null;
//PreparedStatement pstmt3 = null;
//PreparedStatement pstmt4 = null;
PreparedStatement pstmt5 = null;
ResultSet rs = null;
int appliedrecord = 0;
int filestatus = 0;
if(fileList.size() == 0)
{
try
{
HashMap<String, String> msgparams = new HashMap<String, String>();
msgparams.put("msgstring", "Please select one file to verify!");
Window win = (Window) Executions.createComponents("MessageBox.zul", null, msgparams);
win.doModal();
}
catch(Exception e)
{
Globals.setLog(e);
}
}
else
{
Globals.setLog("fileList"+fileList);
try
{
HashMap<String, String> msgparams = new HashMap<String, String>();
msgparams.put("msgstring", "Do you want to verify selected files?");
Window win = (Window) Executions.createComponents("MessageBoxWithResponse.zul", null, msgparams);
win.doModal();
}
catch(Exception e)
{
return;
}
if (message_box_response.response.equalsIgnoreCase("yes"))
{
try
{
DataSource ds = (DataSource) new InitialContext(Globals.getICProps()).lookup(Globals.getDSlookup());
conn1 = ds.getConnection();
String selectsql1 = "update tbl_out_dd_mandate set validation_status = '3',chk_flag = '0',mms_locked = '',mms_locker = '',mms_verifier = ?,mms_verify_time = (select systimestamp from dual),PROCESSING_DATE='"+curDate+"' where ots_mms_zipfile_ref = ?";
String selectsql2 = "update tbl_import_file_details set file_status = '3',verifier = ?,verify_date = (select systimestamp from dual) where file_name= ?";
String selectsql3 = "insert into tbl_out_dd_mandate_archive select * from tbl_out_dd_mandate where mandate_id in (select amend_mandate_id from tbl_out_dd_mandate where ots_mms_zipfile_ref = ?)";
String selectsql4 = "delete from tbl_out_dd_mandate where mandate_id in (select amend_mandate_id from tbl_out_dd_mandate where ots_mms_zipfile_ref = ?)";
String selectsql5 = "select file_status from tbl_import_file_details where file_name = ?";
Globals.setLog("Query Execution Start Time:"+(Calendar.getInstance().getTime()));
for(String file : fileList)
{
Globals.setLog("applied count "+((Label)statusrows.getFellowIfAny("R|"+file).getChildren().get(4)).getValue());
appliedrecord = Integer.parseInt(((Label)statusrows.getFellowIfAny("R|"+file).getChildren().get(4)).getValue());
pstmt5 = conn1.prepareStatement(selectsql5,ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_READ_ONLY);
pstmt5.setString(1, file );
rs = pstmt5.executeQuery();
if(rs.next())
{
filestatus = rs.getInt(1);
}
rs.close();
Globals.setLog("filestatus = "+filestatus);
if(filestatus == 3)
{
try
{
HashMap<String, String> msgparams = new HashMap<String, String>();
msgparams.put("msgstring","File "+file+" is already verified! ");
Window win = (Window) Executions.createComponents("MessageBox.zul", null, msgparams);
win.doModal();
}
catch(Exception e)
{
Globals.setLog(e);
}
return;
}
Globals.setLog("appliedrecord = "+appliedrecord);
conn1.setAutoCommit(false);
Globals.setLog("Query Execution Start Time:"+(Calendar.getInstance().getTime()));
Globals.setLog("selectsql1:update tbl_out_dd_mandate set validation_status = '3',chk_flag = '0',mms_locked = '',mms_locker = '',mms_verifier = '"+s.getAttribute("usern").toString()+"',mms_verify_time = (select systimestamp from dual),PROCESSING_DATE='"+curDate+"' where ots_mms_zipfile_ref = '"+file+"'");
pstmt1 = conn1.prepareStatement(selectsql1,ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE);
pstmt1.setString(1, s.getAttribute("usern").toString());
pstmt1.setString(2, file );
int i = pstmt1.executeUpdate();
Globals.setLog("Query Execution End Time:"+(Calendar.getInstance().getTime()));
Globals.setLog("i = "+i);
if(i == appliedrecord)
{
conn1.commit();
conn1.setAutoCommit(true);
Globals.setLog("Query Execution Start Time:"+(Calendar.getInstance().getTime()));
Globals.setLog("selectsql2:update tbl_import_file_details set file_status = '3',verifier = '"+s.getAttribute("usern").toString()+"',verify_date = (select systimestamp from dual) where file_name= '"+file+"'");
pstmt2 = conn1.prepareStatement(selectsql2,ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE);
pstmt2.setString(1, s.getAttribute("usern").toString());
pstmt2.setString(2, file );
int j = pstmt2.executeUpdate();
Globals.setLog("j = "+j);
Globals.setLog("Query Execution End Time:"+(Calendar.getInstance().getTime()));
if(mntypecb.getValue().equalsIgnoreCase("AMEND"))
{
Globals.setLog("Query Execution Start Time:"+(Calendar.getInstance().getTime()));
Globals.setLog("selectsql3:insert into tbl_out_dd_mandate_archive select * from tbl_out_dd_mandate where mandate_id in (select amend_mandate_id from tbl_out_dd_mandate where ots_mms_zipfile_ref = '"+file+"'");
pstmt3 = conn1.prepareStatement(selectsql3,ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE);
pstmt3.setString(1, file);
int k = pstmt3.executeUpdate();
Globals.setLog("k = "+k);
Globals.setLog("Query Execution End Time:"+(Calendar.getInstance().getTime()));
Globals.setLog("Query Execution Start Time:"+(Calendar.getInstance().getTime()));
Globals.setLog("selectsql4:delete from tbl_out_dd_mandate where mandate_id in (select amend_mandate_id from tbl_out_dd_mandate where ots_mms_zipfile_ref = '"+file+"')");
pstmt4 = conn1.prepareStatement(selectsql4,ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE);
pstmt4.setString(1, file);
int m = pstmt4.executeUpdate();
Globals.setLog("m = "+m);
Globals.setLog("Query Execution End Time:"+(Calendar.getInstance().getTime()));
Globals.auditlogit_tran(file,"Verify",wmmsbulklinkedverification.getId(),"Mandate Verification For File : "+file+" Verified","MMS OUTWARD");
}
else
{
Globals.auditlogit_tran(file,"Verify",wmmsbulklinkedverification.getId(),"Mandate Verification For File : "+file+" Verified","MMS OUTWARD");
}
}
}
Globals.setLog(" updating file level verification...");
loadinitdata();
}
catch (Exception e)
{
Globals.setLog(e);
}
finally{
try{if(rs!=null){rs.close();rs = null;}}catch (Exception fe){Globals.setLog(fe);}
try{if(pstmt1!=null){pstmt1.close();pstmt1 = null;}}catch (Exception fe){Globals.setLog(fe);}
try{if(pstmt2!=null){pstmt2.close();pstmt2 = null;}}catch (Exception fe){Globals.setLog(fe);}
try{if(pstmt5!=null){pstmt5.close();pstmt5 = null;}}catch (Exception fe){Globals.setLog(fe);}
try{if(conn1!=null){conn1.close();conn1 = null;}}catch (Exception fe){Globals.setLog(fe);}
}
}
}
}
}
};
public void clearFilterData()
{
flowtypecb.setValue("");
mntypecb.setValue("");
corpselcb.setValue("");
filenamecb.setValue("");
mntypecb.setSelectedIndex(0);
flowtypecb.setSelectedIndex(0);
}
}