rsvp.controller
Class ResponseController

java.lang.Object
  extended by rsvp.controller.ResponseController
All Implemented Interfaces:
ResponseControllerInterface

public class ResponseController
extends java.lang.Object
implements ResponseControllerInterface

A ResponseController mediates interactions between the view layer and a particular Response.

Author:
willb
See Also:
rsvp.model.Reponse

Constructor Summary
ResponseController(ResponseInterface response)
          Constructs a new ResponseController to act as a proxy to a given Response object.
 
Method Summary
 java.lang.String getComment()
          Returns this respondent's comment.
 java.lang.String getDisplayEmail()
          Returns a displayable (i.e.
 java.lang.String getStatus()
          Returns "yes", "no", or "maybe", depending on the status of the controlled response.
 void updateComment(java.lang.String comment, java.lang.String email)
          Updates the comment of the controlled Response.
 void updateStatus(int status, java.lang.String email)
          Updates the status of the controlled Response.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ResponseController

public ResponseController(ResponseInterface response)
Constructs a new ResponseController to act as a proxy to a given Response object.

Precondition: response must be non-null.

Parameters:
response -
Method Detail

getStatus

public java.lang.String getStatus()
Description copied from interface: ResponseControllerInterface
Returns "yes", "no", or "maybe", depending on the status of the controlled response. (That is, Response.YES, Response.NO, or Response.MAYBE, respectively.)

Specified by:
getStatus in interface ResponseControllerInterface
Returns:
a string representation of the status of the response

getComment

public java.lang.String getComment()
Description copied from interface: ResponseControllerInterface
Returns this respondent's comment.

Specified by:
getComment in interface ResponseControllerInterface
Returns:
this respondent's comment.

getDisplayEmail

public java.lang.String getDisplayEmail()
Description copied from interface: ResponseControllerInterface
Returns a displayable (i.e. spam-sanitized) version of the email address for this respondent, as generated by the getDisplayEmail() method of class EmailAddress.

Specified by:
getDisplayEmail in interface ResponseControllerInterface
Returns:
a displayable version of the email address for this respondent

updateStatus

public void updateStatus(int status,
                         java.lang.String email)
Description copied from interface: ResponseControllerInterface
Updates the status of the controlled Response. Note that this method will only update the status if the view has "authenticated" the respondent by providing their proper email address. Otherwise, it will throw a PermissionException. If the provided status is not valid, this method will throw a BogusParameterException.

Specified by:
updateStatus in interface ResponseControllerInterface
Parameters:
status - the new status. Must be either Response.YES, Response.NO, or Response.MAYBE.
email - an email address, which must match the email address of this respondent

updateComment

public void updateComment(java.lang.String comment,
                          java.lang.String email)
Description copied from interface: ResponseControllerInterface
Updates the comment of the controlled Response. Note that this method will only update the comment if the view has "authenticated" the respondent by providing their proper email address. Otherwise, it will throw a PermissionException.

Specified by:
updateComment in interface ResponseControllerInterface
Parameters:
comment - the new comment
email - an email address, which must match the email address of this respondent