1 package com.sri.emo.wizard.completion.management;
2
3 import com.jcorporate.expresso.core.controller.ControllerException;
4 import com.jcorporate.expresso.core.controller.ExpressoRequest;
5 import com.jcorporate.expresso.core.controller.ExpressoResponse;
6 import com.jcorporate.expresso.core.controller.Transition;
7 import com.jcorporate.expresso.core.db.DBException;
8 import com.sri.common.controller.StateHandler;
9 import com.sri.emo.wizard.wizardgateway.ListWizards;
10 import com.sri.emo.wizard.wizardgateway.WizardGatewayController;
11
12
13 /***
14 * @author Michael Rimov
15 * @version 1.0
16 */
17 public class DoCancel implements StateHandler {
18
19 /***
20 * The completion bean manager.
21 */
22 private final ICompletionBeanManager beanManager;
23
24 /***
25 * The name of this state as referred to by the Expresso Controller
26 */
27 public static final String STATE_NAME = "doCancel";
28
29 /***
30 * The description of this state as referred to by the Expresso Controller.
31 */
32 public static final String STATE_DESCRIPTION = "Cancel";
33
34 /***
35 * Constructs a cancel state handler with the given completion bean manager.
36 *
37 * @param beanManager CompletionBeanManager
38 */
39 public DoCancel(final ICompletionBeanManager beanManager) {
40 this.beanManager = beanManager;
41 }
42
43 /***
44 * Called to handle the request.
45 *
46 * @param request ControllerRequest The Function's ControllerRequest
47 * object.
48 * @param response ControllerResponse The Function's ControllerResponse
49 * object.
50 * @throws DBException upon underlying database exception error.
51 * @throws ControllerException upon underlying ControllerException error.
52 */
53 public void handleRequest(final ExpressoRequest request, final ExpressoResponse response) throws DBException,
54 ControllerException {
55
56 if (beanManager.handleSessionTimeout(request, response)) {
57 return;
58 }
59
60
61 beanManager.destroyActionForm(request);
62
63 Transition cancel = new Transition("cancel", "Cancel", WizardGatewayController.class, ListWizards.STATE_NAME);
64 cancel.redirectTransition(request, response);
65 }
66 }