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;
import java.sql.Connection;
import java.sql.PreparedStatement;
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.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 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.Node;
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
{
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 = "";
public String wfValData() throws RemoteException, ITMException
......@@ -37,7 +51,9 @@ public class SunGeoBiAccess extends ValidatorEJB implements SunGeoBiAccessLocal,
Document dom1 = null;
Document dom2 = 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
{
System.out.println("xmlString [" + xmlString + "]");
......@@ -60,8 +76,14 @@ public class SunGeoBiAccess extends ValidatorEJB implements SunGeoBiAccessLocal,
}
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()+ ":");
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 ");
return errFields;
......@@ -79,25 +101,37 @@ public class SunGeoBiAccess extends ValidatorEJB implements SunGeoBiAccessLocal,
String geoLoc = "";
int errListSize;
StringBuffer errStringXml = new StringBuffer("<?xml version=\"1.0\"?>\r\n<Root><Errors>");
String errCode="";
String errFldName="";
String errCode = "";
String errFldName = "";
String geoLocSql = "";
String dupIdSql = "";
//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 = "";
Connection wfvConn = null;
PreparedStatement pstmt = 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> errFields = new ArrayList<String>();
try
{
System.out.println("Came inside @nd wfValdata::::");
wfvConn = connDriver.getConnectDB("Driver");
wfvConn.setAutoCommit(false);
int currentFormNo = 0;
connDriver = new ConnDriver();
wfvConn = connDriver.getConnectDB("Driver");
//modified by Shital on 24/07/2019 [Start]
//wfvConn = connDriver.getConnectDB("Driver");
//wfvConn.setAutoCommit(false);
//int currentFormNo = 0;
//connDriver = new ConnDriver();
//wfvConn = connDriver.getConnectDB("Driver");
wfvConn = getConnection();
//modified by Shital on 24/07/2019 [End]
wfvConn.setAutoCommit(false);
if (objContext != null && objContext.trim().length() > 0)
{
......@@ -137,11 +171,13 @@ public class SunGeoBiAccess extends ValidatorEJB implements SunGeoBiAccessLocal,
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";
//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();
......@@ -179,7 +215,7 @@ public class SunGeoBiAccess extends ValidatorEJB implements SunGeoBiAccessLocal,
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)
if (geoLoc == null || geoLoc.trim().length() == 0)
{
System.out.println("Empty geo location");
errList.add("VMGEOLCID1");
......@@ -192,8 +228,11 @@ public class SunGeoBiAccess extends ValidatorEJB implements SunGeoBiAccessLocal,
}
else
{
int geoCnt = 0;
String geoLocSql = "SELECT COUNT(*) AS GEO_CNT FROM SITE WHERE GEO_LOC=?";
//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();
......@@ -222,9 +261,11 @@ public class SunGeoBiAccess extends ValidatorEJB implements SunGeoBiAccessLocal,
break;
}
}
int dupIdCount = 0;
String dupIdSql = " SELECT COUNT(*) AS PRIME_CNT FROM SUN_GEOBI_ACCESS WHERE USER_ID = ? AND GEO_LOC=?";
//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);
......@@ -273,7 +314,10 @@ public class SunGeoBiAccess extends ValidatorEJB implements SunGeoBiAccessLocal,
errCode = (String)errList.get(cnt);
errFldName = (String)errFields.get(cnt);
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);
msgType = errorType( wfvConn , errCode );
if ( errString.length() > 0)
......@@ -301,7 +345,6 @@ public class SunGeoBiAccess extends ValidatorEJB implements SunGeoBiAccessLocal,
}
errString = errStringXml.toString();
}
catch (Exception ex)
{
System.out.println("1st catch Exception::" + ex.getMessage());
......@@ -330,6 +373,9 @@ public class SunGeoBiAccess extends ValidatorEJB implements SunGeoBiAccessLocal,
}
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());
throw new ITMException(e);
}
......@@ -344,7 +390,9 @@ public class SunGeoBiAccess extends ValidatorEJB implements SunGeoBiAccessLocal,
Document dom1 = null;
Document dom2 = 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
{
System.out.println("xmlString [" + xmlString + "]");
......@@ -367,8 +415,14 @@ public class SunGeoBiAccess extends ValidatorEJB implements SunGeoBiAccessLocal,
}
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()+ ":");
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 ");
return errFields;
......@@ -379,21 +433,35 @@ public class SunGeoBiAccess extends ValidatorEJB implements SunGeoBiAccessLocal,
String userId = "";
String userdescr = "";
String geoLoc = "";
String chgUser = "";
String chgTerm = "";
String chgDate = "";
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;
PreparedStatement pstmt = null;
ResultSet rs = null;
int currentFormNo = 0;
try
{
String chgUser = checkNull(genericUtility.getValueFromXTRA_PARAMS(xtraParams, "userId"));
String chgTerm = getValueFromXTRA_PARAMS(xtraParams, "termId");
//modified by Shital on 24/07/2019 [Start]
//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();
SimpleDateFormat sdf = new SimpleDateFormat(genericUtility.getApplDateFormat());
String chgDate = sdf.format(currDate);
itcConn = connDriver.getConnectDB("Driver");
//modified by Shital on 24/07/2019 [Start]
//String chgDate = sdf.format(currDate);
chgDate = sdf.format(currDate);
//itcConn = connDriver.getConnectDB("Driver");
itcConn = getConnection();
itcConn.setAutoCommit(false);
int currentFormNo = 0;
//int currentFormNo = 0;
//modified by Shital on 24/07/2019 [End]
if (objContext != null && objContext.trim().length() > 0)
{
currentFormNo = Integer.parseInt(objContext);
......@@ -424,9 +492,9 @@ public class SunGeoBiAccess extends ValidatorEJB implements SunGeoBiAccessLocal,
{
userId = checkNull(genericUtility.getColumnValue("user_id",dom2));
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.setString( 1, userId );
rs = pstmt.executeQuery();
......@@ -445,11 +513,13 @@ public class SunGeoBiAccess extends ValidatorEJB implements SunGeoBiAccessLocal,
pstmt.close();
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");
//modified by Shital on 24/07/2019 [END]
}
}
if (currentColumn.trim().equalsIgnoreCase("geo_loc"))
......@@ -461,13 +531,19 @@ public class SunGeoBiAccess extends ValidatorEJB implements SunGeoBiAccessLocal,
}
break;
}
} catch (Exception ex)
}
catch (Exception ex)
{
System.out.println("1st catch Exception::" + ex.getMessage());
ex.printStackTrace();
} finally {
try {
//modified by Shital on 24/07/2019 [Start]
throw new ITMException(ex);
//modified by Shital on 24/07/2019 [End]
}
finally
{
try
{
if (rs != null)
{
rs.close();
......@@ -483,9 +559,14 @@ public class SunGeoBiAccess extends ValidatorEJB implements SunGeoBiAccessLocal,
itcConn.close();
itcConn = null;
}
} catch (Exception e) {
}
catch (Exception e)
{
System.out.println("Exception:::::: ::" + e);
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);
......@@ -494,20 +575,21 @@ public class SunGeoBiAccess extends ValidatorEJB implements SunGeoBiAccessLocal,
return XmlString.toString();
}
private String checkNull(String input)
{
private String checkNull(String input)
{
if (input == null)
{
input = "";
} else
}
else
{
input = input.trim();
}
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;
......@@ -521,7 +603,8 @@ private String errorType(Connection conn, String errorCode) throws ITMException
{
msgType = rs.getString("MSG_TYPE");
}
} catch (Exception ex)
}
catch (Exception ex)
{
ex.printStackTrace();
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