Commit d4248646 authored by dpawar's avatar dpawar

added new function for error handling


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@96033 ce508802-f39f-4f6c-b175-0d175dae99d5
parent c97fc77a
......@@ -8,6 +8,7 @@ import ibase.system.config.ConnDriver;
import ibase.webitm.ejb.ActionHandlerEJB;
import ibase.webitm.ejb.ITMDBAccessEJB;
import ibase.webitm.ejb.MasterStatefulLocal;
import ibase.webitm.ejb.ValidatorEJB;
import ibase.webitm.ejb.dis.DistCommon;
import ibase.webitm.ejb.fin.FinCommon;
import ibase.webitm.ejb.sys.UtilMethods;
......@@ -15,6 +16,7 @@ import ibase.webitm.utility.GenericUtility;
import ibase.webitm.utility.ITMException;
import ibase.webitm.utility.WriteFldMapping.HearderLabel;
import java.io.StringReader;
import java.rmi.RemoteException;
import java.sql.Connection;
import java.sql.PreparedStatement;
......@@ -28,7 +30,15 @@ import java.util.TreeSet;
import javax.ejb.Stateless;
import javax.naming.InitialContext;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import org.w3c.dom.Document;
// added for ejb3
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.xml.sax.InputSource;
@Stateless // added for ejb3
public class MiscVchEmpIConf extends ActionHandlerEJB implements MiscVchEmpIConfLocal, MiscVchEmpIConfRemote
......@@ -139,7 +149,16 @@ public String confirmMiscVchEmp(String tranId,String xtraParams,String forcedFla
conn.rollback();
return errString;
}else{
return retString;
conn.rollback();
String errorCode=checkNull(getMessagesId(retString));
if("Error".equalsIgnoreCase(errorCode)){
errString = itmdbAccess.getErrorString("", "VMTRNCONN", "", "", conn);
}else{
errString = itmdbAccess.getErrorString("", errorCode, "", "", conn);
}
System.out.println("Final getMessagesId---->>["+errorCode+"]");
return errString;
}
}
......@@ -185,6 +204,7 @@ private String generateMiscVoucher(String tranId, String xtraParams, String forc
String tranIds = tranId;
String xtraParam = xtraParams;
String forcedF = forcedFlag;
ITMDBAccessEJB itmdbAccessL = null;
ResultSet rs = null,rs1 = null;
String siteCode = "",empCode="",acctCode="",cctrCode="",taxApply="",deptCode="",sAmount="",crTerm="",effDate="";
String tranID = "",vouchType="",tranType="",sundryCode="",sundryType="",analCode="",remarks="",acctCodeAp="",cctrCodeAp="";
......@@ -200,6 +220,7 @@ private String generateMiscVoucher(String tranId, String xtraParams, String forc
int lineNo=0,billAmt=0;
try
{
itmdbAccessL=new ITMDBAccessEJB();
if(miscVoucherTranID != null){
miscVoucherTranID.clear();
}
......@@ -778,6 +799,48 @@ private String generateAutoPayment(ArrayList<String> miscTranID,String payMode,S
return retString;
}
public String getMessagesId(String errMag){
System.out.println("in getMessagesId123.........");
String stringMsg=checkNull(errMag);
String msgNo="";
System.out.println("stringMsg----->>["+stringMsg+"]");
try{
if(errMag !=null || errMag.length() > 0){
if(errMag.indexOf("<error") > -1){
DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
//InputSource is = new InputSource(new StringReader(stringMsg));
Document dom= new ValidatorEJB ().parseString(stringMsg);
dom.getDocumentElement().normalize();
String domStr=new GenericUtility().serializeDom(dom);
System.out.println("domStr123----->>["+domStr+"]");
NodeList games = dom.getElementsByTagName("error");
for (int i = 0; i < games.getLength(); i++) {
Node aNode = games.item(i);
System.out.println("--->>"+aNode.getFirstChild().getNodeValue());
NamedNodeMap attributes = aNode.getAttributes();
for (int a = 0; a < attributes.getLength(); a++) {
Node theAttribute = attributes.item(a);
System.out.println(theAttribute.getNodeName() + "=" + theAttribute.getNodeValue());
if("id".equalsIgnoreCase(theAttribute.getNodeName())){
msgNo=theAttribute.getNodeValue();
}
}
}
}
}
System.out.println("msgNo--------->>["+msgNo+"]");
}
catch (Exception e){
System.out.println("Exception in getMessagesId method....");
e.printStackTrace();
return "Error";
}
return msgNo;
}
public String checkNull(String input)
{
......
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