public class User
extends java.lang.Object
Constructor and Description |
---|
User()
Public constructor for the User class that also initializes
the connection to the datasource.
|
Modifier and Type | Method and Description |
---|---|
void |
addProductSupplier(java.lang.String prname,
java.lang.String prserial,
java.lang.String supname,
java.lang.String price)
Adds a supplier and his price to a product.
|
void |
createNewProduct(java.lang.String name,
java.lang.String serial,
java.lang.String desc,
java.lang.String strname,
java.lang.String quantity,
java.lang.String type,
java.lang.String weight,
java.lang.String length,
java.lang.String width,
java.lang.String height)
Creates a new product with the desired attributes.
|
void |
createNewStorage(java.lang.String name,
java.lang.String desc,
int open,
java.lang.String loc)
Creates a new storage with the desired attributes.
|
void |
createNewSupplier(java.lang.String company,
java.lang.String name,
java.lang.String surname,
java.lang.String afm,
java.lang.String address,
java.lang.String telephone,
java.lang.String email)
Creates a new supplier with the desired attributes.
|
void |
deleteProduct(java.lang.String prname,
java.lang.String prserial)
Deletes a product from the database.
|
void |
deleteStorage(java.lang.String storagename)
Deletes a storage from the database.
|
void |
deleteSupplier(java.lang.String company)
Deletes a supplier from the database.
|
java.util.List<Product> |
getAllProducts(int index)
Gets twenty products, based on the index, ordered by name.
|
int |
getAllProductsCount()
Gets the number of all products on the database.
|
java.util.List<Storage> |
getAllStorages()
Gets all the storages that are stored to the database.
|
java.util.List<Supplier> |
getAllSuppliers()
Gets all suppliers from the database.
|
java.util.List<java.lang.String> |
getAllSuppliersNames()
Gets the company names from all the suppliers in the database.
|
java.util.List<User> |
getAllUsers()
Gets all users that are stored to the database.
|
java.lang.String |
getEmail() |
java.lang.String |
getName() |
java.lang.String |
getPassword() |
Product |
getProduct(java.lang.String name,
java.lang.String serial)
Gets the product with the desired name and serial number.
|
int |
getProductsCount(java.lang.String storagename)
Gets the number of products that are stored in a storage.
|
java.util.List<java.lang.String[]> |
getProductSuppliers(java.lang.String prname,
java.lang.String prserial)
Gets all the suppliers and their prices of a product.
|
java.util.List<java.lang.String> |
getProductSuppliersNames(java.lang.String prname,
java.lang.String prserial)
Gets all the supplier names that sell a desired product.
|
java.lang.String |
getRole() |
Storage |
getStorage(java.lang.String storagename)
Gets a storage from the database.
|
java.util.List<Product> |
getStorageLatestActiveProducts(java.lang.String storagename)
Gets the ten latest active products from a storage.
|
java.util.List<Product> |
getStorageProducts(java.lang.String storagename,
int index)
Gets twenty products, based on the index, that a storage contains.
|
int |
getStorageProductsCount(java.lang.String storagename)
Gets the numbers of products in a storage.
|
Supplier |
getSupplier(java.lang.String company)
Gets the supplier with the desired company name.
|
java.util.List<java.lang.String[]> |
getSupplierProducts(java.lang.String company,
int index)
Gets twenty products, based on the index, that the supplier sells.
|
int |
getSuppliersProductsCount(java.lang.String company)
Gets the number of products that a supplier sells.
|
java.lang.String |
getSurname() |
java.lang.String |
getTelephone() |
User |
getUser(java.lang.String username)
Gets a user from the database.
|
java.lang.String |
getUsername() |
void |
insertToDatabase()
Stores all the values of the user attributes to the database.
|
boolean |
retrieveFromDatabase(java.lang.String username,
java.lang.String password)
Sets all the attributes according to the values that are stored to the database
if the username and password inserted by the user are correct.
|
java.util.List<java.lang.String[]> |
searchProducts(java.lang.String category,
java.lang.String criteria)
Searches the database for the product matching the criteria based on a category.
|
void |
setAll(java.lang.String username,
java.lang.String password,
java.lang.String name,
java.lang.String surname,
java.lang.String telephone,
java.lang.String email,
java.lang.String role)
Sets all the user attributes at once.
|
void |
setEmail(java.lang.String email) |
void |
setName(java.lang.String name) |
void |
setPassword(java.lang.String password) |
void |
setRole(java.lang.String role) |
void |
setSurname(java.lang.String surname) |
void |
setTelephone(java.lang.String telephone) |
void |
setUsername(java.lang.String username) |
void |
updateProduct(java.lang.String updateParam,
java.lang.String newValue,
java.lang.String prname,
java.lang.String prserial)
Updates a desired attribute of a product with a new value to the database.
|
void |
updateStorage(java.lang.String updateParam,
java.lang.String newValue,
java.lang.String storagename)
Updates a desired attribute of a storage with a new value to the database.
|
void |
updateSupplier(java.lang.String updateParam,
java.lang.String newValue,
java.lang.String company)
Updates a desired attribute of a supplier with a new value to the database.
|
void |
updateToDatabase(java.lang.String updateParam,
java.lang.String newValue,
java.lang.String username)
Updates a desired attribute with a new value to the database.
|
public User()
public java.lang.String getUsername()
public java.lang.String getPassword()
public java.lang.String getName()
public java.lang.String getSurname()
public java.lang.String getEmail()
public java.lang.String getTelephone()
public java.lang.String getRole()
public void setUsername(java.lang.String username)
username
- public void setPassword(java.lang.String password)
password
- public void setName(java.lang.String name)
name
- public void setSurname(java.lang.String surname)
surname
- public void setEmail(java.lang.String email)
email
- public void setTelephone(java.lang.String telephone)
telephone
- public void setRole(java.lang.String role)
role
- public void setAll(java.lang.String username, java.lang.String password, java.lang.String name, java.lang.String surname, java.lang.String telephone, java.lang.String email, java.lang.String role)
username
- The value of the username.password
- The value of the password.name
- The value of the name.surname
- The value of the surname.telephone
- The value of the telephone.email
- The value of the email.role
- The value of the role.public void insertToDatabase()
public void updateToDatabase(java.lang.String updateParam, java.lang.String newValue, java.lang.String username)
updateParam
- The desired attribute to be updated.newValue
- The new value of the desired attribute.username
- The username of the user that wants to make the update.public boolean retrieveFromDatabase(java.lang.String username, java.lang.String password)
username
- The value of the username inserted by the user.password
- The value of the password inserted by the user.public java.util.List<User> getAllUsers()
public User getUser(java.lang.String username)
username
- The username of the desired user.public java.util.List<Storage> getAllStorages()
public void createNewStorage(java.lang.String name, java.lang.String desc, int open, java.lang.String loc)
name
- The value of the desired storage name.desc
- The value of the desired storage description.open
- A value to show if the desired storage will be open or not.loc
- The value of the desired storage location.public Storage getStorage(java.lang.String storagename)
storagename
- The name of the desired storage.public int getProductsCount(java.lang.String storagename)
storagename
- The name of the storage.public void updateStorage(java.lang.String updateParam, java.lang.String newValue, java.lang.String storagename)
updateParam
- The desired attribute to be updated.newValue
- The new value of the desired attribute.storagename
- The name of the storage that will be updated.public void deleteStorage(java.lang.String storagename)
storagename
- The name of the storage to be deleted.public java.util.List<Product> getStorageProducts(java.lang.String storagename, int index)
storagename
- The name of the desired storage.index
- Index to take twenty products from.public int getStorageProductsCount(java.lang.String storagename)
storagename
- The name of the desired storage.public java.util.List<Product> getStorageLatestActiveProducts(java.lang.String storagename)
storagename
- The name of the desired storage.public void createNewProduct(java.lang.String name, java.lang.String serial, java.lang.String desc, java.lang.String strname, java.lang.String quantity, java.lang.String type, java.lang.String weight, java.lang.String length, java.lang.String width, java.lang.String height)
name
- The value for the name of the product.serial
- The value for the serial number of the product.desc
- The value for the description of the product.strname
- The value for the storage name the product will be stored.quantity
- The value for the quantity of the product.type
- The value for the type of the product.weight
- The value for the weight of the product.length
- The value for the length of the product.width
- The value for the width of the product.height
- The value for the height of the product.public java.util.List<Product> getAllProducts(int index)
index
- Index to take twenty products from.public int getAllProductsCount()
public Product getProduct(java.lang.String name, java.lang.String serial)
name
- The desired product name.serial
- The desired serial number.public java.util.List<java.lang.String> getAllSuppliersNames()
public java.util.List<java.lang.String> getProductSuppliersNames(java.lang.String prname, java.lang.String prserial)
prname
- The name of the desired product.prserial
- The serial number of the desired product.public void updateProduct(java.lang.String updateParam, java.lang.String newValue, java.lang.String prname, java.lang.String prserial)
updateParam
- The desired attribute to be updated.newValue
- The new value of the desired attribute.prname
- The name of the product to be updated.prserial
- The serial number of the product to be updated.public void deleteProduct(java.lang.String prname, java.lang.String prserial)
prname
- The name of the product to be deleted.prserial
- The serial number of the product to be deleted.public void addProductSupplier(java.lang.String prname, java.lang.String prserial, java.lang.String supname, java.lang.String price)
prname
- The name of the desired product.prserial
- The serial number of the desired product.supname
- The name of the desired supplier.price
- The desired price for the product to the supplier.public java.util.List<java.lang.String[]> getProductSuppliers(java.lang.String prname, java.lang.String prserial)
prname
- The name of the desired product.prserial
- The serial number of the desired product.public java.util.List<java.lang.String[]> searchProducts(java.lang.String category, java.lang.String criteria)
category
- The desired category that the search will be performed.criteria
- The criteria is the keyword to be searched.public void createNewSupplier(java.lang.String company, java.lang.String name, java.lang.String surname, java.lang.String afm, java.lang.String address, java.lang.String telephone, java.lang.String email)
company
- The value for the company name.name
- The value for the name.surname
- The value for the surname.afm
- The value for the afm.address
- The value for the address.telephone
- The value for the telephone.email
- The value for the email.public java.util.List<Supplier> getAllSuppliers()
public Supplier getSupplier(java.lang.String company)
company
- The company name of the desired supplier.public int getSuppliersProductsCount(java.lang.String company)
company
- The company name of the desired supplier.public java.util.List<java.lang.String[]> getSupplierProducts(java.lang.String company, int index)
company
- The company name of the desired supplier.index
- Index to take twenty products from.public void updateSupplier(java.lang.String updateParam, java.lang.String newValue, java.lang.String company)
updateParam
- The desired attribute to be updated.newValue
- The new value of the desired attribute.company
- The company name of the supplier to be updated.public void deleteSupplier(java.lang.String company)
company
- The company name of the supplier to be deleted.