BEA Systems, Inc.

examples.portlet.bean
Class TodoBean

java.lang.Object
  |
  +--examples.portlet.bean.TodoBean

public class TodoBean
extends java.lang.Object
implements java.io.Serializable, ToolkitConstants

JSP Bean for the mytodo_edit.jsp and the grouptodo_edit.jsp pages that are used by the My To Do List and Group To Do List portlet examples.

See Also:
Serialized Form

Field Summary
static java.lang.String CHECK
          Constant for the SQL Query String that checks to see if there are any to do items for a user or group.
static java.lang.String CHECKBOX
          Used in processing the HTTP request.
static java.lang.String DELETE
          Constant for the SQL DELETE String that deletes a to do item for a user or group.
protected static int HIGH
           
protected static java.lang.String HIGH_S
           
static java.lang.String INSERT
          Constant for the SQL INSERT String that creates a new to do item for a user or group.
protected static int LOW
           
protected static java.lang.String LOW_S
           
protected static int MEDIUM
           
protected static java.lang.String MEDIUM_S
           
static int MODE_DELETE
          Mode constant for delete mode.
static int MODE_INSERT
          Mode constant for insert mode.
static int MODE_UPDATE
          Mode constant for update mode.
static java.lang.String QUERY
          Constant for the SQL Query String that finds all the to do items for a user or group.
static java.lang.String UPDATE
          Constant for the SQL UPDATE String that updates a to do item for a user or group.
 
Fields inherited from interface com.beasys.commerce.axiom.util.ToolkitConstants
DEFAULT_ID_CACHE, DEFAULT_ID_PROCEDURE, DEFAULT_JDBC_POOL_NAME, DEFAULT_JTS_POOL_NAME, DEFAULT_LOGGING_LEVEL, DEFAULT_WEBLOGIC_HOST, DEFAULT_WEBLOGIC_PORT, ID_CACHE, ID_PROCEDURE, JDBC_POOL_NAME, JTS_POOL_NAME, LOG_DEBUG, LOG_ERROR, LOG_FATAL, LOG_INFO, LOG_SECURITY, LOG_WARNING, LOGGING_LEVEL, WEBLOGIC_HOST, WEBLOGIC_PORT
 
Constructor Summary
TodoBean()
          Creates a new instance.
 
Method Summary
 java.lang.String[][] asTable()
          Returns a 2 dimensional array (table) of the user's or group's current to do items.
 void createQuery(java.sql.PreparedStatement ps, java.lang.String anId)
          A helper method to create the to do list query string.
 void fillCheck(java.sql.PreparedStatement ps, java.lang.String anOwner)
          A helper method to fill the CHECK SQL statement.
 void fillDelete(java.sql.PreparedStatement ps, java.lang.String anOwner)
          A helper method to fill the DELETE SQL statement.
 void fillInsert(java.sql.PreparedStatement ps, java.lang.String anOwner)
          A helper method to fill the INSERT SQL statement.
 void fillUpdate(java.sql.PreparedStatement ps, java.lang.String anOwner, java.lang.String item, int status)
          A helper method to fill the UPDATE SQL statement.
 int getMode()
          Returns the mode for this request.
protected  java.lang.String getPriorityFor(int aPriority)
          Returns the priority for a to do item.
 void load(java.sql.ResultSet rs)
          Loads the to do items into the items list with the results of a query.
 void process(javax.servlet.http.HttpServletRequest aRequest, java.lang.String anOwner, java.sql.PreparedStatement ps)
          Process the check box updates.
 void setDelete(java.lang.String anItem)
          Sets the delete mode and the item to delete.
 void setInsertButton(java.lang.String ignore)
          Sets the mode to insert.
 void setMode(int aMode)
          Sets the mode for a request.
 void setNewItemText(java.lang.String someText)
          Sets the text for a new to do item.
 void setPrioritySelect(java.lang.String aValue)
          Sets the priority for a to do item.
 void setUpdateButton(java.lang.String ignore)
          Sets the mode to update.
protected  void updateStatus(examples.portlet.bean.TodoBean.Item i, boolean aBool, java.lang.String anOwner, java.sql.PreparedStatement ps)
          A helper method to fill the UPDATE SQL statement with a new to do item status.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CHECKBOX

public static final java.lang.String CHECKBOX
Used in processing the HTTP request.

MODE_UPDATE

public static final int MODE_UPDATE
Mode constant for update mode.

MODE_INSERT

public static final int MODE_INSERT
Mode constant for insert mode.

MODE_DELETE

public static final int MODE_DELETE
Mode constant for delete mode.

QUERY

public static final java.lang.String QUERY
Constant for the SQL Query String that finds all the to do items for a user or group.

UPDATE

public static final java.lang.String UPDATE
Constant for the SQL UPDATE String that updates a to do item for a user or group.

INSERT

public static final java.lang.String INSERT
Constant for the SQL INSERT String that creates a new to do item for a user or group.

CHECK

public static final java.lang.String CHECK
Constant for the SQL Query String that checks to see if there are any to do items for a user or group.

DELETE

public static final java.lang.String DELETE
Constant for the SQL DELETE String that deletes a to do item for a user or group.

HIGH

protected static final int HIGH

HIGH_S

protected static final java.lang.String HIGH_S

MEDIUM

protected static final int MEDIUM

MEDIUM_S

protected static final java.lang.String MEDIUM_S

LOW

protected static final int LOW

LOW_S

protected static final java.lang.String LOW_S
Constructor Detail

TodoBean

public TodoBean()
Creates a new instance.
Method Detail

getMode

public int getMode()
Returns the mode for this request.
Returns:
int - one of the mode constants

setMode

public void setMode(int aMode)
Sets the mode for a request.
Parameters:
aMode - One of the mode constants.

setNewItemText

public void setNewItemText(java.lang.String someText)
Sets the text for a new to do item.
Parameters:
someText - The to do item text.

setPrioritySelect

public void setPrioritySelect(java.lang.String aValue)
Sets the priority for a to do item.
Parameters:
aValue - The to do item priority value.

getPriorityFor

protected java.lang.String getPriorityFor(int aPriority)
Returns the priority for a to do item.
Returns:
String - The priority.

asTable

public java.lang.String[][] asTable()
Returns a 2 dimensional array (table) of the user's or group's current to do items.
Returns:
String[][] - A 2 dimensional array (table) of items.

createQuery

public void createQuery(java.sql.PreparedStatement ps,
                        java.lang.String anId)
                 throws java.sql.SQLException
A helper method to create the to do list query string.
Parameters:
ps - The prepared statement for the query.
anId - The owner's (user's) id
Throws:
java.sql.SQLException - Is thrown if an error occurs.

load

public void load(java.sql.ResultSet rs)
Loads the to do items into the items list with the results of a query.
Parameters:
rs - The query result set.

setUpdateButton

public void setUpdateButton(java.lang.String ignore)
Sets the mode to update.

setInsertButton

public void setInsertButton(java.lang.String ignore)
Sets the mode to insert.

fillUpdate

public void fillUpdate(java.sql.PreparedStatement ps,
                       java.lang.String anOwner,
                       java.lang.String item,
                       int status)
                throws java.sql.SQLException
A helper method to fill the UPDATE SQL statement.
Parameters:
ps - The prepared statement for the query.
anOwner - The owner's (user's) id.
item - The to do item to update.
status - The status of the to do item.
Throws:
java.sql.SQLException - Is thrown if an error occurs.

fillDelete

public void fillDelete(java.sql.PreparedStatement ps,
                       java.lang.String anOwner)
                throws java.sql.SQLException
A helper method to fill the DELETE SQL statement.
Parameters:
ps - The prepared statement for the query.
anOwner - The owner's (user's) id.
Throws:
java.sql.SQLException - Is thrown if an error occurs.

fillCheck

public void fillCheck(java.sql.PreparedStatement ps,
                      java.lang.String anOwner)
               throws java.sql.SQLException
A helper method to fill the CHECK SQL statement.
Parameters:
ps - The prepared statement for the query.
anOwner - The owner's (user's) id.
Throws:
java.sql.SQLException - Is thrown if an error occurs.

fillInsert

public void fillInsert(java.sql.PreparedStatement ps,
                       java.lang.String anOwner)
                throws java.sql.SQLException
A helper method to fill the INSERT SQL statement.
Parameters:
ps - The prepared statement for the query.
anOwner - The owner's (user's) id.
Throws:
java.sql.SQLException - Is thrown if an error occurs.

updateStatus

protected void updateStatus(examples.portlet.bean.TodoBean.Item i,
                            boolean aBool,
                            java.lang.String anOwner,
                            java.sql.PreparedStatement ps)
                     throws java.sql.SQLException
A helper method to fill the UPDATE SQL statement with a new to do item status.
Parameters:
i - An Item object representing the to do item.
aBool - true if checked, false if not checked.
anOwner - The owner's (user's) id.
ps - The prepared statement for the query.
Throws:
java.sql.SQLException - Is thrown if an error occurs.

setDelete

public void setDelete(java.lang.String anItem)
Sets the delete mode and the item to delete.
Parameters:
anItem - The item name to delete.

process

public void process(javax.servlet.http.HttpServletRequest aRequest,
                    java.lang.String anOwner,
                    java.sql.PreparedStatement ps)
             throws java.sql.SQLException
Process the check box updates.
Parameters:
aRequest - The HTTP request.
anOwner - The owner of the item.
ps - The prepared SQL statement to execute.
Throws:
java.sql.SQLException - Is thrown if an error occurs.

BEA Systems, Inc.

Copyright © 2000 BEA Systems, Inc. All Rights Reserved