Remove allFieldsLocked field
This commit is contained in:
committed by
Aditya Chandel
parent
7d5829bd7f
commit
b15e1dc642
@@ -44,7 +44,6 @@ public class BookMetadata {
|
||||
private String providerBookId;
|
||||
private String thumbnailUrl;
|
||||
|
||||
private Boolean allFieldsLocked;
|
||||
private Boolean titleLocked;
|
||||
private Boolean subtitleLocked;
|
||||
private Boolean publisherLocked;
|
||||
|
||||
+50
-3
@@ -82,8 +82,6 @@ public class BookMetadataEntity {
|
||||
private Integer goodreadsReviewCount;
|
||||
|
||||
// Locking fields
|
||||
@Column(name = "all_fields_locked")
|
||||
private Boolean allFieldsLocked = Boolean.FALSE;
|
||||
|
||||
@Column(name = "title_locked")
|
||||
private Boolean titleLocked = Boolean.FALSE;
|
||||
@@ -176,7 +174,6 @@ public class BookMetadataEntity {
|
||||
private List<BookAwardEntity> awards;
|
||||
|
||||
public void applyLockToAllFields(boolean lock) {
|
||||
this.allFieldsLocked = lock;
|
||||
this.titleLocked = lock;
|
||||
this.subtitleLocked = lock;
|
||||
this.publisherLocked = lock;
|
||||
@@ -200,4 +197,54 @@ public class BookMetadataEntity {
|
||||
this.goodreadsRatingLocked = lock;
|
||||
this.goodreadsReviewCountLocked = 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.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);
|
||||
}
|
||||
|
||||
public boolean areAllFieldsLocked() {
|
||||
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.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);
|
||||
}
|
||||
}
|
||||
+2
-3
@@ -106,9 +106,8 @@ public class BookMetadataService {
|
||||
List<BookEntity> books = getBookEntities(request);
|
||||
for (BookEntity bookEntity : books) {
|
||||
try {
|
||||
Boolean allFieldsLocked = bookEntity.getMetadata().getAllFieldsLocked();
|
||||
if (Boolean.TRUE.equals(allFieldsLocked)) {
|
||||
log.info("Skipping metadata refresh for locked book: {}", bookEntity.getFileName());
|
||||
if (bookEntity.getMetadata().areAllFieldsLocked()) {
|
||||
log.info("Skipping metadata refresh for fully locked book: {}", bookEntity.getFileName());
|
||||
continue;
|
||||
}
|
||||
Map<MetadataProvider, BookMetadata> metadataMap = fetchMetadataForBook(providers, bookEntity);
|
||||
|
||||
+1
-4
@@ -39,7 +39,7 @@ public class BookMetadataUpdater {
|
||||
|
||||
updateLocks(newMetadata, metadata);
|
||||
|
||||
if (Boolean.TRUE.equals(metadata.getAllFieldsLocked())) {
|
||||
if (metadata.areAllFieldsLocked()) {
|
||||
log.warn("Attempted to update metadata for book with ID {}, but all fields are locked. No update performed.", bookId);
|
||||
return metadata;
|
||||
}
|
||||
@@ -252,9 +252,6 @@ public class BookMetadataUpdater {
|
||||
if (newMetadata.getCoverLocked() != null) {
|
||||
metadata.setCoverLocked(newMetadata.getCoverLocked());
|
||||
}
|
||||
if (newMetadata.getAllFieldsLocked() != null) {
|
||||
metadata.setAllFieldsLocked(newMetadata.getAllFieldsLocked());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user