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