|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcafe.database.DBCommunication
public class DBCommunication
This class communicates data from the database to other components.
| Constructor Summary | |
|---|---|
DBCommunication(DBSettings settings)
|
|
| Method Summary | |
|---|---|
CancelProduct |
cancelProductExport(UserInfo user)
Method cancels the last product "takeout" in the productout table |
void |
deleteFingerprint(int id)
Method removes a fingerprint from db |
void |
exportProduct(UserInfo user,
ExportProduct product)
Method returns exportproducts in a list |
ImportProduct[] |
getAlerts()
Method returns products in a list, where the products have alerts |
FPData[] |
getFingerprintData()
Method returns all the fingerprint data in database in a list |
ProductGroup[] |
getProductGroups()
method returns groups in database and their balance in ProductGroup beans in a list |
ExportProduct[] |
getProductList()
Method returns exportproducts in a list |
void |
importProduct(UserInfo user,
ImportProduct product,
double amount)
Method for importing new products |
void |
insertAlert(ImportProduct product)
Method inserts a alert for a product, if alert is already "valid", keeps the alert as valid if proiduct id found in db, sets the alert for it, if not found, no rows are updated |
UserInfo |
loadUser(int id)
Method for loading user by id, if user not found, returns NULL. |
UserInfo |
loadUser(java.lang.String username)
Returns UserInfo, if given username is not valid returns NULL else returns all the data found in database in UserInfo bean. |
boolean |
reconnectDatabase()
Method tries to reconnect to database if connection is lost for some reason |
void |
removeAlert(ImportProduct product)
Removes alert from a product if productId in db, updates that row, if no product found, does not update any rows |
int |
saveFingerprint(FPData data)
Inserts a new fingerprint into database |
void |
saveUser(UserInfo user)
Saves userInfo into database. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public DBCommunication(DBSettings settings)
throws DBConLostException
settings -
DBConLostException| Method Detail |
|---|
public CancelProduct cancelProductExport(UserInfo user)
throws DBConLostException
Database
cancelProductExport in interface Databaseuser - user who is cancelling last action
DBConLostException - or SocketException when databese is not responding
public void deleteFingerprint(int id)
throws DBConLostException
deleteFingerprint in interface Databaseid - Primary Key of fingerprint to be deleted
DBConLostException
public void exportProduct(UserInfo user,
ExportProduct product)
throws ProductNotFoundException,
DBConLostException
exportProduct in interface Databaseuser - user who is exporting productproduct - of which we are exporting
DBConLostException
ProductNotFoundException
public ImportProduct[] getAlerts()
throws DBConLostException
getAlerts in interface DatabaseDBConLostException
public FPData[] getFingerprintData()
throws DBConLostException
getFingerprintData in interface DatabaseDBConLostException
public ProductGroup[] getProductGroups()
throws DBConLostException
getProductGroups in interface DatabaseDBConLostException
public ExportProduct[] getProductList()
throws DBConLostException
getProductList in interface DatabaseDBConLostException
public void importProduct(UserInfo user,
ImportProduct product,
double amount)
throws ProductNotFoundException,
DBConLostException
importProduct in interface Databaseuser - user who is importing products into systemproduct - product which we are importingamount - amount of goods which we are importing. For example a coffee package is worth 20 cups -> amount 20
ProductNotFoundException
DBConLostException
public void insertAlert(ImportProduct product)
throws ProductNotFoundException,
DBConLostException
insertAlert in interface Databaseproduct - which we are adding alert to
ProductNotFoundException
DBConLostException
public UserInfo loadUser(int id)
throws DBConLostException
loadUser in interface Databaseid -
DBConLostException
public UserInfo loadUser(java.lang.String username)
throws DBConLostException
loadUser in interface Databaseusername -
DBConLostExceptionpublic boolean reconnectDatabase()
reconnectDatabase in interface Database
public void removeAlert(ImportProduct product)
throws DBConLostException
removeAlert in interface Databaseproduct -
DBConLostException
public int saveFingerprint(FPData data)
throws DBConLostException
saveFingerprint in interface Databasedata - griaule produced data to be inserted into database
DBConLostException
public void saveUser(UserInfo user)
throws DBConLostException
saveUser in interface Databaseuser - userInfo bean
DBConLostException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||