| java.lang.Object com.quadcap.app.bugdb.BugSession
BugSession | public class BugSession implements HttpSessionBindingListener(Code) | | A session bean encapsulating access to the Quadcap Bug Database.
JSP pages use methods of this bean to perform the various functions
of the bug database application.
author: Stan Bailes |
Constructor Summary | |
public | BugSession() Create a new session. |
Method Summary | |
public boolean | addBug(Properties props) Execute the 'addBug' action.
Parameters: props - the request properties, contains values for the variousfields in the 'bug' and 'bug_history' tables. | public boolean | addUser(Properties props) Execute the 'addUser' action. | public boolean | deleteProject(Properties p) | public boolean | deleteUser(Properties p) | Hashtable | diffProps(Hashtable a, Hashtable b) Given two bug history records, return a hashtable containing entries
for each field which changed between the two records. | public Hashtable | getBug(String bug_id) Return the current information and history for the specified bug.
Parameters: bug_id - a Hashtable where the keys are the names of the bugproperties and the values are the current (i.e., most recent)values for those properties. | int | getBugHistSize(int bug_id) Return the number of records in the bug history for the specified
bug. | public String | getComponentOwner(String component) Return the name of the user who owns the specified component. | public Connection | getConnection() Return the JDBC connection for this session. | static int | getInt(Properties props, String name) Return an integer valued property
Parameters: props - a properties object Parameters: name - the name of the property to retrieve. | int | getNextId(String type) Return the next integer in the specified sequence. | public Hashtable | getProject(String user) Return the properties for a single component. | public Vector | getProjects() | final Hashtable | getProps(ResultSet rs) Turn the current row in the result set into a Hashtable. | public String | getQuery(String name) | public Properties | getRequestProperties(HttpServletRequest req) Build a Properties object containing all of the request parameters. | static String | getString(Properties props, String name) Return a string-valued property.
Parameters: props - a properties object Parameters: name - the name of the property to retrieve. | public Hashtable | getUser(String user) Return the properties for a single user. | public Vector | getUsers() | public void | handleRequest(HttpServletRequest req) The main request handler. | public String | htmlEncode(String s) Replace occurrences of <, >, and & with their HTML
entity-representation equivalents. | public boolean | isAdmin() | public boolean | isDeveloper() | public boolean | isManager() | public boolean | isUser() | public String | listOptions(String type) Generate an HTML <SELECT> element listing all
elements in the specified table. | public String | listOptions(String type, String sel) Generate an HTML <SELECT> element listing all
elements in the specified table. | public String | listOptions(String table, String type, String sel) Generate an HTML <SELECT> element listing all
elements in the specified table. | public String | listOptions(String seltype, String table, String type, String sel) Generate an HTML <SELECT> element listing all
elements in the specified table. | public String | listUsers(String type, String sel) Generate an HTML <SELECT> element listing all
users. | public boolean | login(Properties props) Execute the 'login' action.
Parameters: props - the request properties for this action. | public boolean | logout(Properties props) Execute the 'logout' action.
Parameters: props - the request properties for this action. | public boolean | newProject(Properties p) Execute the 'newProject' action. | final static java.sql.Timestamp | now() Make a sql timestamp value representing the current time. | public void | saveQuery(String name, String query) Save a bug search query. | public Vector | searchBugs(String query, String ob) Perform the bug search operation.
Parameters: query - the query string, a boolean predicate selecting bugsto be returned. Parameters: ob - an optional column name to use with an 'order by' clause,to cause the list of bugs to be sorted based on that column. | public boolean | updateBug(Properties props) Execute the 'updateBug' action.
Parameters: props - the request properties, contains values for the variousfields in the 'bug' and 'bug_history' tables. | public boolean | updateProject(Properties p) Execute the 'updateProject' action. | public boolean | updateUser(Properties p) Execute the 'updateUser' action. | final public String | urlDecode(String s) Utility to do URL decoding without any exception handling. | public void | valueBound(HttpSessionBindingEvent event) | public void | valueUnbound(HttpSessionBindingEvent event) |
isDeveloper | boolean isDeveloper(Code) | | |
isManager | boolean isManager(Code) | | |
nonDeltas | static Hashtable nonDeltas(Code) | | The properties that we ignore when computing deltas between
successive bug history records.
|
BugSession | public BugSession()(Code) | | Create a new session.
|
addBug | public boolean addBug(Properties props) throws ServletException(Code) | | Execute the 'addBug' action.
Parameters: props - the request properties, contains values for the variousfields in the 'bug' and 'bug_history' tables. true if this action succeeded. exception: ServletException - may be thrown. |
addUser | public boolean addUser(Properties props) throws SQLException, ServletException(Code) | | Execute the 'addUser' action.
Parameters: props - the request properties for this action: - name
- The user's login name
- password
- The user's password
- password2
- The user's password confirmation
- email
- The user's email address
- person_type
- The user's 'class', one of
- User
- Developer
- Manager
- Administrator
exception: SQLException - may be thrown |
diffProps | Hashtable diffProps(Hashtable a, Hashtable b)(Code) | | Given two bug history records, return a hashtable containing entries
for each field which changed between the two records.
Parameters: a - the newer history record Parameters: b - the older history record a Hashtable where the keys are the names of the changed fieldsand the values are strings of the form:Changed from bval to aval |
getBug | public Hashtable getBug(String bug_id) throws ServletException(Code) | | Return the current information and history for the specified bug.
Parameters: bug_id - a Hashtable where the keys are the names of the bugproperties and the values are the current (i.e., most recent)values for those properties. The special key "history"has a Vector of Hashtables value containing the reverse-chronologicalhistory deltas for the bug. exception: ServletException - may be thrown |
getBugHistSize | int getBugHistSize(int bug_id) throws SQLException(Code) | | Return the number of records in the bug history for the specified
bug.
Parameters: bug_id - the bug number the number of history records for this bug. exception: SQLException - may be thrown |
getConnection | public Connection getConnection() throws SQLException(Code) | | Return the JDBC connection for this session.
this session's connection. |
getInt | static int getInt(Properties props, String name) throws ServletException(Code) | | Return an integer valued property
Parameters: props - a properties object Parameters: name - the name of the property to retrieve. the property value exception: ServletException - is thrown if the property isn't a validinteger. |
getNextId | int getNextId(String type) throws SQLException(Code) | | Return the next integer in the specified sequence.
the next integer in this sequence. exception: SQLException - may be thrown |
getProject | public Hashtable getProject(String user) throws SQLException(Code) | | Return the properties for a single component.
Parameters: name - the component name the component's properties exception: SQLException - may be thrown |
getProjects | public Vector getProjects() throws SQLException(Code) | | Return a list of valid project/components, as a Vector of Hashtable
objects,
where each Hashtable object contains all of the user's properties
(except the password!)
a list of valid components exception: SQLException - may be thrown |
getProps | final Hashtable getProps(ResultSet rs) throws SQLException(Code) | | Turn the current row in the result set into a Hashtable.
Parameters: rs - a result set a Hashtable where the keys are the string-valued column labelsof the result set and the values are the string-valued column valuesfrom the current row of the result set. exception: SQLException - may be thrown |
getRequestProperties | public Properties getRequestProperties(HttpServletRequest req)(Code) | | Build a Properties object containing all of the request parameters.
Parameters: req - the http request the request parameters |
getString | static String getString(Properties props, String name)(Code) | | Return a string-valued property.
Parameters: props - a properties object Parameters: name - the name of the property to retrieve. the property value, or the empty string if the propertyisn't defined. |
getUser | public Hashtable getUser(String user) throws SQLException(Code) | | Return the properties for a single user.
Parameters: user - the user name the user's properties (except the password) exception: SQLException - may be thrown |
getUsers | public Vector getUsers() throws SQLException(Code) | | Return a list of valid users, as a Vector of Properties objects,
where each Hashtable object contains all of the user's properties
(except the password!)
a list of valid users exception: SQLException - may be thrown |
htmlEncode | public String htmlEncode(String s)(Code) | | Replace occurrences of <, >, and & with their HTML
entity-representation equivalents.
Parameters: the - the string to encode the encoded string |
isAdmin | public boolean isAdmin()(Code) | | Is this session associated with a user with 'administrator' privileges?
true if the user is valid and has administrator privileges. |
isDeveloper | public boolean isDeveloper()(Code) | | Is this session associated with a user with 'developer' privileges?
true if the user is valid and has developer privileges. |
isManager | public boolean isManager()(Code) | | Is this session associated with a user with 'manager' privileges?
true if the user is valid and has manager privileges. |
isUser | public boolean isUser()(Code) | | Is this session associated with a valid user?
true if the user is valid. |
listOptions | public String listOptions(String type) throws ServletException(Code) | | Generate an HTML <SELECT> element listing all
elements in the specified table.
Parameters: type - the table (e.g., priority, state, etc.) the HTML string. |
listOptions | public String listOptions(String type, String sel) throws ServletException(Code) | | Generate an HTML <SELECT> element listing all
elements in the specified table.
Parameters: type - the table (e.g., priority, state, etc.) Also the nameof the SELECT element, and the name of the column. Parameters: sel - if non null, the value to be initially selected the HTML string. |
listOptions | public String listOptions(String table, String type, String sel) throws ServletException(Code) | | Generate an HTML <SELECT> element listing all
elements in the specified table.
Parameters: table - the table (e.g., priority, state, etc.) Also the nameof the SELECT element. Parameters: type - the name of the column containing the enumerated values. Parameters: sel - if non null, the value to be initially selected the HTML string. |
listOptions | public String listOptions(String seltype, String table, String type, String sel) throws ServletException(Code) | | Generate an HTML <SELECT> element listing all
elements in the specified table.
Parameters: selType - the name of the SELECT widget. Parameters: table - the table (e.g., priority, state, etc.) Parameters: type - the name of the column containing the enumerated values. Parameters: sel - if non null, the value to be initially selected the HTML string. |
listUsers | public String listUsers(String type, String sel) throws ServletException(Code) | | Generate an HTML <SELECT> element listing all
users.
Parameters: type - the name of the SELECT element. Parameters: sel - the value (if any) to be initially selected. |
login | public boolean login(Properties props) throws SQLException(Code) | | Execute the 'login' action.
Parameters: props - the request properties for this action. - username
- The user's login name
- password
- The user's password
exception: SQLException - may be thrown |
logout | public boolean logout(Properties props)(Code) | | Execute the 'logout' action.
Parameters: props - the request properties for this action. Ignored. |
newProject | public boolean newProject(Properties p) throws SQLException(Code) | | Execute the 'newProject' action.
Parameters: props - the request properties for this action: - component
- The name of the project
- owner
- The owner of the project.
exception: SQLException - may be thrown |
now | final static java.sql.Timestamp now()(Code) | | Make a sql timestamp value representing the current time.
a timestamp value. |
searchBugs | public Vector searchBugs(String query, String ob) throws ServletException(Code) | | Perform the bug search operation.
Parameters: query - the query string, a boolean predicate selecting bugsto be returned. Parameters: ob - an optional column name to use with an 'order by' clause,to cause the list of bugs to be sorted based on that column. a Vector of Properties objects,where each Properties element contains entries for each columnin the search result. exception: ServletException - may be thrown |
updateBug | public boolean updateBug(Properties props) throws ServletException(Code) | | Execute the 'updateBug' action.
Parameters: props - the request properties, contains values for the variousfields in the 'bug' and 'bug_history' tables. true if this action succeeded. exception: ServletException - may be thrown. |
updateProject | public boolean updateProject(Properties p) throws SQLException(Code) | | Execute the 'updateProject' action.
Parameters: props - the request properties for this action: - component
- The name of the project
- owner
- The owner of the project.
exception: SQLException - may be thrown |
updateUser | public boolean updateUser(Properties p) throws SQLException(Code) | | Execute the 'updateUser' action.
Parameters: props - the request properties for this action: - name
- The user's login name
- password
- The user's password
- email
- The user's email address
- person_type
- The user's 'class', one of
- User
- Developer
- Manager
- Administrator
exception: SQLException - may be thrown |
urlDecode | final public String urlDecode(String s)(Code) | | Utility to do URL decoding without any exception handling.
Lazy bastard.
Parameters: s - the url to decode the decoded url |
valueBound | public void valueBound(HttpSessionBindingEvent event)(Code) | | This application object has just been bound into an HttpSession
Parameters: event - identifies the session and the name in thesession of this object. |
valueUnbound | public void valueUnbound(HttpSessionBindingEvent event)(Code) | | This application object has just been removed from an HttpSession
Parameters: event - identifies the session and the name in thesession of this object. |
|
|