Search in sources :

Example 1 with PatronNotice

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

the class TitleLevelRequestNoticeSender method applyTlrCancellationNotice.

private CompletableFuture<Result<Void>> applyTlrCancellationNotice(TlrSettingsConfiguration tlrSettings, PatronNoticeEvent patronNoticeEvent) {
    UUID cancellationTemplateId = tlrSettings.getCancellationPatronNoticeTemplateId();
    if (cancellationTemplateId != null) {
        NoticeLogContext noticeLogContext = new NoticeLogContext().withTriggeringEvent(patronNoticeEvent.getEventType().getRepresentation()).withTemplateId(cancellationTemplateId.toString());
        NoticeConfiguration noticeConfiguration = buildTlrNoticeConfiguration(patronNoticeEvent, cancellationTemplateId);
        PatronNotice patronNotice = new PatronNotice(patronNoticeEvent.getUser().getId(), patronNoticeEvent.getNoticeContext(), noticeConfiguration);
        return patronNoticeService.sendNotice(patronNotice, noticeLogContext);
    }
    return ofAsync(() -> null);
}
Also used : NoticeLogContext(org.folio.circulation.domain.representations.logs.NoticeLogContext) NoticeConfiguration(org.folio.circulation.domain.notice.NoticeConfiguration) UUID(java.util.UUID) PatronNotice(org.folio.circulation.domain.notice.PatronNotice)

Example 2 with PatronNotice

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

the class TitleLevelRequestNoticeSender method applyTlrConfirmationNotice.

private CompletableFuture<Result<Void>> applyTlrConfirmationNotice(TlrSettingsConfiguration tlrSettings, PatronNoticeEvent patronNoticeEvent) {
    UUID confirmationTemplateId = tlrSettings.getConfirmationPatronNoticeTemplateId();
    if (confirmationTemplateId != null) {
        NoticeLogContext noticeLogContext = new NoticeLogContext().withTriggeringEvent(patronNoticeEvent.getEventType().getRepresentation()).withTemplateId(confirmationTemplateId.toString());
        NoticeConfiguration noticeConfiguration = buildTlrNoticeConfiguration(patronNoticeEvent, confirmationTemplateId);
        PatronNotice patronNotice = new PatronNotice(patronNoticeEvent.getUser().getId(), patronNoticeEvent.getNoticeContext(), noticeConfiguration);
        return patronNoticeService.sendNotice(patronNotice, noticeLogContext);
    }
    return ofAsync(() -> null);
}
Also used : NoticeLogContext(org.folio.circulation.domain.representations.logs.NoticeLogContext) NoticeConfiguration(org.folio.circulation.domain.notice.NoticeConfiguration) UUID(java.util.UUID) PatronNotice(org.folio.circulation.domain.notice.PatronNotice)

Aggregations

UUID (java.util.UUID)2 NoticeConfiguration (org.folio.circulation.domain.notice.NoticeConfiguration)2 PatronNotice (org.folio.circulation.domain.notice.PatronNotice)2 NoticeLogContext (org.folio.circulation.domain.representations.logs.NoticeLogContext)2