Commit 9b69dbee authored by sghate's avatar sghate

Done changes on SunGeoBiAccess.java Master Component

SunGeoBiAccess.java



git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@205335 ce508802-f39f-4f6c-b175-0d175dae99d5
parent cc6f0e74
...@@ -6,18 +6,32 @@ import java.util.ArrayList; ...@@ -6,18 +6,32 @@ import java.util.ArrayList;
import java.sql.Connection; import java.sql.Connection;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
import java.sql.ResultSet; import java.sql.ResultSet;
import ibase.system.config.ConnDriver; //modified by Shital on 25/07/2019 [Start]
//import ibase.system.config.ConnDriver;
//modified by Shital on 25/07/2019 [End]
import ibase.utility.E12GenericUtility;
import ibase.webitm.ejb.ITMDBAccessEJB;
import ibase.webitm.ejb.ValidatorEJB; import ibase.webitm.ejb.ValidatorEJB;
import ibase.webitm.utility.GenericUtility; //modified by Shital on 25/07/2019 [Start]
//import ibase.webitm.utility.GenericUtility;
//modified by Shital on 25/07/2019 [End]
import ibase.webitm.utility.ITMException; import ibase.webitm.utility.ITMException;
import javax.ejb.Stateless; //modified by Shital on 25/07/2019 [Start]
//import javax.ejb.Stateless;
//modified by Shital on 25/07/2019 [End]
import org.w3c.dom.Document; import org.w3c.dom.Document;
import org.w3c.dom.Node; import org.w3c.dom.Node;
import org.w3c.dom.NodeList; import org.w3c.dom.NodeList;
@Stateless //modified by Shital on 25/07/2019 [Start]
//@Stateless
//modified by Shital on 25/07/2019 [End]
public class SunGeoBiAccess extends ValidatorEJB implements SunGeoBiAccessLocal, SunGeoBiAccessRemote public class SunGeoBiAccess extends ValidatorEJB implements SunGeoBiAccessLocal, SunGeoBiAccessRemote
{ {
GenericUtility genericUtility = GenericUtility.getInstance(); //modified by Shital on 24/07/2019 [Start]
//GenericUtility genericUtility = GenericUtility.getInstance();
E12GenericUtility genericUtility = new E12GenericUtility();
ITMDBAccessEJB itmDBAccessEJB = new ITMDBAccessEJB();
//modified by Shital on 24/07/2019 [End]
String errString = ""; String errString = "";
public String wfValData() throws RemoteException, ITMException public String wfValData() throws RemoteException, ITMException
...@@ -37,7 +51,9 @@ public class SunGeoBiAccess extends ValidatorEJB implements SunGeoBiAccessLocal, ...@@ -37,7 +51,9 @@ public class SunGeoBiAccess extends ValidatorEJB implements SunGeoBiAccessLocal,
Document dom1 = null; Document dom1 = null;
Document dom2 = null; Document dom2 = null;
String errFields = null; String errFields = null;
GenericUtility genericUtility = GenericUtility.getInstance(); //modified by Shital on 24/07/2019 [Start]
//GenericUtility genericUtility = GenericUtility.getInstance();
//modified by Shital on 24/07/2019 [End]
try try
{ {
System.out.println("xmlString [" + xmlString + "]"); System.out.println("xmlString [" + xmlString + "]");
...@@ -60,8 +76,14 @@ public class SunGeoBiAccess extends ValidatorEJB implements SunGeoBiAccessLocal, ...@@ -60,8 +76,14 @@ public class SunGeoBiAccess extends ValidatorEJB implements SunGeoBiAccessLocal,
} }
catch (Exception e) catch (Exception e)
{ {
//modified by Shital on 24/07/2019 [Start]
e.printStackTrace();
//modified by Shital on 24/07/2019 [End]
System.out.println("Exception :SunGeoBiAccess :" + e.getMessage()+ ":"); System.out.println("Exception :SunGeoBiAccess :" + e.getMessage()+ ":");
errFields = genericUtility.createErrorString(e); errFields = genericUtility.createErrorString(e);
//modified by Shital on 24/07/2019 [Start]
throw new ITMException(e);
//modified by Shital on 24/07/2019 [End]
} }
System.out.println("returning from SunGeoBiAccess "); System.out.println("returning from SunGeoBiAccess ");
return errFields; return errFields;
...@@ -79,25 +101,37 @@ public class SunGeoBiAccess extends ValidatorEJB implements SunGeoBiAccessLocal, ...@@ -79,25 +101,37 @@ public class SunGeoBiAccess extends ValidatorEJB implements SunGeoBiAccessLocal,
String geoLoc = ""; String geoLoc = "";
int errListSize; int errListSize;
StringBuffer errStringXml = new StringBuffer("<?xml version=\"1.0\"?>\r\n<Root><Errors>"); StringBuffer errStringXml = new StringBuffer("<?xml version=\"1.0\"?>\r\n<Root><Errors>");
String errCode=""; String errCode = "";
String errFldName=""; String errFldName = "";
String geoLocSql = "";
String dupIdSql = "";
//ringBuffer XmlString = new StringBuffer(); //ringBuffer XmlString = new StringBuffer();
ConnDriver connDriver = new ConnDriver(); //modified by Shital on 24/07/2019 [Start]
//ConnDriver connDriver = new ConnDriver();
//modified by Shital on 24/07/2019 [End]
String msgType = ""; String msgType = "";
Connection wfvConn = null; Connection wfvConn = null;
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
ResultSet rs = null; ResultSet rs = null;
int currentFormNo = 0;
int geoCnt = 0;
int dupIdCount = 0;
int idCount = 0;
String userwfsql = "";
ArrayList<String> errList = new ArrayList<String>(); ArrayList<String> errList = new ArrayList<String>();
ArrayList<String> errFields = new ArrayList<String>(); ArrayList<String> errFields = new ArrayList<String>();
try try
{ {
System.out.println("Came inside @nd wfValdata::::"); System.out.println("Came inside @nd wfValdata::::");
wfvConn = connDriver.getConnectDB("Driver"); //modified by Shital on 24/07/2019 [Start]
wfvConn.setAutoCommit(false); //wfvConn = connDriver.getConnectDB("Driver");
int currentFormNo = 0; //wfvConn.setAutoCommit(false);
connDriver = new ConnDriver(); //int currentFormNo = 0;
wfvConn = connDriver.getConnectDB("Driver"); //connDriver = new ConnDriver();
//wfvConn = connDriver.getConnectDB("Driver");
wfvConn = getConnection();
//modified by Shital on 24/07/2019 [End]
wfvConn.setAutoCommit(false); wfvConn.setAutoCommit(false);
if (objContext != null && objContext.trim().length() > 0) if (objContext != null && objContext.trim().length() > 0)
{ {
...@@ -108,160 +142,167 @@ public class SunGeoBiAccess extends ValidatorEJB implements SunGeoBiAccessLocal, ...@@ -108,160 +142,167 @@ public class SunGeoBiAccess extends ValidatorEJB implements SunGeoBiAccessLocal,
{ {
case 1: case 1:
{ {
parentNodeList = dom.getElementsByTagName("Detail1"); parentNodeList = dom.getElementsByTagName("Detail1");
parentNode = parentNodeList.item(0); parentNode = parentNodeList.item(0);
childNodeList = parentNode.getChildNodes(); childNodeList = parentNode.getChildNodes();
childNodeListLength = childNodeList.getLength(); childNodeListLength = childNodeList.getLength();
for (int ctr = 0; ctr < childNodeListLength; ctr++) for (int ctr = 0; ctr < childNodeListLength; ctr++)
{
childNode = childNodeList.item(ctr);
System.out.println("childNode"+childNode);
if( childNode.getNodeType() != Node.ELEMENT_NODE )
{ {
continue; childNode = childNodeList.item(ctr);
} System.out.println("childNode"+childNode);
childNodeName = childNode.getNodeName(); if( childNode.getNodeType() != Node.ELEMENT_NODE )
if (childNodeName.equalsIgnoreCase("user_id"))
{ {
System.out.println("Childnode name:["+childNodeName+"]"); continue;
userId = checkNull(genericUtility.getColumnValue("user_id", dom2)); }
System.out.println("User ID got in the validation ..::["+ userId + "]"); childNodeName = childNode.getNodeName();
if (userId == null || userId.length() == 0) if (childNodeName.equalsIgnoreCase("user_id"))
{ {
System.out.println("Invalid sitecode ::::"); System.out.println("Childnode name:["+childNodeName+"]");
errList.add("VMGEOURID1"); userId = checkNull(genericUtility.getColumnValue("user_id", dom2));
errFields.add(childNodeName.toLowerCase()); System.out.println("User ID got in the validation ..::["+ userId + "]");
msgType = errorType(wfvConn, "VMGEOURID1"); if (userId == null || userId.length() == 0)
if (msgType.equalsIgnoreCase("E")) {
System.out.println("Invalid sitecode ::::");
errList.add("VMGEOURID1");
errFields.add(childNodeName.toLowerCase());
msgType = errorType(wfvConn, "VMGEOURID1");
if (msgType.equalsIgnoreCase("E"))
{
break;
}
}
else
{ {
break; //modified by Shital on 24/07/2019 [Start]
//int idCount = 0;
//String userwfsql = "SELECT COUNT (*) AS ID_CNT FROM USERS A ,EMPLOYEE B WHERE A.CODE=? AND A.EMP_CODE=B.EMP_CODE AND B.RELIEVE_DATE IS NULL";
userwfsql = "SELECT COUNT (*) AS ID_CNT FROM USERS A ,EMPLOYEE B WHERE A.CODE=? AND A.EMP_CODE=B.EMP_CODE AND B.RELIEVE_DATE IS NULL";
//modified by Shital on 24/07/2019 [End]
pstmt = wfvConn.prepareStatement(userwfsql);
pstmt.setString(1, userId);
rs = pstmt.executeQuery();
if (rs.next())
{
idCount = rs.getInt("ID_CNT");
}
System.out.println("IDCnt:::: " + idCount);
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
if (idCount == 0)
{
System.out.println("Invalid sitecode , Enter valid Input::::");
errList.add("VMGEOURID2");
errFields.add(childNodeName.toLowerCase());
msgType = errorType(wfvConn, "VMGEOURID2");
System.out.println("In user id duplication validation");
if (msgType.equalsIgnoreCase("E"))
{
break;
}
}
} }
}
else
{
int idCount = 0;
String userwfsql = " SELECT COUNT (*) AS ID_CNT FROM USERS A ,EMPLOYEE B WHERE A.CODE=? AND A.EMP_CODE=B.EMP_CODE AND B.RELIEVE_DATE IS NULL";
pstmt = wfvConn.prepareStatement(userwfsql);
pstmt.setString(1, userId);
rs = pstmt.executeQuery();
if (rs.next())
{
idCount = rs.getInt("ID_CNT");
}
System.out.println("IDCnt:::: " + idCount);
if (rs != null)
{
rs.close();
rs = null;
} }
if (pstmt != null) if (childNodeName.equalsIgnoreCase("geo_loc"))
{ {
pstmt.close(); System.out.println("Childnode name:["+childNodeName+"]");
pstmt = null; geoLoc = checkNull(genericUtility.getColumnValue("geo_loc", dom2));
} System.out.println("get loc value:::::::["+geoLoc+"]");
if (idCount == 0) if (geoLoc == null || geoLoc.trim().length() == 0)
{ {
System.out.println("Invalid sitecode , Enter valid Input::::"); System.out.println("Empty geo location");
errList.add("VMGEOURID2"); errList.add("VMGEOLCID1");
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
msgType = errorType(wfvConn, "VMGEOURID2"); msgType = errorType(wfvConn, "VMGEOLCID1");
System.out.println("In user id duplication validation"); if (msgType.equalsIgnoreCase("E"))
if (msgType.equalsIgnoreCase("E")) {
break;
}
}
else
{ {
break; //modified by Shital on 24/07/2019 [Start]
//int geoCnt = 0;
//String geoLocSql = "SELECT COUNT(*) AS GEO_CNT FROM SITE WHERE GEO_LOC=?";
geoLocSql = "SELECT COUNT(*) AS GEO_CNT FROM SITE WHERE GEO_LOC=?";
//modified by Shital on 24/07/2019 [End]
pstmt = wfvConn.prepareStatement(geoLocSql);
pstmt.setString(1,geoLoc);
rs = pstmt.executeQuery();
if (rs.next())
{
geoCnt = rs.getInt("GEO_CNT");
}
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
if (geoCnt == 0)
{
System.out.println("Invalid Geo location code");
errList.add("VMGEOLCID2");
errFields.add(childNodeName.toLowerCase());
msgType = errorType(wfvConn, "VMGEOLCID2");
if (msgType.equalsIgnoreCase("E"));
{
break;
}
}
//modified by Shital on 24/07/2019 [Start]
//int dupIdCount = 0;
//String dupIdSql = " SELECT COUNT(*) AS PRIME_CNT FROM SUN_GEOBI_ACCESS WHERE USER_ID = ? AND GEO_LOC= ?";
dupIdSql = " SELECT COUNT(*) AS PRIME_CNT FROM SUN_GEOBI_ACCESS WHERE USER_ID = ? AND GEO_LOC= ?";
//modified by Shital on 24/07/2019 [End]
pstmt = wfvConn.prepareStatement(dupIdSql);
pstmt.setString(1, userId);
pstmt.setString(2, geoLoc);
rs = pstmt.executeQuery();
if (rs.next())
{
dupIdCount = rs.getInt("PRIME_CNT");
}
System.out.println("count:::: " + dupIdCount);
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
if (dupIdCount > 0)
{
System.out.println("Invalid combination,enter duplicate site code::::");
errList.add("VMGEOLOCID");
errFields.add(childNodeName.toLowerCase());
msgType = errorType(wfvConn, "VMGEOLOCID");
if (msgType.equalsIgnoreCase("E"))
{
break;
}
}
} }
} }
} }
} }
if (childNodeName.equalsIgnoreCase("geo_loc")) break;
{
System.out.println("Childnode name:["+childNodeName+"]");
geoLoc = checkNull(genericUtility.getColumnValue("geo_loc", dom2));
System.out.println("get loc value:::::::["+geoLoc+"]");
if (geoLoc == null || geoLoc.length() == 0)
{
System.out.println("Empty geo location");
errList.add("VMGEOLCID1");
errFields.add(childNodeName.toLowerCase());
msgType = errorType(wfvConn, "VMGEOLCID1");
if (msgType.equalsIgnoreCase("E"))
{
break;
}
}
else
{
int geoCnt = 0;
String geoLocSql = "SELECT COUNT(*) AS GEO_CNT FROM SITE WHERE GEO_LOC=?";
pstmt = wfvConn.prepareStatement(geoLocSql);
pstmt.setString(1,geoLoc);
rs = pstmt.executeQuery();
if (rs.next())
{
geoCnt = rs.getInt("GEO_CNT");
}
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
if (geoCnt == 0)
{
System.out.println("Invalid Geo location code");
errList.add("VMGEOLCID2");
errFields.add(childNodeName.toLowerCase());
msgType = errorType(wfvConn, "VMGEOLCID2");
if (msgType.equalsIgnoreCase("E"));
{
break;
}
}
int dupIdCount = 0;
String dupIdSql = " SELECT COUNT(*) AS PRIME_CNT FROM SUN_GEOBI_ACCESS WHERE USER_ID = ? AND GEO_LOC=?";
pstmt = wfvConn.prepareStatement(dupIdSql);
pstmt.setString(1, userId);
pstmt.setString(2, geoLoc);
rs = pstmt.executeQuery();
if (rs.next())
{
dupIdCount = rs.getInt("PRIME_CNT");
}
System.out.println("count:::: " + dupIdCount);
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
if (dupIdCount > 0)
{
System.out.println("Invalid combination,enter duplicate site code::::");
errList.add("VMGEOLOCID");
errFields.add(childNodeName.toLowerCase());
msgType = errorType(wfvConn, "VMGEOLOCID");
if (msgType.equalsIgnoreCase("E"))
{
break;
}
}
} }
}
}
}
break;
}
errListSize = errList.size(); errListSize = errList.size();
System.out.println("errListSize:::::::["+errListSize+"]"); System.out.println("errListSize:::::::["+errListSize+"]");
if ( errList != null && errListSize > 0 ) if ( errList != null && errListSize > 0 )
...@@ -272,8 +313,11 @@ public class SunGeoBiAccess extends ValidatorEJB implements SunGeoBiAccessLocal, ...@@ -272,8 +313,11 @@ public class SunGeoBiAccess extends ValidatorEJB implements SunGeoBiAccessLocal,
System.out.println("in error For:::::::::::::::"); System.out.println("in error For:::::::::::::::");
errCode = (String)errList.get(cnt); errCode = (String)errList.get(cnt);
errFldName = (String)errFields.get(cnt); errFldName = (String)errFields.get(cnt);
System.out.println("errCode .........."+errCode); System.out.println("errCode .........."+errCode);
errString = getErrorString( errFldName, errCode, userId ); //modified by Shital on 24/07/2019 [Start]
//errString = getErrorString( errFldName, errCode, userId );
errString = itmDBAccessEJB.getErrorString(errFldName, errCode, userId, "", wfvConn);
//modified by Shital on 24/07/2019 [End]
System.out.println("errString is : ::::>>>> " + errString); System.out.println("errString is : ::::>>>> " + errString);
msgType = errorType( wfvConn , errCode ); msgType = errorType( wfvConn , errCode );
if ( errString.length() > 0) if ( errString.length() > 0)
...@@ -300,8 +344,7 @@ public class SunGeoBiAccess extends ValidatorEJB implements SunGeoBiAccessLocal, ...@@ -300,8 +344,7 @@ public class SunGeoBiAccess extends ValidatorEJB implements SunGeoBiAccessLocal,
errStringXml = new StringBuffer( "" ); errStringXml = new StringBuffer( "" );
} }
errString = errStringXml.toString(); errString = errStringXml.toString();
} }
catch (Exception ex) catch (Exception ex)
{ {
System.out.println("1st catch Exception::" + ex.getMessage()); System.out.println("1st catch Exception::" + ex.getMessage());
...@@ -330,6 +373,9 @@ public class SunGeoBiAccess extends ValidatorEJB implements SunGeoBiAccessLocal, ...@@ -330,6 +373,9 @@ public class SunGeoBiAccess extends ValidatorEJB implements SunGeoBiAccessLocal,
} }
catch (Exception e) catch (Exception e)
{ {
//modified by Shital on 24/07/2019 [Start]
e.printStackTrace();
//modified by Shital on 24/07/2019 [End]
System.out.println("Exception:::::: ::" + e.getMessage()); System.out.println("Exception:::::: ::" + e.getMessage());
throw new ITMException(e); throw new ITMException(e);
} }
...@@ -344,7 +390,9 @@ public class SunGeoBiAccess extends ValidatorEJB implements SunGeoBiAccessLocal, ...@@ -344,7 +390,9 @@ public class SunGeoBiAccess extends ValidatorEJB implements SunGeoBiAccessLocal,
Document dom1 = null; Document dom1 = null;
Document dom2 = null; Document dom2 = null;
String errFields = null; String errFields = null;
GenericUtility genericUtility = GenericUtility.getInstance(); //modified by Shital on 24/07/2019 [Start]
//GenericUtility genericUtility = GenericUtility.getInstance();
//modified by Shital on 24/07/2019 [End]
try try
{ {
System.out.println("xmlString [" + xmlString + "]"); System.out.println("xmlString [" + xmlString + "]");
...@@ -367,8 +415,14 @@ public class SunGeoBiAccess extends ValidatorEJB implements SunGeoBiAccessLocal, ...@@ -367,8 +415,14 @@ public class SunGeoBiAccess extends ValidatorEJB implements SunGeoBiAccessLocal,
} }
catch (Exception e) catch (Exception e)
{ {
//modified by Shital on 24/07/2019 [Start]
e.printStackTrace();
//modified by Shital on 24/07/2019 [End]
System.out.println("Exception :SunGeoBiAccess :" + e.getMessage()+ ":"); System.out.println("Exception :SunGeoBiAccess :" + e.getMessage()+ ":");
errFields = genericUtility.createErrorString(e); errFields = genericUtility.createErrorString(e);
//modified by Shital on 24/07/2019 [Start]
throw new ITMException(e);
//modified by Shital on 24/07/2019 [End]
} }
System.out.println("returning from SunGeoBiAccess "); System.out.println("returning from SunGeoBiAccess ");
return errFields; return errFields;
...@@ -379,21 +433,35 @@ public class SunGeoBiAccess extends ValidatorEJB implements SunGeoBiAccessLocal, ...@@ -379,21 +433,35 @@ public class SunGeoBiAccess extends ValidatorEJB implements SunGeoBiAccessLocal,
String userId = ""; String userId = "";
String userdescr = ""; String userdescr = "";
String geoLoc = ""; String geoLoc = "";
String chgUser = "";
String chgTerm = "";
String chgDate = "";
StringBuffer XmlString = new StringBuffer(); StringBuffer XmlString = new StringBuffer();
ConnDriver connDriver = new ConnDriver(); //modified by Shital on 24/07/2019 [Start]
//ConnDriver connDriver = new ConnDriver();
//modified by Shital on 24/07/2019 [End]
Connection itcConn = null; Connection itcConn = null;
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
ResultSet rs = null; ResultSet rs = null;
int currentFormNo = 0;
try try
{ {
String chgUser = checkNull(genericUtility.getValueFromXTRA_PARAMS(xtraParams, "userId")); //modified by Shital on 24/07/2019 [Start]
String chgTerm = getValueFromXTRA_PARAMS(xtraParams, "termId"); //String chgUser = checkNull(genericUtility.getValueFromXTRA_PARAMS(xtraParams, "userId"));
//String chgTerm = getValueFromXTRA_PARAMS(xtraParams, "termId");
chgUser = checkNull(genericUtility.getValueFromXTRA_PARAMS(xtraParams, "userId"));
chgTerm = getValueFromXTRA_PARAMS(xtraParams, "termId");
//modified by Shital on 24/07/2019 [End]
java.util.Date currDate = new java.util.Date(); java.util.Date currDate = new java.util.Date();
SimpleDateFormat sdf = new SimpleDateFormat(genericUtility.getApplDateFormat()); SimpleDateFormat sdf = new SimpleDateFormat(genericUtility.getApplDateFormat());
String chgDate = sdf.format(currDate); //modified by Shital on 24/07/2019 [Start]
itcConn = connDriver.getConnectDB("Driver"); //String chgDate = sdf.format(currDate);
chgDate = sdf.format(currDate);
//itcConn = connDriver.getConnectDB("Driver");
itcConn = getConnection();
itcConn.setAutoCommit(false); itcConn.setAutoCommit(false);
int currentFormNo = 0; //int currentFormNo = 0;
//modified by Shital on 24/07/2019 [End]
if (objContext != null && objContext.trim().length() > 0) if (objContext != null && objContext.trim().length() > 0)
{ {
currentFormNo = Integer.parseInt(objContext); currentFormNo = Integer.parseInt(objContext);
...@@ -407,8 +475,8 @@ public class SunGeoBiAccess extends ValidatorEJB implements SunGeoBiAccessLocal, ...@@ -407,8 +475,8 @@ public class SunGeoBiAccess extends ValidatorEJB implements SunGeoBiAccessLocal,
String objNameDefault = ""; String objNameDefault = "";
switch ( currentFormNo ) switch ( currentFormNo )
{ {
case 1: case 1:
{ {
XmlString.append("<Detail1 domID='1' dbID='' objContext='1' objName='"+ objNameDefault + "' selected='Y'>\r\n"); XmlString.append("<Detail1 domID='1' dbID='' objContext='1' objName='"+ objNameDefault + "' selected='Y'>\r\n");
XmlString.append("<attribute selected='N' updateFlag='A' status='N' pkNames=''/>\r\n"); XmlString.append("<attribute selected='N' updateFlag='A' status='N' pkNames=''/>\r\n");
if (currentColumn.trim().equalsIgnoreCase("itm_default")) if (currentColumn.trim().equalsIgnoreCase("itm_default"))
...@@ -424,9 +492,9 @@ public class SunGeoBiAccess extends ValidatorEJB implements SunGeoBiAccessLocal, ...@@ -424,9 +492,9 @@ public class SunGeoBiAccess extends ValidatorEJB implements SunGeoBiAccessLocal,
{ {
userId = checkNull(genericUtility.getColumnValue("user_id",dom2)); userId = checkNull(genericUtility.getColumnValue("user_id",dom2));
System.out.println("Value of User ID [" + userId + "]"); System.out.println("Value of User ID [" + userId + "]");
if (userId.length() > 0) if (userId.trim().length() > 0)
{ {
String userIdSql = "select name from users where code=?"; String userIdSql = "select name from users where code = ?";
pstmt = itcConn.prepareStatement(userIdSql); pstmt = itcConn.prepareStatement(userIdSql);
pstmt.setString( 1, userId ); pstmt.setString( 1, userId );
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
...@@ -445,11 +513,13 @@ public class SunGeoBiAccess extends ValidatorEJB implements SunGeoBiAccessLocal, ...@@ -445,11 +513,13 @@ public class SunGeoBiAccess extends ValidatorEJB implements SunGeoBiAccessLocal,
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
} }
if (userdescr.length() > 0) //modified by Shital on 24/07/2019 [Start]
/*if (userdescr.length() > 0)
{ {
XmlString.append("<username><![CDATA[").append(checkNull(userdescr)).append("]]></username>\r\n"); XmlString.append("<username><![CDATA[").append(checkNull(userdescr)).append("]]></username>\r\n");
}*/
} XmlString.append("<username><![CDATA[").append(checkNull(userdescr)).append("]]></username>\r\n");
//modified by Shital on 24/07/2019 [END]
} }
} }
if (currentColumn.trim().equalsIgnoreCase("geo_loc")) if (currentColumn.trim().equalsIgnoreCase("geo_loc"))
...@@ -458,16 +528,22 @@ public class SunGeoBiAccess extends ValidatorEJB implements SunGeoBiAccessLocal, ...@@ -458,16 +528,22 @@ public class SunGeoBiAccess extends ValidatorEJB implements SunGeoBiAccessLocal,
System.out.println("value of geo location is : [" + geoLoc+ "]"); System.out.println("value of geo location is : [" + geoLoc+ "]");
} }
XmlString.append("</Detail1>\r\n"); XmlString.append("</Detail1>\r\n");
}
break;
} }
break;
} catch (Exception ex) }
}
catch (Exception ex)
{ {
System.out.println("1st catch Exception::" + ex.getMessage()); System.out.println("1st catch Exception::" + ex.getMessage());
ex.printStackTrace(); ex.printStackTrace();
} finally { //modified by Shital on 24/07/2019 [Start]
try { throw new ITMException(ex);
//modified by Shital on 24/07/2019 [End]
}
finally
{
try
{
if (rs != null) if (rs != null)
{ {
rs.close(); rs.close();
...@@ -483,9 +559,14 @@ public class SunGeoBiAccess extends ValidatorEJB implements SunGeoBiAccessLocal, ...@@ -483,9 +559,14 @@ public class SunGeoBiAccess extends ValidatorEJB implements SunGeoBiAccessLocal,
itcConn.close(); itcConn.close();
itcConn = null; itcConn = null;
} }
} catch (Exception e) { }
catch (Exception e)
{
System.out.println("Exception:::::: ::" + e); System.out.println("Exception:::::: ::" + e);
e.printStackTrace(); e.printStackTrace();
//modified by Shital on 24/07/2019 [Start]
throw new ITMException(e);
//modified by Shital on 24/07/2019 [End]
} }
} }
System.out.println("value of xmlString::::" + XmlString); System.out.println("value of xmlString::::" + XmlString);
...@@ -494,34 +575,36 @@ public class SunGeoBiAccess extends ValidatorEJB implements SunGeoBiAccessLocal, ...@@ -494,34 +575,36 @@ public class SunGeoBiAccess extends ValidatorEJB implements SunGeoBiAccessLocal,
return XmlString.toString(); return XmlString.toString();
} }
private String checkNull(String input) private String checkNull(String input)
{
if (input == null)
{ {
input = ""; if (input == null)
} else {
{ input = "";
input = input.trim(); }
else
{
input = input.trim();
}
return input;
} }
return input;
}
private String errorType(Connection conn, String errorCode) throws ITMException private String errorType(Connection conn, String errorCode) throws ITMException
{
String msgType = "";
PreparedStatement pstmt = null;
ResultSet rs = null;
try
{ {
String sql = " SELECT MSG_TYPE FROM MESSAGES WHERE MSG_NO = ? "; String msgType = "";
pstmt = conn.prepareStatement(sql); PreparedStatement pstmt = null;
pstmt.setString(1, errorCode); ResultSet rs = null;
rs = pstmt.executeQuery(); try
while (rs.next())
{ {
msgType = rs.getString("MSG_TYPE"); 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) }
catch (Exception ex)
{ {
ex.printStackTrace(); ex.printStackTrace();
throw new ITMException(ex); throw new ITMException(ex);
......
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