update
This commit is contained in:
16
build.gradle
16
build.gradle
@@ -15,7 +15,7 @@ sourceCompatibility = JavaVersion.VERSION_21
|
|||||||
targetCompatibility = JavaVersion.VERSION_21
|
targetCompatibility = JavaVersion.VERSION_21
|
||||||
|
|
||||||
application {
|
application {
|
||||||
mainClass = 'lodge.reservationsytem.TestReservations'
|
mainClass = 'lodge.TestReservations'
|
||||||
}
|
}
|
||||||
|
|
||||||
sourceSets {
|
sourceSets {
|
||||||
@@ -34,3 +34,17 @@ dependencies {
|
|||||||
implementation files('libs/gson-2.13.1.jar')
|
implementation files('libs/gson-2.13.1.jar')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
jar {
|
||||||
|
manifest {
|
||||||
|
attributes 'Main-Class': application.mainClass
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.named('jar') {
|
||||||
|
manifest {
|
||||||
|
attributes('Implementation-Title': 'reservationsystem',
|
||||||
|
'Implementation-Version': 1.0,
|
||||||
|
'Main-Class': 'lodge.TestReservations',
|
||||||
|
'Class-Path': 'lodge.reservationsystem com.google.gson .' )
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,3 +1,3 @@
|
|||||||
Manifest-Version: 1.0
|
Manifest-Version: 1.0
|
||||||
Main-Class: lodge.TestReservations
|
Main-Class: lodge.TestReservations
|
||||||
Class-Path: . lodge.reservationsystem com.google.gson
|
Class-Path: lodge.reservationsystem com.google.gson .
|
||||||
@@ -6,6 +6,7 @@ package lodge.reservationsystem;
|
|||||||
|
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public final class AccomodationManager {
|
public final class AccomodationManager {
|
||||||
@@ -44,8 +45,8 @@ public final class AccomodationManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public final AccountList retrieveLoadedAccounts() {
|
public final List<Account> retrieveLoadedAccounts() {
|
||||||
return account_list;
|
return Collections.unmodifiableList(account_list);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Account retrieveAccount(String acct_id) {
|
public Account retrieveAccount(String acct_id) {
|
||||||
|
|||||||
@@ -10,11 +10,7 @@ import java.util.Collections;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.ListIterator;
|
import java.util.ListIterator;
|
||||||
|
|
||||||
public class AccountList extends ArrayList<Account> {
|
class AccountList extends ArrayList<Account> {
|
||||||
|
|
||||||
public AccountList() {
|
|
||||||
super();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String accountSerial(String phone_number, Address mailing_address, EmailAddress email_address) {
|
public static String accountSerial(String phone_number, Address mailing_address, EmailAddress email_address) {
|
||||||
return String.format("A%09d", Math.abs(java.util.Objects.hash(phone_number, mailing_address, email_address)));
|
return String.format("A%09d", Math.abs(java.util.Objects.hash(phone_number, mailing_address, email_address)));
|
||||||
@@ -55,10 +51,6 @@ public class AccountList extends ArrayList<Account> {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Account> getList() {
|
|
||||||
return Collections.unmodifiableList(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<? extends Reservation> getListOfReservations() {
|
public List<? extends Reservation> getListOfReservations() {
|
||||||
ArrayList<Reservation> readList = new ArrayList<>();
|
ArrayList<Reservation> readList = new ArrayList<>();
|
||||||
for (Account acct: this){
|
for (Account acct: this){
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ package lodge.reservationsystem;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
public class AccountReservationList extends ArrayList<Reservation> {
|
class AccountReservationList extends ArrayList<Reservation> {
|
||||||
|
|
||||||
private static String reservationSerial(Reservation reservation) {
|
private static String reservationSerial(Reservation reservation) {
|
||||||
return String.format("R%010d", Math.abs(java.util.Objects.hash(reservation.getPhysical_address())));
|
return String.format("R%010d", Math.abs(java.util.Objects.hash(reservation.getPhysical_address())));
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ public final class CabinReservation extends Reservation {
|
|||||||
protected CabinReservation() {
|
protected CabinReservation() {
|
||||||
setType('C');
|
setType('C');
|
||||||
this.setNumberOfBeds(1);
|
this.setNumberOfBeds(1);
|
||||||
this.setKitchen(KitchenEnum.Kitchenette);
|
this.setKitchen(KitchenTypeEnum.Kitchenette);
|
||||||
}
|
}
|
||||||
|
|
||||||
public CabinReservation(final Address physical_address) {
|
public CabinReservation(final Address physical_address) {
|
||||||
@@ -55,7 +55,7 @@ public final class CabinReservation extends Reservation {
|
|||||||
long days = ChronoUnit.DAYS.between(startdt, enddt);
|
long days = ChronoUnit.DAYS.between(startdt, enddt);
|
||||||
days = (days < 2) ? 1 : days - 1;
|
days = (days < 2) ? 1 : days - 1;
|
||||||
float calcprice = (getSquareFeet() > 900.0f) ? 120.0f + 15.0f : 120.0f;
|
float calcprice = (getSquareFeet() > 900.0f) ? 120.0f + 15.0f : 120.0f;
|
||||||
if (getKitchen() == KitchenEnum.FullKitchen) {
|
if (getKitchen() == KitchenTypeEnum.FullKitchen) {
|
||||||
calcprice = calcprice + 20.0f;
|
calcprice = calcprice + 20.0f;
|
||||||
}
|
}
|
||||||
if (getNumberOfBathRooms() > 1) {
|
if (getNumberOfBathRooms() > 1) {
|
||||||
|
|||||||
@@ -211,7 +211,7 @@ final class DataRepository {
|
|||||||
rsrv.setReservation_status(ReservationStatusEnum.valueOf(jsonReader.nextString()));
|
rsrv.setReservation_status(ReservationStatusEnum.valueOf(jsonReader.nextString()));
|
||||||
break;
|
break;
|
||||||
case "kitchen":
|
case "kitchen":
|
||||||
rsrv.setKitchen(KitchenEnum.valueOf(jsonReader.nextString()));
|
rsrv.setKitchen(KitchenTypeEnum.valueOf(jsonReader.nextString()));
|
||||||
break;
|
break;
|
||||||
case "numberOfBeds":
|
case "numberOfBeds":
|
||||||
rsrv.setNumberOfBeds(Integer.valueOf(jsonReader.nextString()));
|
rsrv.setNumberOfBeds(Integer.valueOf(jsonReader.nextString()));
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ public final class HotelReservation extends Reservation {
|
|||||||
this.setNumberOfBedRooms(1);
|
this.setNumberOfBedRooms(1);
|
||||||
this.setNumberOfBathRooms(1);
|
this.setNumberOfBathRooms(1);
|
||||||
this.setNumberOfFloors(1);
|
this.setNumberOfFloors(1);
|
||||||
this.setKitchen(KitchenEnum.Kitchenette);
|
this.setKitchen(KitchenTypeEnum.Kitchenette);
|
||||||
}
|
}
|
||||||
|
|
||||||
public HotelReservation(final Address physical_address) {
|
public HotelReservation(final Address physical_address) {
|
||||||
@@ -73,7 +73,7 @@ public final class HotelReservation extends Reservation {
|
|||||||
}
|
}
|
||||||
|
|
||||||
float calcprice = (getSquareFeet() > 900.0f) ? 120.0f + 15.0f : 120.0f;
|
float calcprice = (getSquareFeet() > 900.0f) ? 120.0f + 15.0f : 120.0f;
|
||||||
if (getKitchen() == KitchenEnum.FullKitchen) {
|
if (getKitchen() == KitchenTypeEnum.FullKitchen) {
|
||||||
calcprice = calcprice + 10.0f;
|
calcprice = calcprice + 10.0f;
|
||||||
}
|
}
|
||||||
calcprice = calcprice * days;
|
calcprice = calcprice * days;
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ public final class HouseReservation extends Reservation {
|
|||||||
this.setNumberOfBedRooms(1);
|
this.setNumberOfBedRooms(1);
|
||||||
this.setNumberOfBathRooms(1);
|
this.setNumberOfBathRooms(1);
|
||||||
this.setNumberOfFloors(1);
|
this.setNumberOfFloors(1);
|
||||||
this.setKitchen(KitchenEnum.Kitchenette);
|
this.setKitchen(KitchenTypeEnum.Kitchenette);
|
||||||
}
|
}
|
||||||
|
|
||||||
public HouseReservation(final Address physical_address) {
|
public HouseReservation(final Address physical_address) {
|
||||||
|
|||||||
@@ -4,6 +4,6 @@
|
|||||||
*/
|
*/
|
||||||
package lodge.reservationsystem;
|
package lodge.reservationsystem;
|
||||||
|
|
||||||
public enum KitchenEnum {
|
public enum KitchenTypeEnum {
|
||||||
None, Kitchenette, FullKitchen;
|
None, Kitchenette, FullKitchen;
|
||||||
}
|
}
|
||||||
@@ -22,7 +22,7 @@ public abstract class Reservation{
|
|||||||
private ZonedDateTime reservation_end_date;
|
private ZonedDateTime reservation_end_date;
|
||||||
private ReservationStatusEnum reservation_status;
|
private ReservationStatusEnum reservation_status;
|
||||||
|
|
||||||
private KitchenEnum kitchen;
|
private KitchenTypeEnum kitchen;
|
||||||
|
|
||||||
private Integer numberOfBeds;
|
private Integer numberOfBeds;
|
||||||
private Integer numberOfBedRooms;
|
private Integer numberOfBedRooms;
|
||||||
@@ -39,7 +39,7 @@ public abstract class Reservation{
|
|||||||
numberOfBedRooms = 1;
|
numberOfBedRooms = 1;
|
||||||
numberOfBathRooms = 1;
|
numberOfBathRooms = 1;
|
||||||
numberOfFloors = 1;
|
numberOfFloors = 1;
|
||||||
kitchen = KitchenEnum.None;
|
kitchen = KitchenTypeEnum.None;
|
||||||
price = 120.0f;
|
price = 120.0f;
|
||||||
reservation_status = ReservationStatusEnum.Draft;
|
reservation_status = ReservationStatusEnum.Draft;
|
||||||
mailing_address = null;
|
mailing_address = null;
|
||||||
@@ -86,11 +86,11 @@ public abstract class Reservation{
|
|||||||
this.reservation_status = reservation_status;
|
this.reservation_status = reservation_status;
|
||||||
}
|
}
|
||||||
|
|
||||||
public KitchenEnum getKitchen() {
|
public KitchenTypeEnum getKitchen() {
|
||||||
return kitchen;
|
return kitchen;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setKitchen(KitchenEnum kitchen) {
|
public void setKitchen(KitchenTypeEnum kitchen) {
|
||||||
this.kitchen = kitchen;
|
this.kitchen = kitchen;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1 +1,26 @@
|
|||||||
{ "Account":{"account_number": "A2074212339","phone_number": "301-356-3890","mailing_address": { "Address":{"street": "30 Amstadam ave","city": "New York","state": "NY","zip": "12010"}},"email_address": { "EmailAddress":{"email": "newbee952@aol.com"}},"reservation_list":[{"CabinReservation":{"reservation_number":"R2042828431"}}]}}
|
{
|
||||||
|
"Account": {
|
||||||
|
"account_number": "A2074212339",
|
||||||
|
"phone_number": "301-356-3890",
|
||||||
|
"mailing_address": {
|
||||||
|
"Address": {
|
||||||
|
"street": "30 Amstadam ave",
|
||||||
|
"city": "New York",
|
||||||
|
"state": "NY",
|
||||||
|
"zip": "12010"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"email_address": {
|
||||||
|
"EmailAddress": {
|
||||||
|
"email": "newbee952@aol.com"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"reservation_list": [
|
||||||
|
{
|
||||||
|
"CabinReservation": {
|
||||||
|
"reservation_number": "R2042828431"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1 +1,33 @@
|
|||||||
{ "HouseReservation":{"reservation_type": "HouseReservation","reservation_number": "R0499811708","reservation_status": "Completed","reservation_start_date": "2025-11-05T10:00Z[UTC]","reservation_end_date": "2025-11-15T22:00Z[UTC]","account_number": "A1450981765","physical_address": { "Address":{"street": "3000 Osage ave","city": "GreenBelt","state": "MD","zip": "20740"}},"mailing_address": { "Address":{"street": "40012 College ave","city": "College Park","state": "MD","zip": "20740"}},"kitchen": "Kitchenette","numberOfBeds": "4","numberOfBedRooms": "3","numberOfBathRooms": "1","numberOfFloors": "3","squareFeet": "1400","price": "1215.0"}}
|
{
|
||||||
|
"HouseReservation": {
|
||||||
|
"reservation_type": "HouseReservation",
|
||||||
|
"reservation_number": "R0499811708",
|
||||||
|
"reservation_status": "Completed",
|
||||||
|
"reservation_start_date": "2025-11-05T10:00Z[UTC]",
|
||||||
|
"reservation_end_date": "2025-11-15T22:00Z[UTC]",
|
||||||
|
"account_number": "A1450981765",
|
||||||
|
"physical_address": {
|
||||||
|
"Address": {
|
||||||
|
"street": "3000 Osage ave",
|
||||||
|
"city": "GreenBelt",
|
||||||
|
"state": "MD",
|
||||||
|
"zip": "20740"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"mailing_address": {
|
||||||
|
"Address": {
|
||||||
|
"street": "40012 College ave",
|
||||||
|
"city": "College Park",
|
||||||
|
"state": "MD",
|
||||||
|
"zip": "20740"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"kitchen": "Kitchenette",
|
||||||
|
"numberOfBeds": "4",
|
||||||
|
"numberOfBedRooms": "3",
|
||||||
|
"numberOfBathRooms": "1",
|
||||||
|
"numberOfFloors": "3",
|
||||||
|
"squareFeet": "1400",
|
||||||
|
"price": "1215.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user