-
Notifications
You must be signed in to change notification settings - Fork 3
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
[MODCON - 65] - Implement endpoint to save shared setting uuid in all tenants #69
Conversation
src/main/java/org/folio/consortia/controller/SharingSettingController.java
Outdated
Show resolved
Hide resolved
src/main/java/org/folio/consortia/controller/SharingSettingController.java
Outdated
Show resolved
Hide resolved
src/main/java/org/folio/consortia/domain/entity/SharingSettingEntity.java
Outdated
Show resolved
Hide resolved
src/main/java/org/folio/consortia/service/impl/SharingSettingServiceImpl.java
Outdated
Show resolved
Hide resolved
src/main/java/org/folio/consortia/service/impl/SharingSettingServiceImpl.java
Outdated
Show resolved
Hide resolved
src/main/java/org/folio/consortia/service/impl/SharingSettingServiceImpl.java
Outdated
Show resolved
Hide resolved
src/main/java/org/folio/consortia/service/impl/SharingSettingServiceImpl.java
Outdated
Show resolved
Hide resolved
src/test/java/org/folio/consortia/service/SharingSettingServiceTest.java
Show resolved
Hide resolved
src/main/java/org/folio/consortia/service/impl/SharingSettingServiceImpl.java
Outdated
Show resolved
Hide resolved
@@ -80,8 +77,7 @@ public SharingInstance start(UUID consortiumId, SharingInstance sharingInstance) | |||
} | |||
|
|||
try (var context = new FolioExecutionContextSetter(prepareContextForTenant(targetTenantId, folioModuleMetadata, folioExecutionContext))) { | |||
String source = FOLIO_SOURCE_VALUE.equalsIgnoreCase(inventoryInstance.get("source").asText()) ? CONSORTIUM_FOLIO : CONSORTIUM_MARK; |
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.
I am not sure if it still stands but it should be CONSORTIUM_MARC not CONSORTIUM_MARK.
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.
fixed
public class HelperUtils { | ||
|
||
private static final String FOLIO_SOURCE_VALUE = "folio"; | ||
private static final String CONSORTIUM_FOLIO = "CONSORTIUM-FOLIO"; | ||
private static final String CONSORTIUM_MARK = "CONSORTIUM-MARC"; |
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.
Change this to CONSORTIUM_MARC
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.
Changed
@@ -17,4 +25,9 @@ public static String randomString(Integer noOfString) { | |||
RandomStringGenerator generator = new RandomStringGenerator.Builder().withinRange('a', 'z').build(); | |||
return generator.generate(noOfString); | |||
} | |||
|
|||
public static ObjectNode setSourceAsConsortium(JsonNode payload) { | |||
String source = FOLIO_SOURCE_VALUE.equalsIgnoreCase(payload.get("source").asText()) ? CONSORTIUM_FOLIO: CONSORTIUM_MARK; |
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.
I think we should be more explicit here to map folio -> CONSORTIUM-FOLIO and marc -> CONSORTIUM-MARC. if other source values are introduced in the future, it would default to CONSORTIUM-MARC and that wont be ideal. Probably should return an error if we find a source value that is not recognized.
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.
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.
-
The screenshot looks incorrect to me because it is saying if source = CONSORTIUM_FOLIO, set source to CONSORTIUM_FOLIO. But the words are what I expect.
-
I was not aware that this was the case. it was my impression that we would save "consortium" instead of "consortium-folio" for settings. I was thinking about my initial comment in the instance context instead of settings.
Generally, what I am looking for is that CONSORTIUM-MARC is not the default output when source does not match CONSORTIUM-FOLIO.
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.
Yes agree, @azizbekxm for instances if source = "folio" - result should be "CONSORTIUM_FOLIO", if source = "marc" - result should be "CONSORTIUM_MARC" or exception should be thrown
For Settings it always should be "consortium"
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.
@okolawole-ebsco maybe we can use lower case as "consortium_folio" or "consortium_marc" to make it consistent?
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.
@azizbekxm handling such situation using flag isSetting is not approprtiate here, you can leave constants in utility class and move business logic to appropriate services
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.
Fixed big thanks
src/main/java/org/folio/consortia/service/impl/SharingInstanceServiceImpl.java
Outdated
Show resolved
Hide resolved
src/main/java/org/folio/consortia/service/impl/SharingSettingServiceImpl.java
Outdated
Show resolved
Hide resolved
log.info("start:: The Sharing Settings for settingId '{}' and '{}' unique tenant(s) were successfully saved to the database", | ||
sharingSettingRequest.getSettingId(), publicationPostRequest.getTenants().size()); | ||
|
||
ObjectMapper objectMapper = new 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.
this should be a class field
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.
Moved to class field
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.
This field exists in application context, so can be injected
Kudos, SonarCloud Quality Gate passed! |
Purpose
https://issues.folio.org/browse/MODCON-65
Approach
I will implement
based on this diagram
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 the PRs involved in breaking changes would be merged on the same day
to avoid breaking the folio-testing environment.
Communication is paramount if that is to be achieved,
especially as the number of inter-module 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.