-
Notifications
You must be signed in to change notification settings - Fork 5
MODBULKOPS-337 - Stage 3b - FQM Performance (FQL): switching matched records flow to use mod-bulk-operations capabilities #423
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
var jsonb = json.get(getContentJsonKey(entityType)); | ||
try { | ||
ObjectNode extendedRecordWrapper = objectMapper.createObjectNode(); | ||
extendedRecordWrapper.set("entity", objectMapper.readTree(jsonb.toString())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Strings can be used as constants.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
log.error("Error processing JSON content for entity type {}: {}", entityType, e.getMessage()); | ||
throw new FqmFetcherException("Error processing JSON content", e); | ||
} | ||
}).collect(Collectors.joining("\n")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'\n' new line separator is already introduced as constant (or it makes sense to introduce such constant).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
|
||
private String getContentTenantKey(EntityType entityType) { | ||
return switch(entityType) { | ||
case USER -> null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe empty string will be safer then null?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added.
import org.springframework.web.bind.annotation.RequestParam; | ||
|
||
@FeignClient(name = "material-types", configuration = FeignClientConfiguration.class) | ||
public interface MaterialTypeClient { | ||
|
||
@GetMapping(produces = MediaType.APPLICATION_JSON_VALUE) | ||
MaterialTypeCollection getByQuery(@RequestParam String query); | ||
|
||
@GetMapping(value = "/{id}", produces = MediaType.APPLICATION_JSON_VALUE) | ||
MaterialType getById(@PathVariable String id); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we use here UUID type instead of String?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably yes, but in all other clients related to reference data we use String.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's stay as is.
|
||
@Override | ||
public LoanType convertToObject(String value) { | ||
return ItemReferenceHelper.service().getLoanTypeByName(value); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TBC - Looks, there is no flow to restore LoanType from csv representation to object. Why do we need this method?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed.
public class LoanTypeDeserializer extends JsonDeserializer<LoanType> { | ||
@Override | ||
public LoanType deserialize(JsonParser p, DeserializationContext ctxt) throws IOException { | ||
System.out.println("Deserializing LoanType from JSON"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Logging should be used here instead of sout (if applicable).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LoanTypeDeserializer is not needed, removed.
import com.fasterxml.jackson.databind.JsonDeserializer; | ||
import org.folio.bulkops.domain.bean.LoanType; | ||
|
||
public class LoanTypeDeserializer extends JsonDeserializer<LoanType> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Renaming for code readability: JsonParser p -> JsonParser parser.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LoanTypeDeserializer is not needed, removed.
@@ -26,6 +26,7 @@ public class ItemUpdateProcessor extends FolioAbstractUpdateProcessor<ExtendedIt | |||
private final FolioExecutionContext folioExecutionContext; | |||
private final ConsortiaService consortiaService; | |||
private final PermissionsValidator permissionsValidator; | |||
private final ObjectMapper objectMapper; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it used?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed.
@@ -40,7 +41,7 @@ public void updateRecord(ExtendedItem extendedItem) { | |||
} else { | |||
permissionsValidator.checkIfBulkEditWritePermissionExists(folioExecutionContext.getTenantId(), EntityType.ITEM, | |||
NO_ITEM_WRITE_PERMISSIONS_TEMPLATE + folioExecutionContext.getTenantId()); | |||
itemClient.updateItem(item.withHoldingsData(null), item.getId()); | |||
itemClient.updateItem(item.withHoldingsData(null), item.getId()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inline: roll-back format.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
@@ -142,7 +142,7 @@ void testClearItemLocationAndLoanType() { | |||
.withHoldingsRecordId(holdingsId) | |||
.withPermanentLocation(new ItemLocation().withId(UUID.randomUUID().toString()).withName("Permanent location")) | |||
.withTemporaryLocation(new ItemLocation().withId(UUID.randomUUID().toString()).withName("Temporary location")) | |||
.withPermanentLoanType(new LoanType().withId(UUID.randomUUID().toString()).withName("Permanent loan type")); | |||
.withPermanentLoanType(new LoanType().withId(UUID.randomUUID().toString()).withName("Permanent loan type")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inline: roll-back format.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
@@ -174,7 +174,7 @@ void testUpdateItemAndLoanTypeLocation() { | |||
var item = new Item() | |||
.withPermanentLocation(new ItemLocation().withId(UUID.randomUUID().toString()).withName("Permanent location")) | |||
.withTemporaryLocation(new ItemLocation().withId(UUID.randomUUID().toString()).withName("Temporary location")) | |||
.withPermanentLoanType(new LoanType().withId(UUID.randomUUID().toString()).withName("Permanent loan type")) | |||
.withPermanentLoanType(new LoanType().withId(UUID.randomUUID().toString()).withName("Permanent loan type")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inline: roll-back format.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
|
MODBULKOPS-337 - Stage 3b - FQM Performance (FQL): switching matched records flow to use mod-bulk-operations capabilities
Purpose
Fix bug with JSON from FQM.
Approach
Use getters/setters for json properties, JsonIgnore for objects which are absent in FQM response.
TODOS and Open Questions
Learning
Pre-Merge Checklist:
Before merging this PR, please go through the following list and take appropriate actions.
If there are breaking changes, please STOP and consider the following:
Ideally all of the PRs involved in breaking changes would be merged in the same day to avoid breaking the folio-testing environment. Communication is paramount if that is to be achieved, especially as the number of intermodule and inter-team dependencies increase.
While it's helpful for reviewers to help identify potential problems, ensuring that it's safe to merge is ultimately the responsibility of the PR assignee.