Commit a09a31cb authored by prahate's avatar prahate

Changes done for post save of pcontract.

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@186944 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 67d435bc
/********************************************************
Title : PContractPostSave[]
Date : 25/JUN/18
Developer: Pankaj R.
********************************************************/
package ibase.webitm.ejb.dis;
import ibase.webitm.ejb.*;
import ibase.webitm.utility.ITMException;
import ibase.utility.E12GenericUtility;
import ibase.webitm.ejb.sys_UTL.CommonFunctions;
import java.rmi.RemoteException;
import java.sql.*;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import org.w3c.dom.*;
@javax.ejb.Stateless
public class PContractPostSave extends ValidatorEJB implements PContractPostSaveLocal, PContractPostSaveRemote
{
E12GenericUtility genericUtility = new E12GenericUtility();
ITMDBAccessEJB dbEjb = new ITMDBAccessEJB() ;
@Override
public String postSave() throws RemoteException, ITMException
{
return "";
}
@Override
public String postSave(String xmlStringAll, String tranId, String editFlag, String xtraParams, Connection conn) throws RemoteException, ITMException
{
System.out.println("PContractPostSave.postSave()");
String errString = "";
Document dom = null;
PreparedStatement pstmt = null;
ResultSet resultSet = null;
System.out.println("xmlStringAll :: "+xmlStringAll);
System.out.println(" Tran id = "+tranId);
dom = genericUtility.parseString(xmlStringAll);
tranId = genericUtility.getColumnValue("contract_no", dom);
String maxValue = "";
try
{
String maxValueSql = "SELECT SUM(MAX_VALUE) AS MAX_VALUE FROM PCONTRACT_DET WHERE CONTRACT_NO = ? ";
pstmt = conn.prepareStatement(maxValueSql);
pstmt.setString(1, tranId);
resultSet = pstmt.executeQuery();
if(resultSet.next())
{
maxValue = E12GenericUtility.checkNull(resultSet.getString("MAX_VALUE"));
if(maxValue.length() == 0)
{
maxValue = "0";
}
}
resultSet.close(); resultSet = null;
pstmt.close(); pstmt = null;
String updateValue = "UPDATE PCONTRACT_HDR set CONTRACT_AMT = ? where CONTRACT_NO = ?";
pstmt = conn.prepareStatement(updateValue);
pstmt.setString(1, maxValue);
pstmt.setString(2, tranId);
int updateCnt = pstmt.executeUpdate();
if(updateCnt > 0)
{
conn.commit();
}
pstmt.close(); pstmt = null;
}
catch(Exception e)
{
e.printStackTrace();
errString = dbEjb.getErrorString("", "POSFAIL", "");
throw new ITMException( e );
}
finally
{
if(pstmt != null)
{
try {
if (conn != null) {
conn.close();
}
conn = null;
} catch (SQLException e) {
e.printStackTrace();
}
}
}
return errString;
}
}
/********************************************************
Title : PContractPostSaveLocal[]
Date : 25/JUN/18
Developer: Pankaj R.
********************************************************/
package ibase.webitm.ejb.dis;
import java.rmi.RemoteException;
import java.sql.Connection;
import ibase.webitm.utility.ITMException;
import ibase.webitm.ejb.ValidatorLocal;
import javax.ejb.Local; // added for ejb3
@Local // added for ejb3
public interface PContractPostSaveLocal extends ValidatorLocal
{
public String postSave() throws RemoteException,ITMException;
public String postSave(String xmlStringAll, String tranId, String editFlag, String xtraParams, Connection conn) throws RemoteException,ITMException;
}
\ No newline at end of file
/********************************************************
Title : PContractPostSaveRemote[]
Date : 25/JUN/18
Developer: Pankaj R.
********************************************************/
package ibase.webitm.ejb.dis;
import java.rmi.RemoteException;
import java.sql.Connection;
import ibase.webitm.utility.ITMException;
import ibase.webitm.ejb.ValidatorRemote;
import javax.ejb.Remote; // added for ejb3
@Remote // added for ejb3
public interface extends ValidatorRemote
{
public String postSave() throws RemoteException,ITMException;
public String postSave(String xmlStringAll, String tranId, String editFlag, String xtraParams, Connection conn) throws RemoteException,ITMException;
}
\ No newline at end of file
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