Commit 94ce325c authored by abibave's avatar abibave

Request Id:W16LSER004

Source Files of Pricelist master workflow by Jaffar/BPandey.


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@43833 ce508802-f39f-4f6c-b175-0d175dae99d5
parent b3adb086
package ibase.webitm.ejb.dis;
import ibase.system.config.ConnDriver;
import ibase.utility.E12GenericUtility;
import ibase.webitm.utility.ITMException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.LinkedHashMap;
import java.util.Map;
public class PriceListMasterWF
{
public String escalate(String tranId, String empCodeAprv, String xmlDataAll, String processId, String roleCode, String activityId) throws ITMException, Exception {
System.out.println("PricelistMasterWF Parameters ::: tranId["+tranId+"],empCodeAprv["+empCodeAprv+"],xmlDataAll["+xmlDataAll+"],processId["+processId+"],roleCode["+roleCode+"],activityId["+activityId+"]");
String retString = "";
boolean isError = false;
PreparedStatement pstmt = null;
ResultSet rs = null;
String sql = "";
E12GenericUtility genericUtility = null;
SimpleDateFormat simpleDateFormat = null;
String currDate = "";
String signStatus = "", userCode = "",processInfo[] = null;
int resultCnt = 0;
Connection conn = null;
ConnDriver connDriver = null;
try
{
connDriver = new ConnDriver();
genericUtility = new E12GenericUtility();
conn = connDriver.getConnectDB("DriverITM");
conn.setAutoCommit(false);
connDriver = null;
simpleDateFormat = new SimpleDateFormat(genericUtility.getApplDateTimeFormat());
currDate = simpleDateFormat.format(Calendar.getInstance().getTime() );
currDate = genericUtility.getValidDateTimeString( currDate, genericUtility.getApplDateTimeFormat(),genericUtility.getDBDateTimeFormat() ) ;
sql = "select SIGN_STATUS from OBJ_SIGN_TRANS "
+ "WHERE ltrim(rtrim(REF_SER)) = 'M-PL' AND ltrim(rtrim(REF_ID)) = ? AND ltrim(rtrim(ROLE_CODE__SIGN)) = ? "
+ "AND SIGN_STATUS = 'U'";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, tranId);
pstmt.setString(2, roleCode);
rs = pstmt.executeQuery();
if (rs.next())
{
signStatus = rs.getString("SIGN_STATUS");
}
System.out.println("signStatus = " + signStatus);
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if("U".equalsIgnoreCase(signStatus)){
sql = "select code from users where emp_code = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, empCodeAprv);
rs = pstmt.executeQuery();
if (rs.next())
{
userCode = rs.getString("code");
}
userCode = userCode == null ? "" : userCode.trim();
rs.close();
rs = null;
pstmt.close();
pstmt = null;
sql = "UPDATE OBJ_SIGN_TRANS "
+ "SET SIGN_DATE = ?, USER_ID__SIGN = ?, SIGN_REMARKS = 'HR_SPAN is over', SIGN_STATUS = 'V', EMP_CODE = ? "
+ "WHERE ltrim(rtrim(REF_SER)) = 'M-PL' AND ltrim(rtrim(REF_ID)) = ? AND ltrim(rtrim(ROLE_CODE__SIGN)) = ? "
+ "AND SIGN_STATUS = 'U'";
pstmt = conn.prepareStatement(sql);
pstmt.setTimestamp(1,java.sql.Timestamp.valueOf(currDate));
pstmt.setString(2, userCode);
pstmt.setString(3, empCodeAprv);
pstmt.setString(4, tranId);
pstmt.setString(5, roleCode);
resultCnt += pstmt.executeUpdate();
pstmt.close();
pstmt = null;
System.out.println("Update Successfully:"+resultCnt);
processInfo = processId.split(":");
sql = "UPDATE WF_PRC_STATUS "
+ "SET STATUS_DATE = ?, PROCESS_STATUS = 4, ERR_STATUS = '0', "
+ "STATUS_REMARKS='Escalated -> Completing :"+processId+" Invoked :"+processId+"' "
+ "WHERE ltrim(rtrim(REF_SER)) = 'M-PL' AND REF_ID = ? AND PROCESS_ID = ? AND INSTANCE_ID = ? AND ACTIVITY_ID = ? AND PROCESS_STATUS != 3";
pstmt = conn.prepareStatement(sql);
pstmt.setTimestamp(1,java.sql.Timestamp.valueOf(currDate));
pstmt.setString(2, tranId);
pstmt.setString(3, processInfo[0]);
pstmt.setString(4, processInfo[1]);
pstmt.setString(5, activityId);
resultCnt += pstmt.executeUpdate();
pstmt.close();
pstmt = null;
System.out.println("Update Successfully:"+resultCnt);
}
else
{
retString = "N";
}
}
catch (Exception e) {
System.out.println("Exception: CustomerMasterWF escalate method ..> " + e.getMessage());
isError = true;
throw new ITMException(e);
} finally {
if(rs !=null)
{
rs.close();rs=null;
}
if(pstmt != null)
{
pstmt.close();pstmt = null;
}
if (conn != null) {
try {
if (isError || !(resultCnt > 0)) {
conn.rollback();
retString = "N";
System.out.println("PricelistMasterWF escalate: Connection Rollback");
} else {
conn.commit();
retString = "Y";
System.out.println("PricelistMasterWF escalate: Connection Commit");
}
conn.close();
conn = null;
} catch (Exception e) {
e.printStackTrace();
}
}
}
return retString;
}
public String approverSignStatusUpdate(String tranId, String empCodeAprv, String xmlDataAll, String processId, String roleCode, String activityId, String signStatusFlag) throws ITMException, Exception {
System.out.println("Parameters ::: tranId["+tranId+"],empCodeAprv["+empCodeAprv+"],xmlDataAll["+xmlDataAll+"],processId["+processId+"],roleCode["+roleCode+"],signStatusFlag["+signStatusFlag+"]");
String retString = "",signRemarks = "",empName = "";
boolean isError = false;
PreparedStatement pstmt = null;
ResultSet rs = null;
String sql = "";
E12GenericUtility genericUtility = null;
SimpleDateFormat simpleDateFormat = null;
String currDate = "";
String userCode = "",processInfo[] = null;
int resultCnt = 0;
Connection conn = null;
ConnDriver connDriver = null;
empCodeAprv = checkNull(empCodeAprv);
tranId = checkNull(tranId);
processId = checkNull(processId);
signStatusFlag = checkNull(signStatusFlag);
roleCode = checkNull(roleCode);
try
{
connDriver = new ConnDriver();
genericUtility = new E12GenericUtility();
conn = connDriver.getConnectDB("DriverITM");
conn.setAutoCommit(false);
connDriver = null;
simpleDateFormat = new SimpleDateFormat(genericUtility.getApplDateTimeFormat());
currDate = simpleDateFormat.format( Calendar.getInstance().getTime() );
currDate = genericUtility.getValidDateTimeString( currDate, genericUtility.getApplDateTimeFormat(),genericUtility.getDBDateTimeFormat() ) ;
System.out.println(" approverSignStatusUpdate :: currDate :: ["+currDate+"]");
sql = "select u.code,e.emp_fname || ' ' || e.emp_lname as emp_name from users u inner join employee e on e.emp_code = u.emp_code where e.emp_code = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, empCodeAprv);
rs = pstmt.executeQuery();
if (rs.next())
{
userCode = checkNull(rs.getString("code"));
empName = checkNull(rs.getString("emp_name"));
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if("S".equalsIgnoreCase(signStatusFlag)){
signRemarks = "Transaction Approved by "+empName+".";
}
else if("R".equalsIgnoreCase(signStatusFlag)){
signRemarks = "Transaction Rejected by "+empName+".";
}
else{
signRemarks = "Transaction Approved by "+empName+".";
}
sql = "UPDATE OBJ_SIGN_TRANS "
+ "SET SIGN_DATE = ?, USER_ID__SIGN = ?, SIGN_REMARKS = '"+signRemarks+"', SIGN_STATUS = 'V', EMP_CODE = ? "
+ "WHERE ltrim(rtrim(REF_SER)) = 'M-PL' AND ltrim(rtrim(REF_ID)) = ? AND ltrim(rtrim(ROLE_CODE__SIGN)) = ? "
+ "AND SIGN_STATUS = 'U'";
pstmt = conn.prepareStatement(sql);
pstmt.setTimestamp(1,java.sql.Timestamp.valueOf(currDate));
pstmt.setString(2, userCode);
pstmt.setString(3, empCodeAprv);
pstmt.setString(4, tranId);
pstmt.setString(5, roleCode);
resultCnt += pstmt.executeUpdate();
pstmt.close();
pstmt = null;
System.out.println("Update Successfully:"+resultCnt);
processInfo = processId.split(":");
sql = "UPDATE WF_PRC_STATUS SET STATUS_DATE = ?, PROCESS_STATUS = 4, ERR_STATUS = '0', STATUS_REMARKS = '"+signRemarks+"' " +
"WHERE ltrim(rtrim(REF_SER)) = 'M-PL' AND REF_ID = ? AND PROCESS_ID = ? AND INSTANCE_ID = ? AND ACTIVITY_ID = ? AND PROCESS_STATUS != 3";
pstmt = conn.prepareStatement(sql);
pstmt.setTimestamp(1,java.sql.Timestamp.valueOf(currDate));
pstmt.setString(2, tranId);
pstmt.setString(3, processInfo[0]);
pstmt.setString(4, processInfo[1]);
pstmt.setString(5, activityId);
resultCnt += pstmt.executeUpdate();
pstmt.close();
pstmt = null;
System.out.println("Update Successfully:"+resultCnt);
}
catch (Exception e) {
System.out.println("Exception: approverSignStatusUpdate method ..> " + e.getMessage());
isError = true;
throw new ITMException(e);
} finally {
if(rs !=null)
{
rs.close();rs=null;
}
if(pstmt != null)
{
pstmt.close();pstmt = null;
}
if (conn != null) {
try {
if (isError || !(resultCnt > 0)) {
conn.rollback();
retString = "N";
System.out.println("approverSignStatusUpdate: Connection Rollback");
} else {
conn.commit();
retString = "Y";
System.out.println("approverSignStatusUpdate: Connection Commit");
}
conn.close();
conn = null;
} catch (Exception e) {
e.printStackTrace();
}
}
}
return retString;
}
public String checkEscalationStatus(String tranId, String empCodeAprv, String xmlDataAll, String processId, String roleCode, String activityId) throws ITMException, Exception {
System.out.println("checkEscalationStatus Parameters ::: tranId["+tranId+"],empCodeAprv["+empCodeAprv+"],xmlDataAll["+xmlDataAll+"],processId["+processId+"]");
String retString = "";
boolean isError = false;
PreparedStatement pstmt = null;
ResultSet rs = null;
String sql = "",prcId = "", instanceId = "",processInfo[] = null;
int escalationCnt = 0, finAprvObjTransCnt = 0;
Connection conn = null;
ConnDriver connDriver = null;
empCodeAprv = checkNull(empCodeAprv);
tranId = checkNull(tranId);
processId = checkNull(processId);
roleCode = checkNull(roleCode);
try
{
connDriver = new ConnDriver();
conn = connDriver.getConnectDB("DriverITM");
conn.setAutoCommit(false);
connDriver = null;
processInfo = processId.split(":");
prcId = checkNull(processInfo[0]);
instanceId = checkNull(processInfo[1]);
System.out.println(" checkEscalationStatus :: prcId :: ["+prcId+"]"+" instanceId: "+instanceId);
sql = "SELECT COUNT(DISTINCT(W.ACTIVITY_ID)) AS COUNT FROM OBJ_SIGN_TRANS O INNER JOIN WF_PRC_STATUS W " +
"ON O.REF_ID = W.REF_ID WHERE O.SIGN_STATUS='V' AND W.PROCESS_STATUS = 4 AND O.REF_ID ='"+tranId+"' AND W.INSTANCE_ID = "+instanceId+" ";
pstmt = conn.prepareStatement(sql);
rs = pstmt.executeQuery();
if (rs.next())
{
escalationCnt = rs.getInt("COUNT");
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
sql = "SELECT COUNT(W.ACTIVITY_ID) AS COUNT FROM WF_PRC_STATUS W WHERE W.ACTIVITY_ID = '"+activityId+"' AND W.REF_ID ='"+tranId+"' AND W.INSTANCE_ID = "+instanceId+" ";
pstmt = conn.prepareStatement(sql);
rs = pstmt.executeQuery();
if (rs.next())
{
finAprvObjTransCnt = rs.getInt("COUNT");
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
System.out.println("escalationCnt :"+escalationCnt+" finAprvObjTransCnt:"+finAprvObjTransCnt);
}
catch (Exception e) {
System.out.println("Exception: checkEscalationStatus method ..> " + e.getMessage());
isError = true;
throw new ITMException(e);
} finally {
if(rs !=null)
{
rs.close();rs=null;
}
if(pstmt != null)
{
pstmt.close();pstmt = null;
}
if (conn != null) {
try {
if (isError || !(finAprvObjTransCnt < 1)) {
retString = "N";
} else {
retString = "Y";
}
conn.close();
conn = null;
} catch (Exception e) {
e.printStackTrace();
}
}
}
return retString;
}
public String checkWorkflowStatus(String tranId, String empCode, String xmlDataAll, String processInstancetWf) throws ITMException, Exception {
System.out.println("Parameters ::: tranId["+tranId+"],empCode["+empCode+"],xmlDataAll["+xmlDataAll+"],processInstancetWf["+processInstancetWf);
String retString = "";
boolean isError = false;
PreparedStatement pstmt = null;
ResultSet rs = null;
String sql = "";
E12GenericUtility genericUtility = null;
SimpleDateFormat simpleDateFormat = null;
String currDate = "",custCode = "",curInstanceId = "";
String instanceId = "", processInfo[] = null, processId = "",processStatus = "";
Connection conn = null;
ConnDriver connDriver = null;
LinkedHashMap<String, ArrayList<String>> wfPrcStatusDataMap = null;
ArrayList<String> processStatusList = null;
try
{
connDriver = new ConnDriver();
genericUtility = new E12GenericUtility();
conn = connDriver.getConnectDB("DriverITM");
connDriver = null;
simpleDateFormat = new SimpleDateFormat(genericUtility.getApplDateTimeFormat());
currDate = simpleDateFormat.format( Calendar.getInstance().getTime() );
currDate = genericUtility.getValidDateTimeString( currDate, genericUtility.getApplDateTimeFormat(),genericUtility.getDBDateTimeFormat() ) ;
processInfo = processInstancetWf.split(":");
processId = checkNull(processInfo [0]);
curInstanceId = checkNull(processInfo [1]);
wfPrcStatusDataMap = new LinkedHashMap<String, ArrayList<String>>();
sql = "select ct.cust_code,wf.process_status,wf.instance_id from wf_prc_status wf left join customer ct " +
"on ct.cust_code = wf.ref_id where wf.process_id = ? and wf.ref_id = ? and wf.instance_id != ? order by wf.instance_id desc";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, processId);
pstmt.setString(2, tranId);
pstmt.setString(3, curInstanceId);
rs = pstmt.executeQuery();
while (rs.next())
{
instanceId = checkNull(rs.getString("instance_id"));
processStatus = checkNull(rs.getString("process_status"));
custCode = checkNull(rs.getString("cust_code"));
if (wfPrcStatusDataMap.containsKey(instanceId)) {
processStatusList = wfPrcStatusDataMap.get(instanceId);
processStatusList.add(processStatus);
wfPrcStatusDataMap.put(instanceId, processStatusList);
} else {
processStatusList = new ArrayList<String>();
processStatusList.add(processStatus);
wfPrcStatusDataMap.put(instanceId, processStatusList);
}
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if(wfPrcStatusDataMap.size() == 0 && "".equalsIgnoreCase(custCode)){
retString = "Y";
}
else if(wfPrcStatusDataMap.size() > 0 && "".equalsIgnoreCase(custCode)){
Map.Entry<String, ArrayList<String>> entry = wfPrcStatusDataMap.entrySet().iterator().next();
ArrayList<String> prStatusList = entry.getValue();
if(prStatusList.contains("0") || prStatusList.contains("1")){
retString = "N";
}
else{
retString = "Y";
}
}
else{
retString = "N";
}
}
catch (Exception e) {
System.out.println("Exception: PricelistMasterWF checkWorkflowStatus method ..> " + e.getMessage());
isError = true;
throw new ITMException(e);
} finally {
if(rs !=null)
{
rs.close();rs=null;
}
if(pstmt != null)
{
pstmt.close();pstmt = null;
}
if (conn != null) {
try {
if (isError) {
retString = "N";
}
conn.close();
conn = null;
} catch (Exception e) {
e.printStackTrace();
}
}
}
return retString;
}
private String checkNull(String str) {
if(str == null){
str = "";
}
else{
str = str.trim();
}
return str;
}
}
package ibase.webitm.ejb.dis;
import ibase.system.config.AppConnectParm;
import ibase.utility.E12GenericUtility;
import ibase.webitm.ejb.MasterStatefulLocal;
import ibase.webitm.ejb.ValidatorEJB;
import ibase.webitm.utility.ITMException;
import java.rmi.RemoteException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.text.SimpleDateFormat;
import java.util.Properties;
import javax.ejb.Stateless;
import javax.naming.InitialContext;
import org.w3c.dom.Document;
@Stateless
public class PriceListMasterWfEJB extends ValidatorEJB implements PriceListMasterWfEJBLocal, PriceListMasterWfEJBRemote
{
@Override
public String insertPriceListMaster(String objName,String tranId,String transInfoXml,String xtraParams,String entityCode)throws RemoteException, ITMException {
Connection conn = null;
String retString = "";
String [] authencate = new String[2];
authencate[0] = "";
authencate[1] = "";
String siteCode = "";
E12GenericUtility genericUtility = null;
Document xmlDataAll = null;
MasterStatefulLocal masterStatefulLocal = null;
System.out.println("objName: "+tranId+" tranId: "+tranId+" xtraParams: "+xtraParams+" entityCode: "+entityCode+" transInfoXml: "+transInfoXml);
String returnString = "";
try {
System.out.println("Inside Try block of PriceListMasterWfEJB.insertPriceListMaster()");
conn = getConnection();
conn.setAutoCommit(false);
AppConnectParm appConnect = new AppConnectParm();
Properties p = appConnect.getProperty();
InitialContext ctx = new InitialContext(p);
genericUtility = new E12GenericUtility();
SimpleDateFormat dt = new SimpleDateFormat(genericUtility.getApplDateFormat());
if (transInfoXml != null && transInfoXml.trim().length() != 0) {
xmlDataAll = genericUtility.parseString(transInfoXml);
}
StringBuffer xmlString= new StringBuffer("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
xmlString.append("<DocumentRoot><description>Datawindow Root</description><group0><description>Group0 escription</description>");
xmlString.append("<Header0>");
xmlString.append("<description>Header0 members</description>");
//enter proper object name/transaction screen name
xmlString.append("<objName><![CDATA[").append("pricelist_mst_wf").append("]]></objName>");
xmlString.append("<pageContext><![CDATA[").append("1").append("]]></pageContext>");
xmlString.append("<objContext><![CDATA[").append("1").append("]]></objContext>");
xmlString.append("<editFlag><![CDATA[").append("A").append("]]></editFlag>");
xmlString.append("<focusedColumn><![CDATA[").append("").append("]]></focusedColumn>");
xmlString.append("<action><![CDATA[").append("SAVE").append("]]></action>");
xmlString.append("<elementName><![CDATA[").append("").append("]]></elementName>");
xmlString.append("<keyValue><![CDATA[").append("1").append("]]></keyValue>");
xmlString.append("<taxKeyValue><![CDATA[").append("").append("]]></taxKeyValue>");
xmlString.append("<saveLevel><![CDATA[").append("1").append("]]></saveLevel>");
xmlString.append("<forcedSave><![CDATA[").append(true).append("]]></forcedSave>");
xmlString.append("<taxInFocus><![CDATA[").append(false).append("]]></taxInFocus>");
xmlString.append("<Detail1 dbID='' domID=\"1\" objName=\"pricelist_mst_wf\" objContext=\"1\">");
//enter primary key column name
xmlString.append("<attribute pkNames=\"price_list:\" status=\"N\" updateFlag=\"A\" selected=\"N\" />");
if(xmlDataAll.getElementsByTagName("Detail1")!=null && xmlDataAll.getElementsByTagName("Detail1").getLength()>0)
{
String priceList = checkNull(genericUtility.getColumnValueFromNode("price_list", xmlDataAll.getElementsByTagName("Detail1").item(0)));
System.out.println("Price List"+priceList);
String descr = checkNull(genericUtility.getColumnValueFromNode("descr", xmlDataAll.getElementsByTagName("Detail1").item(0)));
String listType = checkNull(genericUtility.getColumnValueFromNode("list_type", xmlDataAll.getElementsByTagName("Detail1").item(0)));
String priceListParent = checkNull(genericUtility.getColumnValueFromNode("price_list__parent", xmlDataAll.getElementsByTagName("Detail1").item(0)));
String orderType = checkNull(genericUtility.getColumnValueFromNode("order_type", xmlDataAll.getElementsByTagName("Detail1").item(0)));
String manageType = checkNull(genericUtility.getColumnValueFromNode("manage_type", xmlDataAll.getElementsByTagName("Detail1").item(0)));
String pList1 = checkNull(genericUtility.getColumnValueFromNode("plist_1", xmlDataAll.getElementsByTagName("Detail1").item(0)));
String pList2 = checkNull(genericUtility.getColumnValueFromNode("plist_2", xmlDataAll.getElementsByTagName("Detail1").item(0)));
String pList3 = checkNull(genericUtility.getColumnValueFromNode("plist_3", xmlDataAll.getElementsByTagName("Detail1").item(0)));
String pList4 = checkNull(genericUtility.getColumnValueFromNode("plist_4", xmlDataAll.getElementsByTagName("Detail1").item(0)));
String rate1Formula = checkNull(genericUtility.getColumnValueFromNode("rate1_formula", xmlDataAll.getElementsByTagName("Detail1").item(0)));
String rate2Formula = checkNull(genericUtility.getColumnValueFromNode("rate2_formula", xmlDataAll.getElementsByTagName("Detail1").item(0)));
String rate3Formula = checkNull(genericUtility.getColumnValueFromNode("rate3_formula", xmlDataAll.getElementsByTagName("Detail1").item(0)));
String rate4Formula = checkNull(genericUtility.getColumnValueFromNode("rate4_formula", xmlDataAll.getElementsByTagName("Detail1").item(0)));
String chgDate = checkNull(genericUtility.getColumnValueFromNode("chg_date", xmlDataAll.getElementsByTagName("Detail1").item(0)));
String chgUser = checkNull(genericUtility.getColumnValueFromNode("chg_user", xmlDataAll.getElementsByTagName("Detail1").item(0)));
String chgTerm = checkNull(genericUtility.getColumnValueFromNode("chg_term", xmlDataAll.getElementsByTagName("Detail1").item(0)));
String pList5 = checkNull(genericUtility.getColumnValueFromNode("plist_5", xmlDataAll.getElementsByTagName("Detail1").item(0)));
String pList6 = checkNull(genericUtility.getColumnValueFromNode("plist_6", xmlDataAll.getElementsByTagName("Detail1").item(0)));
String pList7 = checkNull(genericUtility.getColumnValueFromNode("plist_7", xmlDataAll.getElementsByTagName("Detail1").item(0)));
String pList8 = checkNull(genericUtility.getColumnValueFromNode("plist_8", xmlDataAll.getElementsByTagName("Detail1").item(0)));
String pList9 = checkNull(genericUtility.getColumnValueFromNode("plist_9", xmlDataAll.getElementsByTagName("Detail1").item(0)));
String pList10 = checkNull(genericUtility.getColumnValueFromNode("plist_10", xmlDataAll.getElementsByTagName("Detail1").item(0)));
String pList11 = checkNull(genericUtility.getColumnValueFromNode("plist_11", xmlDataAll.getElementsByTagName("Detail1").item(0)));
String pList12 = checkNull(genericUtility.getColumnValueFromNode("plist_12", xmlDataAll.getElementsByTagName("Detail1").item(0)));
String rate5Formula = checkNull(genericUtility.getColumnValueFromNode("rate5_formula", xmlDataAll.getElementsByTagName("Detail1").item(0)));
String rate6Formula = checkNull(genericUtility.getColumnValueFromNode("rate6_formula", xmlDataAll.getElementsByTagName("Detail1").item(0)));
String rate7Formula = checkNull(genericUtility.getColumnValueFromNode("rate7_formula", xmlDataAll.getElementsByTagName("Detail1").item(0)));
String rate8Formula = checkNull(genericUtility.getColumnValueFromNode("rate8_formula", xmlDataAll.getElementsByTagName("Detail1").item(0)));
String rate9Formula = checkNull(genericUtility.getColumnValueFromNode("rate9_formula", xmlDataAll.getElementsByTagName("Detail1").item(0)));
String rate10Formula = checkNull(genericUtility.getColumnValueFromNode("rate10_formula", xmlDataAll.getElementsByTagName("Detail1").item(0)));
String rate11Formula = checkNull(genericUtility.getColumnValueFromNode("rate11_formula", xmlDataAll.getElementsByTagName("Detail1").item(0)));
String rate12Formula = checkNull(genericUtility.getColumnValueFromNode("rate12_formula", xmlDataAll.getElementsByTagName("Detail1").item(0)));
String calcMethod = checkNull(genericUtility.getColumnValueFromNode("calc_method", xmlDataAll.getElementsByTagName("Detail1").item(0)));
String calcMethodDescr = checkNull(genericUtility.getColumnValueFromNode("calc_method_descr", xmlDataAll.getElementsByTagName("Detail1").item(0)));
String methodApplicable = checkNull(genericUtility.getColumnValueFromNode("method_applicable", xmlDataAll.getElementsByTagName("Detail1").item(0)));
xmlString.append("<price_list>").append("<![CDATA["+priceList+"]]>").append("</price_list>");
xmlString.append("<descr>").append("<![CDATA["+descr+"]]>").append("</descr>");
xmlString.append("<list_type>").append("<![CDATA["+listType+"]]>").append("</list_type>");
xmlString.append("<price_list__parent>").append("<![CDATA["+priceListParent+"]]>").append("</price_list__parent>");
xmlString.append("<order_type>").append("<![CDATA["+orderType+"]]>").append("</order_type>");
xmlString.append("<manage_type>").append("<![CDATA["+manageType+"]]>").append("</manage_type>");
xmlString.append("<plist_1>").append("<![CDATA["+pList1+"]]>").append("</plist_1>");
xmlString.append("<plist_2>").append("<![CDATA["+pList2+"]]>").append("</plist_2>");
xmlString.append("<plist_3>").append("<![CDATA["+pList3+"]]>").append("</plist_3>");
xmlString.append("<plist_4>").append("<![CDATA["+pList4+"]]>").append("</plist_4>");
xmlString.append("<rate1_formula>").append("<![CDATA["+rate1Formula+"]]>").append("</rate1_formula>");
xmlString.append("<rate2_formula>").append("<![CDATA["+rate2Formula+"]]>").append("</rate2_formula>");
xmlString.append("<rate3_formula>").append("<![CDATA["+rate3Formula+"]]>").append("</rate3_formula>");
xmlString.append("<rate4_formula>").append("<![CDATA["+rate4Formula+"]]>").append("</rate4_formula>");
xmlString.append("<chg_date>").append("<![CDATA["+chgDate+"]]>").append("</chg_date>");
xmlString.append("<chg_user>").append("<![CDATA["+chgUser+"]]>").append("</chg_user>");
xmlString.append("<chg_term>").append("<![CDATA["+chgTerm+"]]>").append("</chg_term>");
xmlString.append("<plist_5>").append("<![CDATA["+pList5+"]]>").append("</plist_5>");
xmlString.append("<plist_6>").append("<![CDATA["+pList6+"]]>").append("</plist_6>");
xmlString.append("<plist_7>").append("<![CDATA["+pList7+"]]>").append("</plist_7>");
xmlString.append("<plist_8>").append("<![CDATA["+pList8+"]]>").append("</plist_8>");
xmlString.append("<plist_9>").append("<![CDATA["+pList9+"]]>").append("</plist_9>");
xmlString.append("<plist_10>").append("<![CDATA["+pList10+"]]>").append("</plist_10>");
xmlString.append("<plist_11>").append("<![CDATA["+pList11+"]]>").append("</plist_11>");
xmlString.append("<plist_12>").append("<![CDATA["+pList12+"]]>").append("</plist_12>");
xmlString.append("<rate5_formula>").append("<![CDATA["+rate5Formula+"]]>").append("</rate5_formula>");
xmlString.append("<rate6_formula>").append("<![CDATA["+rate6Formula+"]]>").append("</rate6_formula>");
xmlString.append("<rate7_formula>").append("<![CDATA["+rate7Formula+"]]>").append("</rate7_formula>");
xmlString.append("<rate8_formula>").append("<![CDATA["+rate8Formula+"]]>").append("</rate8_formula>");
xmlString.append("<rate9_formula>").append("<![CDATA["+rate9Formula+"]]>").append("</rate9_formula>");
xmlString.append("<rate10_formula>").append("<![CDATA["+rate10Formula+"]]>").append("</rate10_formula>");
xmlString.append("<rate11_formula>").append("<![CDATA["+rate11Formula+"]]>").append("</rate11_formula>");
xmlString.append("<rate12_formula>").append("<![CDATA["+rate12Formula+"]]>").append("</rate12_formula>");
xmlString.append("<calc_method>").append("<![CDATA["+calcMethod+"]]>").append("</calc_method>");
xmlString.append("<calc_method_descr>").append("<![CDATA["+calcMethodDescr+"]]>").append("</calc_method_descr>");
xmlString.append("<method_applicable>").append("<![CDATA["+methodApplicable+"]]>").append("</method_applicable>");
xmlString.append("</Detail1>");
}
if(xmlDataAll.getElementsByTagName("Detail2")!=null && xmlDataAll.getElementsByTagName("Detail2").getLength()>0)
{
int j=1;
for(int i=0; i<xmlDataAll.getElementsByTagName("Detail2").getLength(); i++)
{
xmlString.append("<Detail2 dbID='' objContext=\"2\" domID='"+j+"' objName=\"pricelist_mst_wf\">");
String priceList = checkNull(genericUtility.getColumnValueFromNode("price_list", xmlDataAll.getElementsByTagName("Detail2").item(0)));
String lineNo = checkNull(genericUtility.getColumnValueFromNode("line_no", xmlDataAll.getElementsByTagName("Detail2").item(0)));
String calcMethod = checkNull(genericUtility.getColumnValueFromNode("calc_method", xmlDataAll.getElementsByTagName("Detail2").item(0)));
String priceListTar = checkNull(genericUtility.getColumnValueFromNode("price_list_tar", xmlDataAll.getElementsByTagName("Detail2").item(0)));
String priceListParent = checkNull(genericUtility.getColumnValueFromNode("price_list_parent", xmlDataAll.getElementsByTagName("Detail2").item(0)));
xmlString.append("<price_list>").append("<![CDATA["+priceList+"]]>").append("</price_list>");
xmlString.append("<line_no>").append("<![CDATA["+lineNo+"]]>").append("</line_no>");
xmlString.append("<calc_method>").append("<![CDATA["+calcMethod+"]]>").append("</calc_method>");
xmlString.append("<price_list_tar>").append("<![CDATA["+priceListTar+"]]>").append("</price_list_tar>");
xmlString.append("<price_list_parent>").append("<![CDATA["+priceListParent+"]]>").append("</price_list_parent>");
xmlString.append("</Detail2>");
j++;
}
}
xmlString.append("</Header0></group0></DocumentRoot>");
try
{
System.out.println("Inside nested try block of PriceListMasterWfEJB.insertPriceListMaster()");
masterStatefulLocal = (MasterStatefulLocal)ctx.lookup("ibase/MasterStatefulEJB/local");
retString = masterStatefulLocal.processRequest( authencate, siteCode, true, xmlString.toString());
if(retString.contains("Success")){
returnString = "Y";
}else{
returnString = "N";
}
}
catch(Exception ee)
{
System.out.println("Inside nested catch block of PriceListMasterWfEJB.insertPriceListMaster()");
ee.printStackTrace();
}
}
catch(Exception e)
{
System.out.println("Inside catch block of PriceListMasterWfEJB.insertPriceListMaster()"+e);
}
finally{
try {
if (conn != null) {
conn.close();
conn = null;
}
} catch (SQLException e) {
e.printStackTrace();
}
}
return returnString;
}
private String checkNull(String str) {
if(str == null){
str = "";
}
else{
str = str.trim();
}
return str;
}
@SuppressWarnings("unused")
private void closePstmtRs(PreparedStatement pStmt, ResultSet rs) {
if (pStmt != null) {
try {
pStmt.close();
} catch (SQLException localSQLException1) {
}
pStmt = null;
}
if (rs != null) {
try {
rs.close();
} catch (SQLException e) {
e.printStackTrace();
}
rs = null;
}
}
}
\ No newline at end of file
package ibase.webitm.ejb.dis;
import java.rmi.RemoteException;
import ibase.webitm.ejb.ValidatorLocal;
import ibase.webitm.utility.ITMException;
import javax.ejb.Local;
@Local
public interface PriceListMasterWfEJBLocal extends ValidatorLocal
{
public String insertPriceListMaster(String objName,String tranId,String xmlDataAll,String xtraParams,String entityCode) throws RemoteException, ITMException;
}
package ibase.webitm.ejb.dis;
import ibase.webitm.ejb.ValidatorRemote;
import ibase.webitm.utility.ITMException;
import java.rmi.RemoteException;
import javax.ejb.Remote;
@Remote
public interface PriceListMasterWfEJBRemote extends ValidatorRemote
{
public String insertPriceListMaster(String objName,String tranId,String xmlDataAll,String xtraParams,String entityCode) 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