use of org.folio.circulation.domain.User in project mod-circulation by folio-org.
the class CirculationCheckInCheckOutLogEventMapper method mapToCheckInLogEventContent.
/**
* This method returns {@link String} content for check-in log event payload
* @param checkInContext check-in flow context {@link CheckInContext}
* @return check-in log event payload
*/
public static String mapToCheckInLogEventContent(CheckInContext checkInContext, User loggedInUser) {
JsonObject logEventPayload = new JsonObject();
write(logEventPayload, LOG_EVENT_TYPE.value(), CHECK_IN.value());
write(logEventPayload, SERVICE_POINT_ID.value(), checkInContext.getCheckInServicePointId());
populateLoanData(checkInContext, logEventPayload);
populateItemData(checkInContext, logEventPayload, loggedInUser);
ofNullable(checkInContext.getCheckInRequest()).flatMap(checkInRequest -> ofNullable(checkInRequest.getClaimedReturnedResolution())).ifPresent(resolution -> write(logEventPayload, CLAIMED_RETURNED_RESOLUTION.value(), resolution.getValue()));
write(logEventPayload, REQUESTS.value(), getUpdatedRequests(checkInContext));
return logEventPayload.encode();
}
use of org.folio.circulation.domain.User in project mod-circulation by folio-org.
the class LoanLogContext method userFromRepresentation.
private static User userFromRepresentation(Loan loan) {
JsonObject userJson = new JsonObject();
ofNullable(loan).ifPresent(l -> write(userJson, "id", l.getUserId()));
return new User(userJson);
}
use of org.folio.circulation.domain.User in project mod-circulation by folio-org.
the class RequestNoticeSender method sendRequestAwaitingPickupNotice.
private CompletableFuture<Result<Void>> sendRequestAwaitingPickupNotice(Request request) {
Item item = request.getItem();
User user = request.getRequester();
PatronNoticeEvent noticeEvent = new PatronNoticeEventBuilder().withItem(item).withUser(user).withEventType(NoticeEventType.AVAILABLE).withNoticeContext(createRequestNoticeContext(request)).withNoticeLogContext(NoticeLogContext.from(request)).build();
return patronNoticeService.acceptNoticeEvent(noticeEvent);
}
Aggregations