Commit 310cbb9f authored by bpandey's avatar bpandey

add logic for sql input in pophelp

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@175520 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 163d928d
...@@ -41,7 +41,7 @@ public class DashboardUtility { ...@@ -41,7 +41,7 @@ public class DashboardUtility {
} }
return splitedArray; return splitedArray;
} }
public String getKeyString(String modName, String fieldName, UserInfoBean userInfo) /*public String getKeyString(String modName, String fieldName, UserInfoBean userInfo)
{ {
ConnDriver connDriver = new ConnDriver(); ConnDriver connDriver = new ConnDriver();
Statement statement = null; Statement statement = null;
...@@ -89,7 +89,7 @@ public class DashboardUtility { ...@@ -89,7 +89,7 @@ public class DashboardUtility {
} }
} }
return keyString; return keyString;
} }*/
private String checkNull(String str) private String checkNull(String str)
{ {
if(str == null) if(str == null)
......
...@@ -9,9 +9,12 @@ import javax.servlet.http.HttpServlet; ...@@ -9,9 +9,12 @@ import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession; import javax.servlet.http.HttpSession;
import ibase.dashboard.Report.Utility.DashboardUtility;
import ibase.utility.UserInfoBean; import ibase.utility.UserInfoBean;
import ibase.system.config.ConnDriver;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Statement;
public class DashboardFilterServlet extends HttpServlet public class DashboardFilterServlet extends HttpServlet
{ {
...@@ -41,9 +44,9 @@ public class DashboardFilterServlet extends HttpServlet ...@@ -41,9 +44,9 @@ public class DashboardFilterServlet extends HttpServlet
objName = request.getParameter("OBJ_NAME"); objName = request.getParameter("OBJ_NAME");
//keyString = request.getParameter("KEYSTRING"); //keyString = request.getParameter("KEYSTRING");
//Add new code By sachin on dated 23/6/2015 //Add new code By birendra on dated 23/6/2015
keyString = new DashboardUtility().getKeyString("W_" + objName, fieldName, userInfo); keyString = this.getKeyString("W_" + objName, fieldName, userInfo);
//Add new code By sachin on dated 23/6/2015 //Add new code By Birendra on dated 23/6/2015
int pos = fieldName.lastIndexOf("."); int pos = fieldName.lastIndexOf(".");
fieldName = fieldName.substring(pos + 1, fieldName.length()); fieldName = fieldName.substring(pos + 1, fieldName.length());
...@@ -80,7 +83,6 @@ public class DashboardFilterServlet extends HttpServlet ...@@ -80,7 +83,6 @@ public class DashboardFilterServlet extends HttpServlet
curToken = curToken.substring(curToken.indexOf(".") + 1); curToken = curToken.substring(curToken.indexOf(".") + 1);
} }
flag = true; flag = true;
//changed by Monif on 3/9/2009.[Simulate it as RCP]
curToken = (curToken.indexOf(",") != -1) ? curToken.substring(0, curToken.indexOf(",")) : curToken; curToken = (curToken.indexOf(",") != -1) ? curToken.substring(0, curToken.indexOf(",")) : curToken;
parameters[ctr] = request.getParameter(curToken); parameters[ctr] = request.getParameter(curToken);
ctr++; ctr++;
...@@ -126,4 +128,73 @@ public class DashboardFilterServlet extends HttpServlet ...@@ -126,4 +128,73 @@ public class DashboardFilterServlet extends HttpServlet
} }
} }
//Add new method for get sql input string from pophel table by Birendra Pandey on dated:
public String getKeyString(String modName, String fieldName, UserInfoBean userInfo)
{
ConnDriver connDriver = new ConnDriver();
Statement statement = null;
ResultSet resultSet = null;
String keyString = "";
Connection connection = null;
String transDB = "";
try
{
transDB = userInfo.getTransDB();
if (transDB != null && !"null".equalsIgnoreCase(transDB.trim()) && transDB.trim().length() > 0)
{
connection = connDriver.getConnectDB(transDB);
}
else
{
connection = connDriver.getConnectDB("DriverITM");
}
statement = connection.createStatement();
String query = "SELECT SQL_INPUT FROM POPHELP WHERE MOD_NAME ='" + modName + "' AND FIELD_NAME = '" + fieldName.toUpperCase() + "'";
System.out.println("modName is ="+modName+ " fieldName is= "+fieldName + " and query " +query);
resultSet = statement.executeQuery(query);
if (resultSet.next())
{
keyString = checkNull(resultSet.getString("SQL_INPUT"));
}
} catch (Exception e)
{
e.printStackTrace();
} finally
{
try
{
resultSet.close();
resultSet = null;
statement.close();
statement = null;
connection.close();
connection = null;
} catch (Exception ex)
{
System.out.println("Finally Exception : DashboardFilterServlet: getKeyString()" + ex.getMessage());
ex.printStackTrace();
}
}
return keyString;
}
private String checkNull(String str)
{
if(str == null)
{
return "";
}
else
{
return str ;
}
}
//end the getKeyString method
} }
\ No newline at end of file
...@@ -60,7 +60,7 @@ public class ParentMetaDataServlet extends HttpServlet ...@@ -60,7 +60,7 @@ public class ParentMetaDataServlet extends HttpServlet
} catch (Exception e) } catch (Exception e)
{ {
System.out.println("Exception : SalesPerfrmncDataServlet :doPost(HttpServletRequest request, HttpServletResponse response) :" + e); System.out.println("Exception : ParentMetaDataServlet :doPost(HttpServletRequest request, HttpServletResponse response) :" + e);
try try
{ {
throw new ITMException(e); throw new ITMException(e);
......
package ibase.dashboard.Report.Utility;
import ibase.system.config.ConnDriver;
import ibase.utility.UserInfoBean;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Statement;
public class DashboardUtility {
@SuppressWarnings("unused")
public String getCommaSeparated(String getString)
{
String[] geoStringArray = this.getSplitedStrng(getString);
String getCommaSeparate = "";
if (geoStringArray != null)
{
for (int i = 0; i < geoStringArray.length; i++)
{
if (i == geoStringArray.length - 1)
{
getCommaSeparate = getCommaSeparate + "'" + geoStringArray[i] + "'";
} else
{
getCommaSeparate = getCommaSeparate + "'" + geoStringArray[i] + "',";
}
}
} else
{
getCommaSeparate = "";
}
return getCommaSeparate;
}
public String[] getSplitedStrng(String valueString)
{
String[] splitedArray = null;
if (valueString != null && valueString.length() > 0)
{
splitedArray = valueString.split(",");
}
return splitedArray;
}
/*public String getKeyString(String modName, String fieldName, UserInfoBean userInfo)
{
ConnDriver connDriver = new ConnDriver();
Statement statement = null;
ResultSet resultSet = null;
String keyString = "";
Connection connection = null;
String transDB = "";
try
{
//transDB = userInfo.getTransDB();
if (transDB != null && !"null".equalsIgnoreCase(transDB.trim()) && transDB.trim().length() > 0)
{
connection = connDriver.getConnectDB(transDB);
} else
{
connection = connDriver.getConnectDB("DriverITM");
}
statement = connection.createStatement();
String query = "SELECT SQL_INPUT FROM POPHELP WHERE MOD_NAME ='" + modName + "' AND FIELD_NAME = '" + fieldName.toUpperCase() + "'";
System.out.println("modName is ="+modName+ " fieldName is= "+fieldName + " and query " +query);
resultSet = statement.executeQuery(query);
if (resultSet.next())
{
keyString = checkNull(resultSet.getString("SQL_INPUT"));
}
} catch (Exception e)
{
e.printStackTrace();
} finally
{
try
{
resultSet.close();
resultSet = null;
statement.close();
statement = null;
connection.close();
connection = null;
} catch (Exception ex)
{
System.out.println("Finally Exception : DashboardUtility: getKeyString()" + ex.getMessage());
ex.printStackTrace();
}
}
return keyString;
}*/
private String checkNull(String str)
{
if(str == null)
{
return "";
}
else
{
return str ;
}
}
}
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