1
2
3
4
5
6
7
8
9
10 package com.sri.emo.wizard.completion.management;
11
12 import com.jcorporate.expresso.core.controller.*;
13 import com.jcorporate.expresso.core.db.DBException;
14 import com.sri.common.controller.StateHandler;
15 import com.sri.emo.wizard.wizardgateway.ListWizards;
16 import com.sri.emo.wizard.wizardgateway.WizardGatewayController;
17
18
19 /***
20 * @author Michael Rimov
21 */
22 public class PromptChooseNode implements StateHandler {
23
24 /***
25 * The name of this state as referred to by the Expresso Controller
26 */
27 public static final String STATE_NAME = "promptChooseNode";
28
29 /***
30 * The description of this state as referred to by the Expresso Controller.
31 */
32 public static final String STATE_DESCRIPTION = "Choose A Node";
33
34 /***
35 * Parent controller backreference.
36 */
37 private final Controller owner;
38
39 /***
40 * Delegating helper methods.
41 */
42 private final CompletionBeanManager beanManager;
43
44 /***
45 * Constructor that takes the owner controller as a paramter.
46 *
47 * @param stateOwner Controller the owning controller.
48 */
49 public PromptChooseNode(Controller stateOwner) {
50 this.owner = stateOwner;
51 beanManager = new CompletionBeanManager();
52 }
53
54 /***
55 * Called to handle the request.
56 *
57 * @param request ControllerRequest The Function's ControllerRequest
58 * object.
59 * @param response ControllerResponse The Function's ControllerResponse
60 * object.
61 * @throws DBException upon underlying database exception error.
62 * @throws ControllerException upon underlying ControllerException error.
63 */
64 public void handleRequest(final ExpressoRequest request, final ExpressoResponse response) throws DBException,
65 ControllerException {
66
67
68 beanManager.createOrRetrieveActionForm(request);
69
70 response.setTitle("Completion Wiz Creator, Part 1");
71
72 Transition next = new Transition(DoChooseNodeStep.STATE_NAME, owner);
73 next.setName("next");
74 next.setLabel("Next");
75 response.add(next);
76
77 response.add(new Transition("cancel", "Cancel", WizardGatewayController.class, ListWizards.STATE_NAME));
78
79 }
80 }