Access.get_user_data (String username) serve per ottenere un oggetto di tipo Entry e all'interno ci sono idati dell'utente
Access.replace_data(String username, Entry new_data) serve per scrivere nel database i nuovi dati dellutente dopo aver modificato loggetto Entry ottenuto con il metodo precedente. Per settare un nuovo bilancio basta invocare il metodo setBalance(double value) sull'oggetto Entry ottenuto. Per settare un nuovo acquisto fatto dell'utente bisogna prima chiamare getStorico() sull'oggetto entry che restituira un arraylist ed in seguito eseguire un add sull'arraylist per aggiungere un nuovo oggetto di tipo StoricoItem (questo conterrà la descrizione, il prezzo al momento dell'acquisto e la data)
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package it.unisa.info13d.Login;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* Created with MONSTER.
|
||||
@@ -10,10 +11,12 @@ import java.io.Serializable;
|
||||
*/
|
||||
public class Entry implements Serializable{
|
||||
|
||||
public Entry (String in_user, String in_password, boolean in_type) {
|
||||
public Entry (String in_user, String in_password, boolean in_type, String in_location) {
|
||||
user = in_user;
|
||||
password = in_password;
|
||||
type = in_type;
|
||||
location = in_location;
|
||||
storico = new ArrayList<StoricoItem>();
|
||||
}
|
||||
|
||||
public String getUser() {
|
||||
@@ -28,8 +31,27 @@ public class Entry implements Serializable{
|
||||
return type;
|
||||
}
|
||||
|
||||
public String getLocation() {
|
||||
return location;
|
||||
}
|
||||
|
||||
public double getBalance() {
|
||||
return balance;
|
||||
}
|
||||
|
||||
public void setBalance(double balance) {
|
||||
this.balance = balance;
|
||||
}
|
||||
|
||||
public ArrayList<StoricoItem> getStorico() {
|
||||
return storico;
|
||||
}
|
||||
|
||||
private String user;
|
||||
private String password;
|
||||
private String location;
|
||||
private double balance = 0;
|
||||
private boolean type;
|
||||
private ArrayList<StoricoItem> storico;
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user