Commit 06ee232e authored by jshaikh's avatar jshaikh

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@181531 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 4d0aa682
......@@ -43,7 +43,6 @@ public class QCOrderAprvConfWF implements QCOrderAprvConfWFRemote, QCOrderAprvCo
E12GenericUtility genericUtility = null;
try {
System.out.println("Try Block of QCOrderAprvConfWF : confirm");
//conn = connDriver.getConnectDB("DriverITM");
UserInfoBean userInfo = new UserInfoBean(userInfoStr);
String transDB = userInfo.getTransDB();
......
......@@ -8,6 +8,8 @@ import java.sql.SQLException;
import javax.ejb.Stateless;
import ibase.system.config.ConnDriver;
import ibase.utility.UserInfoBean;
import ibase.webitm.ejb.ActionHandlerEJB;
import ibase.webitm.ejb.ITMDBAccessEJB;
import ibase.webitm.ejb.ValidatorEJB;
......@@ -17,114 +19,307 @@ import ibase.webitm.utility.ITMException;
@Stateless
public class QCOrderConfWfEJB extends ActionHandlerEJB implements QCOrderConfWfEJBLocal, QCOrderConfWfEJBRemote
{
public String confirm(String tranID, String xtraParams, String forcedFlag) throws RemoteException,ITMException
{
System.out.println("================ QCOrderConfWfEJB : confirm ================");
String userId = "";
String errString = "";
ValidatorEJB validatorEJB = null;
ITMDBAccessEJB itmDBAccessEJB = null;
Connection conn = null;
PreparedStatement pStmt = null;
ResultSet rs = null;
String sql = "";
String status = "",retString = "", qorder_no= "";
String[] authencate = new String[2];
authencate[0] = "";
authencate[1] = "";
boolean isError = false;
try {
itmDBAccessEJB = new ITMDBAccessEJB();
validatorEJB = new ValidatorEJB();
conn = getConnection();
conn.setAutoCommit(false);
userId = validatorEJB.getValueFromXTRA_PARAMS(xtraParams, "loginCode");
System.out.println("tran_id ..> " + tranID+" userId: "+userId+" xtraParams: "+xtraParams+" forcedFlag: "+forcedFlag);
qorder_no = checkNull(tranID);
sql = "SELECT STATUS FROM QC_ORDER WHERE QORDER_NO = ? ";
pStmt = conn.prepareStatement(sql);
pStmt.setString(1, qorder_no);
rs = pStmt.executeQuery();
if (rs.next())
public String confirm(String tranId, String xtraParams, String forcedFlag) throws RemoteException, ITMException
{
String userInfoStr = "";
String errString = "";
try
{
status = rs.getString("STATUS");
userInfoStr = confirm(tranId, xtraParams, forcedFlag, userInfoStr);
System.out.println("userInfoStr of confirm::::: " +userInfoStr);
}
catch(Exception e)
{
System.out.println("Exception in [QCOrderConfWfEJB] confirm " + e.getMessage());
throw new ITMException(e);
}
return errString;
status = checkNull(status);
}
public String confirm(String tranId, String xtraParams, String forcedFlag, String userInfoStr) throws RemoteException, ITMException
{
System.out.println("@@@@@@@@@@@@@@@@@@@@ QCOrderConfWfEJB : confirm @@@@@@@@@@@@@@@@");
String userId = "";
String errString = "";
String transDB = "";
ValidatorEJB validatorEJB = null;
ITMDBAccessEJB itmDBAccessEJB = null;
Connection conn = null;
ConnDriver connDriver = new ConnDriver();
PreparedStatement pStmt = null;
ResultSet rs = null;
String sql = "";
String status = "",retString = "",wf_status = "";
String[] authencate = new String[2];
authencate[0] = "";
authencate[1] = "";
boolean isError = false;
closePstmtRs(pStmt, rs);
try {
itmDBAccessEJB = new ITMDBAccessEJB();
validatorEJB = new ValidatorEJB();
//conn = getConnection();
if(userInfoStr != null && userInfoStr.trim().length() > 0)
{
UserInfoBean userInfo = new UserInfoBean(userInfoStr);
transDB = userInfo.getTransDB();
}
if (transDB != null && transDB.trim().length() > 0)
{
conn = connDriver.getConnectDB(transDB);
}
else
{
conn = connDriver.getConnectDB("DriverITM");
}
//connDriver = null;
conn.setAutoCommit(false);
userId = validatorEJB.getValueFromXTRA_PARAMS(xtraParams, "loginCode");
if(!"C".equalsIgnoreCase(status))
{
GenericWorkflowClass wfGenericClass = new GenericWorkflowClass();
retString = wfGenericClass.invokeWorkflow(conn, tranID, xtraParams, "w_qcorder_new", "qcorder_new");
if ("success".equalsIgnoreCase(retString))
System.out.println("tran_id ..> " + tranId+" userId: "+userId+" xtraParams: "+xtraParams+" forcedFlag: "+forcedFlag);
sql = "SELECT status,wf_status from qc_order where qorder_no = ? ";
pStmt = conn.prepareStatement(sql);
pStmt.setString(1, tranId);
rs = pStmt.executeQuery();
if (rs.next())
{
status = checkNull(rs.getString("status"));
wf_status = checkNull(rs.getString("wf_status"));
}
closePstmtRs(pStmt, rs);
if(!"C".equalsIgnoreCase(status))
{
sql = "UPDATE QC_ORDER SET STATUS_DATE = sysdate WHERE QORDER_NO = ? ";
pStmt = conn.prepareStatement(sql);
pStmt.setString(1, qorder_no);
int updCount = pStmt.executeUpdate();
if (updCount > 0)
if("X".equalsIgnoreCase(status))
{
errString = new ITMDBAccessEJB().getErrorString("", "VFMWRKFLWS", "");
errString = new ITMDBAccessEJB().getErrorString("", "VTWFCLOCAN", "");
}
else
else if ("C".equalsIgnoreCase(status) || "U".equalsIgnoreCase(status) || "".equalsIgnoreCase(status))
{
if("O".equalsIgnoreCase(wf_status) || "R".equalsIgnoreCase(wf_status) || "".equalsIgnoreCase(wf_status))
{
GenericWorkflowClass wfGenericClass = new GenericWorkflowClass();
retString = wfGenericClass.invokeWorkflow(conn, tranId, xtraParams, "w_qcorder_new", "qcorder_new");
if ("success".equalsIgnoreCase(retString)) {
sql = "UPDATE QC_ORDER SET WF_STATUS = 'S' WHERE QORDER_NO = ? ";
pStmt = conn.prepareStatement(sql);
pStmt.setString(1, tranId);
int updCount = pStmt.executeUpdate();
closePstmtRs(pStmt, rs);
if (updCount > 0) {
errString = new ITMDBAccessEJB().getErrorString("", "VFMWRKFLWS", "");
}
else{
errString = new ITMDBAccessEJB().getErrorString("", "VFMWRKFLWF", "");
isError=true;
}
} else {
errString = new ITMDBAccessEJB().getErrorString("", "VFMWRKFLWF", "");
}
}
else
{
errString = new ITMDBAccessEJB().getErrorString("", "VTMWFALINT", "");
}
}
else {
errString = new ITMDBAccessEJB().getErrorString("", "VFMWRKFLWF", "");
isError=true;
}
}
else
{
errString = new ITMDBAccessEJB().getErrorString("", "VFMWRKFLWF", "");
}
else{
errString = new ITMDBAccessEJB().getErrorString("", "VTMWFALCNF", "");
}
} catch (Exception e) {
isError = true;
System.out.println("Exception: confirm method ..> " + e.getMessage());
e.printStackTrace();
errString = itmDBAccessEJB.getErrorString("", "VFMWRKFLWF", userId);
throw new ITMException(e);
} finally {
if (conn != null) {
try {
if (isError) {
conn.rollback();
System.out.println("QCOrderConfWfEJB: confirm: Connection Rollback");
} else {
conn.commit();
System.out.println("QCOrderConfWfEJB: confirm: Connection Commit");
}
conn.close();
conn = null;
} catch (Exception e) {
e.printStackTrace();
}
}
}
else
return errString;
}
public String rejection(String tranId, String xtraParams, String forcedFlag) throws RemoteException,ITMException
{
String userInfoStr = "";
String errString = "";
try
{
errString = new ITMDBAccessEJB().getErrorString("", "VTMWFALCNF", "");
userInfoStr = rejection(tranId, xtraParams, forcedFlag, userInfoStr);
System.out.println("userInfoStr of rejection::::: " +userInfoStr);
}
}
catch (Exception e)
{
isError = true;
System.out.println("Catch block Exception: confirm method ..> " + e.getMessage());
e.printStackTrace();
errString = itmDBAccessEJB.getErrorString("", "VFMWRKFLWF", userId);
throw new ITMException(e);
}
finally
{
if (conn != null)
catch(Exception e)
{
try
System.out.println("Exception in [QCOrderConfWfEJB] rejection " + e.getMessage());
throw new ITMException(e);
}
return errString;
}
public String rejection(String tranId, String xtraParams, String forcedFlag, String userInfoStr) throws RemoteException,ITMException
{
System.out.println("================ QCOrderConfWfEJB : rejection ================");
String userId = "";
String errString = "";
ValidatorEJB validatorEJB = null;
ITMDBAccessEJB itmDBAccessEJB = null;
Connection conn = null;
ConnDriver connDriver = new ConnDriver();
PreparedStatement pStmt = null;
ResultSet rs = null;
String sql = "";
String transDB = "";
String status = "",retString = "", wf_status = "";
String loginEmpCode="";
String[] authencate = new String[2];
authencate[0] = "";
authencate[1] = "";
boolean isError = false;
try {
itmDBAccessEJB = new ITMDBAccessEJB();
validatorEJB = new ValidatorEJB();
//conn = getConnection();
if(userInfoStr != null && userInfoStr.trim().length() > 0)
{
if (isError)
UserInfoBean userInfo = new UserInfoBean(userInfoStr);
transDB = userInfo.getTransDB();
}
if (transDB != null && transDB.trim().length() > 0)
{
conn = connDriver.getConnectDB(transDB);
}
else
{
conn = connDriver.getConnectDB("DriverITM");
}
//connDriver = null;
conn.setAutoCommit(false);
userId = validatorEJB.getValueFromXTRA_PARAMS(xtraParams, "loginCode");
System.out.println("tranId ..> " +tranId+" loginEmpCode: "+loginEmpCode+" xtraParams: "+xtraParams+" forcedFlag: "+forcedFlag);
tranId = checkNull(tranId);
sql = "SELECT status,wf_status from qc_order where qorder_no = ? ";
pStmt = conn.prepareStatement(sql);
pStmt.setString(1, tranId);
rs = pStmt.executeQuery();
if (rs.next())
{
status = checkNull(rs.getString("status"));
wf_status = checkNull(rs.getString("wf_status"));
}
closePstmtRs(pStmt, rs);
if(!"C".equalsIgnoreCase(status))
{
/*if("X".equalsIgnoreCase(status) || "C".equalsIgnoreCase(status))
{
errString = new ITMDBAccessEJB().getErrorString("", "VTWFCLOCAN", "");
}*/
if ("O".equalsIgnoreCase(wf_status) || "R".equalsIgnoreCase(wf_status) || "S".equalsIgnoreCase(wf_status) || "".equalsIgnoreCase(wf_status))
{
conn.rollback();
System.out.println("QCOrderConfWfEJB: confirm: Connection Rollback");
sql = "UPDATE QC_ORDER SET WF_STATUS = 'O' WHERE QORDER_NO = ? ";
pStmt = conn.prepareStatement(sql);
pStmt.setString(1, tranId);
int updCount = pStmt.executeUpdate();
closePstmtRs(pStmt, rs);
if (updCount > 0)
{
retString="Y";
errString = new ITMDBAccessEJB().getErrorString("", "VFMWFOPN", "");
}
else
{
errString = new ITMDBAccessEJB().getErrorString("", "VFMWFFAIL", "");
isError=true;
}
}
else
else
{
conn.commit();
System.out.println("QCOrderConfWfEJB: confirm: Connection Commit");
errString = new ITMDBAccessEJB().getErrorString("", "VTMWFALINT", "");
}
conn.close();
conn = null;
}
catch (Exception e)
}
else
{
e.printStackTrace();
errString = new ITMDBAccessEJB().getErrorString("", "VFMWFCONFN", "");
}
}
catch (Exception e)
{
isError = true;
System.out.println("Exception: rejection method of QCOrderConfWfEJB..> " + e.getMessage());
e.printStackTrace();
//errString = itmDBAccessEJB.getErrorString("", "VFMWRKFLWF", userId);
throw new ITMException(e);
}
finally
{
if (conn != null)
{
try
{
if (isError)
{
conn.rollback();
System.out.println("QCOrderConfWfEJB: rejection: Connection Rollback");
}
else
{
conn.commit();
System.out.println("QCOrderConfWfEJB: rejection: Connection Commit");
}
conn.close();
conn = null;
}
catch (Exception e)
{
e.printStackTrace();
}
}
}
return retString;
}
return errString;
}
private String checkNull(String str)
{
......@@ -141,6 +336,15 @@ public class QCOrderConfWfEJB extends ActionHandlerEJB implements QCOrderConfWfE
private void closePstmtRs(PreparedStatement pStmt, ResultSet rs)
{
if (rs != null) {
try {
rs.close();
} catch (SQLException e) {
e.printStackTrace();
}
rs = null;
}
if (pStmt != null)
{
try
......@@ -150,15 +354,6 @@ public class QCOrderConfWfEJB extends ActionHandlerEJB implements QCOrderConfWfE
}
pStmt = null;
}
if (rs != null) {
try {
rs.close();
} catch (SQLException e) {
e.printStackTrace();
}
rs = null;
}
}
}
......@@ -10,5 +10,8 @@ import ibase.webitm.utility.ITMException;
@Local
public interface QCOrderConfWfEJBLocal extends ActionHandlerLocal
{
public String confirm(String tranID, String xtraParams, String forcedFlag) throws RemoteException,ITMException;
public String confirm(String tranId, String xtraParams, String forcedFlag) throws RemoteException,ITMException;
public String confirm(String tranId, String xtraParams, String forcedFlag, String userInfoStr) throws RemoteException,ITMException;
public String rejection(String tranId, String xtraParams, String forcedFlag) throws RemoteException,ITMException;
public String rejection(String tranId, String xtraParams, String forcedFlag, String userInfoStr) throws RemoteException,ITMException;
}
......@@ -10,5 +10,8 @@ import ibase.webitm.utility.ITMException;
@Remote
public interface QCOrderConfWfEJBRemote extends ActionHandlerRemote
{
public String confirm(String tranID, String xtraParams, String forcedFlag) throws RemoteException,ITMException;
public String confirm(String tranId, String xtraParams, String forcedFlag) throws RemoteException,ITMException;
public String confirm(String tranId, String xtraParams, String forcedFlag, String userInfoStr) throws RemoteException,ITMException;
public String rejection(String tranId, String xtraParams, String forcedFlag) throws RemoteException,ITMException;
public String rejection(String tranId, String xtraParams, String forcedFlag, String userInfoStr) 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