Commit 41a2ab52 authored by sghate's avatar sghate

*Done Migration on CadreIC Master Component.

CadreIC.java
CadreLocal.java
CadreRemote.java


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@204908 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 06a555ff
package ibase.webitm.ejb.adm;
import java.rmi.RemoteException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.ArrayList;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import ibase.utility.E12GenericUtility;
import ibase.webitm.ejb.ITMDBAccessEJB;
import ibase.webitm.ejb.ValidatorEJB;
import ibase.webitm.utility.ITMException;
public class CadreIC extends ValidatorEJB implements CadreLocal,CadreRemote
{
public String wfValData() throws RemoteException, ITMException
{
return "";
}
public String wfValData(String xmlString, String xmlString1,String xmlString2, String objContext, String editFlag,String xtraParams) throws RemoteException,ITMException
{
System.out.println(xmlString);
Document dom = null;
Document dom1 = null;
Document dom2 = null;
String errString = null;
E12GenericUtility genericUtility = null;
try
{
genericUtility = new E12GenericUtility();
if (xmlString != null && xmlString.trim().length() != 0)
{
dom = genericUtility.parseString(xmlString);
System.out.println("Print dom>>>> "+dom);
}
if (xmlString1 != null && xmlString1.trim().length() != 0)
{
dom1 = genericUtility.parseString(xmlString1);
}
if (xmlString2 != null && xmlString2.trim().length() != 0)
{
dom2 = genericUtility.parseString(xmlString2);
}
errString = wfValData(dom, dom1, dom2, objContext, editFlag,
xtraParams);
System.out.println("ErrString :" + errString);
}
catch (Exception e)
{
System.out.println("Exception :DeptIC :wfValData(String xmlString):"+ e.getMessage() + ":");
errString = genericUtility.createErrorString(e);
e.printStackTrace();
throw new ITMException(e);
}
System.out.println("returning from DeptIC wfvaldata");
return errString;
}
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;
int currentFormNo = 0;
int childNodeListLength = 0;
String userId = "";
String childNodeName = null;
String errString = "";
Connection conn = null;
PreparedStatement pstmt = null;
ResultSet rs = null;
String errCode = "";
String errFldName = "";
String msgType = "";
StringBuffer errStringXml = null;
ITMDBAccessEJB itmDbAccess =null;
String descr = "";
String shDescr = "";
E12GenericUtility genericUtility = null;
ArrayList<String> errlist = new ArrayList<String>();
ArrayList<String> errfields = new ArrayList<String>();
try
{
conn = getConnection();
conn.setAutoCommit(false);
errStringXml = new StringBuffer("<?xml version=\"1.0\"?>\r\n<Root><Errors>");
genericUtility = new E12GenericUtility();
itmDbAccess =new ITMDBAccessEJB();
userId = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginCode");
if (objContext != null && objContext.trim().length() > 0)
{
currentFormNo = Integer.parseInt(objContext);
}
switch (currentFormNo)
{
case 1:
{
parentNodeList = dom.getElementsByTagName("Detail1");
parentNode = parentNodeList.item(0);
childNodeList = parentNode.getChildNodes();
childNodeListLength = childNodeList.getLength();
for (int ctr = 0; ctr < childNodeListLength; ctr++)
{
childNode = childNodeList.item(ctr);
if (childNode.getNodeType() != Node.ELEMENT_NODE)
{
continue;
}
childNodeName = childNode.getNodeName();
System.out.println("childNodeName.editFlag." + childNodeName + "" + editFlag);
System.out.println("@V@ Edit flag :- ["+editFlag+"");
if (childNodeName.equalsIgnoreCase("descr"))
{
descr = checkNull(genericUtility.getColumnValue("descr", dom)).trim();
if(descr == null || descr.trim().length() == 0)
{
errlist.add("VTDESC1");
errfields.add(childNodeName.toLowerCase());
}
}
else if (childNodeName.equalsIgnoreCase("sh_descr"))
{
shDescr = checkNull(genericUtility.getColumnValue("sh_descr", dom)).trim();
if(shDescr == null || shDescr.trim().length() == 0)
{
errlist.add("VEADN2");
errfields.add(childNodeName.toLowerCase());
}
}
break;
}
if ( errlist != null && errlist.size() > 0 )
{
int errListSize = errlist.size();
System.out.println("errListSize:::::::["+errListSize+"]");
System.out.println("in error::::::::::");
for (int i = 0; i < errListSize; i++ )
{
System.out.println("in error For:::::::::::::::");
errCode = (String)errlist.get(i);
errFldName = (String)errfields.get(i);
System.out.println("errCode .........."+errCode);
errString = itmDbAccess.getErrorString(errFldName, errCode, userId, "", conn);
System.out.println("errString is : ::::>>>> " + errString);
msgType = 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);
System.out.println("errStringXml .........."+errStringXml);
errString = "";
}
if ( msgType.equalsIgnoreCase("E"))
{
break;
}
}
errlist.clear();
errlist = null;
errfields.clear();
errfields = null;
errStringXml.append("</Errors></Root>\r\n");
}
else
{
errStringXml = new StringBuffer( "" );
}
errString = errStringXml.toString();
}
}
}
catch (Exception e)
{
System.out.println("Exception ::" + e);
e.printStackTrace();
errString = e.getMessage();
throw new ITMException(e);
}
finally
{
try
{
if (rs != null)
{
rs.close();
rs = null;
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
if (conn != null)
{
conn.close();
conn = null;
}
}
catch (Exception d)
{
d.printStackTrace();
throw new ITMException(d);
}
}
System.out.println("ErrString ::" + errString);
return errString;
}
private String errorType( Connection conn , String errorCode ) throws ITMException
{
String msgType = "";
PreparedStatement pstmt = null ;
ResultSet rs = null;
String sql = "";
try
{
sql = " SELECT MSG_TYPE FROM MESSAGES WHERE MSG_NO = ? ";
pstmt = conn.prepareStatement( sql );
pstmt.setString(1, errorCode);
rs = pstmt.executeQuery();
if( rs.next() )
{
msgType = rs.getString("MSG_TYPE");
}
if (rs != null)
{
rs.close();
rs = null;
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
}
catch (Exception ex)
{
ex.printStackTrace();
throw new ITMException(ex);
}
finally
{
try
{
if (rs != null)
{
rs.close();
rs = null;
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
}
catch ( Exception e )
{
e.printStackTrace();
throw new ITMException(e);
}
}
return msgType;
}
private String checkNull(String input)
{
if(input == null)
{
input="";
}
return input;
}
}
package ibase.webitm.ejb.adm;
import java.rmi.RemoteException;
import org.w3c.dom.Document;
import ibase.webitm.ejb.ValidatorLocal;
import ibase.webitm.utility.ITMException;
public interface CadreLocal extends ValidatorLocal
{
public String wfValData(String xmlString, String xmlString1,String xmlString2, String objContext, String editFlag,String xtraParams) throws RemoteException,ITMException ;
public String wfValData(Document dom, Document dom1, Document dom2,String objContext, String editFlag, String xtraParams)throws RemoteException, ITMException;
}
package ibase.webitm.ejb.adm;
import org.w3c.dom.Document;
import java.rmi.RemoteException;
import ibase.webitm.ejb.ValidatorRemote;
import ibase.webitm.utility.ITMException;
public interface CadreRemote 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;
}
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