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)
58 lines
1.1 KiB
Java
58 lines
1.1 KiB
Java
package it.unisa.info13d.Login;
|
|
|
|
import java.io.Serializable;
|
|
import java.util.ArrayList;
|
|
|
|
/**
|
|
* Created with MONSTER.
|
|
* User: xgiovio
|
|
* Date: 17/12/13
|
|
* Time: 0.38
|
|
*/
|
|
public class Entry implements Serializable{
|
|
|
|
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() {
|
|
return user;
|
|
}
|
|
|
|
public String getPassword() {
|
|
return password;
|
|
}
|
|
|
|
public boolean getType() {
|
|
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;
|
|
|
|
}
|