Skip to content

Commit

Permalink
[EDGEPATRON-141]-Removed Address0
Browse files Browse the repository at this point in the history
  • Loading branch information
SinghAdes committed Jul 9, 2024
1 parent 520a349 commit 578ebc1
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 67 deletions.
10 changes: 1 addition & 9 deletions ramls/examples/external_patron.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,7 @@
"middleName": "M",
"lastName": "Doe"
},
"address0": {
"addressLine0": "123 Main St",
"addressLine1": "Apt 4B",
"city": "Metropolis",
"province": "NY",
"zip": "12345",
"country": "USA"
},
"address1": {
"address": {
"addressLine0": "456 Side St",
"addressLine1": "Suite 500",
"city": "Metropolis",
Expand Down
4 changes: 2 additions & 2 deletions ramls/examples/external_patron_collection.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"middleName": "Michael",
"lastName": "Doe"
},
"address0": {
"address": {
"addressLine0": "123 Main St",
"addressLine1": "",
"city": "Anytown",
Expand All @@ -30,7 +30,7 @@
"preferredFirstName": "Janey",
"lastName": "Smith"
},
"address0": {
"address": {
"addressLine0": "456 Oak Ave",
"addressLine1": "Apt 2B",
"city": "Smallville",
Expand Down
39 changes: 3 additions & 36 deletions ramls/external_patron.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,39 +32,7 @@
"required": ["externalSystemId", "firstName", "lastName"],
"additionalProperties": false
},
"address0": {
"type": "object",
"description": "Primary address info of patron",
"properties": {
"addressLine0": {
"type": "string",
"description": "Address, Line 0"
},
"addressLine1": {
"type": "string",
"description": "Address, Line 1"
},
"city": {
"type": "string",
"description": "City name"
},
"province": {
"type": "string",
"description": "Province"
},
"zip": {
"type": "string",
"description": "Zip Code"
},
"country": {
"type": "string",
"description": "Country"
}
},
"required": ["addressLine0", "city", "province", "zip", "country"],
"additionalProperties": false
},
"address1": {
"address": {
"type": "object",
"description": "Secondary address info of patron",
"properties": {
Expand Down Expand Up @@ -126,10 +94,9 @@
},
"minItems": 1,
"maxItems": 3,
"uniqueItems": true,
"description": "Preferred email communication types"
"uniqueItems": true
}
},
"required": ["generalInfo", "address0", "contactInfo", "preferredEmailCommunication"],
"required": ["generalInfo", "address", "contactInfo"],
"additionalProperties": false
}
25 changes: 7 additions & 18 deletions src/main/java/org/folio/edge/patron/model/Patron.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,22 +18,19 @@
@JsonDeserialize(builder = Patron.Builder.class)
@JsonPropertyOrder({
"generalInfo",
"address0",
"address1",
"address",
"contactInfo",
"preferredEmailCommunication"
})
public final class Patron {
public final GeneralInfo generalInfo;
public final Address address0;
public final Address address1;
public final Address address;
public final ContactInfo contactInfo;
public final List<String> preferredEmailCommunication;

private Patron(Builder builder) {
this.generalInfo = builder.generalInfo;
this.address0 = builder.address0;
this.address1 = builder.address1;
this.address = builder.address;
this.contactInfo = builder.contactInfo;
this.preferredEmailCommunication = builder.preferredEmailCommunication;
}
Expand All @@ -46,11 +43,8 @@ public static class Builder {
@JsonProperty("generalInfo")
private GeneralInfo generalInfo;

@JsonProperty("address0")
private Address address0;

@JsonProperty("address1")
private Address address1;
@JsonProperty("address")
private Address address;

@JsonProperty("contactInfo")
private ContactInfo contactInfo;
Expand All @@ -63,13 +57,8 @@ public Builder generalInfo(GeneralInfo generalInfo) {
return this;
}

public Builder address0(Address address0) {
this.address0 = address0;
return this;
}

public Builder address1(Address address1) {
this.address1 = address1;
public Builder address(Address address) {
this.address = address;
return this;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -661,8 +661,7 @@ public static Hold getHold(String itemId, Date holdReqDate) {

public static Patron getPatron() {
return Patron.builder()
.address0(new Patron.Address("fdsf","sds", "fsd", "dasd", "123", "sdsd"))
.address1(new Patron.Address("fdsf","sds", "fsd", "dasd", "123", "sdsd"))
.address(new Patron.Address("fdsf","sds", "fsd", "dasd", "123", "sdsd"))
.contactInfo(new Patron.ContactInfo("342424","232321","fgh@mail"))
.generalInfo(new Patron.GeneralInfo("1234","sds","a","s", "45"))
.preferredEmailCommunication(new ArrayList<>())
Expand Down

0 comments on commit 578ebc1

Please sign in to comment.