Commit c36ba36c authored by cpatil's avatar cpatil

add rollback


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@93934 ce508802-f39f-4f6c-b175-0d175dae99d5
parent bdc4e568
......@@ -79,8 +79,16 @@ public class WOIssueReplacementPrc extends ProcessEJB implements GenerateReceipt
Document headerDom = null;
GenericUtility genericUtility = GenericUtility.getInstance();
ITMDBAccessEJB itmDBAccessLocal = new ITMDBAccessEJB();
ConnDriver connDriver = new ConnDriver();
try
{
if(conn==null)
{
conn = connDriver.getConnectDB("DriverITM");
conn.setAutoCommit(false);
}
if(xmlString != null && xmlString.trim().length()!=0)
{
headerDom = genericUtility.parseString(xmlString);
......@@ -89,16 +97,21 @@ public class WOIssueReplacementPrc extends ProcessEJB implements GenerateReceipt
{
detailDom = genericUtility.parseString(xmlString2);
}
retStr = process(headerDom, detailDom, windowName, xtraParams);
if( retStr == null || retStr.trim().length() == 0 )
retStr = process(headerDom, detailDom, windowName, xtraParams,conn);
System.out.println("@@@@@ final return string["+retStr+"]");
if( retStr != null && retStr.trim().length() > 0 )
{
System.out.println("work order issue replacement generated succesfully........");
//retStr = itmDBAccessLocal.getErrorString("","PRCUSUCCE9","");
System.out.println("transaction update failed........");
//retStr = itmDBAccessLocal.getErrorString("","VTPROUNSU9","");
conn.rollback();
}
else
{
System.out.println("transaction update failed........");
//retStr = itmDBAccessLocal.getErrorString("","VTPROUNSU9","");
System.out.println("work order issue replacement generated succesfully........");
retStr = itmDBAccessLocal.getErrorString("","PRCUSUCCE9","");
conn.commit();
}
}
catch (Exception e)
......@@ -109,10 +122,10 @@ public class WOIssueReplacementPrc extends ProcessEJB implements GenerateReceipt
}
return retStr;
}
public String process(Document headerDom, Document detailDom, String windowName, String xtraParams) throws RemoteException,ITMException
public String process(Document headerDom, Document detailDom, String windowName, String xtraParams,Connection conn) throws RemoteException,ITMException
{
GenericUtility genericUtility = GenericUtility.getInstance();
ConnDriver connDriver = new ConnDriver();
//java.sql.Timestamp chgDate = new java.sql.Timestamp(System.currentTimeMillis());
String sql = "",sql2 = "";
PreparedStatement pstmt = null,pstmtdet =null,pstmt1 = null ,pstmt2 = null ;
......@@ -163,11 +176,7 @@ public class WOIssueReplacementPrc extends ProcessEJB implements GenerateReceipt
try
{
if(conn==null)
{
conn = connDriver.getConnectDB("DriverITM");
conn.setAutoCommit(false);
}
chgUser = genericUtility.getValueFromXTRA_PARAMS(xtraParams,"chgUser");
chgTerm = genericUtility.getValueFromXTRA_PARAMS(xtraParams,"chgTerm");
//chgUser = genericUtility.getValueFromXTRA_PARAMS(xtraParams,"chg_date");
......@@ -1089,7 +1098,7 @@ public class WOIssueReplacementPrc extends ProcessEJB implements GenerateReceipt
{
System.out.println("@@@@@@ connection commit...............");
conn.commit(); //commit to transaction
retStr = itmDBAccessLocal.getErrorString("","VPSUCC1","");
//retStr = itmDBAccessLocal.getErrorString("","VPSUCC1","");
}
}//outer try
catch (Exception e)
......@@ -1100,15 +1109,30 @@ public class WOIssueReplacementPrc extends ProcessEJB implements GenerateReceipt
}
finally
{
System.out.println("Closing Connection2....");
try
try{
System.out.println("@@@@ errString :::["+ retStr+"]" );
if (retStr != null && retStr.trim().length() > 0)
{
System.out.println("@@@@@@ connection rollback...............");
conn.rollback();
return retStr;
}
else
{
System.out.println("@@@@@@ connection commit...............");
conn.commit(); //commit to transaction
//retStr = itmDBAccessLocal.getErrorString("","VPSUCC1","");
}
System.out.println("Closing Connection2....");
//fw.flush();
//fw.close();
conn.close();
conn = null;
}
catch(Exception se){}
catch(Exception se)
{
}
}//
return retStr;
......
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