Commit f7b5934d authored by dkasliwal's avatar dkasliwal

Modify WIPStatusEBJ for Add sitecode parameter in EJB,

Add WIPStatusSchedule file in bean package for WIP Dashboard shedule on weekly
Modify HalolMFGReleaseSchedule file for URI Change like clause in SQL


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@98529 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 04be5c5d
......@@ -53,8 +53,11 @@ public class HalolMFGReleaseSchedule implements Schedule
conn = connDriver.getConnectDB("DriverITM");
connDriver = null;
sendFinalURIList = new ArrayList<String>();
//sql = " select user_id,uri from dashboard_comp where uri like '%ProductionVsBudgetReportExport.jsp%'";
sql = "select user_id,uri from dashboard_comp where uri like '%ExportExample/GwtDashboardPage.html%'";
/*change like clause by Dhanendra on 27-08-15*/
//sql = "select user_id,uri from dashboard_comp where uri like '%ExportExample/GwtDashboardPage.html%'";
sql = "select user_id,uri from dashboard_comp where uri like '%ExportExample/GwtDashboardPage.html?metadataname=halolmfgmonth%'";
pstmt = conn.prepareStatement(sql);
rs = pstmt.executeQuery();
while (rs.next())
......
package ibase.dashboard.mfg.bean;
import ibase.scheduler.utility.interfaces.Schedule;
import ibase.system.config.ConnDriver;
import ibase.utility.CommonConstants;
import ibase.webitm.utility.ITMException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.awt.Desktop;
import java.net.URI;
public class WIPStatusSchedule implements Schedule
{
public String schedule(HashMap map) throws Exception
{
System.out.println(schedule((String) map.get("PROCESS_NAME")));
return schedule((String) map.get("PROCESS_NAME"));
}
public String schedule(String schedule) throws Exception
{
System.out.println("inside WIPStatusSchedule.........");
this.runSchedule();
return schedule;
}
public String schedulePriority(String arg0) throws Exception
{
return null;
}
private void runSchedule() throws ITMException
{
// Add new code on dated 10/01/2013
String sql = "";
ResultSet rs = null;
Connection conn = null;
PreparedStatement pstmt = null;
ConnDriver connDriver = new ConnDriver();
String userID = "";
String uri = "";
String finalURI = "";
List<String> sendFinalURIList = null;
//add new variable on dated1/02/2013
String os = System.getProperty("os.name").toLowerCase();
String browserPathForLinex = "";
try
{
conn = connDriver.getConnectDB("DriverITM");
connDriver = null;
sendFinalURIList = new ArrayList<String>();
sql = "select user_id,uri from dashboard_comp where uri like '%ExportExample/GwtDashboardPage.html?metadataname=wipstatus%'";
pstmt = conn.prepareStatement(sql);
rs = pstmt.executeQuery();
while (rs.next())
{
userID = rs.getString("user_id").trim();
uri = rs.getString("uri").trim();
finalURI = CommonConstants.TOMCAT_HOME + uri +"&EMP_MAILCODE="+ userID;
System.out.println("direct uri from dashboard_comp for WIPStatusSchedule =" + uri);
System.out.println("User id is for WIPStatusSchedule =" + userID);
System.out.println("Final url for WIPStatusSchedule including userID+uri =" + finalURI);
sendFinalURIList.add(finalURI.trim());
}
pstmt.close();
rs.close();
pstmt = null;
rs = null;
if (os.indexOf("win") >= 0)
{
System.out.println("Start Window Section part execution for WIPStatusSchedule");
if (Desktop.isDesktopSupported())
{
Desktop desktop = Desktop.getDesktop();
for (String resourcePath : sendFinalURIList)
{
try
{
desktop.browse(new URI(resourcePath));
Thread.sleep(90000);
System.out.println("End run on browser through window insde WIPStatusSchedule ");
} catch (Exception e)
{
e.printStackTrace();
}
}
}
System.out.println("End of Window Machine section part execution WIPStatusSchedule");
}
/* Ended Added new code for windows palform */
if (os.indexOf("nix") >= 0 || os.indexOf("nux") >= 0)
{
browserPathForLinex = "/usr/bin/firefox";
System.out.println("path of firefox inside WIPStatusSchedule"+browserPathForLinex);
for (String resourcePath : sendFinalURIList)
{
callURL(browserPathForLinex, resourcePath); //call synchronized method
}
}
}// end try block
catch (Exception e)
{
e.printStackTrace();
} finally
{
try
{
if (conn != null)
{
if (rs != null)
rs.close();
rs = null;
if (pstmt != null)
pstmt.close();
pstmt = null;
conn.close();
conn = null;
}
conn = null;
} catch (Exception e)
{
e.printStackTrace();
System.out.println("ibase.dashboard.mfg.bean: WIPStatusSchedule :runSchedule() " + e.getMessage());
}
}
}
synchronized void callURL(String browserPath, String resourcePath)
{
try
{
int second = (int) (System.currentTimeMillis() / 1000) % 60;
System.out.println("View for Time when next URL are comming in WIPStatusSchedule===" + second);
Runtime.getRuntime().exec(new String[]
{ browserPath, resourcePath });
Thread.sleep(90000);
} catch (Exception e)
{
System.out.println("exception in WIPStatusSchedule for callURL " + e.getMessage());
}
}
// This method call for check null
private String checkNull(String input)
{
if (input == null)
{
input = "";
} else
{
input = input.trim();
}
return input;
}
}
......@@ -11,8 +11,10 @@ import org.json.simple.JSONObject;
@Local
public interface WIPStatusLocal extends ValidatorLocal
{
public JSONObject getWIPStatus(String loginId ,String city, String dataSourceName) throws RemoteException, ITMException;
public JSONObject getWIPStatusGrid(String loginId ,String city, String dataSourceName) throws RemoteException, ITMException;
public JSONObject getWIPStatusLinkGrid(String loginId ,String city,String days,String category,String dataSourceName) throws RemoteException, ITMException;
public String getPDFByScheduler(String rptTitle,String remark,String userID, String imgName) throws RemoteException, ITMException;
/*Add new siteCode Parameter by Dhanendra on Date 27-08-15 */
public JSONObject getWIPStatus(String city, String siteCode, String dataSourceName) throws RemoteException, ITMException;
public JSONObject getWIPStatusGrid(String city, String siteCode, String dataSourceName) throws RemoteException, ITMException;
public JSONObject getWIPStatusLinkGrid(String city, String siteCode, String days,String category,String dataSourceName) throws RemoteException, ITMException;
public String getPDFByScheduler(String rptTitle,String remark,String userID, String imgName, String city, String siteCode, String dataSourceName) throws RemoteException, ITMException;
}
......@@ -12,9 +12,11 @@ import org.json.simple.JSONObject;
@Remote
public interface WIPStatusRemote extends ValidatorRemote
{
public JSONObject getWIPStatus(String loginId ,String city, String dataSourceName) throws RemoteException, ITMException;
public JSONObject getWIPStatusGrid(String loginId ,String city, String dataSourceName) throws RemoteException, ITMException;
public JSONObject getWIPStatusLinkGrid(String loginId ,String city,String days,String category,String dataSourceName) throws RemoteException, ITMException;
public String getPDFByScheduler(String rptTitle,String remark,String userID, String imgName) throws RemoteException, ITMException;
/*Add new siteCode Parameter by Dhanendra on Date 27-08-15 */
public JSONObject getWIPStatus(String city, String siteCode, String dataSourceName) throws RemoteException, ITMException;
public JSONObject getWIPStatusGrid(String city, String siteCode, String dataSourceName) throws RemoteException, ITMException;
public JSONObject getWIPStatusLinkGrid(String city, String siteCode, String days,String category,String dataSourceName) throws RemoteException, ITMException;
public String getPDFByScheduler(String rptTitle,String remark,String userID, String imgName, String city, String siteCode, String dataSourceName) throws RemoteException, ITMException;
}
......@@ -10,6 +10,7 @@ import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
@SuppressWarnings("serial")
public class WIPStatusExportPDFServlet extends HttpServlet
......@@ -35,6 +36,17 @@ public class WIPStatusExportPDFServlet extends HttpServlet
{
response.setContentType("application/xml");
HttpSession session = request.getSession(true);
String sessionCity = (String) session.getAttribute("city");
String sessionSiteCode = (String) session.getAttribute("siteCode");
String sessionDataSrcName = (String) session.getAttribute("dataSourceName");
System.out.println("sessionCity :"+sessionCity+"=======sessionSiteCode :"+sessionSiteCode);
System.out.println("sessionDataSrcName :"+sessionDataSrcName);
session.invalidate();
userID = request.getParameter("userID");
rptTitle = request.getParameter("rptTitle");
remark = request.getParameter("remark");
......@@ -43,7 +55,7 @@ public class WIPStatusExportPDFServlet extends HttpServlet
// call EJB method for PDF creation*******************
context = new InitialContext(appConnectParm.getProperty());
wipStatusRemote = (WIPStatusRemote) context.lookup("ibase/WIPStatus/remote");
resultString = wipStatusRemote.getPDFByScheduler(rptTitle,remark,userID,imgName);
resultString = wipStatusRemote.getPDFByScheduler(rptTitle,remark,userID,imgName,sessionCity,sessionSiteCode,sessionDataSrcName);
response.setContentType("text/html");
if(resultString.equals("false"))
{
......
......@@ -31,11 +31,11 @@ public class WIPStatusGridLinkServlet extends HttpServlet
InitialContext context = null;
AppConnectParm appConnectParm = new AppConnectParm();
String dataSourceName = "";
String loginId = "";
String month = "";
String city = "";
String category = "";
String siteCode = "";
try
{
response.setContentType("application/xml");
......@@ -47,13 +47,15 @@ public class WIPStatusGridLinkServlet extends HttpServlet
month = request.getParameter("month");
city = request.getParameter("city");
category = request.getParameter("category");
siteCode = request.getParameter("siteCode");
System.out.println("WIPStatusGridLinkServlet siteCode :"+siteCode);
System.out.println("category :"+category);
System.out.println("month :"+month+"---city :"+city+"----category :"+category);
dataSourceName = request.getParameter("dataSourceName");
context = new InitialContext(appConnectParm.getProperty());
wipStatusRemote = (WIPStatusRemote) context.lookup("ibase/WIPStatus/remote");
JSONObject jsonObjData = (JSONObject)wipStatusRemote.getWIPStatusLinkGrid(loginId,city,month,category,dataSourceName);
JSONObject jsonObjData = (JSONObject)wipStatusRemote.getWIPStatusLinkGrid(city,siteCode,month,category,dataSourceName);
OutputStream outputStream = response.getOutputStream();
outputStream.write(jsonObjData.toString().getBytes());
outputStream.flush();
......
......@@ -31,9 +31,8 @@ public class WIPStatusGridServlet extends HttpServlet
InitialContext context = null;
AppConnectParm appConnectParm = new AppConnectParm();
String dataSourceName = "";
String loginId = "";
String city = "";
String siteCode = "";
try
{
response.setContentType("application/xml");
......@@ -42,11 +41,12 @@ public class WIPStatusGridServlet extends HttpServlet
ibase.utility.UserInfoBean userInfo = (ibase.utility.UserInfoBean) session.getAttribute("USER_INFO");
loginId = userInfo.getLoginCode();*/
city = request.getParameter("city");
System.out.println("in WIPStatusGridServlet city :"+city);
siteCode = request.getParameter("siteCode");
System.out.println("in WIPStatusGridServlet city :"+city+"====siteCode :"+siteCode);
dataSourceName = request.getParameter("dataSourceName");
context = new InitialContext(appConnectParm.getProperty());
wipStatusRemote = (WIPStatusRemote) context.lookup("ibase/WIPStatus/remote");
JSONObject jsonObjData = (JSONObject)wipStatusRemote.getWIPStatusGrid(loginId,city,dataSourceName);
JSONObject jsonObjData = (JSONObject)wipStatusRemote.getWIPStatusGrid(city, siteCode, dataSourceName);
OutputStream outputStream = response.getOutputStream();
outputStream.write(jsonObjData.toString().getBytes());
outputStream.flush();
......
......@@ -31,21 +31,24 @@ public class WIPStatusServlet extends HttpServlet
InitialContext context = null;
AppConnectParm appConnectParm = new AppConnectParm();
String dataSourceName = "";
String loginId = "";
String city = "";
String siteCode = "";
try
{
response.setContentType("application/xml");
/*HttpSession session = request.getSession(true);
ibase.utility.UserInfoBean userInfo = (ibase.utility.UserInfoBean) session.getAttribute("USER_INFO");
loginId = userInfo.getLoginCode();*/
HttpSession session = request.getSession(true);
city = request.getParameter("city");
System.out.println("in WIPStatusServlet city :"+city);
siteCode = request.getParameter("siteCode");
dataSourceName = request.getParameter("dataSourceName");
System.out.println("in WIPStatusServlet city :"+city);
session.setAttribute("city", city);
session.setAttribute("siteCode", siteCode);
session.setAttribute("dataSourceName", dataSourceName);
context = new InitialContext(appConnectParm.getProperty());
wipStatusRemote = (WIPStatusRemote) context.lookup("ibase/WIPStatus/remote");
JSONObject jsonObjData = (JSONObject)wipStatusRemote.getWIPStatus(loginId,city,dataSourceName);
JSONObject jsonObjData = (JSONObject)wipStatusRemote.getWIPStatus(city, siteCode, dataSourceName);
//String jsonObjData = "{'0':{'month':0,'product_catagory':'F','product_value':{'2013':'6','2014':'6'}},'1':{'month':1,'product_catagory':'FRESH','product_value':{'2014':'13','<15 days':'9','>120-180 days':'1','>180 days':'1','>30-60 days':'4','>60-120 days':'5'}}}";
OutputStream outputStream = response.getOutputStream();
//outputStream.write(jsonObjData.toString().replace('\'', '"').getBytes());
......
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