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