Commit d1de0fbf authored by vkadam's avatar vkadam

Price list generation new screen component for item change, validation and...

Price list generation new screen component for item change, validation and Confirm transaction [D15ISUN002]


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@99565 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 1275f669
package ibase.webitm.ejb.dis;
import ibase.utility.E12GenericUtility;
import ibase.utility.CommonConstants;
import ibase.webitm.ejb.*;
import ibase.system.config.*;
import ibase.webitm.utility.ITMException;
import ibase.webitm.ejb.dis.DistCommon;
import ibase.webitm.ejb.ITMDBAccessEJB;
import java.rmi.RemoteException;
import javax.naming.InitialContext;
import javax.ejb.Stateless;
import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import org.apache.axis.encoding.XMLType;
import javax.xml.rpc.ParameterMode;
import java.text.SimpleDateFormat;
import ibase.utility.GenericUtility;
import ibase.webitm.ejb.MasterStatefulLocal;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.Timestamp;
import java.util.Calendar;
//import javax.ejb.Stateless;
import com.ibm.db2.jcc.b.SQLException;
@Stateless
public class PlistGenerationConf extends ActionHandlerEJB implements PlistGenerationConfLocal, PlistGenerationConfRemote
{
String userId = "", termId = "", lckGroup = "", loginSite = "",
loginEmpCode = "";
ibase.utility.E12GenericUtility genericUtility = new ibase.utility.E12GenericUtility();
CommonConstants commonConstants = new CommonConstants();
ibase.webitm.ejb.sys.UtilMethods utilMethods = ibase.webitm.ejb.sys.UtilMethods.getInstance();
String autoConfReqd = "", validUpto = "", exclSeries = "", finEntStr = "",
itemLotReqd = "", defSiteOwn = "";
public String confirm(String tranID, String xtraParams, String forcedFlag) throws RemoteException, ITMException
{
String retString = "";
boolean isConn = false;
Connection conn = null;
try
{
retString = confirm(tranID, xtraParams, forcedFlag, conn, isConn);
if (retString != null && retString.length() > 0)
{
throw new Exception("Exception while calling confirm for tran Id:[" + tranID + "]");
}
} catch (Exception exception)
{
System.out.println("Exception in [InvHoldConfEJB] getCurrdateAppFormat " + exception.getMessage());
}
return retString;
}
public String confirm(String tranId, String xtraParams, String forcedFlag, Connection conn, boolean connStatus) throws RemoteException, ITMException
{
PreparedStatement pstmtSql = null, pstmt1 = null, pstmt2 = null, pstmt3 = null,pstmt4=null;
ResultSet rs = null, rs1 = null, rs2 = null,rs3=null;
// FinCommon finCommon = null;
GenericUtility genericUtility = null;
ITMDBAccessEJB itmDBAccessEJB = null;
// ValidatorEJB validatorEJB = null;
System.out.println("tran id = " + tranId);
// boolean connStatus=false;
String retString = "", sql = "", confirm = "", sysDate = "", itemCode = "",unit = "", lotNoFrom = "", lotNoTo = "";
String rateType = "", isExcisable = "", siteCodeMfg = "", siteCodeOwn = "", itemSer = "", chgReffNo = "", remarks = "", unitPack = "",
parentTranId = "", reffNo = "", reffNoOld = "", priceList = "",effFromStr="",validUptoStr="",empFname="",empMname="",empLname="";
double minQty = 0.0, maxQty = 0.0, rate = 0.0, minRate = 0.0, maxRate = 0.0, shiperSize = 0.0;
String xmlStringPhdrDtl = "";
int lineNo = 0, insertGenCd = 0, packListCnt = 0, insertCount = 0,shelfLife = 0, itemOwnCnt = 0, updateCount=0;
DistCommon distCommon = null;
Timestamp systemdate = null, effFrom = null, validUpToDt = null;
StringBuffer xmlBuff = null;
try
{
if (conn == null)
{
ConnDriver connDriver = null;
connDriver = new ConnDriver();
conn = connDriver.getConnectDB("DriverITM");
conn.setAutoCommit(false);
connDriver = null;
connStatus = true;
}
// finCommon = new FinCommon();
genericUtility = new GenericUtility();
itmDBAccessEJB = new ITMDBAccessEJB();
// validatorEJB = new ValidatorEJB();
userId = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginCode");
loginSite = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginSiteCode");
termId = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "termId");
loginEmpCode = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginEmpCode");
sql = "select confirmed from pricegen_hdr where tran_id = ?";
pstmtSql = conn.prepareStatement(sql);
pstmtSql.setString(1, tranId);
rs = pstmtSql.executeQuery();
if (rs.next())
{
confirm = rs.getString("confirmed") == null ? "N" : rs.getString("confirmed");
}
rs.close();
rs = null;
pstmtSql.close();
pstmtSql = null;
/**
* Check the transaction already confirm
* */
if ("Y".equalsIgnoreCase(confirm))
{
System.out.println("Price list already confirm");
retString = itmDBAccessEJB.getErrorString("", "VTRCONF1", "", "", conn);
return retString;
} else
{
/**
* Select all required DISPARM
* */
distCommon = new DistCommon();
autoConfReqd = checkNull(distCommon.getDisparams("999999", "AUTO_CONF_PLIST", conn)); // To auto confirm generated price list [Y,N]
itemLotReqd = checkNull(distCommon.getDisparams("999999", "ITEM_LOTPACK_REQD", conn)); // item_lot_packsize entry [Y,N]
java.util.Date today = new java.util.Date();
Calendar cal = Calendar.getInstance();
cal.setTime(today);
today = cal.getTime();
SimpleDateFormat sdf = new SimpleDateFormat(genericUtility.getApplDateFormat());
sysDate = sdf.format(today);
System.out.println("System date :- [" + sysDate + "]");
if (autoConfReqd == null || autoConfReqd.trim().length() == 0 || autoConfReqd.trim().equalsIgnoreCase("NULLFOUND"))
{
autoConfReqd = "N";
}
if (itemLotReqd == null || itemLotReqd.trim().length() == 0 || itemLotReqd.trim().equalsIgnoreCase("NULLFOUND"))
{
itemLotReqd = "N";
}
systemdate = Timestamp.valueOf(genericUtility.getValidDateString(sysDate, genericUtility.getApplDateFormat(),
genericUtility.getDBDateFormat()) + " 00:00:00.0");
xmlBuff = new StringBuffer();
xmlBuff.append("<?xml version='1.0' encoding='ISO-8859-1'?><DocumentRoot>");
xmlBuff.append("<description>Datawindow Root</description>");
xmlBuff.append("<group0>");
xmlBuff.append("<description>Group0 description</description>");
xmlBuff.append("<Header0>");
xmlBuff.append("<objName><![CDATA[").append("pricelist_tran").append("]]></objName>");
xmlBuff.append("<pageContext><![CDATA[").append("1").append("]]></pageContext>");
xmlBuff.append("<objContext><![CDATA[").append("1").append("]]></objContext>");
xmlBuff.append("<editFlag><![CDATA[").append("A").append("]]></editFlag>");
xmlBuff.append("<focusedColumn><![CDATA[").append("").append("]]></focusedColumn>");
xmlBuff.append("<action><![CDATA[").append("SAVE").append("]]></action>");
xmlBuff.append("<elementName><![CDATA[").append("").append("]]></elementName>");
xmlBuff.append("<keyValue><![CDATA[").append("1").append("]]></keyValue>");
xmlBuff.append("<taxKeyValue><![CDATA[").append("").append("]]></taxKeyValue>");
xmlBuff.append("<saveLevel><![CDATA[").append("1").append("]]></saveLevel>");
xmlBuff.append("<forcedSave><![CDATA[").append(true).append("]]></forcedSave>");
xmlBuff.append("<taxInFocus><![CDATA[").append(false).append("]]></taxInFocus>");
xmlBuff.append("<description>Header0 members</description>");
/**
* Select and Generate header xml
* for 'pricelist_hdr'
* */
sql = "select price_list,emp_code__aprv,remarks,ref_no,ref_no_old from pricegen_hdr where tran_id=?";
pstmtSql = conn.prepareStatement(sql);
pstmtSql.setString(1, tranId);
rs = pstmtSql.executeQuery();
if (rs.next())
{
priceList = checkNull(rs.getString("price_list"));
reffNo = checkNull(rs.getString("ref_no"));
reffNoOld = checkNull(rs.getString("ref_no_old"));
xmlBuff.append("<Detail1 dbID=\"\" domID=\"1\" objContext=\"1\" objName=\"pricelist_tran\">");
xmlBuff.append("<attribute pkNames=\"\" selected=\"N\" status=\"N\" updateFlag=\"A\"/>");
xmlBuff.append("<tran_id/>");
xmlBuff.append("<tran_date><![CDATA[" + sysDate + "]]></tran_date>");
xmlBuff.append("<price_list><![CDATA[" + priceList + "]]></price_list>");
xmlBuff.append("<ref_no><![CDATA[" + reffNo + "]]></ref_no>");
xmlBuff.append("<ref_no_old><![CDATA[" + reffNoOld + "]]></ref_no_old>");
xmlBuff.append("<chg_date><![CDATA[" + sysDate + "]]></chg_date>");
xmlBuff.append("<chg_user><![CDATA[" + userId + "]]></chg_user>");
xmlBuff.append("<chg_term><![CDATA[" + termId + "]]></chg_term>");
xmlBuff.append("</Detail1>");
}
pstmtSql.close();
pstmtSql = null;
rs.close();
rs = null;
/**
* Select and generate details xml
* for 'pricegen_hdr' and
* */
sql = "select d.item_code,d.unit,d.eff_from,d.valid_upto,d.lot_no__from,d.lot_no__to,d.min_qty,d.max_qty,d.rate,d.rate_type," +
" d.min_rate,d.max_rate,d.is_excisable,d.site_code__mfg,d.site_code__own,i.item_ser," +
" d.shipper_size,d.shelf_life,d.chg_ref_no,d.remarks,d.unit__pack" +
" from pricegen_det d,item i where d.item_code=i.item_code and d.tran_id=?";
pstmt1 = conn.prepareStatement(sql);
pstmt1.setString(1, tranId);
rs1 = pstmt1.executeQuery();
while (rs1.next())
{
itemCode = checkNull(rs1.getString("item_code"));
unit = checkNull(rs1.getString("unit"));
effFrom = rs1.getTimestamp("eff_from");
validUpToDt = rs1.getTimestamp("valid_upto");
lotNoFrom = checkNull(rs1.getString("lot_no__from"));
lotNoTo = checkNull(rs1.getString("lot_no__to"));
minQty = rs1.getDouble("min_qty");
maxQty = rs1.getDouble("max_qty");
rate = rs1.getDouble("rate");
rateType = checkNull(rs1.getString("rate_type"));
minRate = rs1.getDouble("min_rate");
maxRate = rs1.getDouble("max_rate");
isExcisable = checkNull(rs1.getString("is_excisable"));
siteCodeMfg = checkNull(rs1.getString("site_code__mfg"));
siteCodeOwn = checkNull(rs1.getString("site_code__own"));
itemSer = checkNull(rs1.getString("item_ser"));
shiperSize = rs1.getDouble("shipper_size");
shelfLife = rs1.getInt("shelf_life");
chgReffNo = checkNull(rs1.getString("chg_ref_no"));
remarks = checkNull(rs1.getString("remarks"));
unitPack = checkNull(rs1.getString("unit__pack"));
/**
* Check price list is exist
* for item code and lot no
* */
// plistDetailCnt++;
lineNo++;
System.out.println("Line no :- ["+lineNo+"]");
effFromStr=genericUtility.getValidDateString(effFrom.toString(), genericUtility.getDBDateFormat(),
genericUtility.getApplDateFormat());
validUptoStr=genericUtility.getValidDateString(validUpToDt.toString(), genericUtility.getDBDateFormat(),
genericUtility.getApplDateFormat());
xmlBuff.append("<Detail2 dbID=\"\" domID=\"1\" objContext=\"2\" objName=\"pricelist_tran\">");
xmlBuff.append("<attribute pkNames=\"\" selected=\"N\" status=\"N\" updateFlag=\"A\"/>");
xmlBuff.append("<tran_id/>");
xmlBuff.append("<line_no><![CDATA[" + lineNo + "]]></line_no>");
xmlBuff.append("<item_code><![CDATA[" + itemCode + "]]></item_code>");
xmlBuff.append("<lot_no__from><![CDATA[" + lotNoFrom + "]]></lot_no__from>");
xmlBuff.append("<lot_no__to><![CDATA[" + lotNoTo + "]]></lot_no__to>");
xmlBuff.append("<min_qty><![CDATA[" + minQty + "]]></min_qty>");
xmlBuff.append("<max_qty><![CDATA[" + maxQty + "]]></max_qty>");
xmlBuff.append("<rate><![CDATA[" + rate + "]]></rate>");
xmlBuff.append("<rate_type><![CDATA[" + rateType + "]]></rate_type>");
xmlBuff.append("<min_rate><![CDATA[" + minRate + "]]></min_rate>");
xmlBuff.append("<max_rate><![CDATA[" + maxRate + "]]></max_rate>");
xmlBuff.append("<unit><![CDATA[" + unit + "]]></unit>");
xmlBuff.append("<eff_from><![CDATA[" + effFromStr + "]]></eff_from>");
xmlBuff.append("<valid_upto><![CDATA[" + validUptoStr + "]]></valid_upto>");
xmlBuff.append("</Detail2>");
/**
* Check is_excisable for 'gencodes' insert
* */
if ("N".equalsIgnoreCase(isExcisable))
{
System.out.println("Inserting gencodes");
insertGenCd = insertGenCodes(itemCode, lotNoFrom, loginSite, termId, loginEmpCode, sysDate, conn);
System.out.println("Gen codes insert :- [" + insertGenCd + "]");
}
/**
* Check ITEM_LOT_PACKSIZE is required
* */
if ("Y".equalsIgnoreCase(itemLotReqd))
{
System.out.println("ITEM_LOT_PACKSIZE is required");
sql = "select count(*) as COUNT from ITEM_LOT_PACKSIZE where item_code=? and lot_no__from=? and lot_no__to=?";
pstmt2 = conn.prepareStatement(sql);
pstmt2.setString(1, itemCode);
pstmt2.setString(2, lotNoFrom);
pstmt2.setString(3, lotNoTo);
rs2 = pstmt2.executeQuery();
if (rs2.next())
{
packListCnt = rs2.getInt("COUNT");
}
pstmt2.close();
pstmt2 = null;
rs2.close();
rs2 = null;
System.out.println("ITEM_LOT_PACKSIZE count :- [" + packListCnt + "]");
if (packListCnt == 0)
{
insertCount = insertItemLotPackSize(itemCode, lotNoFrom, lotNoTo, unit, loginSite, termId, loginEmpCode,
sysDate, conn, shelfLife, siteCodeMfg, siteCodeOwn, shiperSize, shelfLife, unitPack);
System.out.println("ITEM_LOT_PACKSIZE insert count :- [" + insertCount + "]");
}
}
/**
* Check before insert in 'item_lot_own' record is
* already exist
* */
sql = "select count(*) as COUNT from item_lot_own where site_code=? and item_code=? and lot_no__from=?"
+ " and lot_no__to=?";
pstmt2 = conn.prepareStatement(sql);
pstmt2.setString(1, siteCodeOwn); // use site code own
pstmt2.setString(2, itemCode);
pstmt2.setString(3, lotNoFrom);
pstmt2.setString(4, lotNoTo);
rs2 = pstmt2.executeQuery();
if (rs2.next())
{
itemOwnCnt = rs2.getInt("COUNT");
}
pstmt2.close();
pstmt2 = null;
rs2.close();
rs2 = null;
if (itemOwnCnt == 0)
{
insertCount = insertIntoItemOwn(loginSite, itemCode, itemSer, lotNoFrom, lotNoTo, loginEmpCode, termId,
sysDate, siteCodeOwn,conn);
System.out.println("Item lot own insert count :- [" + insertCount + "]");
}
}// END of detail while loop
pstmt1.close();
pstmt1=null;
rs1.close();
rs1=null;
xmlBuff.append("</Header0>");
xmlBuff.append("</group0>");
xmlBuff.append("</DocumentRoot>");
xmlStringPhdrDtl = xmlBuff.toString();
System.out.println("XML generated :- ["+xmlStringPhdrDtl+"]");
/**
* Call save data
* */
retString = saveData(loginSite, xmlStringPhdrDtl, xtraParams, conn);
System.out.println("Master statefull SAVE return :- ["+retString+"]");
if (retString.indexOf("Success") > -1)
{
System.out.println("Master statefull SAVE success..connection commite");
conn.commit();
String[] arrayForTranIdIssue = retString.split("<TranID>");
int endIndexIssue = arrayForTranIdIssue[1].indexOf("</TranID>");
parentTranId = arrayForTranIdIssue[1].substring(0, endIndexIssue);
System.out.println("@V@ Parent Tran id :- [" + parentTranId + "]");
/**
* Check auto confirm required
* for newly generated price list
* */
if ("Y".equalsIgnoreCase(autoConfReqd))
{
System.out.println("Transaction is commited before confirm !!");
retString = confirmTran("pricelist_tran", parentTranId, xtraParams, "", conn);
System.out.println("Confirm return :- [" + retString + "]");
if (retString.indexOf("VTSUCC1") <= -1)
{
parentTranId="";
}
}
}
/**
* Update confirm status,parentTranId and log in employee code
* for tranId
* in 'pricegen_hdr'
* */
if(parentTranId!=null && parentTranId.trim().length() > 0)
{
systemdate=Timestamp.valueOf(genericUtility.getValidDateString(sysDate, genericUtility.getApplDateFormat(),
genericUtility.getDBDateFormat()) + " 00:00:00.0");
sql = "update pricegen_hdr set confirmed='Y',conf_date=?, tran_id__plgen=?, emp_code__aprv=? where tran_id=?";
pstmt3 = conn.prepareStatement(sql);
pstmt3.setTimestamp(1, systemdate);
pstmt3.setString(2, parentTranId);
pstmt3.setString(3, loginEmpCode); // Log in employee code
pstmt3.setString(4, tranId);
updateCount = pstmt3.executeUpdate();
pstmt3.close();
pstmt3 = null;
// conn.commit();
System.out.println("Update count :- [" + updateCount + "]");
}
else
{
System.out.println("Connection rollback at 'pricegen_hdr' update fail");
conn.rollback();
}
if(updateCount>0)
{
System.out.println("Price list is confirm !!");
retString = itmDBAccessEJB.getErrorString("", "VTCONFIRM", "", "", conn); //Confirm successfully
}
}
// }
} catch (Exception e)
{
if (conn != null)
{
try
{
conn.rollback();
} catch (java.sql.SQLException e1)
{
e1.printStackTrace();
}
}
System.out.println("Exception : " + e);
e.printStackTrace();
throw new ITMException(e);
} finally
{
try
{
if (retString != null && retString.trim().length() > 0)
{
if (conn != null && !conn.isClosed() && connStatus)
{
if (retString.indexOf("VTCONFIRM") > -1)
{
conn.commit();
} else
{
conn.rollback();
}
conn.close();
conn = null;
}
}
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmtSql != null)
{
pstmtSql.close();
pstmtSql = null;
}
// conn.close();
} catch (Exception e)
{
System.out.println("Exception : " + e);
e.printStackTrace();
throw new ITMException(e);
}
}
return retString;
}
private int insertIntoItemOwn(String loginSite2, String itemCode, String itemSer, String lotNoFrom, String lotNoTo, String loginEmpCode2,
String termId2, String sysDate, String siteCodeOwn,Connection conn)
{
int insertCount = 0;
String sql = "";
PreparedStatement pstmt = null;
Timestamp systemdate = null;
try
{
systemdate = Timestamp.valueOf(genericUtility.getValidDateString(sysDate, genericUtility.getApplDateFormat(),
genericUtility.getDBDateFormat()) + " 00:00:00.0");
sql = "insert into item_lot_own (site_code,item_code,item_ser,lot_no__from,lot_no__to,chg_date,chg_user,chg_term)" +
" values(?,?,?,?,?,?,?,?)";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, siteCodeOwn); // Site code own
pstmt.setString(2, itemCode);
pstmt.setString(3, itemSer);
pstmt.setString(4, lotNoFrom);
pstmt.setString(5, lotNoTo);
pstmt.setTimestamp(6, systemdate);
pstmt.setString(7, loginEmpCode2);
pstmt.setString(8, termId2);
insertCount = pstmt.executeUpdate();
pstmt.close();
pstmt = null;
} catch (ITMException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
} catch (java.sql.SQLException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
} catch (Exception e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
return insertCount;
}
public String confirmTran(String businessObj, String tranId, String xtraParams, String forceFlag, Connection conn) throws ITMException
{
String methodName = "",compName = "",retString = "",serviceCode = "",serviceURI = "",actionURI = "",sql = "";
PreparedStatement pstmt = null;
ResultSet rs = null;
try
{
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");
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
System.out.println("serviceCode = " + serviceCode + " compName " + compName);
sql = "SELECT SERVICE_URI,METHOD_NAME FROM SYSTEM_EVENT_SERVICES WHERE SERVICE_CODE = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, serviceCode);
rs = pstmt.executeQuery();
if (rs.next())
{
methodName = rs.getString("METHOD_NAME");
serviceURI = rs.getString("SERVICE_URI");
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
actionURI = "http://NvoServiceurl.org/" + methodName;
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(tranId);
aobj[2] = new String(xtraParams);
aobj[3] = new String("");
// System.out.println("@@@@@@@@@@loginEmpCode:"
// +genericUtility.getValueFromXTRA_PARAMS(xtraParams,"loginEmpCode")+":");
System.out.println("@@@@@@ call.setReturnType(XMLType.XSD_STRING) executed........");
call.setReturnType(XMLType.XSD_STRING);
retString = (String) call.invoke(aobj);
System.out.println("Confirm Complete @@@@@@@@@@@ Return string from NVO is:==>[" + retString + "]");
} catch (Exception e)
{
e.printStackTrace();
throw new ITMException(e);
} finally
{
try
{
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
/*
* if( conn != null ){ conn.close(); conn = null; }
*/
} catch (Exception e)
{
System.out.println("Exception inCalling confirmed");
e.printStackTrace();
try
{
conn.rollback();
} catch (Exception s)
{
System.out.println("Unable to rollback");
s.printStackTrace();
}
throw new ITMException(e);
}
}
return retString;
}
private int insertItemLotPackSize(String itemCode, String lotNoFrom, String lotNoTo, String unit, String loginSite2, String termId2,
String loginEmpCode2, String sysDate, Connection conn, int shelfLife, String siteCodeMfg, String siteCodeOwn, double shiperSize,
int shelfLife2, String unitPack) throws ITMException
{
String sqlStr = "";
PreparedStatement pstmt = null;;
int insertCoun = 0;
Timestamp systemdate = null;
try
{
systemdate = Timestamp.valueOf(genericUtility.getValidDateString(sysDate, genericUtility.getApplDateFormat(),
genericUtility.getDBDateFormat()) + " 00:00:00.0");
sqlStr = "INSERT INTO ITEM_LOT_PACKSIZE (ITEM_CODE,LOT_NO__FROM,LOT_NO__TO,UNIT__PACK,CHG_DATE,CHG_USER,CHG_TERM," +
"SHIPPER_SIZE,SITE_CODE__MFG,SITE_CODE__OWN,UNIT__INNER_LABEL,SHELF_LIFE) VALUES(?,?,?,?,?,?,?,?,?,?,?,?)";
pstmt = conn.prepareStatement(sqlStr);
pstmt.setString(1, itemCode);
pstmt.setString(2, lotNoFrom);
pstmt.setString(3, lotNoTo);
pstmt.setString(4, unitPack);
pstmt.setTimestamp(5, systemdate);
pstmt.setString(6, loginEmpCode2);
pstmt.setString(7, termId2);
pstmt.setDouble(8, shiperSize);
pstmt.setString(9, siteCodeMfg);
pstmt.setString(10, siteCodeOwn);
pstmt.setString(11, unit);
pstmt.setInt(12, shelfLife);
insertCoun = pstmt.executeUpdate();
pstmt.close();
pstmt = null;
} catch (Exception e)
{
e.printStackTrace();
throw new ITMException(e);
}
return insertCoun;
}
private int insertGenCodes(String itemCode, String lotNo, String loginSite, String termId, String empCode,
String sysDate, Connection conn) throws Exception
{
int insertCount = 0;
String sql = "";
PreparedStatement pstmt = null;
ResultSet rs = null;
Timestamp systemdate = null;
int noRecords = 0;
try
{
systemdate = Timestamp.valueOf(genericUtility.getValidDateString(sysDate, genericUtility.getApplDateFormat(),
genericUtility.getDBDateFormat()) + " 00:00:00.0");
sql = "select count(1) from gencodes where fld_name='BATCH_EXEMPTED' and mod_name='W_EXC_EXEMPTED' and fld_value=?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, itemCode.trim() + "," + lotNo.trim());
rs = pstmt.executeQuery();
if (rs.next())
{
noRecords = rs.getInt(1);
}
pstmt.close();
pstmt = null;
rs.close();
rs = null;
if (noRecords == 0)
{
sql = "insert into gencodes (fld_name, mod_name, fld_value, descr, chg_date, chg_user, chg_term) values(?,?,?,?,?,?,?)";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, "BATCH_EXEMPTED");
pstmt.setString(2, "W_EXC_EXEMPTED");
pstmt.setString(3, itemCode.trim() + "," + lotNo.trim());
pstmt.setString(4, itemCode.trim() + "," + lotNo.trim());
pstmt.setTimestamp(5, systemdate);
pstmt.setString(6, empCode);
pstmt.setString(7, termId);
insertCount = pstmt.executeUpdate();
pstmt.close();
pstmt = null;
}
} catch (SQLException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
} catch (ITMException itm)
{
itm.printStackTrace();
}
return insertCount;
}
private String saveData(String siteCode, String xmlString, String xtraParams, Connection conn) throws ITMException
{
System.out.println("saving data...........");
InitialContext ctx = null;
String retString = null;
MasterStatefulLocal masterStateful = null; // for ejb3
ibase.utility.UserInfoBean userInfo;
String chgUser = "", chgTerm = "";
String loginCode = "", loginEmpCode = "", loginSiteCode = "";
E12GenericUtility genericUtility = new E12GenericUtility();
try
{
AppConnectParm appConnect = new AppConnectParm();
ctx = new InitialContext(appConnect.getProperty());
masterStateful = (MasterStatefulLocal) ctx.lookup("ibase/MasterStatefulEJB/local");
System.out.println("-----------masterStateful------- " + masterStateful);
String[] authencate = new String[2];
authencate[0] = "";
authencate[1] = "";
System.out.println("xmlString to masterstateful [" + xmlString + "]");
userInfo = new ibase.utility.UserInfoBean();
System.out.println("xtraParams>>>>" + xtraParams);
chgUser = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "chgUser");
chgTerm = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "chgTerm");
loginCode = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginCode");
loginEmpCode = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginEmpCode");
loginSiteCode = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginSiteCode");
userInfo.setEmpCode(loginEmpCode);
userInfo.setRemoteHost(chgTerm);
userInfo.setSiteCode(loginSiteCode);
userInfo.setLoginCode(loginCode);
userInfo.setEntityCode(loginEmpCode);
System.out.println("userInfo>>>>>" + userInfo);
System.out.println("chgUser :" + chgUser);
System.out.println("chgTerm :" + chgTerm);
System.out.println("loginCode :" + loginCode);
System.out.println("loginEmpCode :" + loginEmpCode);
retString = masterStateful.processRequest(userInfo, xmlString, true, conn);
System.out.println("--retString - -" + retString);
} catch (ITMException itme)
{
System.out.println("ITMException :CreateDistOrder :saveData :==>");
throw itme;
} catch (Exception e)
{
e.printStackTrace();
System.out.println("Exception :CreateDistOrder :saveData :==>");
throw new ITMException(e);
}
return retString;
}
private String checkNull(String input)
{
if (input == null)
{
input = "";
}
return input;
}
}
package ibase.webitm.ejb.dis;
import ibase.webitm.utility.ITMException;
import ibase.webitm.ejb.*;
import java.sql.Connection;
import java.rmi.RemoteException;
import javax.ejb.Local;
@Local
public interface PlistGenerationConfLocal extends ActionHandlerLocal
{
public String confirm(String tranID, String xtraParams, String forcedFlag) throws RemoteException,ITMException;
public String confirm( String tranId, String xtraParams,String forcedFlag, Connection conn, boolean connStatus ) throws RemoteException,ITMException;
}
package ibase.webitm.ejb.dis;
import ibase.webitm.utility.ITMException;
import ibase.webitm.ejb.*;
import java.sql.Connection;
import java.rmi.RemoteException;
import javax.ejb.Remote;
@Remote
public interface PlistGenerationConfRemote extends ActionHandlerRemote
{
public String confirm(String tranID, String xtraParams, String forcedFlag) throws RemoteException,ITMException;
//new method by gulzar - 25/11/11 to call from postsave component
public String confirm( String tranId, String xtraParams,String forcedFlag, Connection conn, boolean connStatus ) throws RemoteException,ITMException;
}
package ibase.webitm.ejb.dis;
import java.rmi.RemoteException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.Timestamp;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import javax.ejb.Stateless;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import ibase.system.config.ConnDriver;
import ibase.webitm.ejb.ValidatorEJB;
import ibase.webitm.ejb.fin.FinCommon;
import ibase.webitm.ejb.sys.UtilMethods;
import ibase.webitm.utility.GenericUtility;
import ibase.webitm.utility.ITMException;
@Stateless
public class PlistGenerationIC extends ValidatorEJB implements PlistGenerationICLocal, PlistGenerationICRemote
{
GenericUtility genericUtility = GenericUtility.getInstance();
FinCommon finCommon = null;
ValidatorEJB validator = null;
Date effFrom = null;
UtilMethods utilMethods = UtilMethods.getInstance();
String dateStr = "";
String errFldName = "";
String errorType ="";
@Override
public String wfValData() throws RemoteException,ITMException
{
return "";
}
@Override
public String itemChanged() throws RemoteException,ITMException
{
return "";
}
@Override
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
{
System.out.println("Val xmlString :: " + xmlString);
System.out.println("Val xmlString1 :: " + xmlString1);
System.out.println("Val xmlString2 :: " + xmlString2);
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) {
throw new ITMException(e);
}
return (errString);
}
@Override
public String wfValData(Document dom, Document dom1, Document dom2, String objContext, String editFlag, String xtraParams)
throws RemoteException, ITMException
{
NodeList parentNodeList = null;
NodeList childNodeList = null;
Node parentNode = null;
Node childNode = null;
String childNodeName = null;
String errString = "",errCode = "",errorType = "",userId = "",sql = "",itemCode = "",siteCodeMfg="",siteCodeOwn="",unitPack="",refNo = "";
String keyFlag = "",manageType = "",priceListParent = "",priceList = "",priceListTar = "",calcMethod = "",tranId = "",sql1 = "",active = "";
Date validUpto = null;
String validUptoStr = "",effFromStr = "",minRateStr = "",maxRateStr = "";
double maxRate=0,shiperSize=0.0;
double shelfLife=0;
String rateStr = "",shiperSizeStr="",shelfLifeStr="",lotNoFrom="",lotNoTo="",empCodeAprv="";
double rate = 0,minRate = 0;
String unit ="";
int ctr = 0,count = 0,currentFormNo = 0;
double minQty = 0,maxQty = 0;;
String minQtyStr = "",maxQtyStr = "";
int childNodeListLength;
StringBuffer valueXmlString = new StringBuffer();
ArrayList<String> errList = new ArrayList();
ArrayList<String> errFields = new ArrayList<String>();
Connection conn = null;
PreparedStatement pstmt = null;
ResultSet rs = null;
ConnDriver connDriver = new ConnDriver();
StringBuffer errStringXml = new StringBuffer(
"<?xml version = \"1.0\"?> \r\n <Root> <Errors>");
try {
conn = connDriver.getConnectDB("DriverITM");
SimpleDateFormat simpleDateFormat = new SimpleDateFormat(genericUtility.getApplDateFormat());
SimpleDateFormat dbDateFormat = new SimpleDateFormat(genericUtility.getInstance().getDBDateFormat());
userId = getValueFromXTRA_PARAMS(xtraParams, "loginCode");
conn = connDriver.getConnectDB("DriverITM");
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>");
switch (currentFormNo)
{
case 1:
System.out.println("testing case 1 for validation ");
parentNodeList = dom.getElementsByTagName("Detail1");
valueXmlString.append("<Detail1>");
parentNode = parentNodeList.item(0);
childNodeList = parentNode.getChildNodes();
childNodeListLength = childNodeList.getLength();
for (ctr = 0; ctr < childNodeListLength; ctr++)
{
childNode = childNodeList.item(ctr);
childNodeName = childNode.getNodeName();
System.out.println("pricelist>>>><<<<");
if (childNodeName.equalsIgnoreCase("price_list"))
{
priceList = genericUtility.getColumnValue("price_list",dom);
if(priceList == null )
{
errCode ="VMPRLNULL";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
break;
}
if (priceList != null && priceList.trim().length() > 0)
{
sql1 = "select count(*) from pricelist_mst where price_list = ?";
pstmt = conn.prepareStatement(sql1);
pstmt.setString(1, priceList);
rs = pstmt.executeQuery();
if (rs.next())
{
count = rs.getInt(1);
System.out.println("Count is " + count);
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if (count == 0)
{
errCode = "VTPLIST";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
break;
}
else
{
sql = "Select manage_type from pricelist_mst where price_list = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, priceList);
rs = pstmt.executeQuery();
if (rs.next())
{
manageType = checkNull(rs.getString(1));
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if (errCode == null || errCode.trim().length() == 0)
{
if (manageType.equalsIgnoreCase("M"))
{
errCode = "VTMTYPE";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
break;
}
}
}
}
}
else if(childNodeName.equalsIgnoreCase("tran_date"))
{
dateStr =genericUtility.getColumnValue("tran_date", dom);
if (dateStr == null)
{
errCode = "VTTRNDTNUL";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
break;
}
}
else if (childNodeName.equalsIgnoreCase("tran_id"))
{
tranId = genericUtility.getColumnValue("tran_id", dom);
sql = "select key_flag from transetup where tran_window = 'w_pricelist_tran' ";
pstmt = conn.prepareStatement(sql);
rs = pstmt.executeQuery();
if (rs.next())
{
keyFlag = rs.getString(1);
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if (keyFlag == null)
{
keyFlag = "M";
tranId = genericUtility.getColumnValue("tran_id",
dom);
}
if (keyFlag.equalsIgnoreCase("M")
&& (tranId == null || tranId.trim().length() == 0))
{
errCode = "VMCODNULL";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
break;
}
else if (editFlag.equalsIgnoreCase("A"))
{
sql = "select count(*) from pricelist_hdr where tran_id = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, tranId);
rs = pstmt.executeQuery();
if (rs.next())
{
count = rs.getInt(1);
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if (count > 0)
{
errCode = "VMDUPL1";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
break;
}
}
}
else if (childNodeName.equalsIgnoreCase("ref_no")
|| childNodeName.equalsIgnoreCase("ref_no_old"))
{
refNo = genericUtility.getColumnValue(childNodeName,
dom);
if (refNo == null)
{
errCode = "VTREFNONUL";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
break;
}
}
}
valueXmlString.append("</Detail1>");
break;
case 2:
parentNodeList = dom.getElementsByTagName("Detail2");
parentNode = parentNodeList.item(0);
childNodeList = parentNode.getChildNodes();
valueXmlString.append("<Detail2>");
ctr =0;
childNodeListLength = childNodeList.getLength();
for (ctr = 0; ctr < childNodeListLength; ctr++) {
childNode = childNodeList.item(ctr);
childNodeName = childNode.getNodeName();
System.out.println("testing case 2 for validation ");
if (childNodeName.equalsIgnoreCase("item_code"))
{
itemCode = genericUtility.getColumnValue("item_code",
dom);
if (itemCode == null || itemCode.trim().length() == 0)
{
errCode = "VTITMNL";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
break;
}
sql = "select count(*) from item where item_code = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, itemCode);
rs = pstmt.executeQuery();
if (rs.next())
{
count = rs.getInt(1);
}
if (count == 0)
{
errCode = "VMITEM_CD";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
break;
} else {
sql1 = "select active from item where item_code = ?";
pstmt = conn.prepareStatement(sql1);
pstmt.setString(1, itemCode);
rs = pstmt.executeQuery();
if (rs.next()) {
active = rs.getString(1);
}
pstmt.close();
pstmt=null;
rs.close();
rs=null;
if (active.equalsIgnoreCase("N"))
{
errCode = "VTITEM4";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
break;
}
}
}
else if (childNodeName.equalsIgnoreCase("unit"))
{
count =0;
unit = genericUtility.getColumnValue("unit",
dom);
sql = "select count(*) from uom where unit = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,unit);
rs = pstmt.executeQuery();
if (rs.next())
{
count = rs.getInt(1);
}
pstmt.close();
pstmt=null;
rs.close();
rs=null;
if (count == 0)
{
errCode = "VTINVUNT02";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
break;
}
}
else if (childNodeName.equalsIgnoreCase("max_qty")||(childNodeName.equalsIgnoreCase("min_qty")))
{
maxQtyStr = genericUtility.getColumnValue("max_qty",dom);
minQtyStr = genericUtility.getColumnValue("min_qty",
dom);
if(maxQtyStr == null || minQtyStr.trim().length() == 0 || minQtyStr == null || minQtyStr.trim().length() == 0 )
{
errCode = "NULLQTY";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
break;
}
//maxQty = maxQtyStr == null ? 0 : maxQtyStr.trim().length() == 0 ? 0 : Integer.parseInt(maxQtyStr.trim());
if((minQtyStr.trim().length() > 0||minQtyStr !=null )&& (maxQtyStr.trim().length() >0 ||maxQtyStr != null ))
{
minQty = Double.parseDouble(minQtyStr.trim());
maxQty = Double.parseDouble(maxQtyStr.trim());
if(minQty<0 || maxQty<0)
{
errCode = "NULLQTY";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
break;
}
if (maxQty < minQty)
{
errCode = "VMMINQTY";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
break;
}
}
}
else if ((childNodeName.equalsIgnoreCase("min_rate"))||(childNodeName.equalsIgnoreCase("rate"))
||(childNodeName.equalsIgnoreCase("max_rate")))
{
minRateStr = checkNull(genericUtility.getColumnValue("min_rate",dom));
maxRateStr = checkNull(genericUtility.getColumnValue("max_rate",dom));
rateStr = checkNull(genericUtility.getColumnValue("rate", dom));
if((minRateStr !=null || minRateStr.trim().length() > 0) && (rateStr != null || rateStr.trim().length() >0 ) &&
(maxRateStr !=null || maxRateStr.trim().length() > 0))
{
minRate = Double.parseDouble(minRateStr);
rate = Double.parseDouble(rateStr);
maxRate = Double.parseDouble(maxRateStr);
if(rate<0 || minRate<0 )
{
errCode = "VTSUBCRATE";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
break;
}
if (rate < minRate)
{
errCode = "VMMINRATE";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
break;
}
if (maxRate < minRate)
{
errCode = "VTRATE7";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
break;
}
}
}
else if (childNodeName.equalsIgnoreCase("valid_upto"))
{
System.out.println("validupto chidnode name" + childNodeName);
validUptoStr = checkNull(genericUtility.getColumnValue("valid_upto", dom));
effFromStr = checkNull(genericUtility.getColumnValue("eff_from",dom));
System.out.println("Valid upto" + validUptoStr);
if((validUptoStr!=null && validUptoStr.trim().length() > 0) && (effFromStr!=null && effFromStr.trim().length()> 0))
{
System.out.println("Inside validupto condition");
//stmtMaster.setTimestamp( 1, java.sql.Timestamp.valueOf(genericUtility.getValidDateTimeString( ldtTranDateFrom, genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat())));
SimpleDateFormat sdf1=new SimpleDateFormat("dd/MM/yy");
effFrom=sdf1.parse(effFromStr);
validUpto=sdf1.parse(validUptoStr);
if (validUpto.before(effFrom))
{
errCode = "VTVALUPTOE";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
break;
}
}
}
else if (childNodeName.equalsIgnoreCase("site_code__mfg"))
{
siteCodeMfg = checkNull(genericUtility.getColumnValue("site_code__mfg", dom));
if(siteCodeMfg==null || siteCodeMfg.trim().length()==0)
{
errCode = "VTSTMFGNLL";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
break;
}
else
{
sql = "select count(*) from site where site_code=?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,siteCodeMfg);
rs = pstmt.executeQuery();
if (rs.next())
{
count = rs.getInt(1);
}
pstmt.close();
pstmt=null;
rs.close();
rs=null;
if(count==0)
{
errCode = "VTINVSTMFG";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
break;
}
}
}
else if (childNodeName.equalsIgnoreCase("site_code__own"))
{
siteCodeOwn = checkNull(genericUtility.getColumnValue("site_code__own", dom));
if(siteCodeOwn==null || siteCodeOwn.trim().length()==0)
{
errCode = "VTSTOWNNLL";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
break;
}
else
{
sql = "select count(*) from site where site_code=?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,siteCodeOwn);
rs = pstmt.executeQuery();
if (rs.next())
{
count = rs.getInt(1);
}
pstmt.close();
pstmt=null;
rs.close();
rs=null;
if(count==0)
{
errCode = "VTINVSTOWN";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
break;
}
}
}
else if (childNodeName.equalsIgnoreCase("unit__pack"))
{
unitPack = checkNull(genericUtility.getColumnValue("unit__pack", dom));
if(unitPack==null || unitPack.trim().length()==0)
{
errCode = "VTUNPKNLL";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
break;
}
else
{
sql = "select count(*) from uom where unit = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,unitPack);
rs = pstmt.executeQuery();
if (rs.next())
{
count = rs.getInt(1);
}
pstmt.close();
pstmt=null;
rs.close();
rs=null;
if (count == 0)
{
errCode = "VTINVUNPK";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
break;
}
}
}
else if (childNodeName.equalsIgnoreCase("shipper_size"))
{
shiperSizeStr=checkNull(genericUtility.getColumnValue("shipper_size", dom));
if(shiperSizeStr!=null && shiperSizeStr.trim().length()>0)
{
shiperSize=Double.parseDouble(shiperSizeStr);
if(shiperSize<0)
{
errCode = "VTINVSHPSZ";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
break;
}
}
}
else if (childNodeName.equalsIgnoreCase("shelf_life"))
{
shelfLifeStr=checkNull(genericUtility.getColumnValue("shelf_life", dom));
if(shelfLifeStr!=null && shelfLifeStr.trim().length()>0)
{
shelfLife=Double.parseDouble(shelfLifeStr);
if(shelfLife<0)
{
errCode = "VTINVSHLF";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
break;
}
}
}
else if (childNodeName.equalsIgnoreCase("lot_no__from"))
{
lotNoFrom=checkNull(genericUtility.getColumnValue("lot_no__from", dom));
if(lotNoFrom==null || lotNoFrom.trim().length()==0)
{
errCode = "VTLOTFRNLL";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
break;
}
}
else if (childNodeName.equalsIgnoreCase("lot_no__to"))
{
lotNoTo=checkNull(genericUtility.getColumnValue("lot_no__to", dom));
if(lotNoTo==null || lotNoTo.trim().length()==0)
{
errCode = "VTLOTTONLL";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
break;
}
}
}
valueXmlString.append("</Detail2>");
break;
}
int errListSize = errList.size();
int cnt = 0;
if(errList != null && errListSize > 0)
{
for(cnt = 0; cnt < errListSize; cnt ++)
{
errCode = errList.get((int) cnt);
System.out.println("errCode .........." + errCode);
errString = getErrorString(errFldName, errCode, userId);
errorType = errorType(conn , errCode);
if(errString.length() > 0)
{
String bifurErrString = errString.substring(errString.indexOf("<Errors>") + 8, errString.indexOf("<trace>"));
bifurErrString = bifurErrString + errString.substring(errString.indexOf("</trace>") + 8, errString.indexOf("</Errors>"));
errStringXml.append(bifurErrString);
errString = "";
}
if(errorType.equalsIgnoreCase("E"))
{
break;
}
}
errList.clear();
errList = null;
errFields.clear();
errFields = null;
errStringXml.append("</Errors> </Root> \r\n");
}
else
{
errStringXml = new StringBuffer("");
}
} catch (Exception e)
{
System.out.println(e.getMessage());
System.out.println("Exception : " + e);
e.printStackTrace();
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();
throw new ITMException( d );
}
//System.out.println("[SOrderFormEJB] Connection is Closed");
}
errString = errStringXml.toString();
return errString;
}
public String itemChanged(String xmlString, String xmlString1,
String xmlString2, String objContext, String currentColumn,
String editFlag, String xtraParams) throws RemoteException,
ITMException {
Document dom = null;
Document dom1 = null;
Document dom2 = null;
String valueXmlString = "";
System.out.println("xmlString:>>>>>>>>>>>>>>>>>>>>>>>>>> " +xmlString);
System.out.println("xmlString1:>>>>>>>>>>>>>>>>>>>>>>>>>> " +xmlString1);
System.out.println("xmlString2:>>>>>>>>>>>>>>>>>>>>>>>>>> " +xmlString2);
System.out.println("objContext:>>>>>>>>>>>>>>>>>>>>>>>>>> " +objContext);
System.out.println("currentColumn:>>>>>>>>>>>>>>>>>>>>>>>>>> " +currentColumn);
System.out.println("editFlag:>>>>>>>>>>>>>>>>>>>>>>>>>> " +editFlag);
System.out.println("xtraParams:>>>>>>>>>>>>>>>>>>>>>>>>>> " +xtraParams);
try
{
if(xmlString != null && xmlString.trim().length() > 0)
{
dom = parseString(xmlString);
}
System.out.println("dom : " + genericUtility.serializeDom(dom));
if(xmlString1 != null && xmlString1.trim().length() > 0)
{
dom1 = parseString(xmlString1);
}
System.out.println("dom1" +genericUtility.serializeDom(dom1));
if(xmlString2 != null && xmlString2.trim().length() > 0)
{
dom2 = parseString(xmlString2);
}
System.out.println("dom2" + genericUtility.serializeDom(dom2));
valueXmlString = itemChanged(dom, dom1, dom2, objContext, currentColumn, editFlag, xtraParams);
} catch (Exception e)
{
System.out.println("Exception : [PriceListGen][itemChanged( String, String )] :==>\n"+ e.getMessage());
}
return valueXmlString;
}
public String itemChanged(Document dom, Document dom1, Document dom2,
String objContext, String currentColumn, String editFlag,
String xtraParams) throws RemoteException, ITMException
{
StringBuffer valueXmlString = new StringBuffer();
NodeList parentNodeList = null;
NodeList childNodeList = null;
Node parentNode = null;
Node childNode = null;
Node parentNode1 = null;
String descr = "";
String itemCode = "";
String childNodeName = null;
String columnValue = "";
String priceList = "";
String unit = "";
String sql = "";
int ctr = 0;
String errString = "";
String refNo="",userId="",loginSite="",termId="",empCode="";
int currentFormNo = 0;
double shelfLife=0.0;
String pdescr ="";
String effFromStr = "";
Connection conn = null;
PreparedStatement pstmt = null, pstmt1 = null, pstmt2 = null;
ResultSet rs = null, rs1 = null, rs2 = null;
GenericUtility genericUtility = GenericUtility.getInstance();
ConnDriver connDriver = new ConnDriver();
try {
System.out.println("dom : " + genericUtility.serializeDom(dom));
System.out.println("dom1" +genericUtility.serializeDom(dom1));
System.out.println("dom2" + genericUtility.serializeDom(dom2));
System.out.println("objContext" + objContext);
System.out.println("currentColumn"+currentColumn);
System.out.println("editFlag" +editFlag);
System.out.println("xtraParams" + xtraParams);
userId = genericUtility.getValueFromXTRA_PARAMS(xtraParams,"loginCode");
loginSite = genericUtility.getValueFromXTRA_PARAMS(xtraParams,"loginSiteCode");
termId = genericUtility.getValueFromXTRA_PARAMS( xtraParams, "termId" );
empCode = genericUtility.getValueFromXTRA_PARAMS( xtraParams, "loginEmpCode" );
conn = connDriver.getConnectDB("DriverITM");
conn.setAutoCommit(false);
connDriver = null;
System.out.println("editFlag@@ : ["+editFlag+"]");
Calendar currentDate = Calendar.getInstance();
SimpleDateFormat simpleDateFormat = new SimpleDateFormat(genericUtility.getApplDateFormat());
String currDate = simpleDateFormat.format(currentDate.getTime());
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>");
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));
System.out.println("currentColumn[" + currentColumn + "]columnValue ==> '" + columnValue + "'");
System.out.println("testing case 1 for item change");
System.out.println("currentColumn"+currentColumn);
if (currentColumn.trim().equalsIgnoreCase("itm_default"))
{
java.sql.Timestamp date1 =null ;
date1 = new java.sql.Timestamp(System.currentTimeMillis()) ;
dateStr = new SimpleDateFormat(genericUtility.getApplDateFormat()).format(date1);
System.out.println("inside item 1234566775578457878 ");
valueXmlString.append("<tran_date>").append("<![CDATA[" + dateStr + "]]>").append("</tran_date>");
// valueXmlString.append("<ref_no>").append("<![CDATA[" + refNo + "]]>").append("</ref_no>");
// valueXmlString.append("<ref_no_old>").append("<![CDATA[" + refNo + "]]>").append("</ref_no_old>");
valueXmlString.append("<add_date>").append("<![CDATA[" + dateStr + "]]>").append("</add_date>");
valueXmlString.append("<add_user>").append("<![CDATA[" + empCode + "]]>").append("</add_user>");
valueXmlString.append("<add_term>").append("<![CDATA[" + termId + "]]>").append("</add_term>");
System.out.println("CHILDNODENAME14153453412341524545454524534" + childNodeName);
}
// else if (currentColumn.trim().equalsIgnoreCase("itm_defaultedit"))
// {
// Timestamp date2 = new java.sql.Timestamp(System.currentTimeMillis()) ;
// dateStr = new SimpleDateFormat(genericUtility.getApplDateFormat()).format(date2);
// System.out.println("inside item 1234566775578457878 ");
// valueXmlString.append("<tran_date>").append("<![CDATA[" + dateStr + "]]>").append("</tran_date>");
// System.out.println("@@@@@@@@ itm_defaultedit called @@@@@@@@");
// System.out.println("Childnodename itmdefaultedit" + childNodeName );
//
//
// }
//
else if (currentColumn.trim().equalsIgnoreCase("price_list"))
{
System.out.println("currentColumn1123512561564567346725672562788ASAAA" + currentColumn);
priceList = genericUtility.getColumnValue("price_list",dom);
sql = "Select descr from pricelist_mst where price_list =?";
System.out.println("PRICELIST" + priceList);
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,priceList );
rs = pstmt.executeQuery();
if (rs.next())
{
pdescr = rs.getString(1) == null ? "" : rs.getString(1);
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
System.out.println("PRICELIST DESCR" +pdescr );
valueXmlString.append("<descr>").append("<![CDATA[" + pdescr + "]]>").append("</descr>");
}
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));
// System.out.println("currentColumn..." + currentColumn);
// if (currentColumn.trim().equalsIgnoreCase("itm_default"))
// {
// priceList = genericUtility.getColumnValue("price_list", dom);
// sql = "Select plist_1,plist_2,plist_3,plist_4,plist_5,plist_6,plist_7,plist_8,plist_9,plist_10,plist_11,plist_12 from pricelist_mst where price_list = ? ";
// pstmt = conn.prepareStatement(sql);
// pstmt.setString(1, priceList);
// rs = pstmt.executeQuery();
// if (rs.next()) {
// plist1 = rs.getString("plist_1");
// plist2 = rs.getString("plist_2");
// plist3 = rs.getString("plist_3");
// plist4 = rs.getString("plist_4");
// plist5 = rs.getString("plist_5");
// plist6 = rs.getString("plist_6");
// plist7 = rs.getString("plist_7");
// plist8 = rs.getString("plist_8");
// plist9 = rs.getString("plist_9");
// plist10 = rs.getString("plist_10");
// plist11 = rs.getString("plist_11");
// plist12 = rs.getString("plist_12");
// }
// rs.close();
// rs = null;
// pstmt.close();
// pstmt = null;
// valueXmlString.append("<rate_1_t>")
// .append("<![CDATA[" + plist1 + "]]>")
// .append("</rate_1_t>");
// valueXmlString.append("<rate_2_t>")
// .append("<![CDATA[" + plist2 + "]]>")
// .append("</rate_2_t>");
// valueXmlString.append("<rate_3_t>")
// .append("<![CDATA[" + plist3 + "]]>")
// .append("</rate_3_t>");
// valueXmlString.append("<rate_4_t>")
// .append("<![CDATA[" + plist4 + "]]>")
// .append("</rate_4_t>");
// valueXmlString.append("<rate_5_t>")
// .append("<![CDATA[" + plist5 + "]]>")
// .append("</rate_5_t>");
// valueXmlString.append("<rate_6_t>")
// .append("<![CDATA[" + plist6 + "]]>")
// .append("</rate_6_t>");
// valueXmlString.append("<rate_7_t>")
// .append("<![CDATA[" + plist7 + "]]>")
// .append("</rate_7_t>");
// valueXmlString.append("<rate_8_t>")
// .append("<![CDATA[" + plist8 + "]]>")
// .append("</rate_8_t>");
// valueXmlString.append("<rate_9_t>")
// .append("<![CDATA[" + plist9 + "]]>")
// .append("</rate_9_t>");
// valueXmlString.append("<rate_10_t>")
// .append("<![CDATA[" + plist10 + "]]>")
// .append("</rate_10_t>");
// valueXmlString.append("<rate_11_t>")
// .append("<![CDATA[" + plist11 + "]]>")
// .append("</rate_11_t>");
// valueXmlString.append("<rate_12_t>")
// .append("<![CDATA[" + plist12 + "]]>")
// .append("</rate_12_t>");
// effFrom = new java.sql.Timestamp(System.currentTimeMillis()) ;
// effFrom = utilMethods.RelativeDate(effFrom, 1);
// effFromStr = new SimpleDateFormat(genericUtility.getApplDateFormat()).format(effFrom);
//
// valueXmlString.append("<eff_from>")
// .append("<![CDATA[" + effFromStr + "]]>")
// .append("</eff_from>");
//
// // effFrom = new
// // SimpleDateFormat(genericUtility.getApplDateFormat()).format(effFrom);
// valueXmlString.append("<list_type protect = \"0\">")
// .append("<![CDATA[" + 0 + "]]>")
// .append("</list_type>");
// valueXmlString.append("<order_type protect = \"0\">")
// .append("<![CDATA[" + 0 + "]]>")
// .append("</order_type>");
// }
// else if (currentColumn.trim().equalsIgnoreCase("itm_default_edit"))
// {
// /*if (currentColumn.equalsIgnoreCase("item_code"))
// {
// itemCode = genericUtility.getColumnValue("item_code",dom);
// sql = "Select descr, unit from item where item_code = ?";
// pstmt = conn.prepareStatement(sql);
// pstmt.setString(1, itemCode);
// rs = pstmt.executeQuery();
// if (rs.next())
// {
// descr = checkNull(rs.getString(1));
// unit = checkNull(rs.getString(2));
// }
// rs.close();
// rs = null;
// pstmt.close();
// pstmt = null;
// /*java.sql.Timestamp date1 =null ;
// date1 = new java.sql.Timestamp(System.currentTimeMillis()) ;
// effFromStr = new SimpleDateFormat(genericUtility.getApplDateFormat()).format(date1);
// System.out.println("inside item 1234566775578457878 ");
//
//
// effFrom = new java.sql.Timestamp(System.currentTimeMillis()) ;
//
// effFromStr = new SimpleDateFormat(genericUtility.getApplDateFormat()).format(effFrom);
//
// valueXmlString.append("<eff_from>")
// .append("<![CDATA[" + effFromStr + "]]>")
// .append("</eff_from>");
// valueXmlString.append("<descr>")
// .append("<![CDATA[" + descr + "]]>")
// .append("</descr>");
// valueXmlString.append("<unit>")
// .append("<![CDATA[" + unit + "]]>")
// .append("</unit>");
//
// }*/
// priceList = genericUtility.getColumnValue("price_list", dom);
// sql = "Select plist_1,plist_2,plist_3,plist_4,plist_5,plist_6,plist_7,plist_8,plist_9,plist_10,plist_11,plist_12 from pricelist_mst where price_list = ? ";
// pstmt = conn.prepareStatement(sql);
// pstmt.setString(1, priceList);
// rs = pstmt.executeQuery();
// if (rs.next()) {
// plist1 = rs.getString("plist_1");
// plist2 = rs.getString("plist_2");
// plist3 = rs.getString("plist_3");
// plist4 = rs.getString("plist_4");
// plist5 = rs.getString("plist_5");
// plist6 = rs.getString("plist_6");
// plist7 = rs.getString("plist_7");
// plist8 = rs.getString("plist_8");
// plist9 = rs.getString("plist_9");
// plist10 = rs.getString("plist_10");
// plist11 = rs.getString("plist_11");
// plist12 = rs.getString("plist_12");
// }
// rs.close();
// rs = null;
// pstmt.close();
// pstmt = null;
// valueXmlString.append("<rate_1_t>")
// .append("<![CDATA[" + plist1 + "]]>")
// .append("</rate_1_t>");
// valueXmlString.append("<rate_2_t>")
// .append("<![CDATA[" + plist2 + "]]>")
// .append("</rate_2_t>");
// valueXmlString.append("<rate_3_t>")
// .append("<![CDATA[" + plist3 + "]]>")
// .append("</rate_3_t>");
// valueXmlString.append("<rate_4_t>")
// .append("<![CDATA[" + plist4 + "]]>")
// .append("</rate_4_t>");
// valueXmlString.append("<rate_5_t>")
// .append("<![CDATA[" + plist5 + "]]>")
// .append("</rate_5_t>");
// valueXmlString.append("<rate_6_t>")
// .append("<![CDATA[" + plist6 + "]]>")
// .append("</rate_6_t>");
// valueXmlString.append("<rate_7_t>")
// .append("<![CDATA[" + plist7 + "]]>")
// .append("</rate_7_t>");
// valueXmlString.append("<rate_8_t>")
// .append("<![CDATA[" + plist8 + "]]>")
// .append("</rate_8_t>");
// valueXmlString.append("<rate_9_t>")
// .append("<![CDATA[" + plist9 + "]]>")
// .append("</rate_9_t>");
// valueXmlString.append("<rate_10_t>")
// .append("<![CDATA[" + plist10 + "]]>")
// .append("</rate_10_t>");
// valueXmlString.append("<rate_11_t>")
// .append("<![CDATA[" + plist11 + "]]>")
// .append("</rate_11_t>");
// valueXmlString.append("<rate_12_t>")
// .append("<![CDATA[" + plist12 + "]]>")
// .append("</rate_12_t>");
//
// effFrom = new java.sql.Timestamp(System.currentTimeMillis()) ;
// effFrom = utilMethods.RelativeDate(effFrom, 1);
// effFromStr = new SimpleDateFormat(genericUtility.getApplDateFormat()).format(effFrom);
//
// valueXmlString.append("<eff_from>")
// .append("<![CDATA[" + effFromStr + "]]>")
// .append("</eff_from>");
//
// // effFrom = new
// // SimpleDateFormat(genericUtility.getApplDateFormat()).format(effFrom);
// valueXmlString.append("<list_type protect = \"0\">")
// .append("<![CDATA[" + 0 + "]]>")
// .append("</list_type>");
// valueXmlString.append("<order_type protect = \"0\">")
// .append("<![CDATA[" + 0 + "]]>")
// .append("</order_type>");
//
//
//
// HashMap<String, Integer> hashMap = new HashMap<String, Integer>();
// hashMap.put("rate", 1);
// hashMap.put("rate_1", 2);
// hashMap.put("rate_2", 3);
// hashMap.put("rate_3", 4);
// hashMap.put("rate_4", 5);
// hashMap.put("rate_5", 6);
// hashMap.put("rate_6", 7);
// hashMap.put("rate_7", 8);
// hashMap.put("rate_8", 9);
// hashMap.put("rate_9", 10);
// hashMap.put("rate_10", 11);
// hashMap.put("rate_11", 12);
// if (hashMap.containsKey("rate"))
// {
// System.out.println("ratevalue:" + hashMap.get("rate"));
// valueXmlString.append("<min_rate>")
// .append("<![CDATA[" + rate + "]]>")
// .append("</min_rate>");
// valueXmlString.append("<max_rate>")
// .append("<![CDATA[" + rate + "]]>")
// .append("</max_rate>");
// } else if (hashMap.containsKey(childNodeName))
// {
// System.out.println("ratevalue:" + hashMap.get(childNodeName));
//
// for (int i = hashMap.get(childNodeName); i < hashMap.size(); i++)
// {
// sql = "DECLARE CUR_RATE_1 DYNAMIC CURSOR FOR SQLSA ";
// pstmt = conn.prepareStatement(sql);
// liNoStr = Integer.toString(i);
// rateStr = "rate" + liNoStr + "_formula";
// rateNo = "rate" + liNoStr;
// sql1 = "Select "
// + rateStr
// + " From Pricelist_mst Where price_list = ?";
// pstmt1 = conn.prepareStatement(sql1);
// pstmt1.setString(1, priceList);
// rs1 = pstmt1.executeQuery();
// if (rs1.next())
// {
// rate = rs1.getInt(1);
//
// }
// rs1.close();
// rs1 = null;
// pstmt1.close();
// pstmt1 = null;
// sql2 = "PREPARE SQLSA FROM " + sql1
// + "OPEN DYNAMIC CUR_RATE_1 using :"
// + priceList + ";"
// + "FETCH CUR_RATE_1; CLOSE CUR_RATE_1 ;";
// pstmt2 = conn.prepareStatement(sql2);
// rs2 = pstmt2.executeQuery();
// if (rs2.next())
// {
// formula = rs2.getString(1);
// }
// rs2.close();
// rs2 = null;
// pstmt2.close();
// pstmt2 = null;
//
// }
// }
//
// }
if (currentColumn.trim().equalsIgnoreCase("itm_default"))
{
valueXmlString.append("<min_qty>").append("<![CDATA[" + 0 + "]]>").append("</min_qty>");
valueXmlString.append("<max_qty>").append("<![CDATA[" + 999999999 + "]]>").append("</max_qty>");
valueXmlString.append("<rate>").append("<![CDATA[" + 0.0000 + "]]>").append("</rate>");
valueXmlString.append("<min_rate>").append("<![CDATA[" + 0.0000 + "]]>").append("</min_rate>");
valueXmlString.append("<max_rate>").append("<![CDATA[" + 0.0000 + "]]>").append("</max_rate>");
valueXmlString.append("<rate_type>").append("<![CDATA[" + "F" + "]]>").append("</rate_type>");
System.out.println("CHILDNODENAME14153453412341524545454524534" + childNodeName);
}
if (currentColumn.equalsIgnoreCase("item_code"))
{
itemCode = genericUtility.getColumnValue("item_code",dom);
sql = "Select descr, unit,shelf_life from item where item_code = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, itemCode);
rs = pstmt.executeQuery();
if (rs.next())
{
descr = checkNull(rs.getString(1));
unit = checkNull(rs.getString(2));
shelfLife = rs.getDouble(3);
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
effFrom = new java.sql.Timestamp(System.currentTimeMillis()) ;
effFrom = utilMethods.RelativeDate(effFrom, 1);
effFromStr = new SimpleDateFormat(genericUtility.getApplDateFormat()).format(effFrom);
valueXmlString.append("<eff_from>").append("<![CDATA[" + effFromStr + "]]>").append("</eff_from>");
valueXmlString.append("<item_descr>").append("<![CDATA[" + descr + "]]>").append("</item_descr>");
valueXmlString.append("<unit>").append("<![CDATA[" + unit + "]]>").append("</unit>");
valueXmlString.append("<shelf_life>").append("<![CDATA[" + shelfLife + "]]>").append("</shelf_life>");
}
valueXmlString.append("</Detail2>");
break;
}
valueXmlString.append("</Root>");
} catch (Exception e)
{
System.out.println(e.getMessage());
System.out.println("Exception : " + e);
e.printStackTrace();
throw new ITMException(e);
}
finally
{
try
{
if(conn!=null)
{
if(rs != null )rs.close();
if(rs1 != null )rs1.close();
if(rs2 != null )rs2.close();
rs = null;
rs1 = null;
rs2 = null;
if(pstmt != null )pstmt.close();
if(pstmt1 != null )pstmt1.close();
if(pstmt2 != null )pstmt2.close();
pstmt =null;
pstmt1 =null;
pstmt2 =null;
conn.close();
}
conn = null;
}catch(Exception d)
{
d.printStackTrace();
throw new ITMException( d );
}
}
return valueXmlString.toString();
}
private String errorType(Connection conn , String errorCode)
{
String msgType = "";
PreparedStatement pstmt = null ;
ResultSet rs = null;
try
{
String sql = " SELECT MSG_TYPE FROM MESSAGES WHERE MSG_NO = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, errorCode);
rs = pstmt.executeQuery();
while(rs.next())
{
msgType = rs.getString("MSG_TYPE");
}
}
catch(Exception ex)
{
ex.printStackTrace();
}
finally
{
try
{
if(rs != null)
{
rs.close();
rs = null;
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
}
catch(Exception e)
{
e.printStackTrace();
}
}
return msgType;
}
private String checkNull(String input)
{
if (input == null)
{
input = "";
}
return input;
}
}
\ No newline at end of file
package ibase.webitm.ejb.dis;
import java.rmi.RemoteException;
import org.w3c.dom.*;
import ibase.webitm.ejb.*;
import ibase.webitm.utility.ITMException;
import javax.ejb.Local; // added for ejb3
@Local // added for ejb3
public interface PlistGenerationICLocal extends ValidatorLocal {
public String wfValData() throws RemoteException,ITMException;
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() 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 ibase.webitm.ejb.ValidatorRemote;
import ibase.webitm.utility.ITMException;
import java.rmi.RemoteException;
import org.w3c.dom.Document;
public interface PlistGenerationICRemote extends ValidatorRemote{
public String wfValData() throws RemoteException,ITMException;
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() 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;
}
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