Skip to content

Commit

Permalink
Make item request non-null CIRC-1416
Browse files Browse the repository at this point in the history
  • Loading branch information
marcjohnson-kint committed Jul 28, 2022
1 parent ec7a307 commit 579bef4
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
5 changes: 3 additions & 2 deletions src/main/java/org/folio/circulation/domain/Request.java
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ public class Request implements ItemRelatedRecord, UserRelatedRecord {
@With
private final Collection<Item> instanceItems;

@NonNull
private final Item item;

@With
Expand All @@ -92,15 +93,15 @@ public class Request implements ItemRelatedRecord, UserRelatedRecord {
public static Request from(JsonObject representation) {
// TODO: make sure that operation and TLR settings don't matter for all processes calling
// this constructor
return new Request(null, null, representation, null, null, new ArrayList<>(), null, null, null,
return new Request(null, null, representation, null, null, new ArrayList<>(), Item.unknown(), null, null,
null, null, null, false, null, false);
}

public static Request from(TlrSettingsConfiguration tlrSettingsConfiguration, Operation operation,
JsonObject representation) {

return new Request(tlrSettingsConfiguration, operation, representation, null, null,
new ArrayList<>(), null, null, null, null, null, null, false, null, false);
new ArrayList<>(), Item.unknown(), null, null, null, null, null, false, null, false);
}

public JsonObject asJson() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,8 @@ public boolean isTlrFeatureEnabled() {
}

public RequestAndRelatedRecords withRequest(Request newRequest) {
Item item = this.request.getItem();
return new RequestAndRelatedRecords(
newRequest.withItem(item == null ? newRequest.getItem() : item),
newRequest,
this.requestQueue,
null,
this.moveRequestRecord,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ private static Request buildRequest(int position, RequestStatus status, String r
.put("status", status.getValue())
.put("position", position);

return new Request(null, null, json, null, null, null, null, null, null, null, null, null, false, null, false);
return new Request(null, null, json, null, null, null, Item.unknown(),
null, null, null, null, null, false, null, false);
}

private static String randomId() {
Expand Down

0 comments on commit 579bef4

Please sign in to comment.