com.sri.emo.controller
Class SelectionWizardManager

java.lang.Object
  extended by org.apache.struts.action.Action
      extended by com.jcorporate.expresso.core.controller.Controller
          extended by com.jcorporate.expresso.core.controller.DBController
              extended by com.sri.common.controller.AbstractDBController
                  extended by com.sri.emo.controller.EmoAction
                      extended by com.sri.emo.controller.SelectionWizardManager
All Implemented Interfaces:
IFooterStateHandler, IHeaderStateHandler, IWizardManager, Serializable

public class SelectionWizardManager
extends EmoAction
implements IWizardManager

Provides CRUD capabilities for Wizard DBObjects. It is designed as a series of Transaction Scripts. See Patterns of Enterprise Application Architecture pattern list for more information.

A controller is a rough model of a finite state machine for a web application. Each state provides user interaction elements that can be rendered in a web page or other medium such as a command line app.

Author:
Mike Rimov
See Also:
Serialized Form

Field Summary
static String STATE_DO_ADDWIZARD
          Finishes the post to state.
static String STATE_DO_DELETE
          Constant for access to state: Delete Wizard.
static String STATE_DO_EDIT
          Finishes the edit to update state.
static String STATE_PROMPT_ADDWIZARD
          Constant for access to state: Add Wizard.
static String STATE_PROMPT_EDIT
          Constant for access to state: Edit Wizard.
static String STATE_PUBLIC_LIST
          synonym to serve old URLs
static String STATE_RUNWIZARD
          Constant for access to state: Run Wizard.
 
Fields inherited from class com.sri.common.controller.AbstractDBController
COLUMN, COMMON_FOOTER_HANDLER, COMMON_HEADER_HANDLER, DELIMIT, EDIT_GROUP_DISPLAY, EMBEDDED_MODE, FOOTER, MAX_CHARS_OUTPUT, MAX_TEXTAREA_LENGTH, MULTIPLE_TEXTAREA_NUM_LINES, REQUEST_CONTAINER, ROW, ROW_BLOCK, SESSION_CONTAINER, SINGLE_TEXTAREA_NUM_LINES, TEXTAREA_NUM_COLS, WARNING_LIST
 
Fields inherited from class com.jcorporate.expresso.core.controller.DBController
CACHE_NAME
 
Fields inherited from class com.jcorporate.expresso.core.controller.Controller
CONTROLLER_PARAM_KEY, CTL_SUCC_CTL, CTL_SUCC_STATE, CTL_SUCC_TRAN, mLog, NEWSTATE_EXCEPTION_KEY, ORIGINAL_URL_KEY, REQUEST_KEY, RESPONSE_KEY, RETURN_TO_SENDER_TRAN, STATE_ERR_CTL, STATE_ERR_STATE, STATE_ERR_TRAN, STATE_PARAM_KEY, STATE_SUCC_CTL, STATE_SUCC_STATE, STATE_SUCC_TRAN
 
Fields inherited from class org.apache.struts.action.Action
defaultLocale, servlet
 
Constructor Summary
SelectionWizardManager()
          Creates an instance of WizardManager.
 
Method Summary
 void add(ExpressoRequest request, ExpressoResponse response)
          Begins an 'add' end-user transaction to create a new wizard.
protected  void buildDecisionMatrix(ControllerRequest request, ControllerResponse response, Block matrix, WizDefinition currentWizard)
          Builds the decision matrix for the current wizard.
protected  void buildWizardSteps(ControllerRequest request, Block steps, WizDefinition currentWizard)
          Builds the steps for the current wizard.
 void edit(WizDefinition wizard, ExpressoRequest request, ExpressoResponse response)
          Begins an 'edit' end-user transaction to edit an existing wizard.
 String getTitle()
          Override of Controller.getTitle() to provide a meaningful name to this controller.
 void run(WizDefinition wizard, ExpressoRequest request, ExpressoResponse response)
          Runs the wizard that the manager is associated with.
protected  void runDoAddState(ControllerRequest request, ControllerResponse response)
          Runs the Complete Add Wizard state.
protected  void runDoDeleteState(ControllerRequest request, ControllerResponse response)
          Runs the Delete Wizard state.
protected  void runDoEditState(ControllerRequest request, ControllerResponse response)
          Runs the complete update state.
protected  void runPromptAddWizardState(ControllerRequest request, ControllerResponse response)
          Runs the Add Wizard Prompt state.
protected  void runPromptDeleteState(ControllerRequest request, ControllerResponse response)
          Runs the Prompt Delete Wizard state.
protected  void runPromptEditState(ControllerRequest request, ControllerResponse response)
          Runs the Edit Wizard state.
protected  void runPublicListState(ControllerRequest request, ControllerResponse response)
          synonym for wizard gateway 'list wizards'
protected  void runRunWizardState(ControllerRequest request, ControllerResponse response)
          Runs the Run Wizard state.
protected  void verifyWizardParameters(ControllerRequest request, ErrorCollection ec, WizDefinition wizdef)
          Checks the parameters for add and edit wizard state pertaining to the wizard definition itself.
 
Methods inherited from class com.sri.emo.controller.EmoAction
addFooter, addHeader, runFooterState, runHeaderState
 
Methods inherited from class com.sri.common.controller.AbstractDBController
addEmbeddedParameter, addWarning, addWarningList, getActionForwarding, getCheckbox, getPermsTrans, getPrettyXML, getTextArea, getTextArea, getWarningList, isEmbeddedMode, isValidAndPopulated, outputXML, populateDBObject, postPerform, prePerform, stateAllowed, str, strTrunc, trimAllTextFields
 
Methods inherited from class com.jcorporate.expresso.core.controller.DBController
getString, isAllowed
 
Methods inherited from class com.jcorporate.expresso.core.controller.Controller
addFinalState, addPromptTransitions, addRegDomainParamtoSession, addRequestedURLtoSession, addState, addStatePairing, endTimer, execute, findControllerForm, generateToken, getActionForward, getControllerChainingTransition, getControllerSecurityTransition, getFinalState, getInitialState, getLogger, getParamValues, getRequestURL, getSchema, getSchemaHierarchy, getSchemaInstance, getSchemaStack, getState, getStates, getString, getString, handleException, instantiate, isFinalState, isHandleState, isPromptState, isTokenValid, loadStateForm, newExpressoState, newState, nextHandleState, nextPromptState, populateStateForm, postPerform, prePerform, previousPromptState, processRequestTransitions, processTransitions, redirectRequest, redirectRequest, remapFromExtension, resetToken, saveToken, setControllerChainingTransition, setControllerSecurityTransition, setCurrentState, setInitialState, setSchema, setSchema, setupDefaultValues, setupReturnToSender, setupSubclassLog, transition, transition, transition, unloadStateForm
 
Methods inherited from class org.apache.struts.action.Action
addErrors, addMessages, execute, generateToken, getDataSource, getDataSource, getErrors, getLocale, getMessages, getResources, getResources, getServlet, isCancelled, isTokenValid, isTokenValid, resetToken, saveErrors, saveErrors, saveMessages, saveMessages, saveToken, setLocale, setServlet
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

STATE_PROMPT_ADDWIZARD

public static final String STATE_PROMPT_ADDWIZARD
Constant for access to state: Add Wizard.

See Also:
Constant Field Values

STATE_DO_ADDWIZARD

public static final String STATE_DO_ADDWIZARD
Finishes the post to state.

See Also:
Constant Field Values

STATE_DO_EDIT

public static final String STATE_DO_EDIT
Finishes the edit to update state.

See Also:
Constant Field Values

STATE_PROMPT_EDIT

public static final String STATE_PROMPT_EDIT
Constant for access to state: Edit Wizard.

See Also:
Constant Field Values

STATE_DO_DELETE

public static final String STATE_DO_DELETE
Constant for access to state: Delete Wizard.

See Also:
Constant Field Values

STATE_RUNWIZARD

public static final String STATE_RUNWIZARD
Constant for access to state: Run Wizard.

See Also:
Constant Field Values

STATE_PUBLIC_LIST

public static final String STATE_PUBLIC_LIST
synonym to serve old URLs

See Also:
Constant Field Values
Constructor Detail

SelectionWizardManager

public SelectionWizardManager()
Creates an instance of WizardManager. The Controller constructor also defines what states and parameters are officially defined by the Controller.

Method Detail

getTitle

public String getTitle()
Override of Controller.getTitle() to provide a meaningful name to this controller.

Overrides:
getTitle in class EmoAction
Returns:
java.lang.String

runPromptAddWizardState

protected void runPromptAddWizardState(ControllerRequest request,
                                       ControllerResponse response)
                                throws ControllerException,
                                       NonHandleableException
Runs the Add Wizard Prompt state.

Parameters:
request - The ControllerRequest object handed to us by the framework. The ControllerRequest contains all the parameters such as web parameters, user security credentials and user locale
response - The ControllerResponse object handed to us by the framework. The ControllerResponse will be populated with the Inputs/Outputs/Transitions/Blocks for ths sytem.
Throws:
ControllerException - upon error
NonHandleableException - upon fatal error

runDoEditState

protected void runDoEditState(ControllerRequest request,
                              ControllerResponse response)
                       throws ControllerException,
                              NonHandleableException
Runs the complete update state.

Parameters:
request - The ControllerRequest object handed to us by the framework. The ControllerRequest contains all the parameters such as web parameters, user security credentials and user locale
response - The ControllerResponse object handed to us by the framework. The ControllerResponse will be populated with the Inputs/Outputs/Transitions/Blocks for ths sytem.
Throws:
ControllerException - upon error
NonHandleableException - upon fatal error

runDoAddState

protected void runDoAddState(ControllerRequest request,
                             ControllerResponse response)
                      throws ControllerException,
                             NonHandleableException
Runs the Complete Add Wizard state.

Parameters:
request - The ControllerRequest object handed to us by the framework. The ControllerRequest contains all the parameters such as web parameters, user security credentials and user locale
response - The ControllerResponse object handed to us by the framework. The ControllerResponse will be populated with the Inputs/Outputs/Transitions/Blocks for ths sytem.
Throws:
ControllerException - upon error
NonHandleableException - upon fatal error

verifyWizardParameters

protected void verifyWizardParameters(ControllerRequest request,
                                      ErrorCollection ec,
                                      WizDefinition wizdef)
                               throws DBException
Checks the parameters for add and edit wizard state pertaining to the wizard definition itself.

Parameters:
request - The CntrollerRequest object.
ec - The error collection to fill with errors if there are issues.
wizdef - the Wizard definition object to populate with values for title, summary, etc if the items are ok.
Throws:
DBException - upon database setField error.

runDoDeleteState

protected void runDoDeleteState(ControllerRequest request,
                                ControllerResponse response)
                         throws ControllerException,
                                NonHandleableException
Runs the Delete Wizard state.

Parameters:
request - The ControllerRequest object handed to us by the framework. The ControllerRequest contains all the parameters such as web parameters, user security credentials and user locale
response - The ControllerResponse object handed to us by the framework. The ControllerResponse will be populated with the Inputs/Outputs/Transitions/Blocks for ths sytem.
Throws:
ControllerException - upon error
NonHandleableException - upon fatal error

runPromptDeleteState

protected void runPromptDeleteState(ControllerRequest request,
                                    ControllerResponse response)
                             throws ControllerException,
                                    NonHandleableException
Runs the Prompt Delete Wizard state.

Parameters:
request - The ControllerRequest object handed to us by the framework. The ControllerRequest contains all the parameters such as web parameters, user security credentials and user locale
response - The ControllerResponse object handed to us by the framework. The ControllerResponse will be populated with the Inputs/Outputs/Transitions/Blocks for ths sytem.
Throws:
ControllerException - upon error
NonHandleableException - upon fatal error

runPromptEditState

protected void runPromptEditState(ControllerRequest request,
                                  ControllerResponse response)
                           throws ControllerException,
                                  NonHandleableException
Runs the Edit Wizard state.

Parameters:
request - The ControllerRequest object handed to us by the framework. The ControllerRequest contains all the parameters such as web parameters, user security credentials and user locale
response - The ControllerResponse object handed to us by the framework. The ControllerResponse will be populated with the Inputs/Outputs/Transitions/Blocks for ths sytem.
Throws:
ControllerException - upon error
NonHandleableException - upon fatal error

buildWizardSteps

protected void buildWizardSteps(ControllerRequest request,
                                Block steps,
                                WizDefinition currentWizard)
                         throws DBException,
                                ControllerException
Builds the steps for the current wizard.

Parameters:
request - the ControllerRequest object
steps - the block to populate with the steps.
currentWizard - the current wizard to build the steps for.
Throws:
DBException - upon database access error
ControllerException - upon ControllerElement related error

buildDecisionMatrix

protected void buildDecisionMatrix(ControllerRequest request,
                                   ControllerResponse response,
                                   Block matrix,
                                   WizDefinition currentWizard)
                            throws DBException,
                                   ControllerException
Builds the decision matrix for the current wizard.

Parameters:
request - the ControllerRequest object.
response - the ControllerResponse object.
matrix - the block to populate with the steps.
currentWizard - the current wizard to build the steps for.
Throws:
DBException - upon database access error
ControllerException - upon ControllerElement related error

runRunWizardState

protected void runRunWizardState(ControllerRequest request,
                                 ControllerResponse response)
                          throws ControllerException,
                                 NonHandleableException
Runs the Run Wizard state.

Parameters:
request - The ControllerRequest object handed to us by the framework. The ControllerRequest contains all the parameters such as web parameters, user security credentials and user locale
response - The ControllerResponse object handed to us by the framework. The ControllerResponse will be populated with the Inputs/Outputs/Transitions/Blocks for ths sytem.
Throws:
ControllerException - upon error
NonHandleableException - upon fatal error

runPublicListState

protected void runPublicListState(ControllerRequest request,
                                  ControllerResponse response)
                           throws ControllerException,
                                  NonHandleableException
synonym for wizard gateway 'list wizards'

Parameters:
request - The ControllerRequest object handed to us by the framework. The ControllerRequest contains all the parameters such as web parameters, user security credentials and user locale
response - The ControllerResponse object handed to us by the framework. The ControllerResponse will be populated with the Inputs/Outputs/Transitions/Blocks for ths sytem.
Throws:
ControllerException - upon error
NonHandleableException - upon fatal error

run

public void run(WizDefinition wizard,
                ExpressoRequest request,
                ExpressoResponse response)
         throws ControllerException
Runs the wizard that the manager is associated with.

Specified by:
run in interface IWizardManager
Parameters:
wizard - WizDefinition
request - ExpressoRequest
response - ExpressoResponse
Throws:
ControllerException

add

public void add(ExpressoRequest request,
                ExpressoResponse response)
         throws ControllerException
Begins an 'add' end-user transaction to create a new wizard.

Specified by:
add in interface IWizardManager
Parameters:
request - ExpressoRequest the request object.
response - ExpressoResponse the response object.
Throws:
ControllerException

edit

public void edit(WizDefinition wizard,
                 ExpressoRequest request,
                 ExpressoResponse response)
          throws ControllerException
Begins an 'edit' end-user transaction to edit an existing wizard.

Specified by:
edit in interface IWizardManager
Parameters:
wizard - The WizardDefinition to edit.
request - ExpressoRequest the request object.
response - ExpressoResponse the response object.
Throws:
ControllerException - upon error.


Copyright © 2004-2006 Codeguild, Inc.. All Rights Reserved.