FINERACT-2455: WC - allow business step update by resolving the step family per COB job - #6423
Open
oleksii-novikov-onix wants to merge 1 commit into
Open
Conversation
…family per COB job
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
Working Capital COB business steps could not be configured.
ConfigJobParameterServiceImpl checked every update against one list of available steps, built once at startup for the Loan family (afterPropertiesSet() cached the result for LOAN). The job name from the request was not used to pick the step family, so any payload containing a Working Capital step was rejected with "... Business steps are not configurable for this job.", including every PUT to /jobs/WORKING_CAPITAL_LOAN_CLOSE_OF_BUSINESS/steps.
The fix resolves the step family per job. BusinessStepCategoryService now describes one family: its category, its COB job name and its business step base type. ConfigJobParameterServiceImpl injects all implementations and looks up the one whose job name matches the request. WorkingCapitalLoanBusinessStepCategoryServiceImpl registers the Working Capital family, LoanBusinessStepCategoryServiceImpl keeps the Loan one.
The same change closes two related defects.
Loan steps could be saved onto the Working Capital job, because they passed the check against the cached Loan list. The result was a configuration that never ran. The execution map is built by intersecting the configured step names with the beans of the job's own family, so it came out empty, the batch job stopped in the partitioner, and inline COB failed with "Execution map is empty!".
A request that carried valid Loan step names was accepted under any job name and wrote rows into m_batch_business_steps that no job would ever read. Unknown job names now return 400.
Removing the startup cache also removes an applicationContext.getBean() call during context refresh and a mutable field shared between requests. Available steps are resolved per request instead.
API behaviour
GET /jobs/{jobName}/available-steps now also accepts a COB job name such as WORKING_CAPITAL_LOAN_CLOSE_OF_BUSINESS. The old category name (loan, any case) still works, and the response still echoes back the value that was passed in.
PUT /jobs/{jobName}/steps returns 400 for a name that is not a configurable COB job. A category name like loan used to be accepted here together with valid Loan steps, and wrote rows under that name which no job ever executed.
Testing
Six scenarios were added to WorkingCapital_COB.feature: available steps for the WC job name, the WC job rejecting a Loan step, the Loan job rejecting a WC step, an unknown job name being rejected, a reorder of all eight WC steps read back through the API, and a WC COB run on a reordered configuration. Scenarios that touch the configuration save it before and restore it after, so a failure cannot leak into the rest of the suite.
BusinessConfigurationApiTest needed no changes. shouldReturnApplyChargeToOverdueLoanStepConfigByJobCategory still sends the category name loan and still gets it back as the response jobName.
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.