Commit 10de8712 authored by cpatil's avatar cpatil

merging from branch


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@101324 ce508802-f39f-4f6c-b175-0d175dae99d5
parent a9d9f0c3
[Dolphin]
SortOrder=1
SortRole=date
Sorting=2
Timestamp=2012,11,28,16,10,37
Timestamp=2016,4,20,11,51,8
Version=3
ViewMode=1
package ibase.webitm.ejb.dis;
......@@ -114,9 +115,7 @@ public class EmpPoLimitIC extends ValidatorEJB implements EmpPoLimitICLocal,EmpP
itemSeries = genericUtility.getColumnValue("item_ser", dom);
eff_from=checkNull(genericUtility.getColumnValue("eff_from", dom));
valid_upto=checkNull(genericUtility.getColumnValue("valid_upto", dom));
// reasCode=genericUtility.getColumnValue("reas_code", dom);
if(eff_from !=null && eff_from.trim().length()>0 )
{
effDate = Timestamp.valueOf(genericUtility.getValidDateString(eff_from, genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat()) + " 00:00:00.0");
......@@ -136,6 +135,7 @@ public class EmpPoLimitIC extends ValidatorEJB implements EmpPoLimitICLocal,EmpP
pstmt.setTimestamp(3,effDate);
pstmt.setTimestamp(4,validDate);
rs = pstmt.executeQuery();
System.out.println("eff_date@@@@for testing"+effDate);
System.out.println("Sql@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@" + Sql);
if (rs.next())
{
......@@ -268,8 +268,35 @@ public class EmpPoLimitIC extends ValidatorEJB implements EmpPoLimitICLocal,EmpP
break ;
}
}
}
if (!editFlag.equalsIgnoreCase("E")) {
System.out.println("Comming to !editFlag condition");
sql=null;
sql=" select COUNT(1) from emp_po_limit where emp_code=? and item_ser=? and ( ( ? BETWEEN eff_from AND valid_upto ) OR (? BETWEEN eff_from AND valid_upto ))";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,empCode);
pstmt.setString(2,itemSeries);
pstmt.setTimestamp(3,effDate);
pstmt.setTimestamp(4,validDate);
rs = pstmt.executeQuery();
if (rs.next()) {
cnt = rs.getInt(1);
}
System.out.println("CHECKING DUPLICATE PERIOD"+cnt);
pstmt.close();
rs.close();
pstmt = null;
rs = null;
if(cnt > 0) {
errString = itmDBAccessEJB.getErrorString("","VMRECD ",userId);
break ;
}
}
System.out.println("Value of itemcode is:*************************"+empCode);
System.out.println("Value ofcust code is:*********************"+itemSeries);
......@@ -474,11 +501,6 @@ public class EmpPoLimitIC extends ValidatorEJB implements EmpPoLimitICLocal,EmpP
}
return input;
}
}
......@@ -649,10 +649,10 @@ insert into obj_itemchange(obj_name,form_no,field_name)values('porderamd
pstmt2 = null;
sql3 = "select sum(a.tot_amt * b.exch_rate) from porddet a,porder b " +
"where (a.purc_order = b.purc_order) and" +
" b.confirmed = 'Y' and a.proj_code = ? and b.purc_order = ? and " +
" a.line_no NOT IN (select line_no__ord from poamd_det where amd_no = ? " +
"and proj_code = ? and line_no__ord is not null) ";
"where (a.purc_order = b.purc_order) and" +
" b.confirmed = 'Y' and a.proj_code = ? and b.purc_order = ? and a.status ! = 'C' and b.status ! = 'X' and" +
" a.line_no NOT IN (select line_no__ord from poamd_det where amd_no = ? " +
"and proj_code = ? and line_no__ord is not null) ";
pstmt3 = conn.prepareStatement(sql3);
pstmt3.setString(1,projCode);
pstmt3.setString(2,purcOrder);
......
......@@ -1826,7 +1826,7 @@ public class POrderAmdIC extends ValidatorEJB implements POrderAmdICLocal,POrder
*/
System.out.println("Discount in dom: " + discount);
dis = Double.parseDouble(discount);
boolean falgporate=false;
boolean falgporate=true;
String pordTyperate="";
if (indNo != null && indNo.length() > 0)
{
......@@ -1860,7 +1860,7 @@ public class POrderAmdIC extends ValidatorEJB implements POrderAmdICLocal,POrder
else
{
falgporate = true;
System.out.println("In Flag False "+ true);
System.out.println("In Flag False "+ falgporate);
}
}
......@@ -1868,7 +1868,7 @@ public class POrderAmdIC extends ValidatorEJB implements POrderAmdICLocal,POrder
System.out.println("falgporate" + falgporate);
if(falgporate)
{
System.out.println("Enter If COndition");
System.out.println("Enter If Flag COndition");
if (dis > 0)
{
Disrate = (rate * dis) / 100;
......
/********************************************************
Title ResourceIC[D16ASUN003]
Date : 12/04/16
Developer: Abhijit Gaikwad
********************************************************/
package ibase.webitm.ejb.dis;
import ibase.system.config.ConnDriver;
import ibase.utility.E12GenericUtility;
import ibase.webitm.ejb.ITMDBAccessEJB;
import ibase.webitm.ejb.ValidatorEJB;
import ibase.webitm.utility.GenericUtility;
import ibase.webitm.utility.ITMException;
import java.text.SimpleDateFormat;
import java.util.*;
import java.rmi.RemoteException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import javax.ejb.Stateless;
@Stateless
public class ProfileResourceIC extends ValidatorEJB implements TaxChapterICLocal, TaxChapterICRemote
{
E12GenericUtility genericUtility= new E12GenericUtility();
public String wfValData(String xmlString, String xmlString1, String xmlString2, String objContext, String editFlag, String xtraParams) throws RemoteException,ITMException
{
String errString = "";
Document dom = null;
Document dom1 = null;
Document dom2 = null;
try
{
if (xmlString != null && xmlString.trim().length() > 0 )
{
dom = parseString(xmlString);
}
if (xmlString1 != null && xmlString1.trim().length() > 0 )
{
dom1 = parseString(xmlString1);
}
if (xmlString2 != null && xmlString2.trim().length() > 0 )
{
dom2 = parseString(xmlString2);
}
errString = wfValData(dom, dom1, dom2, objContext, editFlag, xtraParams);
}
catch(Exception e)
{
System.out.println("Exception : [ProfileResourceIC][wfValData( String, String )] :==>\n" + e.getMessage());
throw new ITMException(e);
}
return(errString);
}
public String wfValData(Document dom, Document dom1, Document dom2, String objContext, String editFlag, String xtraParams) throws RemoteException,ITMException
{
String lineNo = "";
String ResId="";
String childNodeName = null;
String profileId="";
String sql="";
String errString = "";
String errCode = "";
String userId = "";
String errorType = "";
int ct=0;
int count = 0;
int ctr=0;
int currentFormNo = 0;
int childNodeListLength;
NodeList parentNodeList = null;
NodeList childNodeList = null;
Node parentNode = null;
Node childNode = null;
ArrayList<String> errList = new ArrayList<String>();
ArrayList<String> errFields = new ArrayList<String>();
Connection conn = null;
PreparedStatement pstmt = null ;
ResultSet rs = null;
ConnDriver connDriver = new ConnDriver();
ITMDBAccessEJB itmDBAccessEJB = new ITMDBAccessEJB();
StringBuffer errStringXml = new StringBuffer("<?xml version = \"1.0\"?> \r\n <Root> <Errors>");
System.out.println("editFlag="+editFlag);
try
{
conn = connDriver.getConnectDB("DriverITM");
userId = getValueFromXTRA_PARAMS(xtraParams, "loginCode");
if(objContext != null && objContext.trim().length() > 0)
{
currentFormNo = Integer.parseInt(objContext);
System.out.println("currentFormNo>>>>>>>>>>>>>>>>>:"+currentFormNo);
}
switch(currentFormNo)
{
case 1 :
parentNodeList = dom.getElementsByTagName("Detail1");
parentNode = parentNodeList.item(0);
childNodeList = parentNode.getChildNodes();
childNodeListLength = childNodeList.getLength();
for( ctr = 0; ctr < childNodeListLength;ctr++)
{
childNode = childNodeList.item(ctr);
childNodeName = childNode.getNodeName();
int seriesCount=0;
if(childNodeName.equalsIgnoreCase("profile_id"))
{
String id = genericUtility.getColumnValue("profile_id", dom);
String Sql = "SELECT COUNT(1) AS COUNT FROM profile WHERE profile_id=?";
pstmt = conn.prepareStatement(Sql);
pstmt.setString(1,id);
rs = pstmt.executeQuery();
System.out.println("Sql" + Sql);
if (rs.next()) {
seriesCount = rs.getInt("COUNT");
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if (seriesCount > 0)
{
errString = getErrorString(" ", "VMPRFLIDEX", userId);
break;
}
profileId = checkNull(genericUtility.getColumnValue("profile_id", dom));
System.out.println("profileId="+profileId);
if(profileId == null || profileId.trim().length() == 0)
{
errString = itmDBAccessEJB.getErrorString("","VMNUPROID ",userId);
break ;
}
else
{
sql = " select count ( *) from users where profile_id = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, profileId);
rs = pstmt.executeQuery();
if(rs.next())
{
ct = rs.getInt(1);
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if(ct == 0)
{
errString = itmDBAccessEJB.getErrorString("","VTINVPROID ",userId);
break ;
}
}
}
}
break;
case 2 :
System.out.println( "Detail 2 Validation called " );
parentNodeList = dom.getElementsByTagName("Detail2");
parentNode = parentNodeList.item(0);
childNodeList = parentNode.getChildNodes();
childNodeListLength = childNodeList.getLength();
String profileId1="";
int seriesCount = 0;
for( ctr = 0; ctr < childNodeListLength;ctr++)
{
childNode = childNodeList.item(ctr);
childNodeName = childNode.getNodeName();
String id = genericUtility.getColumnValue("profile_id", dom);
String id1 = genericUtility.getColumnValue("res_id", dom);
String id2 = genericUtility.getColumnValue("line_no",dom);
String Sql = "SELECT COUNT(1) AS COUNT FROM profile_resource WHERE profile_id=? AND res_id=?AND line_no=?";
pstmt = conn.prepareStatement(Sql);
pstmt.setString(1,id);
pstmt.setString(2,id1);
pstmt.setString(3,id2);
rs = pstmt.executeQuery();
System.out.println("Sql" + Sql);
if (rs.next()) {
seriesCount = rs.getInt("COUNT");
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if (seriesCount > 0) {
errString = getErrorString(" ", "VMTRANIDEX", userId);
break;
}
if(childNodeName.equalsIgnoreCase("profile_id"))
{
profileId1 = checkNull(genericUtility.getColumnValue("profile_id", dom));
System.out.println("profileId="+profileId1);
if(profileId1 == null || profileId1.trim().length() == 0)
{
System.out.println("Profile id is" + profileId1);
errString = itmDBAccessEJB.getErrorString("","VMNUPROID ",userId);
break ;
}
else
{
sql = " select count ( *) from users where profile_id = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, profileId1);
rs = pstmt.executeQuery();
if(rs.next())
{
ct = rs.getInt(1);
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if(ct == 0)
{
errString = itmDBAccessEJB.getErrorString("","VTINVPROID ",userId);
break ;
}
}
}
else if (childNodeName.equalsIgnoreCase("res_id"))
{
ResId = checkNull(this.genericUtility.getColumnValue("res_id", dom));
if(ResId == null || ResId.trim().length() == 0 )
{
errString = itmDBAccessEJB.getErrorString("","VMNURESID ",userId);
break ;
}
else
{
sql = " select count ( *) from resources where res_id = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, ResId);
rs = pstmt.executeQuery();
if(rs.next())
{
ct = rs.getInt(1);
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if(ct == 0)
{
errCode = "";
errString = itmDBAccessEJB.getErrorString("","VMINVRESID ",userId);
break ;
}
}
}
else if(childNodeName.equalsIgnoreCase("line_no"))
{
lineNo = checkNull(genericUtility.getColumnValue("line_no", dom));
System.out.println("LineNo="+lineNo);
if(lineNo == null || lineNo.trim().length() == 0)
{
errCode = "VMLINENO";
errString = itmDBAccessEJB.getErrorString("","VMLINENO ",userId);
break ;
}
}
}
break;
}
}
catch(Exception e)
{
System.out.println("Exception ::"+e);
e.printStackTrace();
errString=e.getMessage();
throw new ITMException(e);
}
finally
{
try
{
if(conn!=null)
{
if(rs != null )rs.close();
rs = null;
if(pstmt != null )pstmt.close();
pstmt =null;
conn.close();
}
conn = null;
}
catch(Exception d)
{
d.printStackTrace();
}
}
System.out.println("ErrString ::"+errString);
return errString;
}
public String itemChanged(String xmlString, String xmlString1, String xmlString2, String objContext, String currentColumn, String editFlag, String xtraParams) throws RemoteException, ITMException
{
Document dom1 = null;
Document dom = null;
Document dom2 = null;
String valueXmlString = "";
GenericUtility genericUtility = GenericUtility.getInstance();
try
{
if (xmlString != null && xmlString.trim().length() != 0)
{
dom = genericUtility.parseString(xmlString);
}
if (xmlString1 != null && xmlString1.trim().length() != 0)
{
dom1 = genericUtility.parseString(xmlString1);
}
if (xmlString2 != null && xmlString2.trim().length() != 0)
{
dom2 = genericUtility.parseString(xmlString2);
}
valueXmlString = itemChanged(dom, dom1, dom2, objContext, currentColumn, editFlag, xtraParams);
}
catch (Exception e)
{
System.out.println("Exception :ProfileResourceIC:itemChanged(String,String,String,String,String,String):" + e.getMessage() + ":");
valueXmlString = genericUtility.createErrorString(e);
e.printStackTrace();
}
System.out.println("returning from ProfileResourceIC itemChanged");
return (valueXmlString);
}
@Override
public String itemChanged(Document dom, Document dom1, Document dom2, String objContext, String currentColumn, String editFlag, String xtraParams) throws RemoteException, ITMException
{
StringBuffer valueXmlString = new StringBuffer();
Connection conn = null;
ConnDriver connDriver = new ConnDriver();
PreparedStatement pStmt = null;
ResultSet rs = null;
NodeList parentNodeList = null;
NodeList childNodeList = null;
Node parentNode = null;
Node childNode = null;
String sql = "";
int currentFormNo = 0;
int ctr=0;
String childNodeName = null;
String columnValue = null;
String profileId = "",profileName="";
String profileIdItmDe="" , profileIdItmDedesc="";;
String profileIdDetail="",profileIdDetaildesc="";
String resId="",resoucrDesc="";
String itmEditprofile="",itmEditResid="",itmEditline="",itmDesc="";
try
{
if(objContext != null && objContext.trim().length()>0)
{
currentFormNo = Integer.parseInt(objContext);
}
valueXmlString = new StringBuffer("<?xml version=\"1.0\"?><Root><header><editFlag>");
valueXmlString.append(editFlag).append("</editFlag></header>");
conn = connDriver.getConnectDB("DriverITM");
switch (currentFormNo)
{
case 1:
parentNodeList = dom.getElementsByTagName("Detail1");
parentNode = parentNodeList.item(0);
childNodeList = parentNode.getChildNodes();
ctr = 0;
valueXmlString.append("<Detail1>");
int childNodeListLength = childNodeList.getLength();
do
{
childNode = childNodeList.item(ctr);
childNodeName = childNode.getNodeName();
if(childNodeName.equals(currentColumn))
{
if (childNode.getFirstChild() != null)
{
columnValue = childNode.getFirstChild().getNodeValue().trim();
}
}
ctr++;
}while(ctr < childNodeListLength && !childNodeName.equals(currentColumn));
if (currentColumn.trim().equalsIgnoreCase("profile_id"))
{
profileId = genericUtility.getColumnValue("profile_id", dom);
profileId = profileId == null ? "" : profileId.trim();
sql = "select name from users where profile_id =?";
pStmt = conn.prepareStatement(sql);
pStmt.setString(1, profileId);
rs = pStmt.executeQuery();
if (rs.next())
{
profileName = rs.getString(1);
}
rs.close();
rs = null;
pStmt.close();
pStmt = null;
profileName = profileName == null ? "" : profileName.trim();
valueXmlString.append("<descr>").append(profileName).append("</descr>\r\n");
}
valueXmlString.append("</Detail1>");
break;
case 2:
parentNodeList = dom.getElementsByTagName("Detail2");
parentNode = parentNodeList.item(0);
childNodeList = parentNode.getChildNodes();
ctr = 0;
valueXmlString.append("<Detail2>");
childNodeListLength = childNodeList.getLength();
do
{
childNode = childNodeList.item(ctr);
childNodeName = childNode.getNodeName();
if(childNodeName.equals(currentColumn.trim()))
{
if (childNode.getFirstChild() != null)
{
columnValue = childNode.getFirstChild().getNodeValue();
}
}
ctr++;
}
while(ctr < childNodeListLength && !childNodeName.equals(currentColumn));
if (currentColumn.trim().equalsIgnoreCase("itm_default")) {
profileIdItmDe = genericUtility.getColumnValue("profile_id",dom1);
System.out.println("@@@@@3 profileId [" + profileIdItmDe + "]");
profileIdItmDe = profileIdItmDe == null ? "" : profileIdItmDe.trim();
valueXmlString.append("<profile_id>").append("<![CDATA[" + profileIdItmDe + "]]>").append("</profile_id>");
System.out.println("profileIdItmDe["+profileIdItmDe+"]");
sql = "select name from users where profile_id =?";
pStmt = conn.prepareStatement(sql);
pStmt.setString(1, profileIdItmDe);
rs = pStmt.executeQuery();
if (rs.next())
{
profileIdItmDedesc = rs.getString(1);
}
rs.close();
rs = null;
pStmt.close();
pStmt = null;
profileIdItmDedesc = profileIdItmDedesc == null ? "" : profileIdItmDedesc.trim();
System.out.println("profileIdItmDedesc["+profileIdItmDedesc+"]");
valueXmlString.append("<profile_descr>").append(profileIdItmDedesc).append("</profile_descr>\r\n");
if (!editFlag.equalsIgnoreCase("E"))
{
System.out.println("Edit Falg is "+ editFlag);
//String profileIdItmDeFlagA="";
String resIdFalga="";
//String lineFlagA="";
System.out.println("IN IF EditFlag["+editFlag+"]");
// profileIdItmDeFlagA = genericUtility.getColumnValue("profile_id",dom1);
resIdFalga = genericUtility.getColumnValue("res_id",dom);
// lineFlagA = genericUtility.getColumnValue("line_no",dom);
//profileIdItmDeFlagA = profileIdItmDeFlagA == null ? "" : profileIdItmDeFlagA.trim();
resIdFalga = resIdFalga == null ? "" : resIdFalga.trim();
// System.out.println("##### profileIdItmDeFlagA [" + profileIdItmDeFlagA + "]");
System.out.println("##### resIdFalga [" + resIdFalga + "]");
// System.out.println("##### lineFlagA [" + lineFlagA + "]");
// valueXmlString.append("<profile_id>").append("<![CDATA[" + profileIdItmDeFlagA + "]]>").append("</profile_id>");
//valueXmlString.append("<profile_id protect = \"1\" >").append("<![CDATA[" + profileIdItmDeFlagA + "]]>").append("</profile_id>");
valueXmlString.append("<res_id protect = \"0\" >").append("<![CDATA[" + resIdFalga + "]]>").append("</res_id>");
//valueXmlString.append("<line_no protect = \"1\" >").append("<![CDATA[" + lineFlagA + "]]>").append("</line_no>");
}
}
else if (currentColumn.trim().equalsIgnoreCase("itm_defaultedit"))
{
itmEditprofile=genericUtility.getColumnValue("profile_id", dom);
itmEditResid=genericUtility.getColumnValue("res_id", dom);
itmEditline=genericUtility.getColumnValue("line_no", dom);
itmEditResid = itmEditResid == null ? "" : itmEditResid.trim();
System.out.println("itmEditResid["+itmEditResid+"]");
sql = "select descr from resources where res_id=? ";
pStmt = conn.prepareStatement(sql);
pStmt.setString(1, itmEditResid);
rs = pStmt.executeQuery();
if (rs.next())
{
itmDesc = rs.getString(1);
}
rs.close();
rs = null;
pStmt.close();
pStmt = null;
itmDesc = itmDesc == null ? "" : itmDesc.trim();
System.out.println("resoucrDesc["+itmDesc+"]");
valueXmlString.append("<profile_id>").append("<![CDATA[" + itmEditprofile + "]]>").append("</profile_id>");
valueXmlString.append("<res_id protect = \"1\" >").append("<![CDATA[" + itmEditResid + "]]>").append("</res_id>");
valueXmlString.append("<line_no>").append("<![CDATA[" + itmEditline + "]]>").append("</line_no>");
valueXmlString.append("<descr protect= \"1\" >").append("<![CDATA[" + itmDesc + "]]>").append("</descr>");
System.out.println("EditFlag["+editFlag+"]");
if (!editFlag.equalsIgnoreCase("E"))
{
System.out.println("IN IF EditFlag["+editFlag+"]");
//valueXmlString.append("<profile_id protect = \"0\" >").append("<![CDATA[" + itmEditprofile + "]]>").append("</profile_id>");
valueXmlString.append("<res_id protect = \"0\" >").append("<![CDATA[" + itmEditResid + "]]>").append("</res_id>");
}
}
else if(currentColumn.trim().equalsIgnoreCase("profile_id"))
{
profileIdDetail = genericUtility.getColumnValue("profile_id", dom);
System.out.println("profileIdDetail["+profileIdDetail+"]");
profileIdDetail = profileIdDetail == null ? "" : profileIdDetail.trim();
sql = "select name from users where profile_id =?";
pStmt = conn.prepareStatement(sql);
pStmt.setString(1, profileIdDetail);
rs = pStmt.executeQuery();
if (rs.next())
{
profileIdDetaildesc = rs.getString(1);
}
rs.close();
rs = null;
pStmt.close();
pStmt = null;
profileIdDetaildesc = profileIdDetaildesc == null ? "" : profileIdDetaildesc.trim();
System.out.println("profileIdDetaildesc["+profileIdDetaildesc+"]");
valueXmlString.append("<profile_id protect = \"1\" >").append("<![CDATA[" + profileIdDetail + "]]>").append("</profile_id>");
valueXmlString.append("<profile_descr>").append(profileIdDetaildesc).append("</profile_descr>\r\n");
}
else if(currentColumn.trim().equalsIgnoreCase("res_id"))
{
resId = genericUtility.getColumnValue("res_id", dom);
resId = resId == null ? "" : resId.trim();
System.out.println("resId["+resId+"]");
sql = "select descr from resources where res_id=? ";
pStmt = conn.prepareStatement(sql);
pStmt.setString(1, resId);
rs = pStmt.executeQuery();
if (rs.next())
{
resoucrDesc = rs.getString(1);
}
rs.close();
rs = null;
pStmt.close();
pStmt = null;
resoucrDesc = resoucrDesc == null ? "" : resoucrDesc.trim();
System.out.println("resoucrDesc["+resoucrDesc+"]");
valueXmlString.append("<descr>").append(resoucrDesc).append("</descr>\r\n");
}
valueXmlString.append("</Detail2>");
break;
}
valueXmlString.append("</Root>\r\n");
}
catch (Exception e)
{
System.out.println("Exception :ProfileResourceICitemChange•••••••(Document,String):" + e.getMessage() + ":");
valueXmlString.delete(0, valueXmlString.length());
e.printStackTrace();
}
finally
{
try
{
if ( rs != null )
{
rs.close();
rs = null;
}
if ( pStmt != null )
{
pStmt.close();
pStmt = null;
}
if ( conn != null )
{
conn.close();
conn = null;
}
}
catch(Exception e)
{
System.out.println("Exception ::" + e);
e.printStackTrace();
}
}
System.out.println("\n***** ValueXmlString :" + valueXmlString + ":*******");
return valueXmlString.toString();
}
private String checkNull(String input)
{
if(input == null)
{
input = "";
}
return input.trim();
}
}
package ibase.webitm.ejb.dis;
import java.rmi.RemoteException;
import org.w3c.dom.Document;
import ibase.webitm.ejb.*;
import ibase.webitm.utility.ITMException;
import javax.ejb.Local;
@Local
public interface ProfileResourceICLocal extends ValidatorLocal
{
public String wfValData(String xmlString, String xmlString1, String xmlString2, String objContext, String editFlag, String xtraParams) throws RemoteException,ITMException;
public String wfValData(Document dom, Document dom1, Document dom2, String objContext, String editFlag, String xtraParams) throws RemoteException,ITMException;
public String itemChanged(String xmlString, String xmlString1, String xmlString2, String objContext, String currentColumn, String editFlag, String xtraParams) throws RemoteException, ITMException;
public String itemChanged(Document dom, Document dom1, Document dom2, String objContext, String currentColumn, String editFlag, String xtraParams) throws RemoteException, ITMException;
}
package ibase.webitm.ejb.dis;
import java.rmi.RemoteException;
import org.w3c.dom.Document;
import ibase.webitm.ejb.*;
import ibase.webitm.utility.ITMException;
import javax.ejb.Remote;
@Remote
public interface ProfileResourceICRemote extends ValidatorRemote
{
public String wfValData(String xmlString, String xmlString1, String xmlString2, String objContext, String editFlag, String xtraParams) throws RemoteException,ITMException;
public String wfValData(Document dom, Document dom1, Document dom2, String objContext, String editFlag, String xtraParams) throws RemoteException,ITMException;
public String itemChanged(String xmlString, String xmlString1, String xmlString2, String objContext, String currentColumn, String editFlag, String xtraParams) throws RemoteException, ITMException;
public String itemChanged(Document dom, Document dom1, Document dom2, String objContext, String currentColumn, String editFlag, String xtraParams) throws RemoteException, ITMException;
}
/********************************************************
Title ResourceIC[D16ASUN003]
Date : 12/04/16
Developer: Abhijit Gaikwad
********************************************************/
package ibase.webitm.ejb.dis;
import ibase.system.config.ConnDriver;
import ibase.utility.E12GenericUtility;
import ibase.webitm.ejb.ITMDBAccessEJB;
import ibase.webitm.ejb.ValidatorEJB;
import ibase.webitm.utility.ITMException;
import java.util.*;
import java.rmi.RemoteException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import javax.ejb.Stateless;
@Stateless
public class ResourceIC extends ValidatorEJB implements TaxChapterICLocal, TaxChapterICRemote
{
E12GenericUtility genericUtility= new E12GenericUtility();
public String wfValData(String xmlString, String xmlString1, String xmlString2, String objContext, String editFlag, String xtraParams) throws RemoteException,ITMException
{
String errString = "";
Document dom = null;
Document dom1 = null;
Document dom2 = null;
try
{
if (xmlString != null && xmlString.trim().length() > 0 )
{
dom = parseString(xmlString);
}
if (xmlString1 != null && xmlString1.trim().length() > 0 )
{
dom1 = parseString(xmlString1);
}
if (xmlString2 != null && xmlString2.trim().length() > 0 )
{
dom2 = parseString(xmlString2);
}
errString = wfValData(dom, dom1, dom2, objContext, editFlag, xtraParams);
}
catch(Exception e)
{
System.out.println("Exception : [ResourceIC][wfValData( String, String )] :==>\n" + e.getMessage());
throw new ITMException(e);
}
return(errString);
}
public String wfValData(Document dom, Document dom1, Document dom2, String objContext, String editFlag, String xtraParams) throws RemoteException,ITMException
{
String lineNo = "";
String ResId="";
String childNodeName = null;
String profileId="";
String sql="";
String errString = "";
String errCode = "";
String userId = "";
String errorType = "";
int ct=0;
int count = 0;
int ctr=0;
int currentFormNo = 0;
int childNodeListLength;
NodeList parentNodeList = null;
NodeList childNodeList = null;
Node parentNode = null;
Node childNode = null;
ArrayList<String> errList = new ArrayList<String>();
ArrayList<String> errFields = new ArrayList<String>();
Connection conn = null;
PreparedStatement pstmt = null ;
ResultSet rs = null;
ConnDriver connDriver = new ConnDriver();
ITMDBAccessEJB itmDBAccessEJB = new ITMDBAccessEJB();
StringBuffer errStringXml = new StringBuffer("<?xml version = \"1.0\"?> \r\n <Root> <Errors>");
System.out.println("editFlag="+editFlag);
try
{
conn = connDriver.getConnectDB("DriverITM");
userId = getValueFromXTRA_PARAMS(xtraParams, "loginCode");
if(objContext != null && objContext.trim().length() > 0)
{
currentFormNo = Integer.parseInt(objContext);
System.out.println("currentFormNo>>>>>>>>>>>>>>>>>:"+currentFormNo);
}
switch(currentFormNo)
{
case 1 :
System.out.println( "Detail 1 Validation called " );
parentNodeList = dom.getElementsByTagName("Detail1");
parentNode = parentNodeList.item(0);
childNodeList = parentNode.getChildNodes();
childNodeListLength = childNodeList.getLength();
for( ctr = 0; ctr < childNodeListLength;ctr++)
{
childNode = childNodeList.item(ctr);
childNodeName = childNode.getNodeName();
if (childNodeName.equalsIgnoreCase("res_id"))
{
ResId = checkNull(this.genericUtility.getColumnValue("res_id", dom));
if(ResId == null || ResId.trim().length() == 0 )
{
errString = itmDBAccessEJB.getErrorString("","VMNURESID ",userId);
break ;
}
else
{
sql = "select count ( *) from resources where res_id= ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, ResId);
rs = pstmt.executeQuery();
if(rs.next())
{
ct = rs.getInt(1);
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
System.out.println("ct######"+ct);
System.out.println("editFlag######"+editFlag);
if (!editFlag.equalsIgnoreCase("E"))
{
System.out.println("Flag is "+ editFlag);
if (ct > 0)
{
errString = getErrorString(" ", "VMTRANIDEX", userId);
break;
}
}
}
}
}
break;
}
}
catch(Exception e)
{
System.out.println("Exception ::"+e);
e.printStackTrace();
errString=e.getMessage();
throw new ITMException(e);
}
finally
{
try
{
if(conn!=null)
{
if(rs != null )rs.close();
rs = null;
if(pstmt != null )pstmt.close();
pstmt =null;
conn.close();
}
conn = null;
}
catch(Exception d)
{
d.printStackTrace();
}
}
System.out.println("ErrString ::"+errString);
return errString;
}
private String checkNull(String input)
{
if(input == null)
{
input = "";
}
return input.trim();
}
}
package ibase.webitm.ejb.dis;
import java.rmi.RemoteException;
import org.w3c.dom.Document;
import ibase.webitm.ejb.*;
import ibase.webitm.utility.ITMException;
import javax.ejb.Local;
@Local
public interface ResourceICLocal extends ValidatorLocal
{
public String wfValData(String xmlString, String xmlString1, String xmlString2, String objContext, String editFlag, String xtraParams) throws RemoteException,ITMException;
public String wfValData(Document dom, Document dom1, Document dom2, String objContext, String editFlag, String xtraParams) throws RemoteException,ITMException;
}
package ibase.webitm.ejb.dis;
import java.rmi.RemoteException;
import org.w3c.dom.Document;
import ibase.webitm.ejb.*;
import ibase.webitm.utility.ITMException;
import javax.ejb.Remote;
@Remote
public interface ResourceICRemote extends ValidatorRemote
{
public String wfValData(String xmlString, String xmlString1, String xmlString2, String objContext, String editFlag, String xtraParams) throws RemoteException,ITMException;
public String wfValData(Document dom, Document dom1, Document dom2, String objContext, String editFlag, String xtraParams) throws RemoteException,ITMException;
}
......@@ -1528,7 +1528,7 @@ public class SOrderForm extends ValidatorEJB implements SOrderFormLocal, SOrderF
}
}
}
else
/* else
{
sql = " select integral_qty, restrict_upto "
+ " from customeritem"
......@@ -1620,13 +1620,108 @@ public class SOrderForm extends ValidatorEJB implements SOrderFormLocal, SOrderF
break;
}
}
}
}*/
}
rs2.close();
rs2 = null;
pstmt1.close();
pstmt1 = null;//-------------------------Ended By Abhijit Gaiwkad on 16-OCT-2015
System.out.println("Scheme COde in After While :" + schemeCode);
if( schemeCode == null || schemeCode.trim().length() == 0 ) //-------------------------Added By Abhijit Gaiwkad on 16-OCT-2015
{
System.out.println("Not Scheme Apply for item COde");
sql = " select integral_qty, restrict_upto "
+ " from customeritem"
+ " where cust_code = ?"
+ " and item_code = ?";
//System.out.println("select integral_qty var_value.." + sql);
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,custCode);
pstmt.setString(2,itemCode);
rs = pstmt.executeQuery();
if(rs.next())
{
integralQty = rs.getDouble(1) ;
restrictUpto = rs.getTimestamp(2) ;
}
rs.close();
pstmt.close();
pstmt = null;
if( integralQty == 0.0)
{
sql = " select integral_qty "
+ " from siteitem"
+ " where site_code = ?"
+ " and item_code = ?";
//System.out.println("select integral_qty var_value.." + sql);
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,siteCode);
pstmt.setString(2,itemCode);
rs = pstmt.executeQuery();
if(rs.next())
{
integralQty = rs.getDouble(1) ;
}
rs.close();
pstmt.close();
pstmt = null;
}
if( integralQty == 0.0)
{
sql = " select integral_qty"
+ " from item"
+ " where item_code = ?";
//System.out.println("select integral_qty var_value.." + sql);
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,itemCode);
rs = pstmt.executeQuery();
if(rs.next())
{
integralQty = rs.getDouble(1) ;
}
rs.close();
pstmt.close();
pstmt = null;
}
if( restrictUpto != null )
{
if( OrderDate.compareTo( restrictUpto ) <= 0 )
{
errCode = "VTRESDT";
errString = getErrorString("qty_1",errCode,userId);
break;
}
}
if( integralQty > 0 )
{
flag = false;
for(int i = 1; i < 12; i++)
{
strSch="";
strSch = "qty_"+i;
//System.out.println("strSch value...." + strSch);
qtyStr[i] = genericUtility.getColumnValue(strSch,dom);
//qtyStr[i] = qty_[i];
if(qtyStr[i] != null && qtyStr[i].trim().length() > 0)
{
qty[i] = Double.parseDouble( qtyStr[i] );
}
if( ( qty[i] % integralQty ) > 0 )
{
flag = true;
break;
}
}//end for
if( flag )
{
errCode = "VTINTQTY";
errString = getErrorString("qty_1",errCode,userId);
break;
}
}
}
//validation as given by jasmina on 130310-DI89SUN240
String natureVal = genericUtility.getColumnValue( "nature", dom );
......
[Dolphin]
Timestamp=2015,5,26,11,50,50
SortOrder=1
SortRole=date
Timestamp=2016,4,20,12,3,30
Version=3
ViewMode=1
......@@ -6,6 +6,7 @@ import ibase.webitm.ejb.ActionHandlerEJB;
import ibase.webitm.ejb.ITMDBAccessEJB;
import ibase.webitm.ejb.ValidatorLocal;
import ibase.webitm.ejb.dis.DistCommon;
import ibase.webitm.ejb.fin.FinCommon;
import ibase.utility.CommonConstants;
import ibase.utility.E12GenericUtility;
import ibase.webitm.utility.ITMException;
......@@ -6272,7 +6273,7 @@ public class DespatchAct extends ActionHandlerEJB implements DespatchActLocal, D
String quantityStudom = "" ;
double qtyStudom = 0;
DecimalFormat df = new DecimalFormat("#########.###");
Timestamp despDate =null ,expDate = null ,mfgDate=null,retestDate=null;
Timestamp despDate =null ,expDate = null ,mfgDate=null,retestDate=null,plistdate=null,orderdate=null;
int count = 0;
String sExpDate ="" ,sMfgDate="" ,sRetestDate="";
......@@ -7540,6 +7541,7 @@ public class DespatchAct extends ActionHandlerEJB implements DespatchActLocal, D
}
else if(currentColumn.equalsIgnoreCase("lot_no") || currentColumn.equalsIgnoreCase("lot_sl"))
{
String unitstd="";
itemCode = genericUtility.getColumnValue("item_code",dom);
siteCode = genericUtility.getColumnValue("site_code",dom);
locCode = genericUtility.getColumnValue("loc_code",dom);
......@@ -7548,6 +7550,8 @@ public class DespatchAct extends ActionHandlerEJB implements DespatchActLocal, D
saleord = genericUtility.getColumnValue("sord_no",dom);
saleordLine = genericUtility.getColumnValue("line_no__sord",dom);
smNum = genericUtility.getColumnValue("quantity", dom);
unitstd = genericUtility.getColumnValue("unit__std", dom);
System.out.println("unit__std"+unitstd);
System.out.println("lot_no AND lot_sl....:"+itemCode+"..."+siteCode+"..."+locCode+"..."+lotNo+"..."+lotSl+"..."+saleord+"..."+ saleordLine +"..QUANTITY"+smNum);
if(itemCode == null)
{
......@@ -7816,17 +7820,21 @@ public class DespatchAct extends ActionHandlerEJB implements DespatchActLocal, D
rs = null;
pstmt.close();
pstmt = null;
sql = "select price_list , price_list__clg from sorder where sale_order =? ";
String custcode="",plistdiscStr="";
double plistdisc=0,discMerge=0;
sql = "select price_list,price_list__clg,price_list__disc,cust_code,pl_date,order_date from sorder where sale_order =? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,saleord);
System.out.println("@@@sql is"+sql);
rs = pstmt.executeQuery();
if(rs.next())
{
priceList = rs.getString("price_list");
priceListClg = rs.getString("price_list__clg");
plistdiscStr=rs.getString("price_list__disc");
custcode=rs.getString("cust_code");
plistdate = rs.getTimestamp("pl_date");
orderdate = rs.getTimestamp("order_date");
}
rs.close();
rs = null;
......@@ -7879,8 +7887,90 @@ public class DespatchAct extends ActionHandlerEJB implements DespatchActLocal, D
rateStduom = rateStd ; // 18-08 -10
valueXmlString.append("<rate__stduom isSrvCallOnChg='0'>").append("<![CDATA[").append(rateStduom).append("]]>").append("</rate__stduom>\r\n");
setNodeValue( dom, "dimension", (dimension == null) ? " " : dimension );
int Count=0;
System.out.println("Nature is (ABHI)"+nature);
if (nature == null)
{
nature = "C";
}
System.out.println("Sorder Rate is "+ sordRate);
System.out.println("nature is "+ nature);
if (sordRate == 0 && nature.equalsIgnoreCase("C"))
{
System.out.println("Price List discount is " + plistdiscStr);
if(plistdiscStr != null && plistdiscStr.trim().length() > 0)
{
System.out.println("DIscount COndition");
plistdisc = getDiscount(plistdiscStr,orderdate,custcode,siteCode,itemCode,unitstd,discMerge,plistdate,sordQuantity,conn);
System.out.println("Get discount is :"+ plistdisc);
listType = distCommon.getPriceListType(plistdiscStr , conn);
System.out.println("listType is:" +listType);
if("M".equalsIgnoreCase(listType))
{
if(! "L".equalsIgnoreCase(listType))
{
System.out.println("List type L");
pickRate= distCommon.pickRate(priceList,sDespDate,itemCode,lotNo,"D",sordQuantity, conn);
}
pickRate =calcRate(pickRate,plistdisc);
System.out.println("mrate from calcRate function====="+pickRate);
}
else
{
System.out.println("DIscount Else Condition ");
sql ="select count(*) from pricelist where price_list = ? and list_type = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,priceList);
pstmt.setString(2,"I");
rs = pstmt.executeQuery();
if (rs.next())
{
Count = rs.getInt("COUNT");
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
//ibase3-webitm-dis5-12-1-01
// if no record found in price list for I (Inventory) then continue with the current logic else check in Stock table
if(Count == 0 )
{
if(! "L".equalsIgnoreCase(listType))
{
pickRate = distCommon.pickRate(priceList,sDespDate,itemCode,lotNo,"D",sordQuantity, conn);
}
}
else
{
String listTyp= siteCode + "@" + locCode + "@" + lotNo;
pickRate=distCommon.pickRate(priceList, sDespDate, itemCode, listTyp, "I", sordQuantity, conn);
}
}
sConv = genericUtility.getColumnValue("conv__rtuom_stduom",dom);
if(sConv != null && sConv.trim().length() > 0)
{
conv = Double.parseDouble(sConv);
valueXmlString.append("<conv__rtuom_stduom isSrvCallOnChg='0'>").append("<![CDATA[").append(conv).append("]]>").append("</conv__rtuom_stduom>\r\n");///13-08
setNodeValue( dom, "conv__rtuom_stduom", (conv) ); ///13-08
}
if(sConv ==null || conv == 0)
{
conv = 1;
}
rateStduom1 = pickRate * conv;
valueXmlString.append("<rate__stduom isSrvCallOnChg='0'>").append("<![CDATA[").append(rateStduom1).append("]]>").append("</rate__stduom>\r\n");
setNodeValue( dom, "rate__stduom", rateStduom1 );
valueXmlString.append("<conv__rtuom_stduom isSrvCallOnChg='0'>").append("<![CDATA[").append(conv).append("]]>").append("</conv__rtuom_stduom>\r\n");///13-08
setNodeValue( dom, "conv__rtuom_stduom", (conv) );
}
else
{
System.out.println("ELse Condition");
if(sordRate == 0 )
{
if(priceList != null && priceList.trim().length() > 0)
......@@ -7967,6 +8057,9 @@ public class DespatchAct extends ActionHandlerEJB implements DespatchActLocal, D
setNodeValue( dom, "conv__rtuom_stduom", (conv) );///13-08
//} // 13/04/12 manoharan
}
}
}
pickRateClg = 0;
......@@ -8127,6 +8220,165 @@ public class DespatchAct extends ActionHandlerEJB implements DespatchActLocal, D
}
return retString;
}
public double calcRate(double rate,double plistDisc)
{
try
{
rate = rate - (plistDisc * rate)/100;
if( rate < 0 )
{
rate=0;
}
}
catch(Exception e)
{
e.printStackTrace();
}
return rate;
}
public double getDiscount(String plistDisc,Timestamp orderDate,String custCode,String siteCode,String itemCode,String unit,double discMerge,Timestamp plDate,double sordItmQty,Connection conn) throws SQLException, ITMException
{
String ls_listtype = "", itemSer = "",sql="";
double lc_rate=0.0, lc_disc=0.0,rate=0.0,discPerc=0.0;
PreparedStatement pstmt=null;
ResultSet rs = null;
try
{
if(plistDisc.trim().length() > 0)
{
sql = " select case when rate is null then 0 else rate end as rate " +
" from pricelist where price_list = ? and " +
" item_code = ? and unit = ? " +
" and list_type IN ('M','N') " +
" and case when min_qty is null then 0 else min_qty end <= ? " +
" and ((case when max_qty is null then 0 else max_qty end >= ? ) " +
" OR (case when max_qty is null then 0 else max_qty end =0)) and eff_from <= ? " +
" and valid_upto >= ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,plistDisc);
pstmt.setString(2,itemCode);
pstmt.setString(3,unit);
pstmt.setDouble(4,sordItmQty);
pstmt.setDouble(5,sordItmQty);
pstmt.setTimestamp(6,plDate);
pstmt.setTimestamp(7,plDate);
rs = pstmt.executeQuery();
if(rs.next())
{
rate = rs.getDouble("rate");
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
System.out.println("Rate"+ rate);
}
System.out.println("List Type " +ls_listtype);
System.out.println("Price LIst Discount " +plistDisc);
System.out.println("Rate " +rate);
System.out.println("itemCode " +itemCode);
System.out.println("cust_code " +custCode);
discPerc = rate;
if("M".equalsIgnoreCase(ls_listtype) || plistDisc == null || plistDisc.trim().length() == 0 || rate == 0)
{
System.out.println("Pass All condition");
sql = "select item_ser from item where item_code = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,itemCode);
rs = pstmt.executeQuery();
if(rs.next())
{
itemSer = rs.getString("item_ser");
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
System.out.println("itemSer " +itemSer);
sql = "select disc_perc from customer_series where cust_code = ? and item_ser = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,custCode);
pstmt.setString(2,itemSer);
rs = pstmt.executeQuery();
if(rs.next())
{
discPerc = rs.getDouble("disc_perc");
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
System.out.println("disc_perc " +discPerc);
if(discPerc == 0)
{
System.out.println("Perc is"+discPerc);
sql = "select disc_perc from site_customer where site_code = ? and cust_code = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,siteCode);
pstmt.setString(2,custCode);
rs = pstmt.executeQuery();
if(rs.next())
{
discPerc = rs.getDouble("disc_perc");
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
}
if(discPerc == 0)
{
sql = "select disc_perc from customer where cust_code = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,custCode);
rs = pstmt.executeQuery();
if(rs.next())
{
discPerc = rs.getDouble("disc_perc");
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
}
if("M".equalsIgnoreCase(ls_listtype))
{
discMerge = discPerc;
if(rate != 0)
{
discPerc = rate;
}
}
else
{
discMerge = 0;
}
}
if(itemCode == null)
{
discPerc = 0;
}
}
catch(Exception e)
{
e.printStackTrace();
System.out.println("Exception ::"+ e.getMessage());
throw new ITMException(e);
}
return discPerc;
}
}
\ No newline at end of file
......@@ -41,11 +41,11 @@ public class DistOpenPrc extends ActionHandlerEJB
public String opendistOrder(String distOrder, String xtraParams, String forcedFlag) throws RemoteException, ITMException
{
System.out.println("openSaleOrder called........");
String sql = "";
String sql = "",sql1="";
String errString = "";
Connection conn = null;
ConnDriver connDriver = null;
PreparedStatement pstmt = null;
PreparedStatement pstmt = null,pstmt1=null;
ResultSet rs = null;
ITMDBAccessEJB itmDBAccessLocal = new ITMDBAccessEJB();
E12GenericUtility genericUtility = null;
......@@ -53,7 +53,7 @@ public class DistOpenPrc extends ActionHandlerEJB
String chgTerm = ""; String chgUser = "";
int upCount = 0;
String status = ""; String status1 = ""; String confirm = ""; String dorder = "";
String disConfirm = ""; String disOrder = "";
String disConfirm = ""; String disOrder = "",qtyOrder="",qtyShipped="",disStatus="",dOrder="";
double qty = 0.0D; double qtydesp = 0.0D;
boolean flag = false;
try
......@@ -69,7 +69,7 @@ public class DistOpenPrc extends ActionHandlerEJB
chgTerm = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "CHG_TERM");
chgUser = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "CHG_USER");
System.out.println("distOrder @@@@@@@@@@@ORDER===========" + distOrder);
sql = "select confirmed,dist_order from distorder where dist_order= ?";
sql = "select confirmed,dist_order,status from distorder where dist_order= ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, distOrder);
rs = pstmt.executeQuery();
......@@ -78,6 +78,7 @@ public class DistOpenPrc extends ActionHandlerEJB
confirm = rs.getString("confirmed");
dorder = rs.getString("dist_order");
status = rs.getString("status");
}
System.out.println("Confirmed is : " + confirm);
......@@ -88,65 +89,88 @@ public class DistOpenPrc extends ActionHandlerEJB
str1 = errString;
return str1;
}
if (status.equals("P"))
{
System.out.println("already pending......@@@@@@@@@@@@@@@");
System.out.println("Confirmed is : " + dorder);
errString = itmDBAccessLocal.getErrorString("", "VTDOPEN", "");
str1 = errString;
return str1;
}
System.out.println("Status is : " + status);
rs.close();
rs = null;
pstmt.close();
pstmt = null;
sql = "select dist_order,status,confirmed from distorder where dist_order=?";
sql = "select qty_order,qty_shipped,distorder.status,distorder.dist_order from distorder_det ,distorder where distorder.dist_order=distorder_det.dist_order and distorder.dist_order=? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, dorder);
rs = pstmt.executeQuery();
System.out.println("sql@@" + sql + "resultset@@@" + rs);
if (rs.next())
while(rs.next())
{
status = rs.getString("status");
disOrder = rs.getString("dist_order");
disConfirm = rs.getString("confirmed");
System.out.println("status=========" + status);
System.out.println("qty=====" + disOrder);
System.out.println("qtydesp=======" + disConfirm);
if (status.equals("P"))
{
System.out.println("Not closed yet......@@@@@@@@@@@@@@@");
}
qtyOrder = rs.getString(1);
qtyShipped = rs.getString(2);
status = rs.getString(3);
dOrder = rs.getString(4);
if(qtyOrder.equals(qtyShipped) || qtyOrder==qtyShipped)
{
System.out.println("---------------------->FULL ISSUED, CAN NOT BE OPEN");
errString = itmDBAccessLocal.getErrorString("", "VTDOFC", "");
str1 = errString;
return str1;
}
else
{
if (status.equals("X"))
{
sql1 = " update distorder set status='P' where dist_order=?";
pstmt1 = conn.prepareStatement(sql1);
pstmt1.setString(1, dOrder);
upCount = pstmt1.executeUpdate();
pstmt1.close();
pstmt1 = null;
System.out.println("Update Count====" + upCount);
if (upCount > 0)
{
errString = itmDBAccessLocal.getErrorString("", "VTDORDOP", "");
str1 = errString;
return str1;
}
}
else
{
errString = itmDBAccessLocal.getErrorString("", "VTDONO", "");
str1 = errString;
return str1;
}
}
}
System.out.println("qtyOrder=========" + qtyOrder);
System.out.println("qtyShipped=====" + qtyShipped);
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if (status.equals("X"))
{
sql = " update distorder set status='P' where dist_order=?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, disOrder);
upCount = pstmt.executeUpdate();
pstmt.close();
pstmt = null;
System.out.println("Update Count====" + upCount);
System.out.println("Flag is distorder true@@@@");
}
else
{
errString = itmDBAccessLocal.getErrorString("", "VTDONO", "");
str1 = errString;
return str1;
}
if (upCount > 0)
{
errString = itmDBAccessLocal.getErrorString("", "VTDORDOP", "");
str1 = errString;
return str1;
}
}
catch (Exception e)
......
......@@ -9,4 +9,6 @@ public abstract interface DistOpenPrcLocal
{
public abstract String actionHandler(String paramString1, String paramString2, String paramString3)
throws RemoteException, ITMException;
public String opendistOrder(String distOrder, String xtraParams, String forcedFlag) throws RemoteException, ITMException;
}
\ No newline at end of file
......@@ -11,4 +11,5 @@ public abstract interface DistOpenPrcRemote
{
public abstract String actionHandler(String paramString1, String paramString2, String paramString3)
throws RemoteException, ITMException;
public String opendistOrder(String distOrder, String xtraParams, String forcedFlag) throws RemoteException, ITMException;
}
\ No newline at end of file
package ibase.webitm.ejb.dis.adv;
import ibase.scheduler.ejb.BaseRegisteredEJB;
import ibase.scheduler.utility.interfaces.Schedule;
import ibase.system.config.ConnDriver;
import ibase.utility.BaseException;
import ibase.utility.CommonConstants;
import ibase.utility.E12GenericUtility;
import ibase.webitm.utility.*;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.PrintStream;
import java.net.URL;
import java.rmi.RemoteException;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.StringTokenizer;
import javax.ejb.Stateless;
import javax.xml.namespace.QName;
import javax.xml.rpc.ParameterMode;
import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import org.apache.axis.encoding.XMLType;
import org.w3c.dom.Document;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
public class PorcpConfirmEJB implements Schedule
{
GenericUtility genericUtility = GenericUtility.getInstance();
Document dom = null;
boolean isError = false;
@Override
public String schedule(HashMap arg0) throws Exception {
// TODO Auto-generated method stub
return null;
}
//@Override
public String schedulePriority(String arg0) throws Exception {
// TODO Auto-generated method stub
return null;
}
@Override
public String schedule(String scheduleParamXML)throws Exception,ITMException
{
System.out.println("\n\n\n\n\n\t :::::PorcpConfirmEJB[schedule(String scheduleXML)]is called ::::");
Connection localConnection = null;
ResultSet localResultSet1 = null; ResultSet localResultSet2 = null; ResultSet localResultSet3 = null;
Statement localStatement1 = null; Statement localStatement2 = null; Statement localStatement3 = null;
int i = 0; int j = 0; int k = 0; int m = 1;
String str1 = ""; String str2 = ""; String str3 = ""; String str4 = "";
String str5 = ""; String str6 = ""; String str7 = ""; String str8 = ""; String str9 = ""; String str10 = ""; String str11 = ""; String str12 = "";
String[] arrayOfString = new String[10000];
String str13 = null;
FileWriter localFileWriter = null;
BufferedWriter localBufferedWriter = null;
SimpleDateFormat localSimpleDateFormat1 = new SimpleDateFormat("dd/MM/yyyy hh:mm:ss.SSS");
SimpleDateFormat localSimpleDateFormat2 = new SimpleDateFormat("dd-MM-yyyy hh-mm");
Document localDocument1 = null;
ConnDriver localConnDriver = new ConnDriver();
E12GenericUtility genericutility=new E12GenericUtility();
//GenericUtility localGenericUtility = GenericUtility.getInstance();
try
{
localDocument1 = genericutility.parseString(scheduleParamXML);
System.out.println("\n\n\n\n\n PorcpConfirmEJB[schedule(String scheduleXML)] Setting XtraParam..... ");
str6 = getXtraParam(localDocument1);
String str14 = "<?xml version=\"1.0\" encoding='" + CommonConstants.ENCODING + "'?>";
try
{
str13 = CommonConstants.JBOSSHOME + File.separator + "applnlog" + File.separator + "PorcpConfLog_" + localSimpleDateFormat2.format(new Date()) + ".xml";
localFileWriter = new FileWriter(str13, true);
localBufferedWriter = new BufferedWriter(localFileWriter);
localBufferedWriter.write(str14);
localBufferedWriter.newLine();
localBufferedWriter.newLine();
localBufferedWriter.write("<PROCESSED"); localBufferedWriter.write(" ");
localBufferedWriter.write("START-TIME="); localBufferedWriter.write("'" + localSimpleDateFormat1.format(new Date()) + "'"); localBufferedWriter.write(">");
localBufferedWriter.newLine();
localBufferedWriter.flush();
}
catch (Exception localException4)
{
System.out.println("[PorcpConfirmEJB:: schedule()] Exception While Creating Log File ..");
localException4.printStackTrace();
}
localConnection = localConnDriver.getConnectDB("DriverITM");
localConnection.setAutoCommit(false);
str4 = "SELECT VAR_VALUE FROM DISPARM WHERE PRD_CODE ='999999' AND VAR_NAME ='SITE_EXCLUDE_PORCP'";
System.out.println("\n[PorcpConfirmEJB:: schedule()] SQL to get Excludes Site is.." + str4);
localStatement1 = localConnection.createStatement();
localResultSet1 = localStatement1.executeQuery(str4);
if (localResultSet1.next())
{
str11 = localResultSet1.getString("VAR_VALUE");
}
if (localResultSet1 != null) { localResultSet1.close(); localResultSet1 = null; }
if (localStatement1 != null) { localStatement1.close(); localStatement1 = null;
}
System.out.println("\n[PorcpConfirmEJB:: schedule()] excludedSites From DISPARM are .." + str11);
Object localObject1;
if (str11 == null || str11.trim().length()==0 )
{
str1 = "SELECT COUNT(*) AS COUNT FROM PORCP A, SITE B WHERE A.TRAN_DATE >= (SYSDATE-7) AND A.SITE_CODE >= '00' and A.SITE_CODE <= 'zz' AND A.SITE_CODE = B.SITE_CODE AND B.SITE_TYPE ='C' AND CASE WHEN CONFIRMED IS NULL THEN 'N' ELSE CONFIRMED END ='N' AND A.TRAN_SER = 'P-RCP'";
}
else
{
localObject1 = new StringTokenizer(str11, ",");
m = ((StringTokenizer)localObject1).countTokens();
int n = 0;
System.out.println("\n[PorcpConfirmEJB:: schedule()]No Of Sites to Excludes are..." + m);
while (((StringTokenizer)localObject1).hasMoreTokens())
{
arrayOfString[n] = ((StringTokenizer)localObject1).nextToken();
if (m == 1)
{
str12 = str12 + "'" + arrayOfString[n] + "'";
}
else if (n == m - 1)
str12 = str12 + "'" + arrayOfString[n] + "'";
else {
str12 = str12 + "'" + arrayOfString[n] + "'" + ",";
}
n++;
}
str12 = "(" + str12 + ")";
System.out.println("\n[PorcpConfirmEJB:: schedule()] newExcludedSites .." + str12);
str1 = "SELECT COUNT(*) AS COUNT FROM PORCP A, SITE B WHERE A.TRAN_DATE >= (SYSDATE-7) AND A.SITE_CODE >= '00' and A.SITE_CODE <= 'zz' AND A.SITE_CODE = B.SITE_CODE AND B.SITE_TYPE ='C' AND CASE WHEN CONFIRMED IS NULL THEN 'N' ELSE CONFIRMED END ='N' AND A.SITE_CODE NOT IN " + str12 + " AND A.TRAN_SER = 'P-RCP'";
}
System.out.println("\n[PorcpConfirmEJB:: schedule()] Query to count record/s =" + str1);
localStatement1 = localConnection.createStatement();
localResultSet1 = localStatement1.executeQuery(str1);
if (localResultSet1.next())
{
i = localResultSet1.getInt("COUNT");
}
if (localResultSet1 != null) { localResultSet1.close(); localResultSet1 = null; }
if (localStatement1 != null) { localStatement1.close(); localStatement1 = null;
}
if (i == 0)
{
localBufferedWriter.write(" ");
localBufferedWriter.write("<STATUS><![CDATA[ERROR]]></STATUS>");
localBufferedWriter.newLine(); localBufferedWriter.write(" ");
localBufferedWriter.write("<ERRMSG>");
localBufferedWriter.write("Record/s Not Found in PORCP TABLE To Confirm.."); localBufferedWriter.write("</ERRMSG>");
localBufferedWriter.newLine(); localBufferedWriter.write(" ");
localBufferedWriter.write("<NOTE>");
localBufferedWriter.write("UNSUCCESSFUL Scheduler Stopped !! To continue Again Start Scheduler........ "); localBufferedWriter.write("</NOTE>");
localBufferedWriter.flush();
this.isError = true;
return "unsuccessful";
}
localBufferedWriter.write("<TOT_RECORDS>");
localBufferedWriter.write("<![CDATA[" + i + "]]>");
localBufferedWriter.write("</TOT_RECORDS>");
localBufferedWriter.newLine();
if (str11 == null || str11.trim().length()==0)
{
str2 = "SELECT A.TRAN_ID FROM PORCP A, SITE B WHERE A.TRAN_DATE >= (SYSDATE-7) AND A.SITE_CODE >= '00' and A.SITE_CODE <= 'zz' AND A.SITE_CODE = B.SITE_CODE and B.SITE_TYPE ='C' AND CASE WHEN CONFIRMED IS NULL THEN 'N' ELSE CONFIRMED END ='N' AND A.TRAN_SER = 'P-RCP'";
}
else
{
str2 = "SELECT A.TRAN_ID FROM PORCP A, SITE B WHERE A.TRAN_DATE >= (SYSDATE-7) AND A.SITE_CODE >= '00' and A.SITE_CODE <= 'zz' AND A.SITE_CODE = B.SITE_CODE and B.SITE_TYPE ='C' AND CASE WHEN CONFIRMED IS NULL THEN 'N' ELSE CONFIRMED END ='N' AND A.SITE_CODE NOT IN " + str12 + " AND A.TRAN_SER = 'P-RCP'";
}
System.out.println("\n[PorcpConfirmEJB:: schedule()] Very First Query is =" + str2);
localStatement2 = localConnection.createStatement();
localResultSet2 = localStatement2.executeQuery(str2);
while (localResultSet2.next()) { str8 = localResultSet2.getString("TRAN_ID");
System.out.println("\n\n\n\t[PorcpConfirmEJB:: schedule()] Current tranId...is.." + str8);
str3 = "SELECT TRAN_ID, CONFIRMED,SITE_CODE FROM PORCP WHERE TRAN_ID = '" + str8 + "' ";
System.out.println("\n[PorcpConfirmEJB:: schedule()] Query is =" + str3);
localStatement3 = localConnection.createStatement();
localBufferedWriter.newLine();
localBufferedWriter.write("<TRAN_ID_ATT TRAN_ID='" + str8 + "' ");
Object localObject2;
try { localResultSet3 = localStatement3.executeQuery(str3); }
catch (SQLException localSQLException)
{
localObject2 = "ORA-00054: resource busy and acquire with NOWAIT specified";
localBufferedWriter.write(">");
localBufferedWriter.newLine(); localBufferedWriter.write(" "); localBufferedWriter.write(" ");
localBufferedWriter.write("<ERRMSG>");
localBufferedWriter.write("" + localSQLException.getMessage() + "");
localBufferedWriter.write("</ERRMSG>");
localBufferedWriter.newLine();
localBufferedWriter.write("</TRAN_ID_ATT>");
localBufferedWriter.newLine();
localBufferedWriter.flush();
if (localSQLException.getMessage() != null)
{
if (((String)localObject2).equals(localSQLException.getMessage().trim()))
{
System.out.println("\n[PorcpConfirmEJB:: schedule()] Continuing for next batchId..");
continue;
}
}
}
if (localResultSet3.next())
{
str5 = localResultSet3.getString("CONFIRMED");
str8 = localResultSet3.getString("TRAN_ID");
str10 = localResultSet3.getString("SITE_CODE");
localBufferedWriter.write(" ");
localBufferedWriter.write("SITE_CODE =");
localBufferedWriter.write("'" + str10 + "'"); localBufferedWriter.write(">");
localBufferedWriter.newLine();
if (localResultSet3 != null) { localResultSet3.close(); localResultSet3 = null; }
if (localStatement3 != null) { localStatement3.close(); localStatement3 = null;
}
Node localNode1 = null; localObject2 = null;
NamedNodeMap localNamedNodeMap = null;
String str15 = ""; String str16 = ""; String str17 = ""; String str18 = "";
String str19 = getResponse(str8, str6, localConnection);
System.out.println("\n\n\n[PorcpConfirmEJB :: schedule()] response ..as..\n" + str19);
Document localDocument2 = genericutility.parseString(str19);
Node localNode2 = localDocument2.getElementsByTagName("error").item(0);
if (localNode2 != null)
{
localNamedNodeMap = localNode2.getAttributes();
}
if (localNamedNodeMap != null)
{
str15 = localNamedNodeMap.getNamedItem("type").getNodeValue().trim();
}
System.out.println("[PorcpConfirmEJB :: schedule()] msgType.." + str15);
str7 = localNamedNodeMap.getNamedItem("id").getNodeValue().trim();
System.out.println("[PorcpConfirmEJB :: schedule()] msgNo.." + str7);
if ((str15 != null && str15.trim().length()>0) && (str7 != null && str7.trim().length()>0))
{
if (str15.equalsIgnoreCase("P"))
{
System.out.println("[PorcpConfirmEJB :: schedule()] Returning Success..");
str9 = "success";
localBufferedWriter.write(" ");
localBufferedWriter.write("<STATUS><![CDATA[CONFIRMED]]></STATUS>");
localBufferedWriter.newLine(); localBufferedWriter.write(" ");
}
else if (str15.equalsIgnoreCase("E"))
{
localBufferedWriter.write(" ");
localBufferedWriter.write("<STATUS><![CDATA[ERROR]]></STATUS>"); localBufferedWriter.newLine();
try
{
localNode1 = localDocument2.getElementsByTagName("message").item(0);
}
catch (Exception localException7)
{
System.out.println("[PorcpConfirmEJB :: schedule()]Exception arises while getting error message from response");
}
if (localNode1 != null)
{
str16 = localNode1.getFirstChild().getNodeValue();
}
localBufferedWriter.write(" ");
localBufferedWriter.write("<ERROR_ID><![CDATA[" + str7 + " ]]></ERROR_ID>"); localBufferedWriter.newLine();
localBufferedWriter.write(" ");
localBufferedWriter.write("<ERR_MSG>'" + str16 + "'</ERR_MSG>"); localBufferedWriter.newLine();
localBufferedWriter.write(" ");
try
{
localObject2 = localDocument2.getElementsByTagName("description").item(0);
}
catch (Exception localException8)
{
System.out.println("[PorcpConfirmEJB :: schedule()]Exception arises while getting error description from response");
}
if (localObject2 != null)
{
str17 = ((Node)localObject2).getFirstChild().getNodeValue();
}
localBufferedWriter.write("<ERR_DESCR>'" + str17 + "'</ERR_DESCR>"); localBufferedWriter.newLine();
localBufferedWriter.write(" ");
try
{
str18 = localDocument2.getElementsByTagName("trace").item(0).getFirstChild().getNodeValue();
}
catch (Exception localException9)
{
System.out.println("[PorcpConfirmEJB :: schedule()]Exception arises while getting error trace from response");
}
localBufferedWriter.write("<ERR_TRACE>'" + str18 + "'</ERR_TRACE>");
System.out.println("[PorcpConfirmEJB :: schedule()] Returning UnSuccess..");
str9 = "unsuccessful";
}
}
if ((this.isError) || (str9.equals("unsuccessful")))
{
j++;
System.out.println("\n[PorcpConfirmEJB:: schedule()] retValue is .." + str9);
localBufferedWriter.newLine();
localBufferedWriter.write(" ");
localBufferedWriter.write("<NOTE>");
localBufferedWriter.write("UNSUCCESSFUL !!! Skipped the current tranID ");
localBufferedWriter.write("</NOTE>");
localBufferedWriter.newLine();
localBufferedWriter.write("</TRAN_ID_ATT>");
localBufferedWriter.newLine();
localBufferedWriter.flush();
}
else
{
k++;
localBufferedWriter.newLine();
localBufferedWriter.write("</TRAN_ID_ATT>");
localBufferedWriter.newLine();
localBufferedWriter.flush();
}
}
}
if (localResultSet2 != null) { localResultSet2.close(); localResultSet2 = null; }
if (localStatement2 != null) { localStatement2.close(); localStatement2 = null; }
}
catch (Exception localException2)
{
System.out.println("[PorcpConfirmEJB :: schedule()]Exception Arises ...");
try
{
localException2.printStackTrace();
if (j == 0)
{
localBufferedWriter.newLine(); localBufferedWriter.write(" ");
localBufferedWriter.write("" + localException2.getMessage() + "");
localBufferedWriter.newLine(); localBufferedWriter.write(" ");
localBufferedWriter.newLine();
localBufferedWriter.write("</TRAN_ID_ATT>");
localBufferedWriter.newLine();
localBufferedWriter.flush();
}
throw new BaseException(localException2);
}
catch (Exception localException5)
{
}
}
finally
{
System.out.println("\n ::::: [PorcpConfirmEJB:: schedule()]INSIDE FINALLY..Closing ResultSets, Statements & Conection......");
try
{
if (localResultSet2 != null) { localResultSet2.close(); localResultSet2 = null; }
if (localResultSet3 != null) { localResultSet3.close(); localResultSet3 = null; }
if (localStatement2 != null) { localStatement2.close(); localStatement2 = null; }
if (localStatement3 != null) { localStatement3.close(); localStatement3 = null;
}
if (localConnection != null) { localConnection.close(); localConnection = null; }
localBufferedWriter.newLine();
localBufferedWriter.write("<TOT_RECORDS_CONFIRMED>"); localBufferedWriter.write("<![CDATA[" + k + "]]>");
localBufferedWriter.write("</TOT_RECORDS_CONFIRMED>");
localBufferedWriter.newLine();
localBufferedWriter.write("<PROCESS_END-TIME>"); localBufferedWriter.write("<![CDATA[" + localSimpleDateFormat1.format(new Date()) + "]]>");
localBufferedWriter.write("</PROCESS_END-TIME>");
localBufferedWriter.newLine();
localBufferedWriter.write("</PROCESSED>");
localBufferedWriter.newLine();
localBufferedWriter.flush();
localBufferedWriter.close();
System.out.println("\n ::::: [PorcpConfirmEJB:: schedule()]INSIDE FINALLY..Closed ResultSets, Statements & Conection......");
}
catch (Exception localException10)
{
System.out.println("[PorcpConfirmEJB :: schedule()]Exception...Arises in Finally...");
localException10.printStackTrace();
}
System.out.println("\n ::::: [PorcpConfirmEJB:: schedule()] INSIDE FINALLY..All Connections Closed......");
}
return str9;
}
String getResponse(String paramString1, String paramString2, Connection paramConnection) throws Exception
{
String str1 = "gbf_post";
String str2 = ""; String str3 = ""; String str4 = ""; String str5 = ""; String str6 = "";
String str7 = ""; String str8 = null; String str9 = "true";
ResultSet localResultSet1 = null; ResultSet localResultSet2 = null;
Statement localStatement1 = null; Statement localStatement2 = null;
try
{
if (paramString1 != null)
{
System.out.println("\n[PorcpConfirmEJB:: getResponse()] Calling WEB Services method..");
str6 = "http://NvoServiceurl.org/" + str1;
str8 = "SELECT SERVICE_CODE,COMP_NAME,COMP_TYPE FROM SYSTEM_EVENTS WHERE OBJ_NAME ='porcp' AND EVENT_CODE = 'pre_confirm' ";
System.out.println("\n[PorcpConfirmEJB:: getResponse()] 1st selectSql :: \n" + str8);
localStatement1 = paramConnection.createStatement();
localResultSet1 = localStatement1.executeQuery(str8);
if (localResultSet1.next())
{
str4 = localResultSet1.getString("SERVICE_CODE");
str2 = localResultSet1.getString("COMP_NAME");
str7 = localResultSet1.getString("COMP_TYPE");
}
if (str8 != null) str8 = null;
if (localResultSet1 != null) { localResultSet1.close(); localResultSet1 = null; }
if (localStatement1 != null) { localStatement1.close(); localStatement1 = null;
}
str8 = "SELECT SERVICE_URI FROM SYSTEM_EVENT_SERVICES WHERE SERVICE_CODE = '" + str4 + "' ";
System.out.println("\n[PorcpConfirmEJB:: getResponse()] 2nd selectSql :: \n" + str8);
localStatement2 = paramConnection.createStatement();
localResultSet2 = localStatement2.executeQuery(str8);
if (localResultSet2.next())
{
str5 = localResultSet2.getString("SERVICE_URI");
}
System.out.println("\n[PorcpConfirmEJB:: getResponse()] ServiceCode :: " + str4);
System.out.println("\n[PorcpConfirmEJB:: getResponse()] compName :: " + str2);
System.out.println("\n[PorcpConfirmEJB:: getResponse()] compType :: " + str7);
System.out.println("\n[PorcpConfirmEJB:: getResponse()] serviceURI :: " + str5);
System.out.println("\n[PorcpConfirmEJB:: getResponse()] methodName :: " + str1);
System.out.println("[PorcpConfirmEJB:: getResponse()]tranID :: " + paramString1);
System.out.println("[PorcpConfirmEJB:: getResponse()]xtraParams :: " + paramString2);
System.out.println("[PorcpConfirmEJB:: getResponse()]forcedFlag :: " + str9);
Service localService = new Service();
Call localCall = (Call)localService.createCall();
localCall.setTargetEndpointAddress(new URL(str5));
localCall.setOperationName(new QName("http://NvoServiceurl.org", str1));
localCall.setUseSOAPAction(true);
localCall.setSOAPActionURI(str6);
Object[] arrayOfObject = new Object[4];
System.out.println("Adding First Parameter ie. component_name=" + str2 + " to call...");
localCall.addParameter(new QName("http://NvoServiceurl.org", "component_name"), XMLType.XSD_STRING, ParameterMode.IN);
System.out.println("Adding Second Parameter ie. tran_id=" + paramString1 + " to call...");
localCall.addParameter(new QName("http://NvoServiceurl.org", "tran_id"), XMLType.XSD_STRING, ParameterMode.IN);
System.out.println("Adding Third Parameter ie. xtra_params=" + paramString2 + " to call...");
localCall.addParameter(new QName("http://NvoServiceurl.org", "xtra_params"), XMLType.XSD_STRING, ParameterMode.IN);
System.out.println("Adding Fourth Parameter ie. forced_flag=" + str9 + " to call...");
localCall.addParameter(new QName("http://NvoServiceurl.org", "forced_flag"), XMLType.XSD_STRING, ParameterMode.IN);
arrayOfObject[0] = new String(str2);
arrayOfObject[1] = new String(paramString1);
arrayOfObject[2] = new String(paramString2);
arrayOfObject[3] = new String(str9);
localCall.setReturnType(XMLType.XSD_STRING);
str3 = (String)localCall.invoke(arrayOfObject);
System.out.println("[PorcpConfirmEJB:: getResponse()]Return value [" + str3 + "]");
}
else
{
System.out.println("[PorcpConfirmEJB:: getResponse()]TranId is " + paramString1 + " Continuing for next..");
}
}
catch (Exception localException)
{
System.out.println("[PorcpConfirmEJB:: getResponse()]Exception Arises ..." + localException);
}
finally
{
try
{
if (localResultSet1 != null) { localResultSet1.close(); localResultSet1 = null; }
if (localStatement1 != null) { localStatement1.close(); localStatement1 = null; }
if (localResultSet2 != null) { localResultSet2.close(); localResultSet2 = null; }
if (localStatement2 != null) { localStatement2.close(); localStatement2 = null;
}
}
catch (SQLException localSQLException3)
{
System.out.println("\n[PorcpConfirmEJB:: getResponse()] Following Exception arises, While Closing ResultSets,Statements & Connection in Finally..");
localSQLException3.printStackTrace();
}
}
return str3;
}
public String getXtraParam(Document paramDocument) throws Exception
{
NodeList localNodeList1 = null; NodeList localNodeList2 = null; NodeList localNodeList3 = null; NodeList localNodeList4 = null;
Node localNode1 = null; Node localNode2 = null; Node localNode3 = null; Node localNode4 = null;
String str1 = null; String str2 = null; String str3 = "";
localNodeList1 = paramDocument.getElementsByTagName("CRITERIA");
if (localNodeList1 != null)
localNode1 = localNodeList1.item(0);
if (localNode1 != null) {
str1 = localNode1.getFirstChild().getNodeValue();
}
try
{
if ((str1 == null) || (str1.equals("null")))
{
localNodeList2 = paramDocument.getElementsByTagName("siteCode");
if (localNodeList2 != null)
localNode2 = localNodeList2.item(0);
if (localNode2 != null)
str1 = localNode2.getFirstChild().getNodeValue();
System.out.println("\n\n [PorcpConfirmEJB:: schedule()] Taking siteCode From <siteCode>Tag as .." + str1);
}
}
catch (Exception localException1)
{
System.out.println("[PorcpConfirmEJB:: schedule()] Following Exception arises while getting sitecode..");
localException1.printStackTrace();
}
localNodeList3 = paramDocument.getElementsByTagName("OWNER");
localNode3 = localNodeList3.item(0);
str2 = localNode3.getFirstChild().getNodeValue();
System.out.println("\n[PorcpConfirmEJB:: schedule()]Taking loginCode from <OWNER> tag ....." + str2);
try
{
if (str2 == null)
{
localNodeList4 = paramDocument.getElementsByTagName("loginCode");
if (localNodeList4 != null)
localNode4 = localNodeList4.item(0);
if (localNode4 != null)
str2 = localNode4.getFirstChild().getNodeValue();
System.out.println("\n [PorcpConfirmEJB:: schedule()] Taking loginCode From <loginCode>Tag as.." + str2);
}
}
catch (Exception localException2)
{
System.out.println("[PorcpConfirmEJB:: schedule()] Exception arises while getting sitecode as ..");
localException2.printStackTrace();
}
if ((str2 != null) && (str1 != null))
{
str3 = "loginCode=" + str2 + "~~loginSiteCode=" + str1;
System.out.println("xtraParams.." + str3);
}
else
{
System.out.println("loginCode.." + str2);
System.out.println("siteCode.." + str1);
}
return str3;
}
/* public String schedule(String paramString) throws RemoteException, BaseException
{
System.out.println("\n\n\n\n\n\t :::::PorcpConfirmEJB[schedule(String scheduleXML)]is called ::::");
Connection localConnection = null;
ResultSet localResultSet1 = null; ResultSet localResultSet2 = null; ResultSet localResultSet3 = null;
Statement localStatement1 = null; Statement localStatement2 = null; Statement localStatement3 = null;
int i = 0; int j = 0; int k = 0; int m = 1;
String str1 = ""; String str2 = ""; String str3 = ""; String str4 = "";
String str5 = ""; String str6 = ""; String str7 = ""; String str8 = ""; String str9 = ""; String str10 = ""; String str11 = ""; String str12 = "";
String[] arrayOfString = new String[10000];
String str13 = null;
FileWriter localFileWriter = null;
BufferedWriter localBufferedWriter = null;
SimpleDateFormat localSimpleDateFormat1 = new SimpleDateFormat("dd/MM/yyyy hh:mm:ss.SSS");
SimpleDateFormat localSimpleDateFormat2 = new SimpleDateFormat("dd-MM-yyyy hh-mm");
Document localDocument1 = null;
ConnDriver localConnDriver = new ConnDriver();
GenericUtility localGenericUtility = GenericUtility.getInstance();
try
{
localDocument1 = localGenericUtility.parseString(paramString);
System.out.println("\n\n\n\n\n PorcpConfirmEJB[schedule(String scheduleXML)] Setting XtraParam..... ");
str6 = getXtraParam(localDocument1);
String str14 = "<?xml version=\"1.0\" encoding='" + CommonConstants.ENCODING + "'?>";
try
{
str13 = CommonConstants.JBOSSHOME + File.separator + "applnlog" + File.separator + "PorcpConfLog_" + localSimpleDateFormat2.format(new Date()) + ".xml";
localFileWriter = new FileWriter(str13, true);
localBufferedWriter = new BufferedWriter(localFileWriter);
localBufferedWriter.write(str14);
localBufferedWriter.newLine();
localBufferedWriter.newLine();
localBufferedWriter.write("<PROCESSED"); localBufferedWriter.write(" ");
localBufferedWriter.write("START-TIME="); localBufferedWriter.write("'" + localSimpleDateFormat1.format(new Date()) + "'"); localBufferedWriter.write(">");
localBufferedWriter.newLine();
localBufferedWriter.flush();
}
catch (Exception localException4)
{
System.out.println("[PorcpConfirmEJB:: schedule()] Exception While Creating Log File ..");
localException4.printStackTrace();
}
localConnection = localConnDriver.getConnectDB("DriverITM");
localConnection.setAutoCommit(false);
str4 = "SELECT VAR_VALUE FROM DISPARM WHERE PRD_CODE ='999999' AND VAR_NAME ='SITE_EXCLUDE_PORCP'";
System.out.println("\n[PorcpConfirmEJB:: schedule()] SQL to get Excludes Site is.." + str4);
localStatement1 = localConnection.createStatement();
localResultSet1 = localStatement1.executeQuery(str4);
if (localResultSet1.next())
{
str11 = localResultSet1.getString("VAR_VALUE");
}
if (localResultSet1 != null) { localResultSet1.close(); localResultSet1 = null; }
if (localStatement1 != null) { localStatement1.close(); localStatement1 = null;
}
System.out.println("\n[PorcpConfirmEJB:: schedule()] excludedSites From DISPARM are .." + str11);
Object localObject1;
if (str11 == null)
{
str1 = "SELECT COUNT(*) AS COUNT FROM PORCP A, SITE B WHERE A.TRAN_DATE >= (SYSDATE-7) AND A.SITE_CODE >= '00' and A.SITE_CODE <= 'zz' AND A.SITE_CODE = B.SITE_CODE AND B.SITE_TYPE ='C' AND CASE WHEN CONFIRMED IS NULL THEN 'N' ELSE CONFIRMED END ='N' AND A.TRAN_SER = 'P-RCP'";
}
else
{
localObject1 = new StringTokenizer(str11, ",");
m = ((StringTokenizer)localObject1).countTokens();
int n = 0;
System.out.println("\n[PorcpConfirmEJB:: schedule()]No Of Sites to Excludes are..." + m);
while (((StringTokenizer)localObject1).hasMoreTokens())
{
arrayOfString[n] = ((StringTokenizer)localObject1).nextToken();
if (m == 1)
{
str12 = str12 + "'" + arrayOfString[n] + "'";
}
else if (n == m - 1)
str12 = str12 + "'" + arrayOfString[n] + "'";
else {
str12 = str12 + "'" + arrayOfString[n] + "'" + ",";
}
n++;
}
str12 = "(" + str12 + ")";
System.out.println("\n[PorcpConfirmEJB:: schedule()] newExcludedSites .." + str12);
str1 = "SELECT COUNT(*) AS COUNT FROM PORCP A, SITE B WHERE A.TRAN_DATE >= (SYSDATE-7) AND A.SITE_CODE >= '00' and A.SITE_CODE <= 'zz' AND A.SITE_CODE = B.SITE_CODE AND B.SITE_TYPE ='C' AND CASE WHEN CONFIRMED IS NULL THEN 'N' ELSE CONFIRMED END ='N' AND A.SITE_CODE NOT IN " + str12 + " AND A.TRAN_SER = 'P-RCP'";
}
System.out.println("\n[PorcpConfirmEJB:: schedule()] Query to count record/s =" + str1);
localStatement1 = localConnection.createStatement();
localResultSet1 = localStatement1.executeQuery(str1);
if (localResultSet1.next())
{
i = localResultSet1.getInt("COUNT");
}
if (localResultSet1 != null) { localResultSet1.close(); localResultSet1 = null; }
if (localStatement1 != null) { localStatement1.close(); localStatement1 = null;
}
if (i == 0)
{
localBufferedWriter.write(" ");
localBufferedWriter.write("<STATUS><![CDATA[ERROR]]></STATUS>");
localBufferedWriter.newLine(); localBufferedWriter.write(" ");
localBufferedWriter.write("<ERRMSG>");
localBufferedWriter.write("Record/s Not Found in PORCP TABLE To Confirm.."); localBufferedWriter.write("</ERRMSG>");
localBufferedWriter.newLine(); localBufferedWriter.write(" ");
localBufferedWriter.write("<NOTE>");
localBufferedWriter.write("UNSUCCESSFUL Scheduler Stopped !! To continue Again Start Scheduler........ "); localBufferedWriter.write("</NOTE>");
localBufferedWriter.flush();
this.isError = true;
return "unsuccessful";
}
localBufferedWriter.write("<TOT_RECORDS>");
localBufferedWriter.write("<![CDATA[" + i + "]]>");
localBufferedWriter.write("</TOT_RECORDS>");
localBufferedWriter.newLine();
if (str11 == null)
{
str2 = "SELECT A.TRAN_ID FROM PORCP A, SITE B WHERE A.TRAN_DATE >= (SYSDATE-7) AND A.SITE_CODE >= '00' and A.SITE_CODE <= 'zz' AND A.SITE_CODE = B.SITE_CODE and B.SITE_TYPE ='C' AND CASE WHEN CONFIRMED IS NULL THEN 'N' ELSE CONFIRMED END ='N' AND A.TRAN_SER = 'P-RCP'";
}
else
{
str2 = "SELECT A.TRAN_ID FROM PORCP A, SITE B WHERE A.TRAN_DATE >= (SYSDATE-7) AND A.SITE_CODE >= '00' and A.SITE_CODE <= 'zz' AND A.SITE_CODE = B.SITE_CODE and B.SITE_TYPE ='C' AND CASE WHEN CONFIRMED IS NULL THEN 'N' ELSE CONFIRMED END ='N' AND A.SITE_CODE NOT IN " + str12 + " AND A.TRAN_SER = 'P-RCP'";
}
System.out.println("\n[PorcpConfirmEJB:: schedule()] Very First Query is =" + str2);
localStatement2 = localConnection.createStatement();
localResultSet2 = localStatement2.executeQuery(str2);
while (localResultSet2.next()) { str8 = localResultSet2.getString("TRAN_ID");
System.out.println("\n\n\n\t[PorcpConfirmEJB:: schedule()] Current tranId...is.." + str8);
str3 = "SELECT TRAN_ID, CONFIRMED,SITE_CODE FROM PORCP WHERE TRAN_ID = '" + str8 + "' ";
System.out.println("\n[PorcpConfirmEJB:: schedule()] Query is =" + str3);
localStatement3 = localConnection.createStatement();
localBufferedWriter.newLine();
localBufferedWriter.write("<TRAN_ID_ATT TRAN_ID='" + str8 + "' ");
Object localObject2;
try { localResultSet3 = localStatement3.executeQuery(str3); }
catch (SQLException localSQLException)
{
localObject2 = "ORA-00054: resource busy and acquire with NOWAIT specified";
localBufferedWriter.write(">");
localBufferedWriter.newLine(); localBufferedWriter.write(" "); localBufferedWriter.write(" ");
localBufferedWriter.write("<ERRMSG>");
localBufferedWriter.write("" + localSQLException.getMessage() + "");
localBufferedWriter.write("</ERRMSG>");
localBufferedWriter.newLine();
localBufferedWriter.write("</TRAN_ID_ATT>");
localBufferedWriter.newLine();
localBufferedWriter.flush();
if (localSQLException.getMessage() != null)
{
if (((String)localObject2).equals(localSQLException.getMessage().trim()))
{
System.out.println("\n[PorcpConfirmEJB:: schedule()] Continuing for next batchId..");
continue;
}
}
}
if (localResultSet3.next())
{
str5 = localResultSet3.getString("CONFIRMED");
str8 = localResultSet3.getString("TRAN_ID");
str10 = localResultSet3.getString("SITE_CODE");
localBufferedWriter.write(" ");
localBufferedWriter.write("SITE_CODE =");
localBufferedWriter.write("'" + str10 + "'"); localBufferedWriter.write(">");
localBufferedWriter.newLine();
if (localResultSet3 != null) { localResultSet3.close(); localResultSet3 = null; }
if (localStatement3 != null) { localStatement3.close(); localStatement3 = null;
}
Node localNode1 = null; localObject2 = null;
NamedNodeMap localNamedNodeMap = null;
String str15 = ""; String str16 = ""; String str17 = ""; String str18 = "";
String str19 = getResponse(str8, str6, localConnection);
System.out.println("\n\n\n[PorcpConfirmEJB :: schedule()] response ..as..\n" + str19);
Document localDocument2 = localGenericUtility.parseString(str19);
Node localNode2 = localDocument2.getElementsByTagName("error").item(0);
if (localNode2 != null)
{
localNamedNodeMap = localNode2.getAttributes();
}
if (localNamedNodeMap != null)
{
str15 = localNamedNodeMap.getNamedItem("type").getNodeValue().trim();
}
System.out.println("[PorcpConfirmEJB :: schedule()] msgType.." + str15);
str7 = localNamedNodeMap.getNamedItem("id").getNodeValue().trim();
System.out.println("[PorcpConfirmEJB :: schedule()] msgNo.." + str7);
if ((str15 != null) && (str7 != null))
{
if (str15.equalsIgnoreCase("P"))
{
System.out.println("[PorcpConfirmEJB :: schedule()] Returning Success..");
str9 = "success";
localBufferedWriter.write(" ");
localBufferedWriter.write("<STATUS><![CDATA[CONFIRMED]]></STATUS>");
localBufferedWriter.newLine(); localBufferedWriter.write(" ");
}
else if (str15.equalsIgnoreCase("E"))
{
localBufferedWriter.write(" ");
localBufferedWriter.write("<STATUS><![CDATA[ERROR]]></STATUS>"); localBufferedWriter.newLine();
try
{
localNode1 = localDocument2.getElementsByTagName("message").item(0);
}
catch (Exception localException7)
{
System.out.println("[PorcpConfirmEJB :: schedule()]Exception arises while getting error message from response");
}
if (localNode1 != null)
{
str16 = localNode1.getFirstChild().getNodeValue();
}
localBufferedWriter.write(" ");
localBufferedWriter.write("<ERROR_ID><![CDATA[" + str7 + " ]]></ERROR_ID>"); localBufferedWriter.newLine();
localBufferedWriter.write(" ");
localBufferedWriter.write("<ERR_MSG>'" + str16 + "'</ERR_MSG>"); localBufferedWriter.newLine();
localBufferedWriter.write(" ");
try
{
localObject2 = localDocument2.getElementsByTagName("description").item(0);
}
catch (Exception localException8)
{
System.out.println("[PorcpConfirmEJB :: schedule()]Exception arises while getting error description from response");
}
if (localObject2 != null)
{
str17 = ((Node)localObject2).getFirstChild().getNodeValue();
}
localBufferedWriter.write("<ERR_DESCR>'" + str17 + "'</ERR_DESCR>"); localBufferedWriter.newLine();
localBufferedWriter.write(" ");
try
{
str18 = localDocument2.getElementsByTagName("trace").item(0).getFirstChild().getNodeValue();
}
catch (Exception localException9)
{
System.out.println("[PorcpConfirmEJB :: schedule()]Exception arises while getting error trace from response");
}
localBufferedWriter.write("<ERR_TRACE>'" + str18 + "'</ERR_TRACE>");
System.out.println("[PorcpConfirmEJB :: schedule()] Returning UnSuccess..");
str9 = "unsuccessful";
}
}
if ((this.isError) || (str9.equals("unsuccessful")))
{
j++;
System.out.println("\n[PorcpConfirmEJB:: schedule()] retValue is .." + str9);
localBufferedWriter.newLine();
localBufferedWriter.write(" ");
localBufferedWriter.write("<NOTE>");
localBufferedWriter.write("UNSUCCESSFUL !!! Skipped the current tranID ");
localBufferedWriter.write("</NOTE>");
localBufferedWriter.newLine();
localBufferedWriter.write("</TRAN_ID_ATT>");
localBufferedWriter.newLine();
localBufferedWriter.flush();
}
else
{
k++;
localBufferedWriter.newLine();
localBufferedWriter.write("</TRAN_ID_ATT>");
localBufferedWriter.newLine();
localBufferedWriter.flush();
}
}
}
if (localResultSet2 != null) { localResultSet2.close(); localResultSet2 = null; }
if (localStatement2 != null) { localStatement2.close(); localStatement2 = null; }
}
catch (Exception localException2)
{
System.out.println("[PorcpConfirmEJB :: schedule()]Exception Arises ...");
try
{
localException2.printStackTrace();
if (j == 0)
{
localBufferedWriter.newLine(); localBufferedWriter.write(" ");
localBufferedWriter.write("" + localException2.getMessage() + "");
localBufferedWriter.newLine(); localBufferedWriter.write(" ");
localBufferedWriter.newLine();
localBufferedWriter.write("</TRAN_ID_ATT>");
localBufferedWriter.newLine();
localBufferedWriter.flush();
}
throw new BaseException(localException2);
}
catch (Exception localException5)
{
}
}
finally
{
System.out.println("\n ::::: [PorcpConfirmEJB:: schedule()]INSIDE FINALLY..Closing ResultSets, Statements & Conection......");
try
{
if (localResultSet2 != null) { localResultSet2.close(); localResultSet2 = null; }
if (localResultSet3 != null) { localResultSet3.close(); localResultSet3 = null; }
if (localStatement2 != null) { localStatement2.close(); localStatement2 = null; }
if (localStatement3 != null) { localStatement3.close(); localStatement3 = null;
}
if (localConnection != null) { localConnection.close(); localConnection = null; }
localBufferedWriter.newLine();
localBufferedWriter.write("<TOT_RECORDS_CONFIRMED>"); localBufferedWriter.write("<![CDATA[" + k + "]]>");
localBufferedWriter.write("</TOT_RECORDS_CONFIRMED>");
localBufferedWriter.newLine();
localBufferedWriter.write("<PROCESS_END-TIME>"); localBufferedWriter.write("<![CDATA[" + localSimpleDateFormat1.format(new Date()) + "]]>");
localBufferedWriter.write("</PROCESS_END-TIME>");
localBufferedWriter.newLine();
localBufferedWriter.write("</PROCESSED>");
localBufferedWriter.newLine();
localBufferedWriter.flush();
localBufferedWriter.close();
System.out.println("\n ::::: [PorcpConfirmEJB:: schedule()]INSIDE FINALLY..Closed ResultSets, Statements & Conection......");
}
catch (Exception localException10)
{
System.out.println("[PorcpConfirmEJB :: schedule()]Exception...Arises in Finally...");
localException10.printStackTrace();
}
System.out.println("\n ::::: [PorcpConfirmEJB:: schedule()] INSIDE FINALLY..All Connections Closed......");
}
return str9;
}
public String getXtraParam(Document paramDocument) throws Exception
{
NodeList localNodeList1 = null; NodeList localNodeList2 = null; NodeList localNodeList3 = null; NodeList localNodeList4 = null;
Node localNode1 = null; Node localNode2 = null; Node localNode3 = null; Node localNode4 = null;
String str1 = null; String str2 = null; String str3 = "";
localNodeList1 = paramDocument.getElementsByTagName("CRITERIA");
if (localNodeList1 != null)
localNode1 = localNodeList1.item(0);
if (localNode1 != null) {
str1 = localNode1.getFirstChild().getNodeValue();
}
try
{
if ((str1 == null) || (str1.equals("null")))
{
localNodeList2 = paramDocument.getElementsByTagName("siteCode");
if (localNodeList2 != null)
localNode2 = localNodeList2.item(0);
if (localNode2 != null)
str1 = localNode2.getFirstChild().getNodeValue();
System.out.println("\n\n [PorcpConfirmEJB:: schedule()] Taking siteCode From <siteCode>Tag as .." + str1);
}
}
catch (Exception localException1)
{
System.out.println("[PorcpConfirmEJB:: schedule()] Following Exception arises while getting sitecode..");
localException1.printStackTrace();
}
localNodeList3 = paramDocument.getElementsByTagName("OWNER");
localNode3 = localNodeList3.item(0);
str2 = localNode3.getFirstChild().getNodeValue();
System.out.println("\n[PorcpConfirmEJB:: schedule()]Taking loginCode from <OWNER> tag ....." + str2);
try
{
if (str2 == null)
{
localNodeList4 = paramDocument.getElementsByTagName("loginCode");
if (localNodeList4 != null)
localNode4 = localNodeList4.item(0);
if (localNode4 != null)
str2 = localNode4.getFirstChild().getNodeValue();
System.out.println("\n [PorcpConfirmEJB:: schedule()] Taking loginCode From <loginCode>Tag as.." + str2);
}
}
catch (Exception localException2)
{
System.out.println("[PorcpConfirmEJB:: schedule()] Exception arises while getting sitecode as ..");
localException2.printStackTrace();
}
if ((str2 != null) && (str1 != null))
{
str3 = "loginCode=" + str2 + "~~loginSiteCode=" + str1;
System.out.println("xtraParams.." + str3);
}
else
{
System.out.println("loginCode.." + str2);
System.out.println("siteCode.." + str1);
}
return str3;
}
String getResponse(String paramString1, String paramString2, Connection paramConnection) throws Exception
{
String str1 = "gbf_post";
String str2 = ""; String str3 = ""; String str4 = ""; String str5 = ""; String str6 = "";
String str7 = ""; String str8 = null; String str9 = "true";
ResultSet localResultSet1 = null; ResultSet localResultSet2 = null;
Statement localStatement1 = null; Statement localStatement2 = null;
try
{
if (paramString1 != null)
{
System.out.println("\n[PorcpConfirmEJB:: getResponse()] Calling WEB Services method..");
str6 = "http://NvoServiceurl.org/" + str1;
str8 = "SELECT SERVICE_CODE,COMP_NAME,COMP_TYPE FROM SYSTEM_EVENTS WHERE OBJ_NAME ='porcp' AND EVENT_CODE = 'pre_confirm' ";
System.out.println("\n[PorcpConfirmEJB:: getResponse()] 1st selectSql :: \n" + str8);
localStatement1 = paramConnection.createStatement();
localResultSet1 = localStatement1.executeQuery(str8);
if (localResultSet1.next())
{
str4 = localResultSet1.getString("SERVICE_CODE");
str2 = localResultSet1.getString("COMP_NAME");
str7 = localResultSet1.getString("COMP_TYPE");
}
if (str8 != null) str8 = null;
if (localResultSet1 != null) { localResultSet1.close(); localResultSet1 = null; }
if (localStatement1 != null) { localStatement1.close(); localStatement1 = null;
}
str8 = "SELECT SERVICE_URI FROM SYSTEM_EVENT_SERVICES WHERE SERVICE_CODE = '" + str4 + "' ";
System.out.println("\n[PorcpConfirmEJB:: getResponse()] 2nd selectSql :: \n" + str8);
localStatement2 = paramConnection.createStatement();
localResultSet2 = localStatement2.executeQuery(str8);
if (localResultSet2.next())
{
str5 = localResultSet2.getString("SERVICE_URI");
}
System.out.println("\n[PorcpConfirmEJB:: getResponse()] ServiceCode :: " + str4);
System.out.println("\n[PorcpConfirmEJB:: getResponse()] compName :: " + str2);
System.out.println("\n[PorcpConfirmEJB:: getResponse()] compType :: " + str7);
System.out.println("\n[PorcpConfirmEJB:: getResponse()] serviceURI :: " + str5);
System.out.println("\n[PorcpConfirmEJB:: getResponse()] methodName :: " + str1);
System.out.println("[PorcpConfirmEJB:: getResponse()]tranID :: " + paramString1);
System.out.println("[PorcpConfirmEJB:: getResponse()]xtraParams :: " + paramString2);
System.out.println("[PorcpConfirmEJB:: getResponse()]forcedFlag :: " + str9);
Service localService = new Service();
Call localCall = (Call)localService.createCall();
localCall.setTargetEndpointAddress(new URL(str5));
localCall.setOperationName(new QName("http://NvoServiceurl.org", str1));
localCall.setUseSOAPAction(true);
localCall.setSOAPActionURI(str6);
Object[] arrayOfObject = new Object[4];
System.out.println("Adding First Parameter ie. component_name=" + str2 + " to call...");
localCall.addParameter(new QName("http://NvoServiceurl.org", "component_name"), XMLType.XSD_STRING, ParameterMode.IN);
System.out.println("Adding Second Parameter ie. tran_id=" + paramString1 + " to call...");
localCall.addParameter(new QName("http://NvoServiceurl.org", "tran_id"), XMLType.XSD_STRING, ParameterMode.IN);
System.out.println("Adding Third Parameter ie. xtra_params=" + paramString2 + " to call...");
localCall.addParameter(new QName("http://NvoServiceurl.org", "xtra_params"), XMLType.XSD_STRING, ParameterMode.IN);
System.out.println("Adding Fourth Parameter ie. forced_flag=" + str9 + " to call...");
localCall.addParameter(new QName("http://NvoServiceurl.org", "forced_flag"), XMLType.XSD_STRING, ParameterMode.IN);
arrayOfObject[0] = new String(str2);
arrayOfObject[1] = new String(paramString1);
arrayOfObject[2] = new String(paramString2);
arrayOfObject[3] = new String(str9);
localCall.setReturnType(XMLType.XSD_STRING);
str3 = (String)localCall.invoke(arrayOfObject);
System.out.println("[PorcpConfirmEJB:: getResponse()]Return value [" + str3 + "]");
}
else
{
System.out.println("[PorcpConfirmEJB:: getResponse()]TranId is " + paramString1 + " Continuing for next..");
}
}
catch (Exception localException)
{
System.out.println("[PorcpConfirmEJB:: getResponse()]Exception Arises ..." + localException);
}
finally
{
try
{
if (localResultSet1 != null) { localResultSet1.close(); localResultSet1 = null; }
if (localStatement1 != null) { localStatement1.close(); localStatement1 = null; }
if (localResultSet2 != null) { localResultSet2.close(); localResultSet2 = null; }
if (localStatement2 != null) { localStatement2.close(); localStatement2 = null;
}
}
catch (SQLException localSQLException3)
{
System.out.println("\n[PorcpConfirmEJB:: getResponse()] Following Exception arises, While Closing ResultSets,Statements & Connection in Finally..");
localSQLException3.printStackTrace();
}
}
return str3;
}*/
}
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