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
16 /***
17 * @author Michael Rimov
18 */
19 public class PromptChooseCriteria implements StateHandler {
20
21 /***
22 * The name of this state as referred to by the Expresso Controller
23 */
24 public static final String STATE_NAME = "promptChooseCriteria";
25
26 /***
27 * The description of this state as referred to by the Expresso Controller.
28 */
29 public static final String STATE_DESCRIPTION = "Choose Parts Criteria";
30
31
32 /***
33 * Parent controller backreference.
34 */
35 private final Controller parent;
36
37
38 /***
39 * CompletionBean manager.
40 */
41 private final CompletionBeanManager beanManager;
42
43
44 /***
45 * Constructor that takes the owner controller as a paramter.
46 *
47 * @param owner Controller the owning controller.
48 */
49 public PromptChooseCriteria(Controller owner) {
50 parent = owner;
51 beanManager = new CompletionBeanManager();
52 }
53
54 /***
55 * Special construcor that allows substitution of the bean manager.
56 *
57 * @param owner Controller
58 * @param specialManager CompletionBeanManager
59 */
60 public PromptChooseCriteria(Controller owner, CompletionBeanManager specialManager) {
61 parent = owner;
62 beanManager = specialManager;
63 }
64
65 /***
66 * Called to handle the request.
67 *
68 * @param request ControllerRequest The Function's ControllerRequest
69 * object.
70 * @param response ControllerResponse The Function's ControllerResponse
71 * object.
72 * @throws DBException upon underlying database exception error.
73 * @throws ControllerException upon underlying ControllerException error.
74 */
75 public void handleRequest(final ExpressoRequest request, final ExpressoResponse response) throws DBException,
76 ControllerException {
77 response.setTitle("Completion Wiz Creator, Part 3");
78
79
80 if (beanManager.handleSessionTimeout(request, response)) {
81 return;
82 }
83
84 beanManager.getActionForm(request);
85
86
87 Transition back = new Transition(PromptChooseParts.STATE_NAME, parent);
88 back.setName("back");
89 back.setLabel("Back");
90 response.add(back);
91
92 Transition next = new Transition(DoChooseCriteria.STATE_NAME, parent);
93 next.setName("next");
94 next.setLabel("Next");
95 response.add(next);
96 }
97 }