Commit 1d3ab2a8 authored by kgharal's avatar kgharal

RETURN "";


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@93433 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 0ba7e1bd
package ibase.webitm.ejb.dis;
import ibase.system.config.AppConnectParm;
import ibase.system.config.ConnDriver;
import ibase.webitm.ejb.ActionHandlerEJB;
import ibase.webitm.utility.GenericUtility;
import ibase.webitm.utility.ITMException;
import java.awt.color.ProfileDataException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import javax.ejb.Stateless;
import javax.naming.InitialContext;
import javax.xml.rpc.ParameterMode;
import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import org.apache.axis.encoding.XMLType;
@Stateless
public class ApproveSalesReturn extends ActionHandlerEJB implements ApproveSalesReturnLocal, ApproveSalesReturnRemote
{
GenericUtility genericUtility = GenericUtility.getInstance();
public String salesReturn(String tranId , String xtraParams) throws ITMException
{
String errString = "";
//String xtraParams = "";
String forcedFlag = "";
String businessObj = "";
String sql = "";
String empCode = "", entityCode = "", profileId = "", siteCode = "", userCountry = "", userType = "", user = "";
Connection conn = null;
PreparedStatement pstmt = null;
ResultSet rs = null;
try
{
ConnDriver connDriver = null;
connDriver = new ConnDriver();
conn = connDriver.getConnectDB("DriverValidator");
InitialContext ctx = null;
SreturnFormSplitLocal sreturnFormSplitLocal = null;
System.out.println(" ApproveSalesReturnEJB.salesReturn()");
//Hard coded xtraparam
/*user = "SYSTEM";
xtraParams = "loginCode="+user+"~~loginEmpCode=null~~loginSiteCode=null~~entityCode=null~~profileId=null~~userType=null~~runMode=I~~user_lang=en~~user_country=US~~charEnc=ISO-8859-1~~termId=SYSTEM~~chgTerm=SYSTEM~~detCnt=1~~focusRow=1~~REC_CTR=-1~~saveLevel=0";*/
//businessObj = "salesreturn"; // obj name ,
businessObj = "salesreturn_retn";
forcedFlag = "";
System.out.println(" xtraParams ->"+xtraParams);
errString = confirmReturn(businessObj, tranId,xtraParams, conn);
conn.commit();
System.out.println(" -- confirmed -*-");
}
catch(Exception e)
{
try
{
conn.rollback();
}
catch(SQLException es)
{
System.out.println("Rollback exception : " + es.getMessage() + ":");
}
System.out.println("Exception : salesReturn Confirm():" + e.getMessage() + ":");
throw new ITMException(e);
}
finally
{
System.out.println("!! Closing Connection in salesReturn Confirm() !!");
try
{
if( pstmt != null)
{
pstmt.close();
pstmt = null;
}
if( rs != null)
{
rs.close();
rs = null;
}
if( conn != null)
{
conn.close();
conn = null;
}
}
catch(Exception se)
{
System.out.println(se.getMessage());
throw new ITMException(se);
}
}
return errString;
}
private String confirmReturn(String businessObj, String tranIdFr,String xtraParams,Connection conn) throws Exception, ITMException
{
String methodName = "";
String compName = "";
String retString = "";
String serviceCode = "";
String serviceURI = "";
String actionURI = "";
String sql = "";
PreparedStatement pstmt = null;
ResultSet rs = null;
System.out.println("confirmReceipt(String businessObj, String tranIdFr,String xtraParams, String forcedFlag, Connection conn) called >>><!@#>");
System.out.println("Transaction Id for Confirmation--"+tranIdFr);
System.out.println("businessObj-*-"+businessObj);
try
{
methodName = "gbf_post";
actionURI = "http://NvoServiceurl.org/" + methodName;
sql = "SELECT SERVICE_CODE,COMP_NAME FROM SYSTEM_EVENTS WHERE OBJ_NAME = ? AND EVENT_CODE = 'pre_confirm' ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,businessObj);
rs = pstmt.executeQuery();
if ( rs.next() )
{
serviceCode = rs.getString("SERVICE_CODE");
compName = rs.getString("COMP_NAME");
}
System.out.println("serviceCode = "+serviceCode+" compName "+compName);
sql = "SELECT SERVICE_URI FROM SYSTEM_EVENT_SERVICES WHERE SERVICE_CODE = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,serviceCode);
rs = pstmt.executeQuery();
if ( rs.next() )
{
serviceURI = rs.getString("SERVICE_URI");
}
System.out.println("serviceURI = "+serviceURI+" compName = "+compName);
Service service = new Service();
Call call = (Call)service.createCall();
call.setTargetEndpointAddress(new java.net.URL(serviceURI));
call.setOperationName( new javax.xml.namespace.QName("http://NvoServiceurl.org", methodName ) );
call.setUseSOAPAction(true);
call.setSOAPActionURI(actionURI);
Object[] aobj = new Object[4];
call.addParameter( new javax.xml.namespace.QName("http://NvoServiceurl.org", "component_name"), XMLType.XSD_STRING, ParameterMode.IN);
call.addParameter( new javax.xml.namespace.QName("http://NvoServiceurl.org", "tran_id"), XMLType.XSD_STRING, ParameterMode.IN);
call.addParameter( new javax.xml.namespace.QName("http://NvoServiceurl.org", "xtra_params"), XMLType.XSD_STRING, ParameterMode.IN);
call.addParameter( new javax.xml.namespace.QName("http://NvoServiceurl.org", "forced_flag"), XMLType.XSD_STRING, ParameterMode.IN);
aobj[0] = new String(compName);
aobj[1] = new String(tranIdFr);
aobj[2] = new String(xtraParams);
aobj[3] = new String("Y");
System.out.println("@@@@@@@@@@loginEmpCode:" +genericUtility.getValueFromXTRA_PARAMS(xtraParams,"loginEmpCode")+":");
call.setReturnType(XMLType.XSD_STRING);
retString = (String)call.invoke(aobj);
System.out.println("Confirm Complete @@@@@@@@@@@Return string from NVO is:==>["+retString+"]");
}
catch (Exception e) {
conn.rollback();
// TODO Auto-generated catch block
e.printStackTrace();
throw new ITMException(e);
}
finally
{
try
{
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
if (rs != null)
{
rs.close();
rs = null;
}
}
catch (Exception e)
{
conn.rollback();
e.printStackTrace();
e.getMessage();
throw new ITMException(e);
}
}
return "";
}//end of confirmReceipt
}
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