Commit 854a870a authored by smane's avatar smane

Update EJB file for POB Transaction Workflow (D15FSUN007)


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@98654 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 0fe77db2
...@@ -66,7 +66,6 @@ public class POBWizConf extends ActionHandlerEJB implements POBWizConfLocal, POB ...@@ -66,7 +66,6 @@ public class POBWizConf extends ActionHandlerEJB implements POBWizConfLocal, POB
FinCommon finCommon = null; FinCommon finCommon = null;
try try
{ {
ConnDriver connDriver = null; ConnDriver connDriver = null;
connDriver = new ConnDriver(); connDriver = new ConnDriver();
conn = connDriver.getConnectDB("DriverITM"); conn = connDriver.getConnectDB("DriverITM");
...@@ -185,7 +184,6 @@ public class POBWizConf extends ActionHandlerEJB implements POBWizConfLocal, POB ...@@ -185,7 +184,6 @@ public class POBWizConf extends ActionHandlerEJB implements POBWizConfLocal, POB
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
sql = "select curr_code from finent where fin_entity in (select fin_entity from site where site_code = ? )"; sql = "select curr_code from finent where fin_entity in (select fin_entity from site where site_code = ? )";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, siteCode); pstmt.setString(1, siteCode);
...@@ -373,11 +371,14 @@ public class POBWizConf extends ActionHandlerEJB implements POBWizConfLocal, POB ...@@ -373,11 +371,14 @@ public class POBWizConf extends ActionHandlerEJB implements POBWizConfLocal, POB
if (retString.indexOf("Success") > -1) if (retString.indexOf("Success") > -1)
{ {
sql = " update pob_hdr set confirmed = 'Y',conf_date = ?, emp_code__aprv = ? where tran_id = ? "; //wf_status and status_date added in update sql by sagar on 06/10/2015
sql = " update pob_hdr set confirmed = 'Y', conf_date = ?, emp_code__aprv = ?, wf_status='C', status_date= ? where tran_id = ? ";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setTimestamp(1, currDate); pstmt.setTimestamp(1, currDate);
pstmt.setString(2, loginEmpCode); pstmt.setString(2, loginEmpCode);
pstmt.setString(3, tranId); pstmt.setTimestamp(3, currDate);
pstmt.setString(4, tranId);
cnt = pstmt.executeUpdate(); cnt = pstmt.executeUpdate();
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
...@@ -441,14 +442,8 @@ public class POBWizConf extends ActionHandlerEJB implements POBWizConfLocal, POB ...@@ -441,14 +442,8 @@ public class POBWizConf extends ActionHandlerEJB implements POBWizConfLocal, POB
throw new ITMException(e); throw new ITMException(e);
} }
} }
return errString; return errString;
} }
private String checkNull(String input) private String checkNull(String input)
{ {
if(input == null) if(input == null)
...@@ -489,7 +484,9 @@ public class POBWizConf extends ActionHandlerEJB implements POBWizConfLocal, POB ...@@ -489,7 +484,9 @@ public class POBWizConf extends ActionHandlerEJB implements POBWizConfLocal, POB
} }
return retString; return retString;
} }
// Added confirm() method for Submit the Workflow Status
// Code added by sagar on 06/10/15 for workflow, Start
// Added confirm() method for Submit the Workflow Status and workflow will initialize On Submit button
public String confirm(String tranId, String xtraParams, String forcedFlag) throws RemoteException, ITMException public String confirm(String tranId, String xtraParams, String forcedFlag) throws RemoteException, ITMException
{ {
System.out.println(">>>>>>>>>>>POBWizConf called for submit>>>>>>>>>>>>"); System.out.println(">>>>>>>>>>>POBWizConf called for submit>>>>>>>>>>>>");
...@@ -530,11 +527,12 @@ public class POBWizConf extends ActionHandlerEJB implements POBWizConfLocal, POB ...@@ -530,11 +527,12 @@ public class POBWizConf extends ActionHandlerEJB implements POBWizConfLocal, POB
if ("S".equalsIgnoreCase(wfStatus)) if ("S".equalsIgnoreCase(wfStatus))
{ {
errString = itmDBAccessLocal.getErrorString("","VTINVSUB2",""); errString = itmDBAccessLocal.getErrorString("","VTINVSUB2","");
isError= true;
} }
else if ("Y".equalsIgnoreCase(confirmed)) else if ("Y".equalsIgnoreCase(confirmed))
{ {
errString = itmDBAccessLocal.getErrorString("","VTINVCONF2",""); errString = itmDBAccessLocal.getErrorString("","VTINVCONF2","");
isError= true;
} }
else else
{ {
...@@ -554,31 +552,17 @@ public class POBWizConf extends ActionHandlerEJB implements POBWizConfLocal, POB ...@@ -554,31 +552,17 @@ public class POBWizConf extends ActionHandlerEJB implements POBWizConfLocal, POB
if (updCount > 0) if (updCount > 0)
{ {
errString = itmDBAccessLocal.getErrorString("", "VTPOBSUBM", ""); errString = itmDBAccessLocal.getErrorString("", "VTPOBSUBM", "");
conn.commit();
} }
else else
{ {
errString = itmDBAccessLocal.getErrorString("", "SUBMITFAIL", ""); errString = itmDBAccessLocal.getErrorString("", "SUBMITFAIL", "");
isError=true;
} }
} }
else else
{
sql = " update pob_hdr set wf_status = 'O' where tran_id = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, tranId);
updCount = pstmt.executeUpdate();
pstmt.close();
pstmt = null;
System.out.println(">>>After Workflow init Failure updCount:"+updCount);
if (updCount > 0)
{
errString = itmDBAccessLocal.getErrorString("", "SUBMITFAIL", "");
conn.commit();
}
else
{ {
errString = itmDBAccessLocal.getErrorString("", "SUBMITFAIL", ""); errString = itmDBAccessLocal.getErrorString("", "SUBMITFAIL", "");
} isError=true;
} }
} }
} }
...@@ -588,6 +572,7 @@ public class POBWizConf extends ActionHandlerEJB implements POBWizConfLocal, POB ...@@ -588,6 +572,7 @@ public class POBWizConf extends ActionHandlerEJB implements POBWizConfLocal, POB
{ {
if(conn!=null) if(conn!=null)
{ {
isError=true;
try try
{ {
conn.rollback(); conn.rollback();
...@@ -606,6 +591,17 @@ public class POBWizConf extends ActionHandlerEJB implements POBWizConfLocal, POB ...@@ -606,6 +591,17 @@ public class POBWizConf extends ActionHandlerEJB implements POBWizConfLocal, POB
{ {
System.out.println(">>>Before Closing Connection in POBWizConf finally"); System.out.println(">>>Before Closing Connection in POBWizConf finally");
//if(conn != null && !conn.isClosed()) //if(conn != null && !conn.isClosed())
System.out.println("In finally Check isError:"+isError);
if(!isError)
{
conn.commit();
System.out.println(">>>In if commit successfuly");
}
else
{
conn.rollback();
System.out.println(">>>In else rollback successfuly");
}
if(conn != null) if(conn != null)
{ {
conn.close(); conn.close();
...@@ -621,7 +617,6 @@ public class POBWizConf extends ActionHandlerEJB implements POBWizConfLocal, POB ...@@ -621,7 +617,6 @@ public class POBWizConf extends ActionHandlerEJB implements POBWizConfLocal, POB
{ {
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
} }
} }
catch (Exception e) catch (Exception e)
...@@ -632,7 +627,9 @@ public class POBWizConf extends ActionHandlerEJB implements POBWizConfLocal, POB ...@@ -632,7 +627,9 @@ public class POBWizConf extends ActionHandlerEJB implements POBWizConfLocal, POB
} }
} }
return errString; return errString;
}
} //end confirm method
//Added invokeWorkflow() method by sagar on 28/09/15 for POB Transaction Workflow Initiation //Added invokeWorkflow() method by sagar on 28/09/15 for POB Transaction Workflow Initiation
private String invokeWorkflow(Connection conn , String tranId, String xtraParams,String hdrEdiFlag)throws ITMException private String invokeWorkflow(Connection conn , String tranId, String xtraParams,String hdrEdiFlag)throws ITMException
{ {
...@@ -718,14 +715,8 @@ public class POBWizConf extends ActionHandlerEJB implements POBWizConfLocal, POB ...@@ -718,14 +715,8 @@ public class POBWizConf extends ActionHandlerEJB implements POBWizConfLocal, POB
pStmt=null; pStmt=null;
} }
String entityCodeInit = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginEmpCode"); String entityCodeInit = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginEmpCode");
System.out.println(">>>In invokeWorkflow Before invokeWorkflowExternal node:"+node);
System.out.println(">>>In invokeWorkflow Before invokeWorkflowExternal entityCodeInit:"+entityCodeInit);
System.out.println(">>>In invokeWorkflow Before invokeWorkflowExternal wrkflwInit:"+wrkflwInit);
System.out.println(">>>In invokeWorkflow Before invokeWorkflowExternal objName:"+objName);
System.out.println(">>>In invokeWorkflow Before invokeWorkflowExternal refSer:"+refSer);
System.out.println(">>>In invokeWorkflow Before invokeWorkflowExternal tranId:"+tranId);
retString = xml2dbObj.invokeWorkflowExternal(domAll, entityCodeInit, wrkflwInit, objName, refSer, tranId); retString = xml2dbObj.invokeWorkflowExternal(domAll, entityCodeInit, wrkflwInit, objName, refSer, tranId);
System.out.println(">>>retString From xml2dbObj.invokeWorkflowExternal --->"+retString); System.out.println(">>>retString From xml2dbObj.invokeWorkflowExternal:"+retString);
} }
catch(Exception ex) catch(Exception ex)
{ {
...@@ -753,5 +744,7 @@ public class POBWizConf extends ActionHandlerEJB implements POBWizConfLocal, POB ...@@ -753,5 +744,7 @@ public class POBWizConf extends ActionHandlerEJB implements POBWizConfLocal, POB
} }
} }
return "success"; return "success";
}
} //end invokeWorkflow method
// Code added by sagar on 06/10/15 for workflow, End
} }
\ No newline at end of file
/******************************************************** /********************************************************
Title : POBWizWfConf (D15FSUN007) Title : POBWizWfConf (D15FSUN007)
Date : 18/09/15 Date : 07/10/15
Author: Sagar Mane Author: Sagar Mane
********************************************************/ ********************************************************/
...@@ -26,18 +26,19 @@ import org.w3c.dom.Document; ...@@ -26,18 +26,19 @@ import org.w3c.dom.Document;
import org.w3c.dom.Node; import org.w3c.dom.Node;
import org.w3c.dom.NodeList; import org.w3c.dom.NodeList;
public class POBWizWfConf //extends ValidatorEJB public class POBWizWfConf
{ {
public String confirm(String tranId, String empCodeAprv, String xmlDataAll, String processId, String keyFlag) public String confirm(String tranId, String empCodeAprv, String xmlDataAll, String processId, String keyFlag)
throws RemoteException, ITMException throws RemoteException, ITMException
{ {
System.out.println(">>>>> POBWizWfConf confirm called <<<<<"); System.out.println(">>>>> POBWizWfConf confirm called <<<<<");
System.out.println(">>> POBWizWfConf Parameters tranId:"+tranId); System.out.println(">>> POBWizWfConf Parameters tranId:"+tranId);
System.out.println(">>> POBWizWfConf Parameters empCodeAprv:"+ empCodeAprv); System.out.println(">>> POBWizWfConf Parameters empCodeAprv:"+ empCodeAprv);
System.out.println(">>> POBWizWfConf Parameters processId:"+ processId); System.out.println(">>> POBWizWfConf Parameters processId:"+ processId);
System.out.println(">>> POBWizWfConf confirm xmlDataAll:"+ xmlDataAll); System.out.println(">>> POBWizWfConf confirm xmlDataAll:"+ xmlDataAll);
System.out.println(">>> POBWizWfConf confirm keyFlag:"+ keyFlag); System.out.println(">>> POBWizWfConf confirm keyFlag:"+ keyFlag);
String sql = "";
String loginCode = ""; String loginCode = "";
String loginSiteCode = ""; String loginSiteCode = "";
String loginEmpCode = "", termId="SYSTEM"; String loginEmpCode = "", termId="SYSTEM";
...@@ -46,14 +47,12 @@ public class POBWizWfConf //extends ValidatorEJB ...@@ -46,14 +47,12 @@ public class POBWizWfConf //extends ValidatorEJB
String pobProcId="",instanceId="",activityId="",seqId=""; String pobProcId="",instanceId="",activityId="",seqId="";
String suHeadDiscStr= "",clusterHeadDiscStr=""; String suHeadDiscStr= "",clusterHeadDiscStr="";
String retString = ""; String retString = "";
double maxDiscount=0.0, suHeadDiscount=0.0, clusterHeadDisc=0.0,countHeadDisc=0.0;
int pobHdrUpdCnt=0; int pobHdrUpdCnt=0;
double maxDiscount=0.0, suHeadDiscount=0.0, clusterHeadDisc=0.0,countHeadDisc=0.0;
Connection conn = null; Connection conn = null;
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
ResultSet rs = null; ResultSet rs = null;
String sql = "";
ConnDriver connDriver = new ConnDriver(); ConnDriver connDriver = new ConnDriver();
InitialContext ctx = null; InitialContext ctx = null;
AppConnectParm acp = null; AppConnectParm acp = null;
...@@ -96,20 +95,16 @@ public class POBWizWfConf //extends ValidatorEJB ...@@ -96,20 +95,16 @@ public class POBWizWfConf //extends ValidatorEJB
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
loginCode = loginCode == null ? "" : loginCode.trim(); loginCode = loginCode == null ? "" : loginCode.trim();
System.out.println(">>>Before xtraParams loginCode:"+loginCode);
System.out.println(">>>Before xtraParams loginSiteCode:"+loginSiteCode);
System.out.println(">>>Before xtraParams empCodeAprv:"+empCodeAprv);
//xtraParams = "loginCode=" + loginCode + "~~" + "loginSiteCode=" + loginSiteCode + "~~" + "loginEmpCode=" + empCodeAprv;
xtraParams = "loginCode=" + loginCode + "~~" + "loginSiteCode=" + loginSiteCode + "~~" + "loginEmpCode=" + empCodeAprv + "~~" + "termId=" + termId; xtraParams = "loginCode=" + loginCode + "~~" + "loginSiteCode=" + loginSiteCode + "~~" + "loginEmpCode=" + empCodeAprv + "~~" + "termId=" + termId;
System.out.println(">>>Before calling confirm xtraParams:"+xtraParams); System.out.println(">>>Before calling confirm xtraParams:"+xtraParams);
System.out.println(">>>Before Check keyFlag:"+ keyFlag); System.out.println(">>>Before Check keyFlag:"+ keyFlag);
if("POBWFUPDATE".equalsIgnoreCase(keyFlag)) if("POBWFUPDATE".equalsIgnoreCase(keyFlag))
{ {
System.out.println(">>>>Check POBWFUPDATE for update workflow status"); // Add this condition if Request is Revert then wf_status will update as 'O' Open.
System.out.println(">>>>Check POBWFUPDATE for update workflow status as Open");
if(tranId!= null && tranId.trim().length() > 0) if(tranId!= null && tranId.trim().length() > 0)
{ {
sql= "update pob_hdr set wf_status='O' where tran_id= ? "; sql= "update pob_hdr set wf_status='O' where tran_id= ? ";
...@@ -127,29 +122,46 @@ public class POBWizWfConf //extends ValidatorEJB ...@@ -127,29 +122,46 @@ public class POBWizWfConf //extends ValidatorEJB
} }
} }
} }
else if("POBREJECT".equalsIgnoreCase(keyFlag))
{
// Add this condition if Request is Rejected then wf_status will update as 'R' Rejected
System.out.println(">>>>Check POBREJECT for update workflow status as Rejected");
if(tranId!= null && tranId.trim().length() > 0)
{
sql= "update pob_hdr set wf_status='R' where tran_id= ? ";
pstmt=conn.prepareStatement(sql);
pstmt.setString(1, tranId);
pobHdrUpdCnt=pstmt.executeUpdate();
pstmt.close();
pstmt= null;
System.out.println(">>>pobHdrUpdCnt:"+pobHdrUpdCnt);
if(pobHdrUpdCnt > 0)
{
conn.commit();
System.out.println("Transaction Commited Successfully");
retString = "Y";
}
}
}
else if("POBCONFIRM".equalsIgnoreCase(keyFlag)) else if("POBCONFIRM".equalsIgnoreCase(keyFlag))
{ {
// Add this condition if Request is Approved then POB Confirmation Will call and Approved mail will be sent
System.out.println(">>>>Check POBCONFIRM for Confirmation"); System.out.println(">>>>Check POBCONFIRM for Confirmation");
acp = new AppConnectParm(); acp = new AppConnectParm();
ctx = new InitialContext(acp.getProperty()); ctx = new InitialContext(acp.getProperty());
pobWizConfLocal = (POBWizConfLocal) ctx.lookup("ibase/POBWizConf/local"); pobWizConfLocal = (POBWizConfLocal) ctx.lookup("ibase/POBWizConf/local");
retString = pobWizConfLocal.pobConfirm(tranId, xtraParams, "Y"); retString = pobWizConfLocal.pobConfirm(tranId, xtraParams, "Y");
//retString="VTCNFSUCC";VTCNFSUCC
System.out.println(">>>>In POBWizWfConf return from confirm:" + retString); System.out.println(">>>>In POBWizWfConf return from confirm:" + retString);
if(retString.indexOf("VTCNFSUCC") > -1) if(retString.indexOf("VTCNFSUCC") > -1)
{ {
System.out.println(">>>POBWizConf Transaction confirm Successfull"); System.out.println(">>>POBWizConf Transaction confirm Successfull");
retString = "Y"; retString = "Y";
} }
else
{
System.out.println(">>>Exception while calling EJB POBWizConf component");
}
} }
else if("POBWFCON".equalsIgnoreCase(keyFlag)) else if("POBWFCON".equalsIgnoreCase(keyFlag))
{ {
// Add this condition for check the Maximum Discount in POB_DET table and Check (THIRD,FOURTH,FIFTH) Approver Discount Limit from disparm table for defined variable.
System.out.println(">>>>Check POBWFCON for Maximum Discount"); System.out.println(">>>>Check POBWFCON for Maximum Discount");
//maxDiscount= getMaxDiscoutRate(xmlDataAll);
sql = " select max(discount) as discount from pob_det where tran_id= ? "; sql = " select max(discount) as discount from pob_det where tran_id= ? ";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, tranId); pstmt.setString(1, tranId);
...@@ -163,7 +175,7 @@ public class POBWizWfConf //extends ValidatorEJB ...@@ -163,7 +175,7 @@ public class POBWizWfConf //extends ValidatorEJB
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
System.out.println(">>Return getMaxDiscoutRate maxDiscount:"+ maxDiscount); System.out.println(">>Get pob_det maxDiscount:"+ maxDiscount);
if(processId!= null && processId.trim().length() > 0) if(processId!= null && processId.trim().length() > 0)
{ {
processInfo= processId.split(":"); processInfo= processId.split(":");
...@@ -186,11 +198,7 @@ public class POBWizWfConf //extends ValidatorEJB ...@@ -186,11 +198,7 @@ public class POBWizWfConf //extends ValidatorEJB
if("THIRD_CON".equalsIgnoreCase(activityId.trim())) if("THIRD_CON".equalsIgnoreCase(activityId.trim()))
{ {
System.out.println(">>>Checking Max Discount for THIRD_CON(SU Head) :"); System.out.println(">>>Checking Max Discount for THIRD_CON(SU Head) :");
if(suHeadDiscStr.trim().length() == 0) if(suHeadDiscStr.trim().length() > 0)
{
System.out.println(">>>Please Define SUHEAD_DISCOUNT in disparm ");
}
else
{ {
if(checkIsNumber(suHeadDiscStr)) if(checkIsNumber(suHeadDiscStr))
{ {
...@@ -206,21 +214,12 @@ public class POBWizWfConf //extends ValidatorEJB ...@@ -206,21 +214,12 @@ public class POBWizWfConf //extends ValidatorEJB
retString="N"; retString="N";
} }
} }
else
{
System.out.println(">>>Please Define SUHEAD_DISCOUNT in disparm in proper format ");
} }
} }
System.out.println(">>>>THIRD_CON return retString:"+retString);
}
else if("FORTH_CON".equalsIgnoreCase(activityId.trim())) else if("FORTH_CON".equalsIgnoreCase(activityId.trim()))
{ {
System.out.println(">>>Checking Max Discount for FRTH_SIGN(Cluster Head):"); System.out.println(">>>Checking Max Discount for FRTH_SIGN(Cluster Head):");
if(clusterHeadDiscStr.trim().length() == 0) if(clusterHeadDiscStr.trim().length() > 0)
{
System.out.println(">>>Please Define SUHEAD_DISCOUNT in disparm ");
}
else
{ {
if(checkIsNumber(clusterHeadDiscStr)) if(checkIsNumber(clusterHeadDiscStr))
{ {
...@@ -239,10 +238,6 @@ public class POBWizWfConf //extends ValidatorEJB ...@@ -239,10 +238,6 @@ public class POBWizWfConf //extends ValidatorEJB
retString="N"; retString="N";
} }
} }
else
{
System.out.println(">>>Please Define SUHEAD_DISCOUNT in disparm in proper format ");
}
} }
System.out.println(">>>>FORTH_CON return retString:"+retString); System.out.println(">>>>FORTH_CON return retString:"+retString);
} }
...@@ -250,7 +245,6 @@ public class POBWizWfConf //extends ValidatorEJB ...@@ -250,7 +245,6 @@ public class POBWizWfConf //extends ValidatorEJB
{ {
System.out.println(">>>Checking Max Discount for FIFTH_CON(Country Head):"); System.out.println(">>>Checking Max Discount for FIFTH_CON(Country Head):");
retString="Y"; retString="Y";
System.out.println(">>>>FIFTH_CON return retString:"+retString);
} }
} }
} }
......
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