Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

openfuture.bugbase.domain
Class Persistency  view Persistency download Persistency.java

java.lang.Object
  extended byopenfuture.bugbase.domain.Persistency

public class Persistency
extends java.lang.Object

Persistency Layer implementing the database access. Created: Tue Feb 08 06:04:19 2000

Version:
$Revision: 1.5 $

Field Summary
private  java.util.LinkedList bugReportList
           
(package private)  java.sql.Connection connection
           
(package private)  java.util.LinkedList doctors
           
(package private)  java.util.LinkedList packages
           
(package private)  openfuture.util.database.DBServer sqlServer
           
(package private)  java.lang.String sqlServerURL
           
 
Constructor Summary
Persistency(java.lang.String dbServerClass, java.lang.String url, java.lang.String user, java.lang.String password)
          Creates a new Persistency instance.
 
Method Summary
 void addAttachment(java.lang.Integer reportID, java.lang.String attachmentPath)
          add an attachment to an existing bug report
 java.lang.Integer addBugReport(java.lang.String project, BugReport report)
          Add a new bug report for the given project
 User adminLogin(Login login)
          Login into the bug database as administrator.
 boolean changePassword(Login login, java.lang.String newPassword)
          Change the current users password.
 java.sql.Connection createConnection(Login login)
          Tries to establish a new connection to the database.
 void createTable(java.lang.String tableName, java.util.LinkedList columns, java.util.LinkedList dataTypes, java.util.LinkedList constraints)
          Creates a database table.
 User doctorLogin(Login login)
          Login into the bug database as doctor.
 java.util.LinkedList executeQuery(java.lang.String command)
          Execute a SQL query.
 BugReport getBugReport(java.lang.Integer id)
          Retrieve a single bug report.
 java.util.LinkedList getBugReportList(java.lang.String project, java.lang.Boolean filterReported, java.lang.Boolean filterStarted, java.lang.Boolean filterFixed, java.lang.Boolean filterRejected, java.lang.String searchString, java.lang.String reporterId, java.lang.String doctorId)
          Get the list of bug reports for the given project selecting only those which match the given filters.
 java.sql.Connection getConnection()
          Get the value of connection.
 java.sql.Connection getConnection(java.lang.String user, java.lang.String password)
          Get a new connection for given user and password
 java.util.LinkedList getDoctors()
          Extract those users belonging to the group 'doctors'.
 java.util.LinkedList getGroups()
          Retrieves the list of all group IDs
 openfuture.bugbase.model.Version getObjectVersion(java.lang.String name)
          Get the version of a persinstency object.
 java.util.LinkedList getPackages(java.lang.String project)
          Get the value of packages.
 openfuture.bugbase.model.Version getPersistencyVersion()
          Get the persistency version.
 java.util.LinkedList getProjects()
          Get the value of projects.
 openfuture.util.database.DBServer getSqlServer()
          Get the value of sqlServer.
 java.lang.String getSqlServerURL()
          Get the value of sqlServerURL.
 User getUser(java.lang.String userid)
          Retrieve the user with the given user ID.
 java.util.LinkedList getUserData()
          Retrieves user data from the database
private  openfuture.bugbase.model.Version getVersion(java.lang.String object)
          Get the version of the given persistency object.
 void init()
          Initialize the database
private  java.lang.String join(java.lang.String separator, java.util.LinkedList strings)
          Join a list of Strings into one single string with the given separator.
 User login(Login login)
          Login into the bug database.
 void saveUserData(java.util.LinkedList users, java.util.LinkedList deleted)
          Save user data.
 void setConnection(java.sql.Connection v)
          Set the value of connection.
 void setObjectVersion(java.lang.String name, openfuture.bugbase.model.Version version)
          Set the version of a persinstency object.
 void setPackages(java.lang.String project, java.util.LinkedList v)
          Set the value of packages.
 void setPersistencyVersion(openfuture.bugbase.model.Version version)
          Set persistency version.
 void setProjects(java.util.LinkedList v)
          Retrieve the list of all projects available.
 void setSqlServer(openfuture.util.database.DBServer v)
          Set the value of sqlServer.
 void setSqlServerURL(java.lang.String v)
          Set the value of sqlServerURL.
private  void setVersion(java.lang.String object, openfuture.bugbase.model.Version version)
          Set the version of the given persistency object.
private  java.util.LinkedList split(java.lang.String separator, java.lang.String input)
          Describe split method here.
protected  java.lang.String sqlToString(java.lang.String s)
           
 java.lang.String stringToSql(java.lang.Object o)
          Describe sqlToString method here.
private  boolean tableExists(java.lang.String name)
          Check, if the given table exists.
 void updateBugReport(BugReport report)
          Update an existing bug report.
 void updateBugReports(java.util.LinkedList reports)
          Update existing bug reports.
private  void updateGroups(java.sql.Statement statement, User user)
          Update the user's groups.
 boolean validAdminUser(User user)
          Check, if the user belongs to the group 'admin'.
 boolean validDoctorUser(User user)
          Check, if the user belongs to the group 'doctors'.
 boolean validUser(Login login)
          Check, if the given login is valid.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

sqlServer

openfuture.util.database.DBServer sqlServer

connection

java.sql.Connection connection

sqlServerURL

java.lang.String sqlServerURL

doctors

java.util.LinkedList doctors

packages

java.util.LinkedList packages

bugReportList

private java.util.LinkedList bugReportList
Constructor Detail

Persistency

public Persistency(java.lang.String dbServerClass,
                   java.lang.String url,
                   java.lang.String user,
                   java.lang.String password)
            throws java.sql.SQLException,
                   java.lang.InstantiationException,
                   java.lang.IllegalAccessException,
                   java.lang.ClassNotFoundException
Creates a new Persistency instance.

Method Detail

createConnection

public java.sql.Connection createConnection(Login login)
                                     throws java.sql.SQLException
Tries to establish a new connection to the database.


changePassword

public boolean changePassword(Login login,
                              java.lang.String newPassword)
Change the current users password.


getBugReport

public BugReport getBugReport(java.lang.Integer id)
Retrieve a single bug report.


getBugReportList

public java.util.LinkedList getBugReportList(java.lang.String project,
                                             java.lang.Boolean filterReported,
                                             java.lang.Boolean filterStarted,
                                             java.lang.Boolean filterFixed,
                                             java.lang.Boolean filterRejected,
                                             java.lang.String searchString,
                                             java.lang.String reporterId,
                                             java.lang.String doctorId)
Get the list of bug reports for the given project selecting only those which match the given filters. If some filter is true, the bug report must be of that state, if the filter was false, the bug report mus NOT be of that state, and if null, this state is ignored.


addBugReport

public java.lang.Integer addBugReport(java.lang.String project,
                                      BugReport report)
Add a new bug report for the given project


updateBugReports

public void updateBugReports(java.util.LinkedList reports)
Update existing bug reports.


updateBugReport

public void updateBugReport(BugReport report)
Update an existing bug report.


getProjects

public java.util.LinkedList getProjects()
Get the value of projects.


setProjects

public void setProjects(java.util.LinkedList v)
Retrieve the list of all projects available.


getDoctors

public java.util.LinkedList getDoctors()
Extract those users belonging to the group 'doctors'.


getPackages

public java.util.LinkedList getPackages(java.lang.String project)
Get the value of packages.


setPackages

public void setPackages(java.lang.String project,
                        java.util.LinkedList v)
Set the value of packages.


getPersistencyVersion

public openfuture.bugbase.model.Version getPersistencyVersion()
Get the persistency version.


setPersistencyVersion

public void setPersistencyVersion(openfuture.bugbase.model.Version version)
Set persistency version.


getObjectVersion

public openfuture.bugbase.model.Version getObjectVersion(java.lang.String name)
Get the version of a persinstency object.


setObjectVersion

public void setObjectVersion(java.lang.String name,
                             openfuture.bugbase.model.Version version)
Set the version of a persinstency object.


getVersion

private openfuture.bugbase.model.Version getVersion(java.lang.String object)
Get the version of the given persistency object.


setVersion

private void setVersion(java.lang.String object,
                        openfuture.bugbase.model.Version version)
Set the version of the given persistency object.


getUserData

public java.util.LinkedList getUserData()
Retrieves user data from the database


getUser

public User getUser(java.lang.String userid)
Retrieve the user with the given user ID. If no matching user can be found, null is returned.


validUser

public boolean validUser(Login login)
Check, if the given login is valid.


validAdminUser

public boolean validAdminUser(User user)
Check, if the user belongs to the group 'admin'.


validDoctorUser

public boolean validDoctorUser(User user)
Check, if the user belongs to the group 'doctors'.


login

public User login(Login login)
Login into the bug database. If the login succeeds, the user data is returned. Otherwise, null is returned.


adminLogin

public User adminLogin(Login login)
Login into the bug database as administrator. If the login succeeds, the user data is returned. Otherwise, null is returned.


doctorLogin

public User doctorLogin(Login login)
Login into the bug database as doctor. If the login succeeds, the user data is returned. Otherwise, null is returned.


getGroups

public java.util.LinkedList getGroups()
Retrieves the list of all group IDs


saveUserData

public void saveUserData(java.util.LinkedList users,
                         java.util.LinkedList deleted)
                  throws java.sql.SQLException,
                         openfuture.bugbase.error.BugBaseException
Save user data. Update only dirty users. The users from deleted are deleted.


addAttachment

public void addAttachment(java.lang.Integer reportID,
                          java.lang.String attachmentPath)
                   throws java.sql.SQLException
add an attachment to an existing bug report


updateGroups

private void updateGroups(java.sql.Statement statement,
                          User user)
                   throws java.sql.SQLException
Update the user's groups.


join

private java.lang.String join(java.lang.String separator,
                              java.util.LinkedList strings)
Join a list of Strings into one single string with the given separator.


init

public void init()
          throws java.sql.SQLException
Initialize the database


createTable

public void createTable(java.lang.String tableName,
                        java.util.LinkedList columns,
                        java.util.LinkedList dataTypes,
                        java.util.LinkedList constraints)
                 throws java.sql.SQLException
Creates a database table.


executeQuery

public java.util.LinkedList executeQuery(java.lang.String command)
Execute a SQL query.


getConnection

public java.sql.Connection getConnection()
                                  throws java.sql.SQLException
Get the value of connection.


setConnection

public void setConnection(java.sql.Connection v)
Set the value of connection.


getConnection

public java.sql.Connection getConnection(java.lang.String user,
                                         java.lang.String password)
                                  throws java.sql.SQLException
Get a new connection for given user and password


getSqlServer

public openfuture.util.database.DBServer getSqlServer()
Get the value of sqlServer.


setSqlServer

public void setSqlServer(openfuture.util.database.DBServer v)
Set the value of sqlServer.


getSqlServerURL

public java.lang.String getSqlServerURL()
Get the value of sqlServerURL.


setSqlServerURL

public void setSqlServerURL(java.lang.String v)
Set the value of sqlServerURL.


split

private java.util.LinkedList split(java.lang.String separator,
                                   java.lang.String input)
Describe split method here.


tableExists

private boolean tableExists(java.lang.String name)
Check, if the given table exists.


stringToSql

public java.lang.String stringToSql(java.lang.Object o)
Describe sqlToString method here.


sqlToString

protected java.lang.String sqlToString(java.lang.String s)