org.blojsom.plugin.comment
Class MathCommentAuthenticationPlugin

java.lang.Object
  extended byorg.blojsom.plugin.comment.CommentModerationPlugin
      extended byorg.blojsom.plugin.comment.MathCommentAuthenticationPlugin
All Implemented Interfaces:
BlojsomPlugin

public class MathCommentAuthenticationPlugin
extends CommentModerationPlugin

Math comment authenticator plugin

Since:
blojsom 2.22
Version:
$Id: MathCommentAuthenticationPlugin.java,v 1.7 2006/01/25 18:29:46 czarneckid Exp $
Author:
David Czarnecki

Field Summary
static java.lang.String BLOJSOM_MATH_AUTHENTICATOR_PLUGIN_ANSWER
           
static java.lang.String BLOJSOM_MATH_AUTHENTICATOR_PLUGIN_ANSWER_CHECK_PARAM
           
static java.lang.String BLOJSOM_MATH_AUTHENTICATOR_PLUGIN_OPERATION
           
static java.lang.String BLOJSOM_MATH_AUTHENTICATOR_PLUGIN_STATUS_MESSAGE
           
static java.lang.String BLOJSOM_MATH_AUTHENTICATOR_PLUGIN_VALUE1
           
static java.lang.String BLOJSOM_MATH_AUTHENTICATOR_PLUGIN_VALUE2
           
 
Fields inherited from class org.blojsom.plugin.comment.CommentModerationPlugin
BLOJSOM_COMMENT_MODERATION_PLUGIN_APPROVED, COMMENT_MODERATION_ENABLED
 
Constructor Summary
MathCommentAuthenticationPlugin()
          Math comment authenticator plugin
 
Method Summary
protected  int getAnswerForOperation(int value1, int value2, int operation)
          Return the result from the specified operation where 0 = addition, 1 = subtraction, 2 = multiplication
protected  java.lang.String getOperatorForOperation(int operation)
          Return the appropriate operator for the operation
protected  void moderateComment(javax.servlet.http.HttpServletRequest httpServletRequest, javax.servlet.http.HttpServletResponse httpServletResponse, BlogUser user, java.util.Map context, BlogEntry[] entries)
          Simple check to see if comment moderation is enabled

 
Methods inherited from class org.blojsom.plugin.comment.CommentModerationPlugin
cleanup, destroy, init, process
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BLOJSOM_MATH_AUTHENTICATOR_PLUGIN_ANSWER

public static final java.lang.String BLOJSOM_MATH_AUTHENTICATOR_PLUGIN_ANSWER
See Also:
Constant Field Values

BLOJSOM_MATH_AUTHENTICATOR_PLUGIN_VALUE1

public static final java.lang.String BLOJSOM_MATH_AUTHENTICATOR_PLUGIN_VALUE1
See Also:
Constant Field Values

BLOJSOM_MATH_AUTHENTICATOR_PLUGIN_VALUE2

public static final java.lang.String BLOJSOM_MATH_AUTHENTICATOR_PLUGIN_VALUE2
See Also:
Constant Field Values

BLOJSOM_MATH_AUTHENTICATOR_PLUGIN_OPERATION

public static final java.lang.String BLOJSOM_MATH_AUTHENTICATOR_PLUGIN_OPERATION
See Also:
Constant Field Values

BLOJSOM_MATH_AUTHENTICATOR_PLUGIN_ANSWER_CHECK_PARAM

public static final java.lang.String BLOJSOM_MATH_AUTHENTICATOR_PLUGIN_ANSWER_CHECK_PARAM
See Also:
Constant Field Values

BLOJSOM_MATH_AUTHENTICATOR_PLUGIN_STATUS_MESSAGE

public static final java.lang.String BLOJSOM_MATH_AUTHENTICATOR_PLUGIN_STATUS_MESSAGE
See Also:
Constant Field Values
Constructor Detail

MathCommentAuthenticationPlugin

public MathCommentAuthenticationPlugin()
Math comment authenticator plugin

Method Detail

moderateComment

protected void moderateComment(javax.servlet.http.HttpServletRequest httpServletRequest,
                               javax.servlet.http.HttpServletResponse httpServletResponse,
                               BlogUser user,
                               java.util.Map context,
                               BlogEntry[] entries)
                        throws BlojsomPluginException
Simple check to see if comment moderation is enabled

Overrides:
moderateComment in class CommentModerationPlugin
Parameters:
httpServletRequest - Request
httpServletResponse - Response
user - BlogUser instance
context - Context
entries - Blog entries retrieved for the particular request
Throws:
BlojsomPluginException - If there is an error in moderating a comment

getAnswerForOperation

protected int getAnswerForOperation(int value1,
                                    int value2,
                                    int operation)
Return the result from the specified operation where 0 = addition, 1 = subtraction, 2 = multiplication

Parameters:
value1 - Value 1
value2 - Value 2
operation - Operation where 0 = addition, 1 = subtraction, 2 = multiplication
Returns:
Value of operation

getOperatorForOperation

protected java.lang.String getOperatorForOperation(int operation)
Return the appropriate operator for the operation

Parameters:
operation - Operation where 0 = addition, 1 = subtraction, 2 = multiplication
Returns:
+ for addition, - for subtraction, and * for multiplication