-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
FINERACT-1760: savings account externalId support #3411
FINERACT-1760: savings account externalId support #3411
Conversation
...der/src/main/java/org/apache/fineract/portfolio/savings/domain/SavingsAccountRepository.java
Outdated
Show resolved
Hide resolved
integration-tests/src/test/java/org/apache/fineract/integrationtests/SavingsAccountsTest.java
Outdated
Show resolved
Hide resolved
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.
Please kindly see my comments!
899e0a6
to
a56658b
Compare
Thanks for your review @adamsaghy, I fixed the PR according to your comments. Can you please review it again? |
SavingsAccount findByExternalId(String externalId); | ||
SavingsAccount findByExternalId(ExternalId externalId); | ||
|
||
@Query("SELECT sa.id FROM SavingsAccount sa WHERE sa.externalId = :externalId") |
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 method would work without the @Query
annotation as well! ;)
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, nice catch, thanks!
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.
LGTM
@abraham-menyhart Run './gradlew :integration-tests:spotlessApply' to fix these violations. |
0e8ab52
to
15fc04a
Compare
...ider/src/main/java/org/apache/fineract/portfolio/savings/domain/DepositAccountAssembler.java
Outdated
Show resolved
Hide resolved
...ider/src/main/java/org/apache/fineract/portfolio/savings/domain/DepositAccountAssembler.java
Outdated
Show resolved
Hide resolved
final String newValue = command.stringValueOfParameterNamed(SavingsApiConstants.externalIdParamName); | ||
actualChanges.put(SavingsApiConstants.externalIdParamName, newValue); | ||
this.externalId = StringUtils.defaultIfEmpty(newValue, null); | ||
this.externalId = ExternalIdFactory.produce(newValue); |
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.
Here we should generate one if nothing was provided: ExternalIdFactory.create(...)
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.
Since it is an Entity class, and the create method is not static, I should pass the ExternalIdFactory
dependency as a method parameter, etc. So it won't be very pretty I think. Is it a business requirement? In the other cases, I'll implement your change request, only this case I'm a bit hesitant.
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.
Till this logic is not extracted out from the entity you might wanna use this:
ExternalId externalId = ExternalIdFactory.produce(newValue);
if (externalId.isEmpty() && TemporaryConfigurationServiceContainer.isExternalIdAutoGenerationEnabled()) {
externalId = ExternalId.generate();
}
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.
Thanks! Updated the PR according to this.
...ider/src/main/java/org/apache/fineract/portfolio/savings/domain/SavingsAccountAssembler.java
Outdated
Show resolved
Hide resolved
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.
Please see my comments!
15fc04a
to
1600795
Compare
1600795
to
73c62a7
Compare
Description
Describe the changes made and why they were made.
Ignore if these details are present on the associated Apache Fineract JIRA ticket.
Checklist
Please make sure these boxes are checked before submitting your pull request - thanks!
Write the commit message as per https://github.com/apache/fineract/#pull-requests
Acknowledge that we will not review PRs that are not passing the build ("green") - it is your responsibility to get a proposed PR to pass the build, not primarily the project's maintainers.
Create/update unit or integration tests for verifying the changes made.
Follow coding conventions at https://cwiki.apache.org/confluence/display/FINERACT/Coding+Conventions.
Add required Swagger annotation and update API documentation at fineract-provider/src/main/resources/static/legacy-docs/apiLive.htm with details of any API changes
Submission is not a "code dump". (Large changes can be made "in repository" via a branch. Ask on the developer mailing list for guidance, if required.)
FYI our guidelines for code reviews are at https://cwiki.apache.org/confluence/display/FINERACT/Code+Review+Guide.