View Javadoc
1   /******************************************************************************
2    * EngineReportPageController.java - The Spring controller to tell us about the Engine's status
3    * 
4    * PicMan - The BuckoSoft Picture Manager in Java
5    * Copyright(c) 2005 - Dick Balaska
6    * 
7    */
8   package com.buckosoft.PicMan.web;
9   
10  import java.io.IOException;
11  import java.util.HashMap;
12  import java.util.Map;
13  
14  import javax.servlet.ServletException;
15  import javax.servlet.http.HttpServletRequest;
16  import javax.servlet.http.HttpServletResponse;
17  
18  import org.apache.commons.logging.Log;
19  import org.apache.commons.logging.LogFactory;
20  import org.springframework.web.servlet.ModelAndView;
21  
22  import com.buckosoft.BSAccount.web.BSAccountPageController;
23  import com.buckosoft.BSAccount.web.BSAccountUserWebSession;
24  import com.buckosoft.PicMan.domain.User;
25  
26  /** Tell us about the Engine's status
27   * @author Dick Balaska
28   * @since 2005/08/11
29   */
30  public class EngineReportPageController extends BSAccountPageController {
31  
32  	private final static boolean DEBUG = false;
33  	protected final Log logger = LogFactory.getLog(getClass());
34  	
35  //	private PicManFacade pmf;
36  //	private DatabaseFacade dbf;
37  	
38  	/** Set the reference to the PicMan API.
39  	 * @param pmf The PicManFacade
40  	 */
41  //	public void setPicMan(PicManFacade pmf) { this.pmf = pmf; }
42  //	public PicManFacade getPicMan() { return(pmf); }
43  
44  	/** Set the reference to the PicMan Database
45  	 * @param dbf The DatabaseFacade
46  	 */
47  //	public void setDatabase(DatabaseFacade dbf) { this.dbf = dbf; }
48  //	public DatabaseFacade getDatabase() { return(dbf); }
49  
50  
51  	/** Spring standard http request handler
52  	 * @param request The http request
53  	 * @param response The http response
54  	 * @return The Spring Model and View
55  	 */ 
56  	public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response)
57  	throws ServletException, IOException {
58  		
59      	BSAccountUserWebSession userWebSession = this.bsAccountMan.getUserWebSession(request);
60  		if (userWebSession != null) {
61  			if (DEBUG)
62  				logger.info("session-user = '" + userWebSession.getUser().getUsername() + "'");
63  		}
64  		User user = (User)userWebSession.getUser();
65  		Map<String, Object> myModel = new HashMap<String, Object>();
66  		myModel.put("userWebSession", userWebSession);
67  		myModel.put("refreshDelay", "" + 10);
68  		myModel.put("engineReportRows", user.getEngineReportRows());
69  		myModel.put("engineReportColumns", user.getEngineReportColumns());
70  		return new ModelAndView("EngineReportPage", "model", myModel);
71  	}
72  	
73  	
74  }