FINERACT-2772: Tax group - User should be able to set end date if start date was in the past - #6293
Open
rymghosn wants to merge 1 commit into
Conversation
…e on TaxGroupData TaxGroup.findOneBy() threw TaxMappingNotFoundException as soon as the first existing mapping didn't match instead of checking the rest, and could NPE via getId().equals(...) when an existing mapping's id was null. Both surfaced as intermittent Internal Server Errors when adding a new component to a tax group that already had multiple mappings. Also exposes the read-side businessDate on TaxGroupData so clients can validate a new component's start date against it before submitting.
rymghosn
force-pushed
the
port/CBS-212-tax-group-findoneby-null-fix-and-businessdate
branch
from
August 19, 2026 10:47
84672c1 to
9201672
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.
TaxGroup.findOneBy(TaxGroupMappings)threwTaxMappingNotFoundExceptionas soon as the first existing mapping in the set didn't match the one being looked up, instead of checking the rest of the set. With a tax group that has more than one component mapping, this meant editing/adding a component could randomly fail with an Internal Server Error depending on iteration order, even though a matching mapping existed further down the set. The same method could also throw an NPE viagroupMappings.getId().equals(...)when an existing mapping's id was itselfnull.This PR:
findOneByto scan the full set of existing mappings and only throwTaxMappingNotFoundExceptionif none of them match, usingObjects.equalsto avoid the NPE on a null id.businessDatefield onTaxGroupData(populated fromDateUtils.getBusinessLocalDate()when fetching a single tax group), so a client can validate a new tax component's start date against the system business date before submitting, instead of relying on the server round-trip to reject it.Changes
TaxGroup#findOneBy: iterate over all mappings before giving up,Objects.equalsinstead of.getId().equals(...)TaxGroupData: newbusinessDatefield +withBusinessDate(TaxGroupData, LocalDate)factory (mirrors the existingtemplate(...)copy-factory pattern); existing
lookup()/template()factories updated to carry the field throughTaxGroupMapper:businessDatemarkedignorein the MapStruct mapping (it's computed, not entity data)TaxReadPlatformServiceImpl#retrieveTaxGroupData: populatesbusinessDateon the returnedTaxGroupDataPR:(https://issues.apache.org/jira/browse/FINERACT-2772)