Commit 0b9fbfd7 authored by vvengurlekar's avatar vvengurlekar

WRONG COMPONENT MERGED- EmpAddChange

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@208506 ce508802-f39f-4f6c-b175-0d175dae99d5
parent b682b9f3
//Migrated By Yashwant on 18/07/2019[Start]
package ibase.webitm.ejb.adm;
import java.rmi.RemoteException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import ibase.utility.E12GenericUtility;
import ibase.webitm.ejb.ITMDBAccessEJB;
import ibase.webitm.ejb.ValidatorEJB;
import ibase.webitm.utility.ITMException;
public class EmpAddChange extends ValidatorEJB implements EmpAddChangeLocal,EmpAddChangeRemote
{
public String wfValData(String xmlString, String xmlString1, String xmlString2, String objContext, String editFlag,
String xtraParams) throws RemoteException, ITMException
{
System.out.println(xmlString);
Document dom = null;
Document dom1 = null;
Document dom2 = null;
String errString = "";
E12GenericUtility genericUtility = null;
try {
genericUtility = new E12GenericUtility();
if (xmlString != null && xmlString.trim().length() != 0)
{
dom = genericUtility.parseString(xmlString);
System.out.println("Print dom>>>> " + dom);
}
if (xmlString1 != null && xmlString1.trim().length() != 0)
{
dom1 = genericUtility.parseString(xmlString1);
}
if (xmlString2 != null && xmlString2.trim().length() != 0)
{
dom2 = genericUtility.parseString(xmlString2);
}
errString = wfValData(dom, dom1, dom2, objContext, editFlag, xtraParams);
System.out.println("ErrString :" + errString);
}
catch (Exception e)
{
System.out.println("Exception :EmpAddChange :wfValData(String xmlString):" + e.getMessage() + ":");
errString = genericUtility.createErrorString(e);
e.printStackTrace();
throw new ITMException(e);
}
System.out.println("returning from EmpAddChange wfvaldata");
return errString;
}
public String wfValData(Document dom, Document dom1, Document dom2, String objContext, String editFlag,
String xtraParams) throws RemoteException, ITMException
{
PreparedStatement pstmt = null;
ResultSet rs = null;
String childNodeName = null;
StringBuffer errStringXml = null;
ITMDBAccessEJB itmDbAcess = null;
Connection conn = null;
int currentFormNo = 0;
NodeList parentList = null;
NodeList childList = null;
Node parentNode = null;
Node childNode = null;
int noOfChilds = 0;
int cnt = 0;
String errString="";
String userId = "";
String tranId="";
String sql = "";
String empCode="";
String curCity="";
String perCity="";
String mLevel="";
String loginSiteCode="";
ArrayList<String> errList = new ArrayList<String>();
ArrayList<String> errFields = new ArrayList<String>();
String errorType="";
errStringXml = new StringBuffer("<?xml version=\"1.0\"?>\r\n<Root><Errors>");
E12GenericUtility genericUtility = null;
try
{
genericUtility = new E12GenericUtility();
itmDbAcess = new ITMDBAccessEJB();
conn = getConnection();
userId = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginCode");
loginSiteCode=genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginSiteCode");
if (objContext != null && objContext.trim().length() > 0)
{
currentFormNo = Integer.parseInt(objContext);
}
parentList = dom.getElementsByTagName("Detail" + currentFormNo);
parentNode = parentList.item(0);
childList = parentNode.getChildNodes();
noOfChilds = childList.getLength();
System.out.println("noOfChilds--->>>" + noOfChilds);
switch (currentFormNo)
{
case 1:
NodeList parentNodeList = dom.getElementsByTagName("Detail1");
parentNode = parentNodeList.item(0);
NodeList childNodeList = parentNode.getChildNodes();
int childNodeListLength = childNodeList.getLength();
System.out.println("child Node List Length::::::" + childNodeListLength);
for (int ctr = 0; ctr < childNodeListLength; ctr++)
{
childNode = childNodeList.item(ctr);
System.out.println("childNode" + childNode);
if (childNode.getNodeType() != Node.ELEMENT_NODE)
{
continue;
}
childNodeName = childNode.getNodeName();
System.out.println("childNodeName.editFlag." + childNodeName + "" + editFlag);
System.out.println("@V@ Edit flag :- [" + editFlag + "");
if("tran_id".equalsIgnoreCase(childNodeName))
{
tranId = checkNull(genericUtility.getColumnValue("tran_id", dom));
if("A".equalsIgnoreCase(editFlag))
{
sql=" select count(*) as cnt from employee_add_change where tran_id = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, tranId);
rs = pstmt.executeQuery();
if (rs.next())
{
cnt = rs.getInt("cnt");
}
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(cnt > 0)
{
errList.add("VMDTRAN");
errFields.add(childNodeName.toLowerCase());
errorType = errorType(conn, "VMDTRAN");
if(errorType.equalsIgnoreCase("E"))
{
break;
}
}
}
}
if ("emp_code".equalsIgnoreCase(childNodeName))
{
empCode=checkNull(genericUtility.getColumnValue("emp_code", dom));
if(mLevel == null || mLevel.trim().length() == 0)
{
sql="select USR_LEV as mlevl from users where code = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, userId);
rs = pstmt.executeQuery();
if (rs.next())
{
mLevel = rs.getString("mlevl");
}
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
}
if("A".equalsIgnoreCase(editFlag) || "E".equalsIgnoreCase(editFlag))
{
if(empCode == null || empCode.trim().length() == 0)
{
errList.add("VEEMP2");
errFields.add(childNodeName.toLowerCase());
errorType = errorType(conn, "VEEMP2");
if(errorType.equalsIgnoreCase("E"))
{
break;
}
}
else
{
cnt = 0;
sql="select count(*) as cnt from employee where emp_code = ? and work_site = (case when ? > 1 then ? else work_site end)";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, empCode);
pstmt.setString(2,mLevel);
pstmt.setString(3,loginSiteCode);
rs = pstmt.executeQuery();
if (rs.next())
{
cnt = rs.getInt("cnt");
}
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(cnt == 0)
{
errList.add("VMEMP1");
errFields.add(childNodeName.toLowerCase());
errorType = errorType(conn, "VMEMP1");
if(errorType.equalsIgnoreCase("E"))
{
break;
}
}
if("A".equalsIgnoreCase(editFlag))
{
cnt = 0;
sql="select count(*) as cnt from employee_add_change where emp_code = ? and confirmed = 'N'";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, empCode);
rs = pstmt.executeQuery();
if (rs.next())
{
cnt = rs.getInt("cnt");
}
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(cnt > 0)
{
errList.add("VMENCIM");
errFields.add(childNodeName.toLowerCase());
errorType = errorType(conn, "VMENCIM");
if(errorType.equalsIgnoreCase("E"))
{
break;
}
}
}
}
}
}
if ("cur_city".equalsIgnoreCase(childNodeName))
{
curCity=checkNull(genericUtility.getColumnValue("cur_city", dom));
if(curCity.trim().length() > 0)
{
cnt = 0;
sql="select count(*) as cnt from station where sh_descr = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, curCity);
rs = pstmt.executeQuery();
if (rs.next())
{
cnt = rs.getInt("cnt");
}
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(cnt == 0)
{
errList.add("VMSTANCD");
errFields.add(childNodeName.toLowerCase());
errorType = errorType(conn, "VMSTANCD");
if(errorType.equalsIgnoreCase("E"))
{
break;
}
}
}
}
if ("per_city".equalsIgnoreCase(childNodeName))
{
perCity=checkNull(genericUtility.getColumnValue("per_city", dom));
if(perCity.trim().length() > 0)
{
cnt = 0;
sql="select count(*) as cnt from station where sh_descr = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, perCity);
rs = pstmt.executeQuery();
if (rs.next())
{
cnt = rs.getInt("cnt");
}
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(cnt == 0)
{
errList.add("VMSTANCD");
errFields.add(childNodeName.toLowerCase());
errorType = errorType(conn, "VMSTANCD");
if(errorType.equalsIgnoreCase("E"))
{
break;
}
}
}
}
}
System.out.println("errStringXml.toString()---1= "+errStringXml.toString());
if (errList != null && errList.size() > 0)
{
System.out.println("errList==[" + errList + "]");
int errListSize = errList.size();
System.out.println("errListSize:::::::[" + errListSize + "]");
System.out.println("in error::::::::::");
for (int i = 0; i < errListSize; i++)
{
System.out.println("in error For:::::::::::::::");
String errCode = (String) errList.get(i);
String errFldName = (String) errFields.get(i);
System.out.println("errCode .........." + errCode);
errString = itmDbAcess.getErrorString(errFldName, errCode, userId, "", conn);
System.out.println("errString is : ::::>>>> " + errString);
String msgType = errorType(conn, errCode);
if (errString.length() > 0)
{
String bifurErrString = errString.substring(errString.indexOf("<Errors>") + 8,errString.indexOf("<trace>"));
bifurErrString = bifurErrString + errString.substring(errString.indexOf("</trace>") + 8,errString.indexOf("</Errors>"));
errStringXml.append(bifurErrString);
System.out.println("errStringXml .........." + errStringXml);
errString = "";
}
if (msgType.equalsIgnoreCase("E"))
{
break;
}
}
errList.clear();
errFields.clear();
}
errStringXml.append("</Errors></Root>\r\n");
System.out.println("errStringXml.toString()---2= "+errStringXml.toString());
}
}
catch (Exception e)
{
e.printStackTrace();
throw new ITMException(e);
}
finally
{
try
{
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
if (conn != null)
{
conn.close();
conn = null;
}
}
catch (Exception e)
{
System.out.println("Exception ::" + e);
e.printStackTrace();
throw new ITMException(e);
}
}
errString = errStringXml.toString();
return errString;
}
public String itemChanged(String xmlString, String xmlString1, String xmlString2, String objContext,
String currentColumn, String editFlag, String xtraParams) throws RemoteException, ITMException
{
Document dom1 = null;
Document dom = null;
Document dom2 = null;
String valueXmlString = "";
E12GenericUtility genericUtility = null;
try
{
genericUtility = new E12GenericUtility();
if (xmlString != null && xmlString.trim().length() != 0)
{
dom = genericUtility.parseString(xmlString);
}
if (xmlString1 != null && xmlString1.trim().length() != 0)
{
dom1 = genericUtility.parseString(xmlString1);
}
if (xmlString2 != null && xmlString2.trim().length() != 0)
{
dom2 = genericUtility.parseString(xmlString2);
}
valueXmlString = itemChanged(dom, dom1, dom2, objContext, currentColumn, editFlag, xtraParams);
}
catch (Exception e)
{
System.out.println("Exception :EmpAddChange :itemChanged(String,String):" + e.getMessage() + ":");
valueXmlString = genericUtility.createErrorString(e);
e.printStackTrace();
throw new ITMException(e);
}
System.out.println("returning from EmpAddChange itemChanged");
return valueXmlString;
}
public String itemChanged(Document dom , Document dom1, Document dom2, String objContext, String currentColumn,
String editFlag, String xtraParams) throws RemoteException, ITMException
{
PreparedStatement pstmt = null;
ResultSet rs = null;
Connection conn = null;
StringBuffer valueXmlString = null;
int currentFormNo = 0;
E12GenericUtility genericUtility = null;
String lsTranId="";
String sql = "";
String lsConf="";
String empCode="";
String curAdd1="";
String curAdd2="";
String curAdd3="";
String curCity="";
String curPin="";
String curTel1="";
String curTel2="";
String curTel3="";
String lsCurCity="";
String lsCurrentState="";
String lsPermanantCity="";
String lsPermanantState="";
String empMname="";
String empLname="";
String designation="";
String curState="";
String perAdd1="";
String perAdd2="";
String perAdd3="";
String perCity="";
String perState="";
String perPin="";
String perTel="";
String deptCode="";
String mobileNo="";
String smsDomain="";
String emailIdOff="";
String emailIdPer="";
String imeNo="";
String workSite="";
String lsEmpCode="";
String empFname="";
String lsDepartment= "";
int mLevl=0;
String userId="";
String loginSiteCode="";
try
{
genericUtility = new E12GenericUtility();
java.util.Date toDay = new java.util.Date();
SimpleDateFormat sdf = new SimpleDateFormat(genericUtility.getApplDateFormat());
String ldToday = sdf.format(toDay);
System.out.println("currentFormNo...." + currentFormNo);
conn = getConnection();
if (objContext != null && objContext.trim().length() > 0)
{
currentFormNo = Integer.parseInt(objContext);
}
valueXmlString = new StringBuffer("<?xml version=\"1.0\"?>\r\n<Root>\r\n<Header>\r\n<editFlag>");
valueXmlString.append(editFlag).append("</editFlag>\r\n</Header>\r\n");
System.out.println("current form no: " + currentFormNo);
userId = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginCode");
loginSiteCode=genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginSiteCode");
if(mLevl == 0)
{
sql="select USR_LEV as mlevl from users where code = ?";
pstmt=conn.prepareStatement(sql);
pstmt.setString(1,userId);
rs=pstmt.executeQuery();
if(rs.next())
{
mLevl=rs.getInt("mlevl");
}
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
}
switch (currentFormNo)
{
case 1:
{
valueXmlString.append("<Detail1>\r\n");
if ("itm_defaultedit".equalsIgnoreCase(currentColumn))
{
System.out.println("====================itm default edit================");
lsTranId = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "tran_id");
if(lsTranId == null || lsTranId.trim().length() == 0)
{
lsTranId = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "as_tran_id");
if(lsTranId == null || lsTranId.trim().length() == 0)
{
lsTranId=checkNull(genericUtility.getColumnValue("tran_id", dom));
}
}
System.out.println("lsTranId======="+lsTranId);
valueXmlString.append("<tran_id ><![CDATA[").append(lsTranId).append("]]></tran_id>\r\n");
sql="select confirmed as ls_conf from employee_add_change where tran_id = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, lsTranId);
rs = pstmt.executeQuery();
if (rs.next())
{
lsConf = rs.getString("ls_conf");
}
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
if("N".equalsIgnoreCase(lsConf))
{
empCode=checkNull(genericUtility.getColumnValue("emp_code", dom));
valueXmlString.append("<emp_code protect=\"0\"><![CDATA[").append(empCode).append("]]></emp_code>\r\n");
curAdd1=checkNull(genericUtility.getColumnValue("cur_add1", dom));
valueXmlString.append("<cur_add1 protect=\"0\"><![CDATA[").append(curAdd1).append("]]></cur_add1>\r\n");
curAdd2=checkNull(genericUtility.getColumnValue("cur_add2", dom));
valueXmlString.append("<cur_add2 protect=\"0\"><![CDATA[").append(curAdd2).append("]]></cur_add2>\r\n");
curAdd3=checkNull(genericUtility.getColumnValue("cur_add3", dom));
valueXmlString.append("<cur_add3 protect=\"0\"><![CDATA[").append(curAdd3).append("]]></cur_add3>\r\n");
curCity=checkNull(genericUtility.getColumnValue("cur_city", dom));
valueXmlString.append("<cur_city protect=\"0\"><![CDATA[").append(curCity).append("]]></cur_city>\r\n");
curState=checkNull(genericUtility.getColumnValue("cur_state", dom));
valueXmlString.append("<cur_state protect=\"0\"><![CDATA[").append(curState).append("]]></cur_state>\r\n");
curPin=checkNull(genericUtility.getColumnValue("cur_pin", dom));
valueXmlString.append("<cur_pin protect=\"0\"><![CDATA[").append(curPin).append("]]></cur_pin>\r\n");
curTel1=checkNull(genericUtility.getColumnValue("cur_tel1", dom));
valueXmlString.append("<cur_tel1 protect=\"0\"><![CDATA[").append(curTel1).append("]]></cur_tel1>\r\n");
curTel2=checkNull(genericUtility.getColumnValue("cur_tel2", dom));
valueXmlString.append("<cur_tel2 protect=\"0\"><![CDATA[").append(curTel2).append("]]></cur_tel2>\r\n");
curTel3=checkNull(genericUtility.getColumnValue("cur_tel3", dom));
valueXmlString.append("<cur_tel3 protect=\"0\"><![CDATA[").append(curTel3).append("]]></cur_tel3>\r\n");
}
}
if ("itm_default".equalsIgnoreCase(currentColumn))
{
System.out.println("====================itm default================");
valueXmlString.append("<tran_date ><![CDATA[").append(ldToday).append("]]></tran_date>\r\n");
empCode=checkNull(genericUtility.getColumnValue("emp_code", dom));
valueXmlString.append("<emp_code protect=\"0\"><![CDATA[").append(empCode).append("]]></emp_code>\r\n");
curAdd1=checkNull(genericUtility.getColumnValue("cur_add1", dom));
valueXmlString.append("<cur_add1 protect=\"0\"><![CDATA[").append(curAdd1).append("]]></cur_add1>\r\n");
curAdd2=checkNull(genericUtility.getColumnValue("cur_add2", dom));
valueXmlString.append("<cur_add2 protect=\"0\"><![CDATA[").append(curAdd2).append("]]></cur_add2>\r\n");
curAdd3=checkNull(genericUtility.getColumnValue("cur_add3", dom));
valueXmlString.append("<cur_add3 protect=\"0\"><![CDATA[").append(curAdd3).append("]]></cur_add3>\r\n");
curCity=checkNull(genericUtility.getColumnValue("cur_city", dom));
valueXmlString.append("<cur_city protect=\"0\"><![CDATA[").append(curCity).append("]]></cur_city>\r\n");
curPin=checkNull(genericUtility.getColumnValue("cur_pin", dom));
valueXmlString.append("<cur_pin protect=\"0\"><![CDATA[").append(curPin).append("]]></cur_pin>\r\n");
curTel1=checkNull(genericUtility.getColumnValue("cur_tel1", dom));
valueXmlString.append("<cur_tel1 protect=\"0\"><![CDATA[").append(curTel1).append("]]></cur_tel1>\r\n");
curTel2=checkNull(genericUtility.getColumnValue("cur_tel2", dom));
valueXmlString.append("<cur_tel2 protect=\"0\"><![CDATA[").append(curTel2).append("]]></cur_tel2>\r\n");
curTel3=checkNull(genericUtility.getColumnValue("cur_tel3", dom));
valueXmlString.append("<cur_tel3 protect=\"0\"><![CDATA[").append(curTel3).append("]]></cur_tel3>\r\n");
}
if ("emp_code".equalsIgnoreCase(currentColumn))
{
System.out.println("================Inside EMP Code item change================");
lsEmpCode=checkNull(genericUtility.getColumnValue("emp_code", dom));
sql="select emp_fname, emp_mname, emp_lname, designation," +
" cur_add1, cur_add2, cur_add3, cur_city," +
" cur_state, cur_pin, cur_tel1, cur_tel2," +
" cur_tel3, per_add1, per_add2, per_add3," +
" per_city, per_state, per_pin, per_tel," +
" dept_code, mobile_no , sms_domain , email_id_off , email_id_per," +
" ime_no , work_site " +
" from employee " +
" where employee.emp_code = ? and work_site = (case when ? > 1 then ? else work_site end)";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, lsEmpCode);
pstmt.setInt(2, mLevl);
pstmt.setString(3, loginSiteCode);
rs = pstmt.executeQuery();
if (rs.next())
{
empFname = checkNull(rs.getString("emp_fname"));
empMname = checkNull(rs.getString("emp_mname"));
empLname = checkNull(rs.getString("emp_lname"));
designation = checkNull(rs.getString("designation"));
curAdd1= rs.getString("cur_add1");
curAdd2= rs.getString("cur_add2");
curAdd3= rs.getString("cur_add3");
curCity= rs.getString("cur_city");
curState = rs.getString("cur_state");
curPin = rs.getString("cur_pin");
curTel1 = rs.getString("cur_tel1");
curTel2 = rs.getString("cur_tel2");
curTel3 = rs.getString("cur_tel3");
perAdd1 = rs.getString("per_add1");
perAdd2 = rs.getString("per_add2");
perAdd3 = rs.getString("per_add3");
perCity = rs.getString("per_city");
perState = rs.getString("per_state");
perPin = rs.getString("per_pin");
perTel = rs.getString("per_tel");
deptCode = rs.getString("dept_code");
mobileNo = rs.getString("mobile_no");
smsDomain = rs.getString("sms_domain");
emailIdOff = rs.getString("email_id_off");
emailIdPer = rs.getString("email_id_per");
imeNo = rs.getString("ime_no");
workSite = rs.getString("work_site");
}
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
System.out.println("FNAME:::::::::::::"+empFname);
System.out.println("MNAME:::::::::::::"+empMname);
System.out.println("LNAME:::::::::::::"+empLname);
sql="select distinct department.descr as ls_department from department,employee"
+ " where department.dept_code = employee.dept_code and employee.dept_code = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,deptCode);
rs = pstmt.executeQuery();
if(rs.next())
{
lsDepartment= rs.getString("ls_department");
}
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
valueXmlString.append("<emp_fname ><![CDATA[").append(empFname).append("]]></emp_fname>\r\n");
valueXmlString.append("<emp_mname ><![CDATA[").append(empMname).append("]]></emp_mname>\r\n");
valueXmlString.append("<emp_lname ><![CDATA[").append(empLname).append("]]></emp_lname>\r\n");
valueXmlString.append("<department_descr ><![CDATA[").append(lsDepartment).append("]]></department_descr>\r\n");
valueXmlString.append("<designation ><![CDATA[").append(designation).append("]]></designation>\r\n");
valueXmlString.append("<cur_add1 ><![CDATA[").append(curAdd1).append("]]></cur_add1>\r\n");
valueXmlString.append("<cur_add2 ><![CDATA[").append(curAdd2).append("]]></cur_add2>\r\n");
valueXmlString.append("<cur_add3 ><![CDATA[").append(curAdd3).append("]]></cur_add3>\r\n");
valueXmlString.append("<cur_city ><![CDATA[").append(curCity).append("]]></cur_city>\r\n");
valueXmlString.append("<cur_state ><![CDATA[").append(curState).append("]]></cur_state>\r\n");
valueXmlString.append("<cur_pin ><![CDATA[").append(curPin).append("]]></cur_pin>\r\n");
valueXmlString.append("<cur_tel1 ><![CDATA[").append(curTel1).append("]]></cur_tel1>\r\n");
valueXmlString.append("<cur_tel2 ><![CDATA[").append(curTel2).append("]]></cur_tel2>\r\n");
valueXmlString.append("<cur_tel3 ><![CDATA[").append(curTel3).append("]]></cur_tel3>\r\n");
valueXmlString.append("<per_add1 ><![CDATA[").append(perAdd1).append("]]></per_add1>\r\n");
valueXmlString.append("<per_add2 ><![CDATA[").append(perAdd2).append("]]></per_add2>\r\n");
valueXmlString.append("<per_add3 ><![CDATA[").append(perAdd3).append("]]></per_add3>\r\n");
valueXmlString.append("<per_city ><![CDATA[").append(perCity).append("]]></per_city>\r\n");
valueXmlString.append("<per_state ><![CDATA[").append(perState).append("]]></per_state>\r\n");
valueXmlString.append("<per_pin ><![CDATA[").append(perPin).append("]]></per_pin>\r\n");
valueXmlString.append("<per_tel ><![CDATA[").append(perTel).append("]]></per_tel>\r\n");
valueXmlString.append("<mobile_no ><![CDATA[").append(mobileNo).append("]]></mobile_no>\r\n");
valueXmlString.append("<sms_domain ><![CDATA[").append(smsDomain).append("]]></sms_domain>\r\n");
valueXmlString.append("<email_id_off ><![CDATA[").append(emailIdOff).append("]]></email_id_off>\r\n");
valueXmlString.append("<email_id_per ><![CDATA[").append(emailIdPer).append("]]></email_id_per>\r\n");
valueXmlString.append("<ime_no ><![CDATA[").append(imeNo).append("]]></ime_no>\r\n");
valueXmlString.append("<work_site ><![CDATA[").append(workSite).append("]]></work_site>\r\n");
}
if ("cur_city".equalsIgnoreCase(currentColumn))
{
System.out.println("====================cur_city================");
lsCurCity=checkNull(genericUtility.getColumnValue("cur_city", dom));
sql="select state_code as ls_current_state from station where sh_descr = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, lsCurCity);
rs = pstmt.executeQuery();
if (rs.next())
{
lsCurrentState = rs.getString("ls_current_state");
}
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
valueXmlString.append("<cur_state protect=\"1\"><![CDATA[").append(lsCurrentState).append("]]></cur_state>\r\n");
}
if ("per_city".equalsIgnoreCase(currentColumn))
{
System.out.println("====================per_city================");
lsPermanantCity=checkNull(genericUtility.getColumnValue("per_city", dom));
sql="select state_code as ls_permanant_state from station where sh_descr = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, lsPermanantCity);
rs = pstmt.executeQuery();
if (rs.next())
{
lsPermanantState = rs.getString("ls_permanant_state");
}
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
valueXmlString.append("<per_state protect=\"1\"><![CDATA[").append(lsPermanantState).append("]]></per_state>\r\n");
}
}
valueXmlString.append("</Detail1>");
break;
}
valueXmlString.append("</Root>");
}
catch (Exception e)
{
e.printStackTrace();
System.out.println("Exception :EmpAddChange [itemChanged(String xmlString)] : ==>\n" + e.getMessage());
throw new ITMException(e);
}
finally
{
try
{
if (conn != null)
{
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
conn.close();
conn = null;
}
}
catch (Exception e)
{
System.out.println("Exception ::" + e);
e.printStackTrace();
throw new ITMException(e);
}
}
return valueXmlString.toString();
}
private String errorType(Connection conn, String errorCode) throws ITMException
{
String msgType = "";
PreparedStatement pstmt = null;
ResultSet rs = null;
try
{
if (conn == null)
{
System.out.println("Connection is null");
} else
{
System.out.println("Connection is not null");
}
String sql = " SELECT MSG_TYPE FROM MESSAGES WHERE MSG_NO = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, errorCode);
rs = pstmt.executeQuery();
if (rs.next())
{
msgType = rs.getString("MSG_TYPE");
}
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
}
catch (Exception ex)
{
ex.printStackTrace();
throw new ITMException(ex);
}
finally
{
try
{
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
}
catch (Exception e)
{
e.printStackTrace();
throw new ITMException(e);
}
}
return msgType;
}
private String checkNull(String input)
{
if (input == null)
{
input = "";
}
return input;
}
}
//Migrated By Yashwant on 18/07/2019[End]
package ibase.webitm.ejb.adm;
import java.rmi.RemoteException;
import org.w3c.dom.Document;
import ibase.webitm.ejb.ValidatorLocal;
import ibase.webitm.utility.ITMException;
public interface EmpAddChangeLocal extends ValidatorLocal
{
public String itemChanged(String xmlString, String xmlString1, String xmlString2, String objContext, String currentColumn, String editFlag, String xtraParams) throws RemoteException,ITMException;
public String itemChanged(Document dom, Document dom1,Document dom2, String objContext, String currentColumn, String editFlag, String xtraParams) throws RemoteException,ITMException;
public String wfValData(String xmlString, String xmlString1,String xmlString2, String objContext, String editFlag,String xtraParams) throws RemoteException,ITMException ;
public String wfValData(Document dom, Document dom1, Document dom2,String objContext, String editFlag, String xtraParams)throws RemoteException, ITMException;
}
package ibase.webitm.ejb.adm;
import java.rmi.RemoteException;
import org.w3c.dom.Document;
import ibase.webitm.ejb.ValidatorRemote;
import ibase.webitm.utility.ITMException;
public interface EmpAddChangeRemote extends ValidatorRemote
{
public String itemChanged(String xmlString, String xmlString1, String xmlString2, String objContext, String currentColumn, String editFlag, String xtraParams) throws RemoteException,ITMException;
public String itemChanged(Document dom, Document dom1,Document dom2, String objContext, String currentColumn, String editFlag, String xtraParams) throws RemoteException,ITMException;
public String wfValData(String xmlString, String xmlString1,String xmlString2, String objContext, String editFlag,String xtraParams) throws RemoteException,ITMException ;
public String wfValData(Document dom, Document dom1, Document dom2,String objContext, String editFlag, String xtraParams)throws RemoteException, ITMException;
}
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