Commit 04eb069b authored by vvengurlekar's avatar vvengurlekar

Dashboard parent ejb added

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@177452 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 4e07585d
package ibase.dashboard.metadata.ejb;
import ibase.dashboard.Report.Utility.DashboardUtility;
import ibase.system.config.ConnDriver;
import ibase.utility.CommonConstants;
import ibase.utility.E12GenericUtility;
import ibase.webitm.ejb.ValidatorEJB;
import ibase.webitm.utility.GenericUtility;
import ibase.webitm.utility.ITMException;
import java.io.File;
import java.rmi.RemoteException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.Statement;
import java.sql.Timestamp;
import java.text.SimpleDateFormat;
import java.util.Arrays;
import java.util.Calendar;
import java.util.LinkedHashMap;
import java.util.Map.Entry;
import javax.ejb.Stateless;
import org.json.simple.JSONObject;
@Stateless
public class DashboardParentEJB extends ValidatorEJB implements DashboardParentEJBLocal, DashboardParentEJBRemote
{
public DashboardParentEJB() {
// TODO Auto-generated constructor stub
}
DashboardUtility dashboardUtility = new DashboardUtility();
@Override
public String getKeyString(String modName, String fieldName, String transDB) throws RemoteException, ITMException
{
Statement statement = null;
ResultSet resultSet = null;
String keyString = "";
Connection conn = null;
ConnDriver connDriver = new ConnDriver();
try
{
if (transDB != null && transDB.trim().length() > 0)
{
conn = connDriver.getConnectDB(transDB);
}
else
{
conn = connDriver.getConnectDB("DriverITM");
}
connDriver = null;
statement = conn.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 = dashboardUtility.checkNull(resultSet.getString("SQL_INPUT"));
}
} catch (Exception e)
{
e.printStackTrace();
} finally
{
try
{
resultSet.close();
resultSet = null;
statement.close();
statement = null;
conn.close();
conn = null;
} catch (Exception ex)
{
System.out.println("Finally Exception : DashboardParentEJB: getKeyString()" + ex.getMessage());
ex.printStackTrace();
}
}
return keyString;
}
@SuppressWarnings("unchecked")
@Override
public JSONObject getDefaultFilterValue(String transDB ) throws RemoteException, ITMException
{
ConnDriver connDriver = new ConnDriver();
Statement statement = null;
ResultSet rs = null;
JSONObject parentDataJson = new JSONObject();
Connection connection = null;
try
{
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 Acct_Prd,Code,Descr From Period Where To_Date(Sysdate) Between Fr_Date and To_Date ";
rs = statement.executeQuery(query);
if (rs.next())
{
parentDataJson.put("CURRENT_ACCTCODE",dashboardUtility.checkNull(rs.getString("Acct_Prd")));
parentDataJson.put("CURRENT_PRDCODE", dashboardUtility.checkNull(rs.getString("Code")));
}
} catch (Exception e)
{
e.printStackTrace();
} finally
{
try
{
rs.close();
rs = null;
statement.close();
statement = null;
connection.close();
connection = null;
} catch (Exception ex)
{
System.out.println("Finally Exception : DashboardFilterServlet: getDefaultFilterValue()" + ex.getMessage());
ex.printStackTrace();
}
}
return parentDataJson;
}
}
package ibase.dashboard.metadata.ejb;
import ibase.webitm.ejb.ValidatorLocal;
import ibase.webitm.utility.ITMException;
import java.rmi.RemoteException;
import javax.ejb.Local;
import org.json.simple.JSONObject;
@Local
public interface DashboardParentEJBLocal extends ValidatorLocal
{
public String getKeyString(String ObjectName, String fieldName, String transDB) throws RemoteException, ITMException;
public JSONObject getDefaultFilterValue(String dataSourceName) throws RemoteException, ITMException;
}
package ibase.dashboard.metadata.ejb;
import ibase.webitm.ejb.ValidatorRemote;
import ibase.webitm.utility.ITMException;
import java.rmi.RemoteException;
import javax.ejb.Remote;
import org.json.simple.JSONObject;
@Remote
public interface DashboardParentEJBRemote extends ValidatorRemote
{
public String getKeyString(String ObjectName, String fieldName, String transDB) throws RemoteException, ITMException;
public JSONObject getDefaultFilterValue(String dataSourceName) 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