View Javadoc
1   /******************************************************************************
2    * SyncSetupPageController.java - The Spring controller to display the Sync Setup page
3    * 
4    * PicMan - The BuckoSoft Picture Manager in Java
5    * Copyright(c) 2014 - 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  
27  /**
28   * The Spring controller to display the Sync Setup page. <br>
29   * 
30   * @author Dick Balaska
31   * @since 2014/06/07
32   * @see <a href="http://cvs.buckosoft.com/Projects/PicMan/PicMan/src/main/java/com/buckosoft/PicMan/web/SyncSetupPageController.java">SyncSetupPageController.java</a>
33   */
34  public class SyncSetupPageController extends BSAccountPageController {
35  
36  //	private final static boolean DEBUG = false;
37  	protected final Log logger = LogFactory.getLog(getClass());
38  	
39  	private PicManFacade	pmf;
40  	private DatabaseFacade	dbf;
41  	private	boolean			compressJS = false;
42  	
43  	/** Set the reference to the PicMan API
44  	 * @param pmf The PicManFacade
45  	 */
46  	public void setPicMan(PicManFacade pmf) { 
47  		this.pmf = pmf;
48  		this.dbf = pmf.getDB();
49  	}
50  	/** bean getter so Spring AOP can determine the type
51  	 * @return The PicManFacade
52  	 */
53  	public PicManFacade getPicMan() { return(pmf); }
54  
55  	public void setDatabase(DatabaseFacade dbf) { this.dbf = dbf; }
56  	/** bean getter so Spring AOP can determine the type
57  	 * @return The DatabaseFacade
58  	 */
59  	public DatabaseFacade getDatabase() { return(dbf); }
60  
61  	/**
62  	 * @return the compressJS
63  	 */
64  	public boolean isCompressJS() {
65  		return compressJS;
66  	}
67  
68  	/**
69  	 * @param compressJS the compressJS to set
70  	 */
71  	public void setCompressJS(boolean compressJS) {
72  		this.compressJS = compressJS;
73  	}
74  
75  	/** Build the model that spring outputs to the browser
76  	 * @param request The http request
77  	 * @param response The http response
78  	 */
79  	public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response)
80  			throws ServletException, IOException {
81  
82  	   	BSAccountUserWebSession userWebSession = this.bsAccountMan.getUserWebSession(request);
83  	    Map<String, Object> myModel = new HashMap<String, Object>();
84  		myModel.put("userWebSession", userWebSession);
85  		myModel.put("compressJS", compressJS);
86  //		myModel.put("picMan", pmf);
87          return new ModelAndView("SyncSetupPage", "model", myModel);
88  	}
89  	
90  }