cafe.gui
Interface UserInterfaceEvent

All Known Implementing Classes:
MainGuiHandler

public interface UserInterfaceEvent

This interface provides methods for GUI so that it can get information from other components.

Version:
0.1
Author:
Markus Penttila

Method Summary
 boolean authenticateUser(java.lang.String username, java.lang.String password)
          Authenticates an user's CS department username and password
 CancelProduct cancelProductExport(UserInfo user)
          Cancels the last export transaction from the given user.
 void deleteFingerprint(int id)
          Deletes a certain fingerprint (data) from database and memory.
 void exportProduct(UserInfo user, ExportProduct product)
          Marks an export transaction to the given user and product.
 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.
 void insertAlert(ImportProduct product)
          Inserts an alert to the given product to the database.
 UserInfo loadUser(java.lang.String username)
          Loads an user's information from the database based on the CS dep. username.
 void removeAlert(ImportProduct product)
          Removes the alert from the given product.
 void saveUser(UserInfo user)
          Saves an UserInfo instance describing a certain user to the database.
 

Method Detail

authenticateUser

boolean authenticateUser(java.lang.String username,
                         java.lang.String password)
Authenticates an user's CS department username and password

Parameters:
username - user's username
password - user's password
Returns:
true if username and password match, false if the do not.

saveUser

void saveUser(UserInfo user)
Saves an UserInfo instance describing a certain user to the database.

Parameters:
user - UserInfo to be stored

exportProduct

void exportProduct(UserInfo user,
                   ExportProduct product)
Marks an export transaction to the given user and product.

Parameters:
user - the current user exporting a product
product - the product to be exported

importProduct

void importProduct(UserInfo user,
                   ImportProduct product,
                   double amount)
Marks an import transaction to the given user and product.

Parameters:
user - the current user importing a product
product - the product to be imported
amount - the amount (size) of the imported product

getProductList

ExportProduct[] getProductList()
Returns a list of all exportable products.

Returns:
the list containing all exportable products

insertAlert

void insertAlert(ImportProduct product)
Inserts an alert to the given product to the database.

Parameters:
product - the product that will receive the alert

removeAlert

void removeAlert(ImportProduct product)
Removes the alert from the given product.

Parameters:
product - the product whose alert will be dismissed

getAlerts

ImportProduct[] getAlerts()
Returns a list of all products that have an alert set.

Returns:
list of products as ImportProduct instances.

getProductGroups

ProductGroup[] getProductGroups()
Returns a list of all product groups.

Returns:
the list of ProductGroup instances

deleteFingerprint

void deleteFingerprint(int id)
Deletes a certain fingerprint (data) from database and memory.

Parameters:
id - the id of the fingerprint that will be deleted

loadUser

UserInfo loadUser(java.lang.String username)
Loads an user's information from the database based on the CS dep. username.

Parameters:
username - the username of the user to be loaded
Returns:
a UserInfo instance containing a user's information.

cancelProductExport

CancelProduct cancelProductExport(UserInfo user)
Cancels the last export transaction from the given user.

Parameters:
user - the user whose transaction will be cancelled
Returns:
information about the cancelled product. null if such transaction could not be found.