Commit c3f157bb authored by jshaikh's avatar jshaikh

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@180794 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 529ec06c
package ibase.webitm.ejb.mfg;
import java.rmi.RemoteException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import javax.ejb.Stateless;
import ibase.webitm.ejb.ActionHandlerEJB;
import ibase.webitm.ejb.ITMDBAccessEJB;
import ibase.webitm.ejb.ValidatorEJB;
import ibase.webitm.ejb.dis.GenericWorkflowClass;
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())
{
status = rs.getString("STATUS");
}
status = checkNull(status);
closePstmtRs(pStmt, rs);
if(!"C".equalsIgnoreCase(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 STATUS_DATE = sysdate WHERE QORDER_NO = ? ";
pStmt = conn.prepareStatement(sql);
pStmt.setString(1, qorder_no);
int updCount = pStmt.executeUpdate();
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("", "VTMWFALCNF", "");
}
}
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)
{
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;
}
private String checkNull(String str)
{
if(str == null)
{
str = "";
}
else
{
str = str.trim();
}
return str;
}
private void closePstmtRs(PreparedStatement pStmt, ResultSet rs)
{
if (pStmt != null)
{
try
{
pStmt.close();
} catch (SQLException localSQLException1) {
}
pStmt = null;
}
if (rs != null) {
try {
rs.close();
} catch (SQLException e) {
e.printStackTrace();
}
rs = null;
}
}
}
package ibase.webitm.ejb.mfg;
import java.rmi.RemoteException;
import javax.ejb.Local;
import ibase.webitm.ejb.ActionHandlerLocal;
import ibase.webitm.utility.ITMException;
@Local
public interface QCOrderConfWfEJBLocal extends ActionHandlerLocal
{
public String confirm(String tranID, String xtraParams, String forcedFlag) throws RemoteException,ITMException;
}
package ibase.webitm.ejb.mfg;
import java.rmi.RemoteException;
import javax.ejb.Remote;
import ibase.webitm.ejb.ActionHandlerRemote;
import ibase.webitm.utility.ITMException;
@Remote
public interface QCOrderConfWfEJBRemote extends ActionHandlerRemote
{
public String confirm(String tranID, String xtraParams, String forcedFlag) 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