1 package com.sri.emo.wizard.completion.management;
2
3 import com.jcorporate.expresso.core.controller.*;
4 import com.sri.emo.wizard.completion.model.CompletionBean;
5
6
7 /***
8 * Interface that adapts the CompletionBean to the Webapp Session. (Or other
9 * pseudo-session depending on implementation.)
10 *
11 * @author Michael Rimov
12 * @version 1.0
13 */
14 public interface ICompletionBeanManager {
15
16 /***
17 * Creates or retrieves the action form. If it doesn't exist on the session then
18 * we create it.
19 *
20 * @param request ControllerRequest
21 * @return CompletionBean
22 * @throws ControllerException
23 */
24 CompletionBean createOrRetrieveActionForm(final ExpressoRequest request) throws ControllerException;
25
26 /***
27 * Destroys the completion bean from the session. Most often done after the bean has been saved.
28 *
29 * @param request ControllerRequest
30 * @throws ControllerException
31 */
32 void destroyActionForm(final ExpressoRequest request) throws ControllerException;
33
34 /***
35 * Retrieve an action form. If it doesn't exist, don't create it. Return
36 *
37 * @param request ControllerRequest
38 * @return CompletionBean
39 * @throws ControllerException
40 */
41 CompletionBean getActionForm(final ExpressoRequest request) throws ControllerException;
42
43 /***
44 * Checks if session has timed out and redirects to 'list wizards' state if it has.
45 *
46 * @param request The <tt>ControllerRequest</tt> handed to us by the framework.
47 * @param response <tt>ControllerResponse</tt> handed to us by the framework.
48 * @return boolean true if we handled a timeout. False otherwise.
49 * @throws ControllerException
50 * @throws NonHandleableException
51 */
52 boolean handleSessionTimeout(final ExpressoRequest request,
53 final ExpressoResponse response) throws ControllerException, NonHandleableException;
54
55 /***
56 * Validate the bean and return any action errors.
57 *
58 * @param request ControllerRequest
59 * @param errorsToAdd ErrorCollection
60 * @return ErrorCollection with or without any specified errors.
61 * @throws ControllerException upon error.
62 */
63 ErrorCollection validate(final ExpressoRequest request, ErrorCollection errorsToAdd) throws ControllerException;
64
65 /***
66 * Saves the specified completion bean to session.
67 *
68 * @param request the ExpressoRequest that contains the session.
69 * @param wizardBeanToSave CompletionBean
70 */
71 void setCompletionBean(final ExpressoRequest request, CompletionBean wizardBeanToSave) throws ControllerException;
72 }