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