View Javadoc
1   /******************************************************************************
2    * PosterDisplayPageController.java - The Spring controller to display the Poster in progress.
3    * 
4    * PicMan - The BuckoSoft Picture Manager in Java
5    * Copyright(c) 2012 - 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.business.PicManFacade;
25  import com.buckosoft.PicMan.db.DatabaseFacade;
26  import com.buckosoft.PicMan.domain.User;
27  
28  /** The Spring controller to display the Poster work in progress.
29   * @author Dick Balaska
30   * @since 2012/07/21
31   * @see <a href="http://cvs.buckosoft.com/Projects/java/PicMan/PicMan/src/com/buckosoft/PicMan/web/PosterDisplayPageController.java">PosterDisplayPageController.java</a>
32   */
33  public class PosterDisplayPageController  extends BSAccountPageController {
34  
35  	private final static boolean DEBUG = false;
36  	
37      /** Logger for this class and subclasses */
38      protected final Log logger = LogFactory.getLog(getClass());
39  
40  	private PicManFacade	pmf;
41  	private DatabaseFacade	dbf;
42  	
43  	public void setPicMan(PicManFacade pmf) { this.pmf = pmf; }
44  	public PicManFacade getPicMan() { return(pmf); }
45  
46  	public void setDatabase(DatabaseFacade dbf) { this.dbf = dbf; }
47  	public DatabaseFacade getDatabase() { return(dbf); }
48  	
49  
50      public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response)
51              throws ServletException, IOException {
52  
53      	BSAccountUserWebSession userWebSession = this.bsAccountMan.getUserWebSession(request);
54      	User user = (User)userWebSession.getUser();
55  		if (DEBUG)
56  			logger.info("returning hello view with session " + userWebSession);
57  		
58  		String now = (new java.util.Date()).toString();
59  
60          Map<String, Object> myModel = new HashMap<String, Object>();
61          myModel.put("userWebSession", userWebSession);
62          myModel.put("now", now);
63          myModel.put("picMan", getPicMan());
64  		myModel.put("database", dbf);
65  		myModel.put("refreshDelay", user.getMosaicDisplayDelay());
66  		myModel.put("picName", user.getMosaicTestPic());
67          return new ModelAndView("PosterDisplayPage", "model", myModel);
68      }
69  
70  }