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)
{ {
...@@ -137,11 +171,13 @@ public class SunGeoBiAccess extends ValidatorEJB implements SunGeoBiAccessLocal, ...@@ -137,11 +171,13 @@ public class SunGeoBiAccess extends ValidatorEJB implements SunGeoBiAccessLocal,
break; break;
} }
} }
else else
{ {
int idCount = 0; //modified by Shital on 24/07/2019 [Start]
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"; //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 = wfvConn.prepareStatement(userwfsql);
pstmt.setString(1, userId); pstmt.setString(1, userId);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
...@@ -179,7 +215,7 @@ public class SunGeoBiAccess extends ValidatorEJB implements SunGeoBiAccessLocal, ...@@ -179,7 +215,7 @@ public class SunGeoBiAccess extends ValidatorEJB implements SunGeoBiAccessLocal,
System.out.println("Childnode name:["+childNodeName+"]"); System.out.println("Childnode name:["+childNodeName+"]");
geoLoc = checkNull(genericUtility.getColumnValue("geo_loc", dom2)); geoLoc = checkNull(genericUtility.getColumnValue("geo_loc", dom2));
System.out.println("get loc value:::::::["+geoLoc+"]"); System.out.println("get loc value:::::::["+geoLoc+"]");
if (geoLoc == null || geoLoc.length() == 0) if (geoLoc == null || geoLoc.trim().length() == 0)
{ {
System.out.println("Empty geo location"); System.out.println("Empty geo location");
errList.add("VMGEOLCID1"); errList.add("VMGEOLCID1");
...@@ -192,8 +228,11 @@ public class SunGeoBiAccess extends ValidatorEJB implements SunGeoBiAccessLocal, ...@@ -192,8 +228,11 @@ public class SunGeoBiAccess extends ValidatorEJB implements SunGeoBiAccessLocal,
} }
else else
{ {
int geoCnt = 0; //modified by Shital on 24/07/2019 [Start]
String geoLocSql = "SELECT COUNT(*) AS GEO_CNT FROM SITE WHERE GEO_LOC=?"; //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 = wfvConn.prepareStatement(geoLocSql);
pstmt.setString(1,geoLoc); pstmt.setString(1,geoLoc);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
...@@ -222,9 +261,11 @@ public class SunGeoBiAccess extends ValidatorEJB implements SunGeoBiAccessLocal, ...@@ -222,9 +261,11 @@ public class SunGeoBiAccess extends ValidatorEJB implements SunGeoBiAccessLocal,
break; break;
} }
} }
//modified by Shital on 24/07/2019 [Start]
int dupIdCount = 0; //int dupIdCount = 0;
String dupIdSql = " SELECT COUNT(*) AS PRIME_CNT FROM SUN_GEOBI_ACCESS WHERE USER_ID = ? AND GEO_LOC=?"; //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 = wfvConn.prepareStatement(dupIdSql);
pstmt.setString(1, userId); pstmt.setString(1, userId);
pstmt.setString(2, geoLoc); pstmt.setString(2, geoLoc);
...@@ -273,7 +314,10 @@ public class SunGeoBiAccess extends ValidatorEJB implements SunGeoBiAccessLocal, ...@@ -273,7 +314,10 @@ public class SunGeoBiAccess extends ValidatorEJB implements SunGeoBiAccessLocal,
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)
...@@ -301,7 +345,6 @@ public class SunGeoBiAccess extends ValidatorEJB implements SunGeoBiAccessLocal, ...@@ -301,7 +345,6 @@ public class SunGeoBiAccess extends ValidatorEJB implements SunGeoBiAccessLocal,
} }
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);
...@@ -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"))
...@@ -461,13 +531,19 @@ public class SunGeoBiAccess extends ValidatorEJB implements SunGeoBiAccessLocal, ...@@ -461,13 +531,19 @@ public class SunGeoBiAccess extends ValidatorEJB implements SunGeoBiAccessLocal,
} }
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,20 +575,21 @@ public class SunGeoBiAccess extends ValidatorEJB implements SunGeoBiAccessLocal, ...@@ -494,20 +575,21 @@ 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) if (input == null)
{ {
input = ""; input = "";
} else }
else
{ {
input = input.trim(); 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 = ""; String msgType = "";
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
ResultSet rs = null; ResultSet rs = null;
...@@ -521,7 +603,8 @@ private String errorType(Connection conn, String errorCode) throws ITMException ...@@ -521,7 +603,8 @@ private String errorType(Connection conn, String errorCode) throws ITMException
{ {
msgType = rs.getString("MSG_TYPE"); 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