Commit 7c04cb09 authored by sghate's avatar sghate

shital: updated Component on 20/8/2019

CadreIC.java
CadreLocal.java
CadreRemote.java
 

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@205479 ce508802-f39f-4f6c-b175-0d175dae99d5
parent a43fe0b6
package ibase.webitm.ejb.adm;
import java.rmi.RemoteException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
......@@ -10,6 +9,8 @@ import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import java.rmi.RemoteException;
import ibase.utility.E12GenericUtility;
import ibase.webitm.ejb.ITMDBAccessEJB;
import ibase.webitm.ejb.ValidatorEJB;
......@@ -30,11 +31,10 @@ public class CadreIC extends ValidatorEJB implements CadreLocal,CadreRemote
Document dom2 = null;
String errString = null;
E12GenericUtility genericUtility = null;
E12GenericUtility genericUtility = new E12GenericUtility();
try
{
genericUtility = new E12GenericUtility();
if (xmlString != null && xmlString.trim().length() != 0)
{
dom = genericUtility.parseString(xmlString);
......@@ -54,12 +54,12 @@ public class CadreIC extends ValidatorEJB implements CadreLocal,CadreRemote
}
catch (Exception e)
{
System.out.println("Exception :DeptIC :wfValData(String xmlString):"+ e.getMessage() + ":");
System.out.println("Exception :CadreIC :wfValData(String xmlString):"+ e.getMessage() + ":");
errString = genericUtility.createErrorString(e);
e.printStackTrace();
throw new ITMException(e);
}
System.out.println("returning from DeptIC wfvaldata");
System.out.println("returning from CadreIC wfvaldata");
return errString;
}
......@@ -70,130 +70,165 @@ public class CadreIC extends ValidatorEJB implements CadreLocal,CadreRemote
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;
ITMDBAccessEJB itmDbAccess =new ITMDBAccessEJB();
NodeList parentList = null;
NodeList childList = null;
String descr = "";
String shDescr = "";
E12GenericUtility genericUtility = null;
ArrayList<String> errlist = new ArrayList<String>();
ArrayList<String> errfields = new ArrayList<String>();
String shDescr = "" , cadreCode = "" , sql = "";
int noOfChilds = 0 , counter = 0 , cnt = 0;
E12GenericUtility genericUtility = new E12GenericUtility();
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();
errStringXml = new StringBuffer("<?xml version=\"1.0\"?>\r\n<Root><Errors>");
userId = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginCode");
if (objContext != null && objContext.trim().length() > 0)
if (objContext != null && objContext.trim().length() > 0)
{
currentFormNo = Integer.parseInt(objContext);
}
switch (currentFormNo)
{
case 1:
parentList = dom.getElementsByTagName("Detail" + currentFormNo);
parentNode = parentList.item(0);
childList = parentNode.getChildNodes();
noOfChilds = childList.getLength();
System.out.println("noOfChilds--->>>" + noOfChilds);
for (counter = 0; counter < noOfChilds; counter++)
{
parentNodeList = dom.getElementsByTagName("Detail1");
parentNode = parentNodeList.item(0);
childNodeList = parentNode.getChildNodes();
childNodeListLength = childNodeList.getLength();
for (int ctr = 0; ctr < childNodeListLength; ctr++)
childNode = childList.item(counter);
childNodeName = childNode.getNodeName();
System.out.println("childNodeName>>>>>" + childNodeName + "childNode>>>>>>" +childNode + "counter>>>" +counter);
switch (currentFormNo)
{
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+"");
case 1:
if (childNodeName.equalsIgnoreCase("descr"))
parentNodeList = dom.getElementsByTagName("Detail1");
parentNode = parentNodeList.item(0);
childNodeList = parentNode.getChildNodes();
int childNodeListLength = childNodeList.getLength();
System.out.println("child Node List Length::::::" + childNodeListLength);
for (int ctr = 0; ctr < childNodeListLength; ctr++)
{
descr = checkNull(genericUtility.getColumnValue("descr", dom)).trim();
if(descr == null || descr.trim().length() == 0)
childNode = childNodeList.item(ctr);
System.out.println("childNode" + childNode);
if (childNode.getNodeType() != Node.ELEMENT_NODE)
{
errlist.add("VTDESC1");
errfields.add(childNodeName.toLowerCase());
continue;
}
}
else if (childNodeName.equalsIgnoreCase("sh_descr"))
{
shDescr = checkNull(genericUtility.getColumnValue("sh_descr", dom)).trim();
if(shDescr == null || shDescr.trim().length() == 0)
childNodeName = childNode.getNodeName();
System.out.println("childNodeName.editFlag." + childNodeName + "@V@ Edit flag :-" + editFlag);
if ("cadre_code".equalsIgnoreCase(childNodeName))
{
errlist.add("VEADN2");
errfields.add(childNodeName.toLowerCase());
cadreCode = checkNull(genericUtility.getColumnValue("cadre_code", dom)).trim();
System.out.println("cadre_code :: ["+cadreCode+"]");
if(cadreCode == null || cadreCode.trim().length() == 0)
{
errList.add("VTCAN81");
errFields.add(childNodeName.toLowerCase());
}
else
{
sql = "select count(*) as cnt from cadre where cadre_code = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, cadreCode);
rs = pstmt.executeQuery();
if (rs.next())
{
cnt = rs.getInt("cnt");
}
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(cnt > 0)
{
errList.add("VTCAN81");
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)
else if ("descr".equalsIgnoreCase(childNodeName))
{
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 = "";
descr = checkNull(genericUtility.getColumnValue("descr", dom)).trim();
if(descr == null || descr.trim().length() == 0)
{
errList.add("VTDESC1");
errFields.add(childNodeName.toLowerCase());
}
}
if ( msgType.equalsIgnoreCase("E"))
else if ("sh_descr".equalsIgnoreCase(childNodeName))
{
break;
shDescr = checkNull(genericUtility.getColumnValue("sh_descr", dom)).trim();
if(shDescr == null || shDescr.trim().length() == 0)
{
errList.add("VEADN2");
errFields.add(childNodeName.toLowerCase());
}
}
}
errlist.clear();
errlist = null;
errfields.clear();
errfields = null;
errStringXml.append("</Errors></Root>\r\n");
}
else
{
errStringXml = new StringBuffer( "" );
break;
}
errString = errStringXml.toString();
}
System.out.println("errStringXml.toString()---1= "+errStringXml.toString());
if (errList != null && errList.size() > 0)
{
System.out.println("errList==[" + errList + "]");
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:::::::::::::::");
String errCode = (String) errList.get(i);
String errFldName = (String) errFields.get(i);
System.out.println("errCode .........." + errCode);
errString = itmDbAccess.getErrorString(errFldName, errCode, userId, "", conn);
System.out.println("errString is : ::::>>>> " + errString);
String 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();
errFields.clear();
}
errStringXml.append("</Errors></Root>\r\n");
System.out.println("errStringXml.toString()---2= "+errStringXml.toString());
}
catch (Exception e)
{
System.out.println("Exception ::" + e);
System.out.println("Exception CadreIC::" + e);
e.printStackTrace();
errString = e.getMessage();
throw new ITMException(e);
......@@ -225,64 +260,67 @@ public class CadreIC extends ValidatorEJB implements CadreLocal,CadreRemote
throw new ITMException(d);
}
}
errString = errStringXml.toString();
System.out.println("ErrString ::" + errString);
return errString;
}
private String errorType( Connection conn , String errorCode ) throws ITMException
{
private String errorType(Connection conn, String errorCode) throws ITMException {
String msgType = "";
PreparedStatement pstmt = null ;
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);
try {
if (conn == null) {
System.out.println("Connection is null");
} else {
System.out.println("Connection is not null");
}
String sql = " SELECT MSG_TYPE FROM MESSAGES WHERE MSG_NO = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, errorCode);
rs = pstmt.executeQuery();
if( rs.next() )
if (rs.next())
{
msgType = rs.getString("MSG_TYPE");
}
if (rs != null)
}
if (rs != null)
{
rs.close();
rs = null;
}
if(pstmt != null)
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
}
catch (Exception ex)
} catch (Exception ex)
{
ex.printStackTrace();
throw new ITMException(ex);
}
finally
}
finally
{
try
try
{
if (rs != null)
if (rs != null)
{
rs.close();
rs = null;
}
if(pstmt != null)
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
}
catch ( Exception e )
} catch (Exception e)
{
e.printStackTrace();
throw new ITMException(e);
}
}
}
return msgType;
}
......
......@@ -2,15 +2,16 @@ 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() 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(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.adm;
import org.w3c.dom.Document;
import java.rmi.RemoteException;
import org.w3c.dom.Document;
import ibase.webitm.ejb.ValidatorRemote;
import ibase.webitm.utility.ITMException;
......@@ -12,4 +10,8 @@ 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;
/* 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