Java Doc for BugSession.java in  » Web-Server » Quadcap-Web-Server » com » quadcap » app » bugdb » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Web Server » Quadcap Web Server » com.quadcap.app.bugdb 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


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


Field Summary
 Connectionconn
    
final  StringdbPass
    
final  StringdbUrl
    
final  StringdbUser
    
 Vectordebug_history
    
 PreparedStatementdeleteProject
    
 PreparedStatementdeleteUser
    
final  StringdriverName
    
 PreparedStatementgetBug
    
 PreparedStatementgetBugHist
    
 PreparedStatementgetComponentOwner
    
 PreparedStatementgetProject
    
 PreparedStatementgetQuery
    
 PreparedStatementgetUser
    
 PreparedStatementinsertBugHist
    
 PreparedStatementinsertPerson
    
 booleanisAdmin
    
 booleanisDeveloper
    
 booleanisManager
    
 booleanisUser
    
static  Objectlock
    
 Stringme
     My user name.
 Stringmy_person_type
    
 PreparedStatementnewProject
    
static  HashtablenonDeltas
     The properties that we ignore when computing deltas between successive bug history records.
 PreparedStatementsaveQuery
    
 PreparedStatementupdateProject
    
 PreparedStatementupdateUser
    

Constructor Summary
public  BugSession()
     Create a new session.

Method Summary
public  booleanaddBug(Properties props)
     Execute the 'addBug' action.
Parameters:
  props - the request properties, contains values for the variousfields in the 'bug' and 'bug_history' tables.
public  booleanaddUser(Properties props)
     Execute the 'addUser' action.
public  booleandeleteProject(Properties p)
    
public  booleandeleteUser(Properties p)
    
 HashtablediffProps(Hashtable a, Hashtable b)
     Given two bug history records, return a hashtable containing entries for each field which changed between the two records.
public  HashtablegetBug(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.
 intgetBugHistSize(int bug_id)
     Return the number of records in the bug history for the specified bug.
public  StringgetComponentOwner(String component)
     Return the name of the user who owns the specified component.
public  ConnectiongetConnection()
     Return the JDBC connection for this session.
static  intgetInt(Properties props, String name)
     Return an integer valued property
Parameters:
  props - a properties object
Parameters:
  name - the name of the property to retrieve.
 intgetNextId(String type)
     Return the next integer in the specified sequence.
public  HashtablegetProject(String user)
     Return the properties for a single component.
public  VectorgetProjects()
    
final  HashtablegetProps(ResultSet rs)
     Turn the current row in the result set into a Hashtable.
public  StringgetQuery(String name)
    
public  PropertiesgetRequestProperties(HttpServletRequest req)
     Build a Properties object containing all of the request parameters.
static  StringgetString(Properties props, String name)
     Return a string-valued property.
Parameters:
  props - a properties object
Parameters:
  name - the name of the property to retrieve.
public  HashtablegetUser(String user)
     Return the properties for a single user.
public  VectorgetUsers()
    
public  voidhandleRequest(HttpServletRequest req)
     The main request handler.
public  StringhtmlEncode(String s)
     Replace occurrences of <, >, and & with their HTML entity-representation equivalents.
public  booleanisAdmin()
    
public  booleanisDeveloper()
    
public  booleanisManager()
    
public  booleanisUser()
    
public  StringlistOptions(String type)
     Generate an HTML <SELECT> element listing all elements in the specified table.
public  StringlistOptions(String type, String sel)
     Generate an HTML <SELECT> element listing all elements in the specified table.
public  StringlistOptions(String table, String type, String sel)
     Generate an HTML <SELECT> element listing all elements in the specified table.
public  StringlistOptions(String seltype, String table, String type, String sel)
     Generate an HTML <SELECT> element listing all elements in the specified table.
public  StringlistUsers(String type, String sel)
     Generate an HTML <SELECT> element listing all users.
public  booleanlogin(Properties props)
     Execute the 'login' action.
Parameters:
  props - the request properties for this action.
public  booleanlogout(Properties props)
     Execute the 'logout' action.
Parameters:
  props - the request properties for this action.
public  booleannewProject(Properties p)
     Execute the 'newProject' action.
final static  java.sql.Timestampnow()
     Make a sql timestamp value representing the current time.
public  voidsaveQuery(String name, String query)
     Save a bug search query.
public  VectorsearchBugs(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  booleanupdateBug(Properties props)
     Execute the 'updateBug' action.
Parameters:
  props - the request properties, contains values for the variousfields in the 'bug' and 'bug_history' tables.
public  booleanupdateProject(Properties p)
     Execute the 'updateProject' action.
public  booleanupdateUser(Properties p)
     Execute the 'updateUser' action.
final public  StringurlDecode(String s)
     Utility to do URL decoding without any exception handling.
public  voidvalueBound(HttpSessionBindingEvent event)
    
public  voidvalueUnbound(HttpSessionBindingEvent event)
    

Field Detail
conn
Connection conn(Code)



dbPass
final String dbPass(Code)



dbUrl
final String dbUrl(Code)



dbUser
final String dbUser(Code)



debug_history
Vector debug_history(Code)



deleteProject
PreparedStatement deleteProject(Code)



deleteUser
PreparedStatement deleteUser(Code)



driverName
final String driverName(Code)



getBug
PreparedStatement getBug(Code)



getBugHist
PreparedStatement getBugHist(Code)



getComponentOwner
PreparedStatement getComponentOwner(Code)



getProject
PreparedStatement getProject(Code)



getQuery
PreparedStatement getQuery(Code)



getUser
PreparedStatement getUser(Code)



insertBugHist
PreparedStatement insertBugHist(Code)



insertPerson
PreparedStatement insertPerson(Code)



isAdmin
boolean isAdmin(Code)



isDeveloper
boolean isDeveloper(Code)



isManager
boolean isManager(Code)



isUser
boolean isUser(Code)



lock
static Object lock(Code)



me
String me(Code)
My user name. 'nobody' until logged in.



my_person_type
String my_person_type(Code)



newProject
PreparedStatement newProject(Code)



nonDeltas
static Hashtable nonDeltas(Code)
The properties that we ignore when computing deltas between successive bug history records.



saveQuery
PreparedStatement saveQuery(Code)



updateProject
PreparedStatement updateProject(Code)



updateUser
PreparedStatement updateUser(Code)




Constructor Detail
BugSession
public BugSession()(Code)
Create a new session.




Method Detail
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



deleteProject
public boolean deleteProject(Properties p) throws SQLException(Code)
Execute the 'deleteProject' action
exception:
  SQLException - may be thrown



deleteUser
public boolean deleteUser(Properties p) throws SQLException(Code)
Execute the 'deleteUser' action
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



getComponentOwner
public String getComponentOwner(String component) throws SQLException, ServletException(Code)
Return the name of the user who owns the specified component.
Parameters:
  component - the component name the component's owner
exception:
  SQLException - may be thrown
exception:
  ServletException - 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



getQuery
public String getQuery(String name) throws ServletException(Code)
Return the saved bug search query with the specified name
Parameters:
  name - the name of the query the query string
exception:
  ServletException - 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



handleRequest
public void handleRequest(HttpServletRequest req) throws ServletException, SQLException(Code)
The main request handler. Determine which action is to be invoked and dispatch the appropriate routine.
Parameters:
  req - the http request
exception:
  ServletException - may be thrown
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.



saveQuery
public void saveQuery(String name, String query) throws ServletException(Code)
Save a bug search query.
Parameters:
  name - the query name
Parameters:
  query - the query string
exception:
  ServletException - may be thrown



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.



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.