update - write reservation
This commit is contained in:
@@ -48,6 +48,7 @@ public class Account {
|
||||
return reservation_list.add(rsrv);
|
||||
}
|
||||
|
||||
|
||||
// @TODO Write Account out in JSON
|
||||
public static void Write(Account acct) throws IOException {
|
||||
String dataRoot = DataRepository.getPath();
|
||||
@@ -58,6 +59,10 @@ public class Account {
|
||||
writer.write(acct.toString());
|
||||
writer.flush();
|
||||
}
|
||||
|
||||
for (Reservation r: acct.reservation_list){
|
||||
r.Write(r);
|
||||
}
|
||||
}
|
||||
|
||||
public String account_number() {
|
||||
|
||||
@@ -175,7 +175,7 @@ public abstract class Reservation{
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
sb.append("{ \"Reservation\":{");
|
||||
sb.append(String.format("{ \"%s\":{", ReservationType()));
|
||||
sb.append("\"reservation_type\": \"" + ReservationType() + "\",");
|
||||
sb.append("\"reservation_number\": \"" + reservation_number + "\",");
|
||||
sb.append("\"reservation_status\": \"" + reservation_status + "\",");
|
||||
@@ -200,7 +200,7 @@ public abstract class Reservation{
|
||||
Path path = Paths.get(dataRoot);
|
||||
|
||||
try (BufferedWriter writer = Files.newBufferedWriter(path, StandardCharsets.UTF_8)) {
|
||||
writer.write(super.toString());
|
||||
writer.write(toString());
|
||||
writer.flush();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user