From b6e9a73cf96d8f9df2652fba85d28cf484cc6096 Mon Sep 17 00:00:00 2001 From: "aditya.chandel" <> Date: Thu, 29 May 2025 21:53:17 -0600 Subject: [PATCH] Display notification long when metadata refresh is attempted on a locked book --- .../model/entity/BookMetadataEntity.java | 31 ------------------- .../booklore/service/BookMetadataService.java | 1 + 2 files changed, 1 insertion(+), 31 deletions(-) diff --git a/booklore-api/src/main/java/com/adityachandel/booklore/model/entity/BookMetadataEntity.java b/booklore-api/src/main/java/com/adityachandel/booklore/model/entity/BookMetadataEntity.java index f1435e433..631943d60 100644 --- a/booklore-api/src/main/java/com/adityachandel/booklore/model/entity/BookMetadataEntity.java +++ b/booklore-api/src/main/java/com/adityachandel/booklore/model/entity/BookMetadataEntity.java @@ -219,34 +219,6 @@ public class BookMetadataEntity { this.hardcoverReviewCountLocked = lock; } - public boolean isAnyFieldLocked() { - return Boolean.TRUE.equals(this.titleLocked) - || Boolean.TRUE.equals(this.subtitleLocked) - || Boolean.TRUE.equals(this.publisherLocked) - || Boolean.TRUE.equals(this.publishedDateLocked) - || Boolean.TRUE.equals(this.descriptionLocked) - || Boolean.TRUE.equals(this.isbn13Locked) - || Boolean.TRUE.equals(this.isbn10Locked) - || Boolean.TRUE.equals(this.asinLocked) - || Boolean.TRUE.equals(this.pageCountLocked) - || Boolean.TRUE.equals(this.thumbnailLocked) - || Boolean.TRUE.equals(this.languageLocked) - || Boolean.TRUE.equals(this.ratingLocked) - || Boolean.TRUE.equals(this.reviewCountLocked) - || Boolean.TRUE.equals(this.coverLocked) - || Boolean.TRUE.equals(this.seriesNameLocked) - || Boolean.TRUE.equals(this.seriesNumberLocked) - || Boolean.TRUE.equals(this.seriesTotalLocked) - || Boolean.TRUE.equals(this.authorsLocked) - || Boolean.TRUE.equals(this.categoriesLocked) - || Boolean.TRUE.equals(this.amazonRatingLocked) - || Boolean.TRUE.equals(this.amazonReviewCountLocked) - || Boolean.TRUE.equals(this.goodreadsRatingLocked) - || Boolean.TRUE.equals(this.goodreadsReviewCountLocked) - || Boolean.TRUE.equals(this.hardcoverRatingLocked) - || Boolean.TRUE.equals(this.hardcoverReviewCountLocked); - } - public boolean areAllFieldsLocked() { return Boolean.TRUE.equals(this.titleLocked) && Boolean.TRUE.equals(this.subtitleLocked) @@ -257,10 +229,7 @@ public class BookMetadataEntity { && Boolean.TRUE.equals(this.isbn10Locked) && Boolean.TRUE.equals(this.asinLocked) && Boolean.TRUE.equals(this.pageCountLocked) - && Boolean.TRUE.equals(this.thumbnailLocked) && Boolean.TRUE.equals(this.languageLocked) - && Boolean.TRUE.equals(this.ratingLocked) - && Boolean.TRUE.equals(this.reviewCountLocked) && Boolean.TRUE.equals(this.coverLocked) && Boolean.TRUE.equals(this.seriesNameLocked) && Boolean.TRUE.equals(this.seriesNumberLocked) diff --git a/booklore-api/src/main/java/com/adityachandel/booklore/service/BookMetadataService.java b/booklore-api/src/main/java/com/adityachandel/booklore/service/BookMetadataService.java index 79af47352..9dbfb03c2 100644 --- a/booklore-api/src/main/java/com/adityachandel/booklore/service/BookMetadataService.java +++ b/booklore-api/src/main/java/com/adityachandel/booklore/service/BookMetadataService.java @@ -111,6 +111,7 @@ public class BookMetadataService { try { if (bookEntity.getMetadata().areAllFieldsLocked()) { log.info("Skipping metadata refresh for fully locked book: {}", bookEntity.getFileName()); + notificationService.sendMessage(Topic.LOG, createLogNotification("Book '" + bookEntity.getMetadata().getTitle() + "' is locked. Please unlock it before updating metadata.")); continue; } Map metadataMap = fetchMetadataForBook(providers, bookEntity);