Skip to content
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

MODBULKOPS-383 - 404 Not Found error (instead of optimistic locking error) on Confirmation screen when bulk edit Items via Central tenant #300

Merged
merged 8 commits into from
Nov 11, 2024

Conversation

alekGbuz
Copy link
Contributor

@alekGbuz alekGbuz commented Nov 5, 2024

MODBULKOPS-383 - 404 Not Found error (instead of optimistic locking error) on Confirmation screen when bulk edit Items via Central tenant

Purpose

Approach

Add tenant initialization of item entity to retrieve holding from correct tenant

TODOS and Open Questions

Learning

Pre-Merge Checklist:

Before merging this PR, please go through the following list and take appropriate actions.

  • Does this PR meet or exceed the expected quality standards?
    • Code coverage on new code is 80% or greater
    • Duplications on new code is 3% or less
    • There are no major code smells or security issues
  • Does this introduce breaking changes?
    • Were any API paths or methods changed, added or removed?
    • Were there any schema changes?
    • Did any of the interface versions change?
    • Were permissions changed, added, or removed?
    • Are there new interface dependencies?
    • There are no breaking changes in this PR.

If there are breaking changes, please STOP and consider the following:

  • What other modules will these changes impact?
  • Do JIRAs exist to update the impacted modules?
    • If not, please create them
    • Do they contain the appropriate level of detail? Which endpoints/schemas changed, etc.
    • Do they have all they appropriate links to blocked/related issues?
  • Are the JIRAs under active development?
    • If not, contact the project's PO and make sure they're aware of the urgency.
  • Do PRs exist for these changes?
    • If so, have they been approved?

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.

@alekGbuz alekGbuz self-assigned this Nov 5, 2024
@alekGbuz alekGbuz requested a review from a team November 5, 2024 09:20
return format("/inventory/view/%s/%s/%s", instanceId, holdingId, item.getId());
try (var ignored = new FolioExecutionContextSetter(prepareContextForTenant(tenantIdOfEntity, folioModuleMetadata, folioExecutionContext))) {
var holding = holdingsClient.getHoldingById(holdingId);
var instanceId = holding.getInstanceId();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please keep only the holdingsClient invocation inside the try-with-resources block? This will be logically correct and help avoid potential issues in the future. The purpose of this try-with-resources block is to switch the tenant only for the client invocation and then revert it to the original tenant after the block completes.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated, thanks


public String resolve(EntityType type, BulkOperationsEntity entity) {

public String resolve(EntityType type, BulkOperationsEntity original) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What was the purpose of renaming the variable entity to original? This utility method should be applied not only to the original entity but potentially to any entity whose type needs to be determined.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From one side for item in ecs environment for inventory link resolving it is necessary to know tenant, the tenant is populated in original json files. The other side previous code is used this method for original entities only.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, return name of parameter original to entity. This generic method can be used not only for original entity - this can be confusing.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated

@alekGbuz
Copy link
Contributor Author

hi @khandramai , please take a look.

Copy link

sonarcloud bot commented Nov 11, 2024

@alekGbuz alekGbuz merged commit 54cf499 into master Nov 11, 2024
6 checks passed
@alekGbuz alekGbuz deleted the MODBULKOPS-383 branch November 11, 2024 11:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants