Repository navigation
Conversation
Replace the native SQL query that loads business-rule options in SmsCampaignReadPlatformServiceImpl retrieveTemplate with a QueryDSL query over stretchy_report, stretchy_report_parameter and
stretchy_parameter.
- Group the joined rows by report id into one SmsBusinessRulesData per report, with its parameters collected into a label -> name
map. This keeps the behaviour of BusinessRuleMapper, and the reports stay in query order.
- Filter on report_type only when a report type is given; otherwise return every report.
- Add unit tests for the grouping of rules and parameters and for the report-type filter with and without a value.
# Conflicts:
# fineract-provider/src/main/java/org/apache/fineract/infrastructure/campaigns/sms/service/SmsCampaignReadPlatformServiceImpl.java
# fineract-provider/src/test/java/org/apache/fineract/infrastructure/campaigns/sms/service/SmsCampaignReadPlatformServiceImplTest.java
Add method level q-types for retrieveTemplate
jefische
force-pushed
the
fineract-3283
branch
from
December 5, 2026 18:32
f15a25f to
0a5027a
Compare
Extend retrieveTemplateMapsAllRules so it covers all of the business-rule grouping, and assert the exact SQL that is generated:
- Add a report with no parameters. The left joins return one row with null parameter columns, which must map to a {null=null}
entry, as BusinessRuleMapper produced.
- Assert every returned rule, including a report with a null subtype and a single parameter, and check the order the rules
come back in.
- Compare the full generated SQL with EXPECTED_TEMPLATE_SQL and check that the report type is bound to the first parameter.
- Remove retrieveTemplateFiltersByReportType. The test above now covers everything it checked.
jefische
marked this pull request as ready for review
December 6, 2026 17:42
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
Jira: Fineract-3283
Migrates the business-rule lookup in
SmsCampaignReadPlatformServiceImpl.retrieveTemplatefrom native SQL throughJdbcTemplateandBusinessRuleMapperto QueryDSL.stretchy_report,stretchy_report_parameterandstretchy_parameter. It filters onreport_typeonly when a report type is given; otherwise it returns every report, as before.SmsBusinessRulesDataper report. Each report's parameters are collected into aparameterLabel -> parameterNamemap, which keeps thebehaviour of
BusinessRuleMapper. ALinkedHashMapkeeps the reports in query order.The response shape of
GET /smscampaigns/templatedoes not change.Tests
New unit tests in
SmsCampaignReadPlatformServiceImplTest:retrieveTemplateMapsAllRules: rows for the same report are merged into one rule with all of its parameters.retrieveTemplateReturnsAllReportsForNullReportType: a null report type adds nowhereclause and binds no parameter.To run them:
./gradlew :fineract-provider:test --tests "org.apache.fineract.infrastructure.campaigns.sms.service.SmsCampaignReadPlatformServiceImplTest"
Checklist
Please make sure these boxes are checked before submitting your pull request - thanks!
Your assigned reviewer(s) will follow our guidelines for code reviews.