Search in sources :

Example 1 with NoticeEventType

use of org.folio.circulation.domain.notice.NoticeEventType in project mod-circulation by folio-org.

the class ItemLevelRequestNoticeSender method sendNoticeOnRequestCreated.

@Override
public Result<RequestAndRelatedRecords> sendNoticeOnRequestCreated(RequestAndRelatedRecords relatedRecords) {
    Request request = relatedRecords.getRequest();
    Item item = request.getItem();
    NoticeEventType eventType = requestTypeToEventMap.getOrDefault(request.getRequestType(), NoticeEventType.UNKNOWN);
    PatronNoticeEvent requestCreatedEvent = createPatronNoticeEvent(request, eventType).withItem(item);
    patronNoticeService.acceptNoticeEvent(requestCreatedEvent);
    Loan loan = request.getLoan();
    if (request.getRequestType() == RequestType.RECALL && loan != null) {
        sendNoticeOnItemRecalledEvent(loan);
        sendLogEvent(loan);
    }
    return Result.succeeded(relatedRecords);
}
Also used : Item(org.folio.circulation.domain.Item) NoticeEventType(org.folio.circulation.domain.notice.NoticeEventType) Loan(org.folio.circulation.domain.Loan) Request(org.folio.circulation.domain.Request) PatronNoticeEvent(org.folio.circulation.domain.notice.PatronNoticeEvent)

Example 2 with NoticeEventType

use of org.folio.circulation.domain.notice.NoticeEventType in project mod-circulation by folio-org.

the class TitleLevelRequestNoticeSender method sendNoticeOnRequestCreated.

@Override
public Result<RequestAndRelatedRecords> sendNoticeOnRequestCreated(RequestAndRelatedRecords relatedRecords) {
    Request request = relatedRecords.getRequest();
    TlrSettingsConfiguration tlrSettings = request.getTlrSettingsConfiguration();
    NoticeEventType eventType = requestTypeToEventMap.getOrDefault(request.getRequestType(), NoticeEventType.UNKNOWN);
    if (tlrSettings.isTitleLevelRequestsFeatureEnabled() && tlrSettings.getConfirmationPatronNoticeTemplateId() != null) {
        PatronNoticeEvent requestCreatedEvent = createPatronNoticeEvent(request, eventType);
        applyTlrConfirmationNotice(request.getTlrSettingsConfiguration(), requestCreatedEvent);
    }
    return Result.succeeded(relatedRecords);
}
Also used : NoticeEventType(org.folio.circulation.domain.notice.NoticeEventType) Request(org.folio.circulation.domain.Request) TlrSettingsConfiguration(org.folio.circulation.domain.configuration.TlrSettingsConfiguration) PatronNoticeEvent(org.folio.circulation.domain.notice.PatronNoticeEvent)

Aggregations

Request (org.folio.circulation.domain.Request)2 NoticeEventType (org.folio.circulation.domain.notice.NoticeEventType)2 PatronNoticeEvent (org.folio.circulation.domain.notice.PatronNoticeEvent)2 Item (org.folio.circulation.domain.Item)1 Loan (org.folio.circulation.domain.Loan)1 TlrSettingsConfiguration (org.folio.circulation.domain.configuration.TlrSettingsConfiguration)1