FINERACT-2256: New command processing - Product Mix (org.apache.fineract.portfolio.loanproduct.productmix)#5622
Open
leonardoalunno wants to merge 1 commit intoapache:developfrom
Conversation
8571fd6 to
b273343
Compare
There was a problem hiding this comment.
Pull request overview
This PR migrates the Product Mix (loan product restriction rules) write-path to the new typed command processing pipeline (org.apache.fineract.command.*), replacing the legacy JsonCommand/CommandWrapper approach.
Changes:
- Reworked Product Mix create/update/delete endpoints to send typed commands through
CommandPipeline. - Updated handlers and write service APIs to accept typed request payloads (
ProductMixCommandRequest,ProductMixDeleteRequest) instead ofJsonCommand. - Refactored Product Mix validation away from JSON parsing toward list-based validation and added bean validation annotations to
ProductMixRequest.
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/productmix/service/ProductMixWritePlatformServiceJpaRepositoryImpl.java | Updates write service methods to accept typed requests and adds a new typed delete operation. |
| fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/productmix/service/ProductMixWritePlatformService.java | Updates service interface method signatures to typed requests. |
| fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/productmix/serialization/ProductMixDataValidator.java | Replaces JSON-driven validation with List<Long> validation helpers. |
| fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/productmix/handler/CreateProductMixCommandHandler.java | Migrates create handling to CommandHandler + resilience4j retry. |
| fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/productmix/handler/UpdateProductMixCommandHandler.java | Migrates update handling to CommandHandler + resilience4j retry. |
| fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/productmix/handler/DeleteProductMixCommandHandler.java | Migrates delete handling to CommandHandler + resilience4j retry. |
| fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/productmix/data/ProductMixRequest.java | Adds Jakarta bean validation constraints for request body payloads. |
| fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/productmix/data/ProductMixDeleteRequest.java | Introduces a typed delete request payload record. |
| fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/productmix/data/ProductMixCommandRequest.java | Introduces a typed create/update request payload record. |
| fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/productmix/command/CreateProductMixCommand.java | Introduces typed create command. |
| fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/productmix/command/UpdateProductMixCommand.java | Introduces typed update command. |
| fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/productmix/command/DeleteProductMixCommand.java | Introduces typed delete command. |
| fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/productmix/api/ProductMixApiResource.java | Switches REST endpoints from legacy command logging to CommandPipeline dispatch. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
Comment on lines
88
to
90
| final Map<String, Object> changes = new LinkedHashMap<>(); | ||
| changes.put("restrictedProductsForMix", restrictedProductsAsMap.keySet()); | ||
| changes.put("restrictedProductsForMix", new ArrayList<>(restrictedProductsAsMap.keySet())); | ||
| changes.put("removedProductsForMix", removedRestrictions); |
Comment on lines
+1
to
+5
| package org.apache.fineract.portfolio.loanproduct.productmix.data; | ||
|
|
||
| import java.io.Serial; | ||
| import java.io.Serializable; | ||
| import lombok.Builder; |
| public void validateForCreate(final String json) { | ||
| if (StringUtils.isBlank(json)) { | ||
| throw new InvalidJsonException(); | ||
| if (CollectionUtils.isEmpty(restrictedProducts)) { |
Comment on lines
+76
to
+79
| final Long productId = request.productId(); | ||
| final Set<Long> restrictedIds = Set.copyOf(request.restrictedProducts()); | ||
|
|
||
| final Set<String> restrictedIds = new HashSet<>(Arrays.asList(command.arrayValueOfParameterNamed("restrictedProducts"))); | ||
| this.productMixDataValidator.validateRestrictedProductsForCreate(request.restrictedProducts()); |
...ortfolio/loanproduct/productmix/service/ProductMixWritePlatformServiceJpaRepositoryImpl.java
Outdated
Show resolved
Hide resolved
b273343 to
809bb71
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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!
FYI our guidelines for code reviews are at https://cwiki.apache.org/confluence/display/FINERACT/Code+Review+Guide.