org.kuali.rice.kns.rules
Class PromptBeforeValidationBase

java.lang.Object
  extended by org.kuali.rice.kns.rules.PromptBeforeValidationBase
All Implemented Interfaces:
PromptBeforeValidation, BusinessRule

public abstract class PromptBeforeValidationBase
extends Object
implements PromptBeforeValidation

This class simplifies requesting clarifying user input prior to applying business rules. It mostly shields the classes that extend it from being aware of the web layer, even though the input is collected via a series of one or more request/response cycles. Beware: method calls with side-effects will have unusual results. While it looks like the doRules method is executed sequentially, in fact, it is more of a geometric series: if n questions are asked, then the code up to and including the first question is executed n times, the second n-1 times, ..., the last question only one time.


Nested Class Summary
 class PromptBeforeValidationBase.ContextSession
          This is a description of what this class does - wliang don't forget to fill this in.
 
Field Summary
protected  String buttonClicked
           
protected  PromptBeforeValidationEvent event
           
protected  KualiForm form
           
protected static org.apache.log4j.Logger LOG
           
protected  String question
           
 
Constructor Summary
PromptBeforeValidationBase()
           
 
Method Summary
 void abortRulesCheck()
          This bounces the user back to the document as if they had never tried to routed it.
 boolean askOrAnalyzeYesNoQuestion(String id, String text)
          This method poses a Y/N question to the user.
abstract  boolean doPrompts(Document document)
          Implementations will override this method to do perform the actual prompting and/or logic They are able to utilize the following methods: abortRulesCheck() askOrAnalyzeYesNoQuestion(String, String) #hasAsked(String)
 boolean processPrompts(org.apache.struts.action.ActionForm form, javax.servlet.http.HttpServletRequest request, PromptBeforeValidationEvent event)
          Callback method from Maintenance action that allows checks to be done and response redirected via the PreRulesCheckEvent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOG

protected static org.apache.log4j.Logger LOG

question

protected String question

buttonClicked

protected String buttonClicked

event

protected PromptBeforeValidationEvent event

form

protected KualiForm form
Constructor Detail

PromptBeforeValidationBase

public PromptBeforeValidationBase()
Method Detail

doPrompts

public abstract boolean doPrompts(Document document)
Implementations will override this method to do perform the actual prompting and/or logic They are able to utilize the following methods:
  • abortRulesCheck()
  • askOrAnalyzeYesNoQuestion(String, String)
  • #hasAsked(String)

    Parameters:
    document -
    Returns:

  • processPrompts

    public boolean processPrompts(org.apache.struts.action.ActionForm form,
                                  javax.servlet.http.HttpServletRequest request,
                                  PromptBeforeValidationEvent event)
    Description copied from interface: PromptBeforeValidation
    Callback method from Maintenance action that allows checks to be done and response redirected via the PreRulesCheckEvent

    Specified by:
    processPrompts in interface PromptBeforeValidation
    event - stores various information necessary to render the question prompt
    Returns:
    boolean indicating whether the validation (and if validation successful, the action) should continue. If false, the values within the event parameter will determine how the struts action handler should proceed

    abortRulesCheck

    public void abortRulesCheck()
    This bounces the user back to the document as if they had never tried to routed it. (Business rules are not invoked and the action is not executed.)


    askOrAnalyzeYesNoQuestion

    public boolean askOrAnalyzeYesNoQuestion(String id,
                                             String text)
                                      throws org.kuali.rice.kns.rules.PromptBeforeValidationBase.IsAskingException
    This method poses a Y/N question to the user. If the user has already answered the question, then it returns whether the answer to the question was yes or no Code that invokes this method will behave a bit strangely, so you should try to keep it as simple as possible.

    Parameters:
    id - an ID for the question
    text - the text of the question, to be displayed on the screen
    Returns:
    true if the user answered Yes, false if the user answers no
    Throws:
    IsAskingException - if the user needs to be prompted the question
    org.kuali.rice.kns.rules.PromptBeforeValidationBase.IsAskingException


    Copyright © 2005-2012 The Kuali Foundation. All Rights Reserved.