Skip to content

Commit

Permalink
CIRC-2084 renamed storage-loan-7-2.json to storage-loan-7-3.json and …
Browse files Browse the repository at this point in the history
…changes made in LoanRepository
  • Loading branch information
SreejaMangarapu committed Jun 6, 2024
1 parent 875e9ef commit 79a2328
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -298,9 +298,12 @@ private Result<MultipleRecords<Loan>> mapResponseToLoans(Response response) {
}

private static void addIsDcbProperty(Loan loan, Item item, JsonObject storageLoan) {
write(storageLoan, IS_DCB, (nonNull(loan.getUser()) && nonNull(loan.getUser().getLastName())
&& loan.getUser().getLastName().equalsIgnoreCase(DCB_USER_LASTNAME))
|| item.isDcbItem());
write(storageLoan, IS_DCB, isDcbLoan(loan, item));
}

private static boolean isDcbLoan(Loan loan, Item item) {
return item.isDcbItem() || (nonNull(loan.getUser()) && nonNull(loan.getUser().getLastName())
&& loan.getUser().getLastName().equalsIgnoreCase(DCB_USER_LASTNAME));
}

private static JsonObject mapToStorageRepresentation(Loan loan, Item item) {
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/api/support/fakes/StorageSchema.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public static JsonSchemaValidator validatorForStorageItemSchema() throws IOExcep
}

public static JsonSchemaValidator validatorForStorageLoanSchema() throws IOException {
return JsonSchemaValidator.fromResource("/storage-loan-7-2.json");
return JsonSchemaValidator.fromResource("/storage-loan-7-3.json");
}

public static JsonSchemaValidator validatorForLocationInstSchema() throws IOException {
Expand Down
15 changes: 11 additions & 4 deletions src/test/java/api/support/fixtures/CirculationItemsFixture.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,17 @@ public IndividualResource createCirculationItem(String barcode, UUID holdingId,
return circulationItemClient.create(circulationItemsBuilder);
}

public IndividualResource createCirculationItemForDcb(String barcode, UUID holdingId, UUID locationId, String instanceTitle,boolean isDcb) {
CirculationItemsBuilder circulationItemsBuilder = new CirculationItemsBuilder().withBarcode(barcode).withHoldingId(holdingId)
.withLoanType(loanTypesFixture.canCirculate().getId()).withMaterialType(materialTypesFixture.book().getId())
.withLocationId(locationId).withInstanceTitle(instanceTitle).withDcb(isDcb);
public IndividualResource createCirculationItemForDcb(String barcode, UUID holdingId, UUID locationId,
String instanceTitle, boolean isDcb) {
CirculationItemsBuilder circulationItemsBuilder = new CirculationItemsBuilder()
.withBarcode(barcode)
.withHoldingId(holdingId)
.withLoanType(loanTypesFixture.canCirculate().getId())
.withMaterialType(materialTypesFixture.book().getId())
.withLocationId(locationId)
.withInstanceTitle(instanceTitle)
.withDcb(isDcb);

return circulationItemClient.create(circulationItemsBuilder);
}

Expand Down
File renamed without changes.

0 comments on commit 79a2328

Please sign in to comment.