Commit 1c988fc5 authored by sgadve's avatar sgadve

-Convert the Arrears delete form business logic WSR to JB,Adding two component...

-Convert the Arrears delete form business logic WSR to JB,Adding two component ArrearsDeleteIc and ArrearsDeletePrc and respected sql.

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@205121 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 85beb241
This diff is collapsed.
/**
* Added by saiprasad G.
* For process the data migrate from WSR to JB
*/
package ibase.webitm.ejb.adm.adv;
import java.rmi.RemoteException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import org.w3c.dom.Document;
import ibase.utility.E12GenericUtility;
import ibase.webitm.ejb.ProcessEJB;
import ibase.webitm.utility.ITMException;
public class ArrearsDeletePrc extends ProcessEJB
{
E12GenericUtility genericUtility=new E12GenericUtility();
public String process(String xmlString,String xmlString1,String objContext,String xtraParams) throws RemoteException,ITMException
{
Document detailDom = null;
Document headerDom = null;
String retStr = "";
try
{
if(xmlString != null && xmlString.trim().length()!=0)
{
headerDom = genericUtility.parseString(xmlString);
System.out.println("headerDom" + xmlString);
}
if(xmlString1 != null && xmlString1.trim().length()!=0)
{
detailDom = genericUtility.parseString(xmlString1);
System.out.println("detailDom" + xmlString1);
}
retStr = process(headerDom, detailDom, objContext, xtraParams);
}
catch(Exception e)
{
System.out.println("Exception:ArrearsDeletePrc:process"+e);
}
return retStr;
}
public String process(Document headerDom, Document detailDom, String objContext, String xtraParams)throws RemoteException, ITMException
{
String retStr="";
Connection con=null;
try
{
if(con==null)
{
con = getConnection();
con.setAutoCommit(false);
}
retStr=processData(headerDom, detailDom, objContext, xtraParams, con);
}
catch(Exception e)
{
System.out.println("Exception e1"+e);
}
finally
{
try
{
con.close();
con=null;
}
catch(Exception e)
{
System.out.println("Exception e1"+e);
}
}
return retStr;
}
public String processData(Document headerDom , Document detailDom,String objContext ,String xtraParams , Connection con )
{
String prdCodeAcct = "", prdCodeFr = "",prdCodeTo="" ,empCodeFr="",empCodeTo ="";
String siteCodeFr = "", siteCodeTo = "", prcGrpFr = "", prcGrpTo = "";
String prdCode = "",empCode="",siteCodePay="",prcGrp="",prdAccountCode="" , errorString = "";
PreparedStatement pStmt = null;
ResultSet rs = null;
int count;
String userId ="";
boolean isSuccess = false;
StringBuilder sql = new StringBuilder();
try
{
userId=genericUtility.getValueFromXTRA_PARAMS(xtraParams,"loginCode");
System.out.println("userId:- " + userId);
empCodeFr = E12GenericUtility.checkNull(genericUtility.getColumnValue("emp_code__fr", headerDom));
empCodeTo = E12GenericUtility.checkNull(genericUtility.getColumnValue("emp_code__to", headerDom));
siteCodeFr = E12GenericUtility.checkNull(genericUtility.getColumnValue("site_code__fr", headerDom));
siteCodeTo = E12GenericUtility.checkNull(genericUtility.getColumnValue("site_code__to", headerDom));
prdCodeFr = E12GenericUtility.checkNull(genericUtility.getColumnValue("prd_code__fr", headerDom));
prdCodeTo = E12GenericUtility.checkNull(genericUtility.getColumnValue("prd_code__to", headerDom));
prcGrpFr = E12GenericUtility.checkNull(genericUtility.getColumnValue("proc_group__fr", headerDom));
prcGrpTo = E12GenericUtility.checkNull(genericUtility.getColumnValue("proc_group__to", headerDom));
prdCodeAcct = E12GenericUtility.checkNull(genericUtility.getColumnValue("prd_code__acc", headerDom));
if(empCodeFr.length() <= 0)
{
empCodeFr = "0000";
}
if(empCodeTo.length() <= 0)
{
empCodeTo = "ZZZ";
}
if(siteCodeFr.length() <= 0)
{
siteCodeFr = "000";
}
if(siteCodeTo.length() <= 0)
{
siteCodeTo = "ZZZ";
}
if(prcGrpFr.length() <= 0)
{
prcGrpFr = "000";
}
if(prcGrpTo.length() <= 0)
{
prcGrpTo = "ZZZ";
}
sql.append("SELECT ARREARS.PRD_CODE,ARREARS.EMP_CODE,ARREARS.SITE_CODE__PAY,EMPLOYEE.PROC_GROUP,ARREARS.PRD_CODE__ACC FROM ARREARS,EMPLOYEE");
sql.append(" WHERE ( ARREARS.EMP_CODE = EMPLOYEE.EMP_CODE ) AND ( ( ARREARS.PRD_CODE >= ? ) ");
sql.append(" AND ( ARREARS.PRD_CODE <= ? ) AND ( ARREARS.EMP_CODE >= ? ) AND");
sql.append("(ARREARS.EMP_CODE <= ?) AND ( ARREARS.SITE_CODE__PAY >= ?) AND (ARREARS.SITE_CODE__PAY <= ?) AND (EMPLOYEE.PROC_GROUP >= ?) AND ");
sql.append("( EMPLOYEE.PROC_GROUP <= ?) AND ( ARREARS.PRD_CODE__ACC = ? ) AND ( ARREARS.VOUCHER_NO IS NULL ))");
pStmt = con.prepareStatement(sql.toString());
pStmt.setString(1, prdCodeFr);
pStmt.setString(2, prdCodeTo);
pStmt.setString(3, empCodeFr);
pStmt.setString(4, empCodeTo);
pStmt.setString(5, siteCodeFr);
pStmt.setString(6, siteCodeTo);
pStmt.setString(7, prcGrpFr);
pStmt.setString(8, prcGrpTo);
pStmt.setString(9, prdCodeAcct);
rs = pStmt.executeQuery();
while(rs.next())
{
prdCode = rs.getString("PRD_CODE");
empCode = rs.getString("EMP_CODE");
siteCodePay = rs.getString("SITE_CODE__PAY");
prcGrp = rs.getString("PROC_GROUP");
//prdAccountCode = rs.getString("PRD_CODE__ACC");
System.out.println("###Sai:"+prdCode+"\t"+empCode+"\t"+siteCodePay+"\t"+prcGrp+"\t"+prdAccountCode);
String deleteSql="DELETE FROM ARREARS WHERE PRD_CODE=? AND EMP_CODE=? AND PRD_CODE__ACC=?";
PreparedStatement pStmt1 = con.prepareStatement(deleteSql);
pStmt1.setString(1, prdCode);
pStmt1.setString(2, empCode);
pStmt1.setString(3, prdCodeAcct);
count= pStmt1.executeUpdate();
System.out.println("Data deleted:"+count);
if(count>0)
{
isSuccess = true;
con.commit();
}
else
{
con.rollback();
}
if(pStmt1!=null)
{
pStmt1.close();
pStmt1 = null;
}
}
if(rs!=null)
{
rs.close();
rs= null;
}
if(pStmt!=null)
{
pStmt.close();
pStmt = null;
}
if(isSuccess)
{
errorString = genericUtility.getErrorString("", "PROCSUCC", userId);
}
}
catch(Exception e)
{
System.out.println("Exception in processData1:"+e);
}
finally
{
try
{
if(rs!=null)
{
rs.close();
rs = null;
}
if(pStmt!=null)
{
pStmt.close();
pStmt = null;
}
}
catch(Exception e)
{
System.out.println("Excption in processData2:"+e);
}
}
return errorString;
}
}
----------Arrear deletion [START]-------------------------------------------------------------
update system_events set comp_name='ibase.webitm.ejb.adm.ArrearsDeleteIC',comp_type='JB' where obj_name='arrears_deletion'and event_code='post_item_change';
update system_events set service_code='poic_default_ejb' where obj_name='arrears_deletion' and event_code='post_item_change';
update system_events set comp_name='ibase.webitm.ejb.adm.ArrearsDeleteIC',comp_type='JB' , service_code='prv_default_ejb' where obj_name='arrears_deletion'and event_code='pre_validate';
Insert into SYSTEM_EVENT_SERVICES (SERVICE_CODE,SERVICE_DESCR,SERVICE_URI,SERVICE_PROVIDER,METHOD_NAME,RETURN_VALUE,RETURN_TYPE,RETURN_DESCR,RETURN_XFRM,CHG_DATE,CHG_USER,CHG_TERM,SERVICE_NAMESPACE,RES_ELEM,SOAP_ACTION) values ('prc_default_ejb','Action To process','http://localhost:9090/axis/services/ProcessService','Base Information','process','String','S',null,null,sysdate,'BASE','BASE',null,null,null);
Insert into SYSTEM_SERVICE_ARGS (SERVICE_CODE,LINE_NO,ARG_NAME,ARG_MODE,DESCR,ARG_TYPE,ARG_XFRM,CHG_DATE,CHG_USER,CHG_TERM,ARG_VALUE) values ('prc_default_ejb',1,'COMPONENT_TYPE','I','Component Type','S',null,sysdate,'BASE','BASE','JB');
Insert into SYSTEM_SERVICE_ARGS (SERVICE_CODE,LINE_NO,ARG_NAME,ARG_MODE,DESCR,ARG_TYPE,ARG_XFRM,CHG_DATE,CHG_USER,CHG_TERM,ARG_VALUE) values ('prc_default_ejb',2,'COMPONENT_NAME','I','Component Name','S',null,sysdate,'BASE','BASE','');
Insert into SYSTEM_SERVICE_ARGS (SERVICE_CODE,LINE_NO,ARG_NAME,ARG_MODE,DESCR,ARG_TYPE,ARG_XFRM,CHG_DATE,CHG_USER,CHG_TERM,ARG_VALUE) values ('prc_default_ejb',3,'XML_DATA_1','I','XML data of form no 1','S',null,sysdate,'BASE','BASE',null);
Insert into SYSTEM_SERVICE_ARGS (SERVICE_CODE,LINE_NO,ARG_NAME,ARG_MODE,DESCR,ARG_TYPE,ARG_XFRM,CHG_DATE,CHG_USER,CHG_TERM,ARG_VALUE) values ('prc_default_ejb',4,'XML_DATA__ALL','I','XML data of form no 1','S',null,sysdate,'BASE','BASE',null);
Insert into SYSTEM_SERVICE_ARGS (SERVICE_CODE,LINE_NO,ARG_NAME,ARG_MODE,DESCR,ARG_TYPE,ARG_XFRM,CHG_DATE,CHG_USER,CHG_TERM,ARG_VALUE) values ('prc_default_ejb',5,'OBJ_CONTEXT','I','Object Context','S',null,sysdate,'BASE','BASE','');
Insert into SYSTEM_SERVICE_ARGS (SERVICE_CODE,LINE_NO,ARG_NAME,ARG_MODE,DESCR,ARG_TYPE,ARG_XFRM,CHG_DATE,CHG_USER,CHG_TERM,ARG_VALUE) values ('prc_default_ejb',6,'XTRA_PARAMS','I','Extra Arguments','S',null,sysdate,'BASE','BASE',null);
update system_events set service_code='prc_default_ejb' where obj_name='arrears_deletion' and event_code='process';
update system_events set comp_name='ibase.webitm.ejb.adm.adv.ArrearsDeletePrc',comp_type='JB' where service_code='prc_default_ejb' and obj_name='arrears_deletion';
----------Arrear deletion [END]---------------------------------------------------------
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment