|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcafe.main.MainGuiHandler
public class MainGuiHandler
This class connects GUI with Database and Authentication components
Constructor Summary | |
---|---|
MainGuiHandler(Database db,
CoffeeTouch main,
AuthenticationSettings authSettings)
Constructs a new instance of this class and creates Authentication instance. |
Method Summary | |
---|---|
boolean |
authenticateUser(java.lang.String username,
java.lang.String password)
Authenticates an user's CS department username and password by calling UserAuthentication interface's authenticateUser method. |
CancelProduct |
cancelProductExport(UserInfo user)
Cancels the last export transaction from the given user. |
void |
deleteFingerprint(int id)
Deletes a certain fingerprint (data) from the database and fingerprint cache by calling Database interface's deleteFingerprint and CoffeeTouch's deleteFingerprint methods. |
void |
exportProduct(UserInfo user,
ExportProduct product)
Marks an export transaction to the given user and product by calling Database interface's exportProduct method. |
ImportProduct[] |
getAlerts()
Returns a list of all products that have an alert set. |
ProductGroup[] |
getProductGroups()
Returns a list of all product groups. |
ExportProduct[] |
getProductList()
Returns a list of all exportable products. |
void |
importProduct(UserInfo user,
ImportProduct product,
double amount)
Marks an import transaction to the given user and product by calling Database interface's importProduct method. |
void |
insertAlert(ImportProduct product)
Inserts an alert to the given product to the database by calling Database interface's insertAlert method. |
UserInfo |
loadUser(java.lang.String username)
Loads an user's information from the database based on the CS dep. username given as an argument. |
void |
removeAlert(ImportProduct product)
Removes the alert from the given product by calling Database interface's removeAlert method. |
void |
saveUser(UserInfo user)
Saves an UserInfo instance describing a certain user to the database by calling Database interface's saveUser method. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public MainGuiHandler(Database db, CoffeeTouch main, AuthenticationSettings authSettings)
db
- reference to a class that implemens database interfacemain
- reference to main classauthSettings
- settings to be passed on to AuthenticationMethod Detail |
---|
public boolean authenticateUser(java.lang.String username, java.lang.String password)
authenticateUser
in interface UserInterfaceEvent
username
- user's usernamepassword
- user's password
true
if username and password match, false
if the do not.public CancelProduct cancelProductExport(UserInfo user)
cancelProductExport
in interface UserInterfaceEvent
user
- the user whose transaction will be cancelled
null
if such
transaction could not be found.public void deleteFingerprint(int id)
deleteFingerprint
in interface UserInterfaceEvent
id
- the id of the fingerprint that will be deletedpublic void exportProduct(UserInfo user, ExportProduct product)
exportProduct
in interface UserInterfaceEvent
user
- the current user exporting a productproduct
- the product to be exportedpublic ImportProduct[] getAlerts()
getAlerts
in interface UserInterfaceEvent
public ProductGroup[] getProductGroups()
getProductGroups
in interface UserInterfaceEvent
public ExportProduct[] getProductList()
getProductList
in interface UserInterfaceEvent
public void importProduct(UserInfo user, ImportProduct product, double amount)
importProduct
in interface UserInterfaceEvent
user
- the current user importing a productproduct
- the product to be importedamount
- the amount (size) of the imported productpublic void insertAlert(ImportProduct product)
insertAlert
in interface UserInterfaceEvent
product
- the product that will receive the alertpublic UserInfo loadUser(java.lang.String username)
loadUser
in interface UserInterfaceEvent
username
- the username of the user to be loaded
public void removeAlert(ImportProduct product)
removeAlert
in interface UserInterfaceEvent
product
- the product whose alert will be dismissedpublic void saveUser(UserInfo user)
saveUser
in interface UserInterfaceEvent
user
- UserInfo to be stored
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |