live.struts.actions
Class CloneGuestAction

java.lang.Object
  extended byorg.apache.struts.action.Action
      extended bylive.struts.actions.CheckedAction
          extended bylive.struts.actions.SwitchedAction
              extended bylive.struts.actions.CloneGuestAction

public class CloneGuestAction
extends SwitchedAction

Author:
Evan Driscoll

Nested Class Summary
 
Nested classes inherited from class live.struts.actions.CheckedAction
CheckedAction.ActionInfo
 
Field Summary
 
Fields inherited from class org.apache.struts.action.Action
defaultLocale, servlet
 
Constructor Summary
CloneGuestAction()
           
 
Method Summary
private  int countDigits(int number)
          Given a number, this function will count the number of digits that are present in the number; number=100 would return 3, number=2 would return 1.
 org.apache.struts.action.ActionForward displayPage(CheckedAction.ActionInfo info)
          This function is called when a request was submitted by an HTTP GET request.
private  String formatFixedNumberString(int number, int totalDesiredDigitCount)
          Puts the number string in the proper format for the clone name (ensures that all clone names will have the same number of characters).
private  LinkedList generateMultipleGuestNamesList(String startText, int startNumber, int endNumber)
          This is the function we use to generate the names for a family of clones.
 org.apache.struts.action.ActionForward performAction(CheckedAction.ActionInfo info)
          This function is called when a request was submitted by an HTTP POST request.
 
Methods inherited from class live.struts.actions.SwitchedAction
act
 
Methods inherited from class live.struts.actions.CheckedAction
execute
 
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, saveErrors, saveMessages, saveMessages, saveToken, setLocale, setServlet
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CloneGuestAction

public CloneGuestAction()
Method Detail

displayPage

public org.apache.struts.action.ActionForward displayPage(CheckedAction.ActionInfo info)
Description copied from class: SwitchedAction
This function is called when a request was submitted by an HTTP GET request. Implement this in subclasses to display a page where the user can enter any information necessary to actually do something, confirm that they want to actually do something, etc.

Specified by:
displayPage in class SwitchedAction
Parameters:
info - The request info passed to SwitchedAction.act(CheckedAction.ActionInfo)
Returns:
The forward to go to
See Also:
SwitchedAction.displayPage(live.struts.actions.CheckedAction.ActionInfo)

performAction

public org.apache.struts.action.ActionForward performAction(CheckedAction.ActionInfo info)
Description copied from class: SwitchedAction
This function is called when a request was submitted by an HTTP POST request. This function should actually perform whatever action the user wanted. You should probably strive to make it so that the URL that calls this action can only be POSTed to from the page displayed by SwitchedAction.displayPage(CheckedAction.ActionInfo) so that you know that the user is coming from that page.

Specified by:
performAction in class SwitchedAction
Parameters:
info - The request info passed to SwitchedAction.act(CheckedAction.ActionInfo)
Returns:
The forward to go to
See Also:
SwitchedAction.performAction(live.struts.actions.CheckedAction.ActionInfo)

generateMultipleGuestNamesList

private LinkedList generateMultipleGuestNamesList(String startText,
                                                  int startNumber,
                                                  int endNumber)
                                           throws Exception
This is the function we use to generate the names for a family of clones.

Parameters:
startText - The base guest name
startNumber - The number at which the clone family will start
endNumber - The number at which the clone family will end
Returns:
LinkedList LinkedList of names for clones
Throws:
Exception - Exception if there is an error with the parameters

formatFixedNumberString

private String formatFixedNumberString(int number,
                                       int totalDesiredDigitCount)
                                throws Exception
Puts the number string in the proper format for the clone name (ensures that all clone names will have the same number of characters).

Parameters:
number - The number to format.
totalDesiredDigitCount - How many digits to make the number string.
Returns:
String The now-formatted number.
Throws:
Exception - if the number is not able to be formatted properly.

countDigits

private int countDigits(int number)
                 throws Exception
Given a number, this function will count the number of digits that are present in the number; number=100 would return 3, number=2 would return 1.

Parameters:
number - The number for which we wish to know the number of digits.
Returns:
The number of digits in number.
Throws:
Exception - If the number is negative.


Copyright © 2005