Commit 5a2b766d authored by dpingle's avatar dpingle

* add getFromAdmEnv method

AdmCommon.java


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@216402 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 9da73bdd
......@@ -45,7 +45,9 @@ import ibase.webitm.ejb.sys.UtilMethods;
import ibase.webitm.utility.GenericUtility;
import ibase.webitm.utility.ITMException;
import ibase.webitm.utility.TransIDGenerator;
//Modified By Dipesh.P on [07/02/2020]Start
import java.util.Iterator;
//Modified By Dipesh.P on [07/02/2020]End
/*
Sudhir
*/
......@@ -6878,4 +6880,338 @@ public class AdmCommon
}
//Ended by Varsha V on 28-11-19 as per suggested by Sir
//Added By Dipesh P on [07-02-2020]Start
public ArrayList getFromAdmEnv(String empCode, String deptCode,String workSite, String geoLoc, String applType, String finEntity, Connection conn)throws Exception
{
PreparedStatement pstmt = null;
ResultSet rs = null;
String sSQL = "";
String hrdMailID = "";
String hrdEmpCode = "";
boolean recordFound = false;
ArrayList empList = new ArrayList();
ArrayList mailList = new ArrayList();
try
{
System.out.println("Inside getFromAdmEnv of AdmCommon");
sSQL = "Select E.WORK_SITE,E.Dept_Code,F.Fin_Entity,S.GEO_LOC From Employee E,Finent F,Site S Where E.Emp_Code = ? " +
" AND F.FIN_ENTITY = S.FIN_ENTITY AND S.SITE_CODE = E.WORK_SITE ";
pstmt = conn.prepareStatement(sSQL);
pstmt.setString(1, empCode);
rs = pstmt.executeQuery();
if(rs.next())
{
workSite = rs.getString("WORK_SITE");
deptCode = rs.getString("DEPT_CODE");
finEntity = rs.getString("FIN_ENTITY");
geoLoc = rs.getString("GEO_LOC");
}
rs.close();rs = null;
pstmt.close();pstmt = null;
System.out.println(" empSite --------------------- ["+workSite+"]");
System.out.println(" deptCode ["+deptCode+"]");
System.out.println(" geoLoc ["+geoLoc+"]");
sSQL = "SELECT EMP_CODE__HR, FIN_ENTITY,SITE_CODE,APP_TYPE,DEPT_CODE FROM ADM_ENV WHERE ? BETWEEN VALID_FROM AND VALID_TO " +
" AND FIN_ENTITY = ? AND DEPT_CODE = ? AND APP_TYPE = ? AND SITE_CODE = ? AND GEO_LOC = ?";
pstmt = conn.prepareStatement(sSQL);
pstmt.setTimestamp(1, new Timestamp(System.currentTimeMillis()));
pstmt.setString(2, finEntity);
pstmt.setString(3, deptCode);
pstmt.setString(4, applType);
pstmt.setString(5, workSite);
pstmt.setString(6, geoLoc);
rs = pstmt.executeQuery();
while( rs.next())
{
recordFound = true;
hrdEmpCode = rs.getString("EMP_CODE__HR");
finEntity = rs.getString("FIN_ENTITY");
workSite = rs.getString("SITE_CODE");
applType = rs.getString("APP_TYPE");
deptCode = rs.getString("DEPT_CODE");
empList.add(hrdEmpCode);
empList.add(finEntity);
empList.add(workSite);
empList.add(applType);
empList.add(deptCode);
String errorCode = (String) empList.get(0);
empCode = (String) empList.get(1);
System.out.println("empList:::::"+empList);
}
if( !recordFound)
{
if( rs != null )
{
rs.close(); rs = null;
}
if( pstmt != null )
{
pstmt.close(); pstmt = null;
}
sSQL = "SELECT EMP_CODE__HR, FIN_ENTITY,SITE_CODE,APP_TYPE,DEPT_CODE FROM ADM_ENV WHERE ? BETWEEN VALID_FROM AND VALID_TO " +
" AND FIN_ENTITY = ? AND DEPT_CODE = ? AND APP_TYPE = ? AND SITE_CODE = ? AND GEO_LOC = ? ";
pstmt = conn.prepareStatement(sSQL);
pstmt.setTimestamp(1, new Timestamp(System.currentTimeMillis()));
pstmt.setString(2, finEntity);
pstmt.setString(3, "99999");
pstmt.setString(4, applType);
pstmt.setString(5, workSite);
pstmt.setString(6, geoLoc);
rs = pstmt.executeQuery();
while( rs.next())
{
recordFound = true;
hrdEmpCode = rs.getString("EMP_CODE__HR");
finEntity = rs.getString("FIN_ENTITY");
workSite = rs.getString("SITE_CODE");
applType = rs.getString("APP_TYPE");
deptCode = rs.getString("DEPT_CODE");
empList.add(hrdEmpCode);
empList.add(finEntity);
empList.add(workSite);
empList.add(applType);
empList.add(deptCode);
String errorCode = (String) empList.get(0);
empCode = (String) empList.get(1);
}
if( !recordFound)
{
if( rs != null )
{
rs.close(); rs = null;
}
if( pstmt != null )
{
pstmt.close(); pstmt = null;
}
sSQL = "SELECT EMP_CODE__HR, FIN_ENTITY,SITE_CODE,APP_TYPE,DEPT_CODE FROM ADM_ENV WHERE ? BETWEEN VALID_FROM AND VALID_TO " +
" AND FIN_ENTITY = ? AND DEPT_CODE = ? AND APP_TYPE = ? AND SITE_CODE = ? AND GEO_LOC = ? ";
pstmt = conn.prepareStatement(sSQL);
pstmt.setTimestamp(1, new Timestamp(System.currentTimeMillis()));
pstmt.setString(2, finEntity);
pstmt.setString(3, "99999");
pstmt.setString(4, applType);
pstmt.setString(5, "99999");
pstmt.setString(6, geoLoc);
rs = pstmt.executeQuery();
while( rs.next())
{
recordFound = true;
hrdEmpCode = rs.getString("EMP_CODE__HR");
finEntity = rs.getString("FIN_ENTITY");
workSite = rs.getString("SITE_CODE");
applType = rs.getString("APP_TYPE");
deptCode = rs.getString("DEPT_CODE");
empList.add(hrdEmpCode);
empList.add(finEntity);
empList.add(workSite);
empList.add(applType);
empList.add(deptCode);
String errorCode = (String) empList.get(0);
empCode = (String) empList.get(1);
}
if( !recordFound)
{
if( rs != null )
{
rs.close(); rs = null;
}
if( pstmt != null )
{
pstmt.close(); pstmt = null;
}
sSQL = "SELECT EMP_CODE__HR, FIN_ENTITY,SITE_CODE,APP_TYPE,DEPT_CODE FROM ADM_ENV WHERE ? BETWEEN VALID_FROM AND VALID_TO " +
" AND FIN_ENTITY = ? AND DEPT_CODE = ? AND APP_TYPE = ? AND SITE_CODE = ? AND GEO_LOC = ? ";
pstmt = conn.prepareStatement(sSQL);
pstmt.setTimestamp(1, new Timestamp(System.currentTimeMillis()));
pstmt.setString(2, finEntity);
pstmt.setString(3, "99999");
pstmt.setString(4, applType);
pstmt.setString(5, "99999");
pstmt.setString(6, "99999");
rs = pstmt.executeQuery();
while( rs.next())
{
recordFound = true;
hrdEmpCode = rs.getString("EMP_CODE__HR");
finEntity = rs.getString("FIN_ENTITY");
workSite = rs.getString("SITE_CODE");
applType = rs.getString("APP_TYPE");
deptCode = rs.getString("DEPT_CODE");
empList.add(hrdEmpCode);
empList.add(finEntity);
empList.add(workSite);
empList.add(applType);
empList.add(deptCode);
String errorCode = (String) empList.get(0);
empCode = (String) empList.get(1);
}
if( !recordFound)
{
if( rs != null )
{
rs.close(); rs = null;
}
if( pstmt != null )
{
pstmt.close(); pstmt = null;
}
sSQL = "SELECT EMP_CODE__HR, FIN_ENTITY,SITE_CODE,APP_TYPE,DEPT_CODE FROM ADM_ENV WHERE ? BETWEEN VALID_FROM AND VALID_TO " +
" AND FIN_ENTITY = ? AND DEPT_CODE = ? AND APP_TYPE = ? AND SITE_CODE = ? AND GEO_LOC = ?";
pstmt = conn.prepareStatement(sSQL);
pstmt.setTimestamp(1, new Timestamp(System.currentTimeMillis()));
pstmt.setString(2, finEntity);
pstmt.setString(3, "99999");
pstmt.setString(4, "99999");
pstmt.setString(5, "99999");
pstmt.setString(6, "99999");
rs = pstmt.executeQuery();
while( rs.next())
{
recordFound = true;
hrdEmpCode = rs.getString("EMP_CODE__HR");
finEntity = rs.getString("FIN_ENTITY");
workSite = rs.getString("SITE_CODE");
applType = rs.getString("APP_TYPE");
deptCode = rs.getString("DEPT_CODE");
empList.add(hrdEmpCode);
empList.add(finEntity);
empList.add(workSite);
empList.add(applType);
empList.add(deptCode);
String errorCode = (String) empList.get(0);
empCode = (String) empList.get(1);
}
if( !recordFound)
{
if( rs != null )
{
rs.close(); rs = null;
}
if( pstmt != null )
{
pstmt.close(); pstmt = null;
}
sSQL = "SELECT EMP_CODE__HR, FIN_ENTITY,SITE_CODE,APP_TYPE,DEPT_CODE FROM ADM_ENV WHERE ? BETWEEN VALID_FROM AND VALID_TO " +
" AND FIN_ENTITY = ? AND DEPT_CODE = ? AND APP_TYPE = ? AND SITE_CODE = ? AND GEO_LOC = ?";
pstmt = conn.prepareStatement(sSQL);
pstmt.setTimestamp(1, new Timestamp(System.currentTimeMillis()));
pstmt.setString(2, "99999");
pstmt.setString(3, "99999");
pstmt.setString(4, "99999");
pstmt.setString(5, "99999");
pstmt.setString(6, "99999");
rs = pstmt.executeQuery();
while( rs.next())
{
recordFound = true;
hrdEmpCode = rs.getString("EMP_CODE__HR");
finEntity = rs.getString("FIN_ENTITY");
workSite = rs.getString("SITE_CODE");
applType = rs.getString("APP_TYPE");
deptCode = rs.getString("DEPT_CODE");
empList.add(hrdEmpCode);
empList.add(finEntity);
empList.add(workSite);
empList.add(applType);
empList.add(deptCode);
String errorCode = (String) empList.get(0);
empCode = (String) empList.get(1);
}
if( rs != null )
{
rs.close();
rs = null;
}
if( pstmt != null )
{
pstmt.close();
pstmt = null;
}
}
}
}
}
}
if( rs != null )
{
rs.close(); rs = null;
}
if( pstmt != null )
{
pstmt.close(); pstmt = null;
}
System.out.println("empList -------->"+empList);
if( empList.size() > 0 )
{
Iterator it = empList.iterator();
while(it.hasNext())
{
hrdEmpCode = it.next().toString();
sSQL = "SELECT EMAIL_ID_OFF FROM EMPLOYEE WHERE EMP_CODE = ? ";
pstmt = conn.prepareStatement(sSQL);
pstmt.setString(1, hrdEmpCode);
rs = pstmt.executeQuery();
if(rs.next())
{
hrdMailID = rs.getString("EMAIL_ID_OFF");
mailList.add(hrdMailID);
}
rs.close();rs = null;
pstmt.close();pstmt = null;
}
}
}
catch(Exception e)
{
e.printStackTrace();
System.out.println("ERRRRRRRRRROOOOOORRRRRR ---->"+e.getMessage());
throw e;
}
finally
{
try
{
if( rs != null )
{
rs.close(); rs = null;
}
if( pstmt != null )
{
pstmt.close(); pstmt = null;
}
}
catch(Exception es)
{
throw es;
}
}
return mailList;
}
//Added By Dipesh P on [07-02-2020]Start
}
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