org.mozdev.MacroTracker.classes
Class MacroTrackerDatabase

java.lang.Object
  extended by org.mozdev.MacroTracker.classes.MacroTrackerDatabase
All Implemented Interfaces:
iBugDatabase, java.io.Serializable

public class MacroTrackerDatabase
extends java.lang.Object
implements java.io.Serializable, iBugDatabase

A Bug Database that can be saved to a file using the MacroTracker Database format.

Author:
R.J. Keller
See Also:
Serialized Form

Field Summary
 
Fields inherited from interface org.mozdev.MacroTracker.classes.iBugDatabase
bugs, products, resolution, status, users
 
Constructor Summary
MacroTrackerDatabase()
           
 
Method Summary
 void addBug(Bug bug)
          Adds a bug to the bug database.
 void addProduct(Product productToAdd)
          Adds a Product to the BugDatabase.
 void addUser(User usr)
          Adds a user to the bug database.
 int bugCount()
          Returns how many bugs are in the bug database.
 Bug getBug(int index)
          Returns a bug in the bug database.
 java.lang.String getName()
          Returns the name of the database.
 Product getProduct(int index)
          Returns the product located at the specified index in the Product database.
 Product getProduct(java.lang.String productName)
          Returns a Product based on the productName taken in.
 User getUser(int index)
          Returns the user by their ID number.
 User getUser(java.lang.String email)
          Returns the user with the given email.
 boolean isValidUser(java.lang.String email)
          Returns whether or not the user's email taken in is a valid MacroTracker user.
 boolean isValidUser(User user)
          Returns whether or not the user taken in is a registered MacroTracker user.
 int productCount()
          Returns how many product's are held in this MacroTracker database.
 java.util.Iterator productIterator()
          Returns an iterator that can iterate through all of the Product's in this database.
 void removeBug(int index)
          Removes a bug from the bug database.
 boolean removeProduct(int index)
          Removes a Product that bugs are tracked for from the BugDatabase.
 void removeProduct(java.lang.String aProduct)
          Removes a product when the name of the product is taken in.
 void removeUser(int index)
          Removes a user from the bug database.
 void removeUser(java.lang.String aUser)
          Removes a user from the bug database.
 void setName(java.lang.String aName)
          Sets the name of the BugDatabase
 int userCount()
          The number of users in the BugDatabase.
 java.util.Iterator userIterator()
          Returns an iterator that will iterate through all of the users in the BugDatabase.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MacroTrackerDatabase

public MacroTrackerDatabase()
Method Detail

getName

public java.lang.String getName()
Returns the name of the database.

Specified by:
getName in interface iBugDatabase

setName

public void setName(java.lang.String aName)
Sets the name of the BugDatabase

Specified by:
setName in interface iBugDatabase

addBug

public void addBug(Bug bug)
Adds a bug to the bug database.

Parameters:
bug - The bug to add to the database.

isValidUser

public boolean isValidUser(User user)
Returns whether or not the user taken in is a registered MacroTracker user.

Parameters:
user - The user to ensure is a valid user.

isValidUser

public boolean isValidUser(java.lang.String email)
Returns whether or not the user's email taken in is a valid MacroTracker user.

Specified by:
isValidUser in interface iBugDatabase
Parameters:
email - The email address of the user to validate.

bugCount

public int bugCount()
Returns how many bugs are in the bug database.


getBug

public Bug getBug(int index)
Returns a bug in the bug database.

Parameters:
index - The bug number of the bug to return.

removeBug

public void removeBug(int index)
Removes a bug from the bug database.

Parameters:
index - The bug number of the bug to remove from the database
(precondition: 0 <= index < bugCount())

addUser

public void addUser(User usr)
Adds a user to the bug database.


removeUser

public void removeUser(java.lang.String aUser)
Removes a user from the bug database.


userCount

public int userCount()
The number of users in the BugDatabase.


getUser

public User getUser(int index)
Returns the user by their ID number.

Parameters:
index - The ID number of the user to return.

userIterator

public java.util.Iterator userIterator()
Returns an iterator that will iterate through all of the users in the BugDatabase.


getUser

public User getUser(java.lang.String email)
Returns the user with the given email.

Parameters:
email - The email address of the User to return.
(precondition: isValidUser(email) == true)
Returns:
a User object that corresponds with the email address taken in.

removeUser

public void removeUser(int index)
Removes a user from the bug database.

Parameters:
index - The user ID of the user to remove from the bug database.

addProduct

public void addProduct(Product productToAdd)
Adds a Product to the BugDatabase. A Product is a product released from the company that they would like MacroTracker to report bugs or issues for.

Parameters:
productToAdd - the product to add to the BugDatabase.

productCount

public int productCount()
Returns how many product's are held in this MacroTracker database.


getProduct

public Product getProduct(int index)
Returns the product located at the specified index in the Product database.

Parameters:
index - The index of the Product you want returned.
(precondition: 0 <= index < productCount())

getProduct

public Product getProduct(java.lang.String productName)
Returns a Product based on the productName taken in.


productIterator

public java.util.Iterator productIterator()
Returns an iterator that can iterate through all of the Product's in this database.


removeProduct

public boolean removeProduct(int index)
Removes a Product that bugs are tracked for from the BugDatabase. This product must not have any bugs using that product or else this function will return false without the Product being removed.

Returns:
Returns whether or not the Product was successfully removed.

removeProduct

public void removeProduct(java.lang.String aProduct)
Removes a product when the name of the product is taken in. This product must not have any bugs using that product or else the product will not be removed from the Bug Database.



Copyright © 2003-2004 R.J. Keller. All Rights Reserved.