Commit faa28761 authored by dpingle's avatar dpingle

* changes done EmployeeSepConfirm component on [19/11/19]

EmployeeSepConfirm.java


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@212453 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 7ef2cddd
......@@ -8,6 +8,11 @@ import java.sql.Timestamp;
import java.text.SimpleDateFormat;
import javax.ejb.Stateless;
import javax.xml.rpc.ParameterMode;
import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import org.apache.axis.encoding.XMLType;
import ibase.utility.CommonConstants;
import ibase.utility.E12GenericUtility;
......@@ -88,8 +93,15 @@ public class EmployeeSepConfirm extends ActionHandlerEJB implements EmployeeSepC
int liAddonDays = 0, liCnt = 0;
PreparedStatement pstmt = null;
ResultSet rs = null;
//Modified By Dipesh on[19/11/2019][Start]
String bussinessObj = "";
String xmlStringDt = "";
//Modified By Dipesh on[19/11/2019][End]
try
{
System.out.println("Inside Post Logic Method..!!!!");
userId = checkNull(genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginCode"));
chgTerm = checkNull(genericUtility.getValueFromXTRA_PARAMS(xtraParams, "termId"));
......@@ -319,6 +331,25 @@ public class EmployeeSepConfirm extends ActionHandlerEJB implements EmployeeSepC
System.out.println("lsProcWindow==> " + lsProcWindow);
}
//Modified By Dipesh on[19/11/2019][Start]
if(errString == null || errString.trim().length()==0)
{
if(lsProcWindow != null && "L".equalsIgnoreCase(lsProcWindow))
{
bussinessObj = "att_proc_lwp";
}
else
{
bussinessObj = "attd_proc_norule";
}
xmlStringDt = getTabSeparateString(lsEmpCode, lsRelievePeriod, ldtPeriodTodate, 0 ,ldtPeriodTodate, conn);
errString = confirmAttendanceProcess(bussinessObj, xmlStringDt, xtraParams, "false", conn);
}
//Modified By Dipesh on[19/11/2019][End]
/*if(errString == null || errString.trim().length() == 0)
{
if(lsProcWindow == null || lsProcWindow.trim().length() == 0)
......@@ -389,6 +420,7 @@ public class EmployeeSepConfirm extends ActionHandlerEJB implements EmployeeSepC
}
public String gbfRetrieveSeparation(String asEmpCode, Timestamp adResiDate ,Connection conn) throws ITMException
{
......@@ -853,7 +885,191 @@ public class EmployeeSepConfirm extends ActionHandlerEJB implements EmployeeSepC
}
return lsErrCode;
}
//Modified By Dipesh on[19/11/2019][Start]
private String confirmAttendanceProcess(String businessObj, String XMLData,String xtraParams, String forcedFlag , Connection conn) throws ITMException
{
String methodName = "gbf_process";
String compName = "";
String retString = "";
String serviceCode = "";
String serviceURI = "";
String actionURI = "";
String sql = "";
PreparedStatement pStmt = null;
ResultSet rs = null;
System.out.println("confirmAttendanceProcess");
String compType = "";
try
{
//Modified By Dipesh on[19/11/2019][Start]
xtraParams = xtraParams+"~~"+ "is_proc_from = EMPSEP";
//Modified By Dipesh on[19/11/2019][End]
actionURI = "http://NvoServiceurl.org/" + methodName;
System.out.println("businessObj ---*------>"+businessObj+"---"+XMLData+"---"+xtraParams+"---"+forcedFlag);
if(conn != null)
{
conn.commit();
}
sql = "SELECT SERVICE_CODE,COMP_NAME,COMP_TYPE FROM SYSTEM_EVENTS WHERE OBJ_NAME = ? AND EVENT_CODE = 'process' ";
pStmt = conn.prepareStatement(sql);
pStmt.setString(1,businessObj);
rs = pStmt.executeQuery();
if ( rs.next() )
{
serviceCode = rs.getString("SERVICE_CODE");
compName = rs.getString("COMP_NAME");
compType =rs.getString("COMP_TYPE");
}
System.out.println("serviceCode = "+serviceCode+" compName "+compName);
if(rs != null)
{
rs.close();
rs = null;
}
if(pStmt != null)
{
pStmt.close();
pStmt = null;
}
sql = "SELECT SERVICE_URI,METHOD_NAME FROM SYSTEM_EVENT_SERVICES WHERE SERVICE_CODE = ? ";
pStmt = conn.prepareStatement(sql);
pStmt.setString(1,serviceCode);
rs = pStmt.executeQuery();
if ( rs.next() )
{
serviceURI = rs.getString("SERVICE_URI");
methodName=rs.getString("METHOD_NAME");
}
System.out.println("serviceURI = "+serviceURI+" compName = "+compName);
if(rs != null)
{
rs.close();
rs = null;
}
if(pStmt != null)
{
pStmt.close();
pStmt = null;
}
if("WSR".equalsIgnoreCase(compType))
{
Service service = new Service();
Call call = (Call)service.createCall();
call.setTargetEndpointAddress(new java.net.URL(serviceURI));
call.setOperationName( new javax.xml.namespace.QName("http://NvoServiceurl.org", methodName ) );
call.setUseSOAPAction(true);
call.setSOAPActionURI(actionURI);
Object[] aobj = new Object[4];
call.addParameter( new javax.xml.namespace.QName("http://NvoServiceurl.org", "component_name"), XMLType.XSD_STRING, ParameterMode.IN);
call.addParameter( new javax.xml.namespace.QName("http://NvoServiceurl.org", "tab_xml_data_1"), XMLType.XSD_STRING, ParameterMode.IN);
call.addParameter( new javax.xml.namespace.QName("http://NvoServiceurl.org", "tab_xml_data__all"), XMLType.XSD_STRING, ParameterMode.IN);
call.addParameter( new javax.xml.namespace.QName("http://NvoServiceurl.org", "xtra_params"), XMLType.XSD_STRING, ParameterMode.IN);
aobj[0] = new String(compName.trim());
aobj[1] = new String(XMLData);
aobj[2] = new String(XMLData);
aobj[3] = new String(xtraParams);
call.setReturnType(XMLType.XSD_STRING);
retString = (String)call.invoke(aobj);
System.out.println("Return string from NVO is:==>["+retString+"]");
}
}
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;
}
}
catch(Exception e)
{
System.out.println("Exception inCalling confirmed");
e.printStackTrace();
try{
conn.rollback();
}catch (Exception s)
{
System.out.println("Unable to rollback");
s.printStackTrace();
}
throw new ITMException(e);
}
}
return retString;
}
private String getTabSeparateString(String empCode, String prdCode, Timestamp attdDate,int noOfDays ,Timestamp toDate, Connection conn) throws ITMException
{
String retString = "";
String sql = "";
StringBuffer retTabSepStrBuff = new StringBuffer();
E12GenericUtility genericUtility = new E12GenericUtility();
try
{
SimpleDateFormat sdf = new SimpleDateFormat(genericUtility.getApplDateFormat());
String dateInDatabaseFormat = sdf.format(attdDate);
retTabSepStrBuff.append(empCode.trim()).append("\t"); // employee from
retTabSepStrBuff.append(empCode.trim()).append("\t"); // employee to
retTabSepStrBuff.append(prdCode).append("\t"); // period code
retTabSepStrBuff.append(prdCode).append("\t"); // period code to
retTabSepStrBuff.append(00).append("\t"); // site code from
retTabSepStrBuff.append("ZZ").append("\t"); // site code to
retTabSepStrBuff.append(dateInDatabaseFormat).append("\t"); // attd date
retTabSepStrBuff.append("PP").append("\t"); // Type
retTabSepStrBuff.append(noOfDays).append("\t"); // no_days
retTabSepStrBuff.append(00).append("\t"); // proc_group__from
retTabSepStrBuff.append("ZZ").append("\t"); // proc_group__to
retTabSepStrBuff.append(sdf.format(toDate)).append("\n"); // cutoff_date ( LAST DATE OF THE PERIOD)
retTabSepStrBuff.append("").append("\t"); // emp_name__fr
retTabSepStrBuff.append("").append("\t"); // emp_name__to
retTabSepStrBuff.append("").append("\t"); // fr_prd_descr
retTabSepStrBuff.append("").append("\t"); // emp_name__to
retTabSepStrBuff.append("").append("\t"); // emp_name__to
retTabSepStrBuff.append("").append("\t"); // emp_name__to
retTabSepStrBuff.append("").append("\t"); // emp_name__to
System.out.println(" final xml --> "+retTabSepStrBuff.toString());
}
catch(Exception e)
{
e.printStackTrace();
retString = e.getMessage();
throw new ITMException(e);
}
finally
{
try
{
}
catch(Exception ex)
{
ex.printStackTrace();
throw new ITMException(ex);
}
}
return retTabSepStrBuff.toString();
}
//Modified By Dipesh on[19/11/2019][End]
private String checkNull(String input)
{
if (input == null)
......
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