fineract
fineract copied to clipboard
FINERACT-2493: New command processing - execute job
Description
Migrates the "execute job" REST endpoint (both by jobId and by short-name) from the legacy command-processing path to the new fineract-command framework. Cleans up dead code from the legacy execute-job path.
Scope (PR 2 of 2 for FINERACT-2493)
- New typed
JobExecuteRequest/JobExecuteResponsePOJOs - New
JobExecuteCommandandJobExecuteCommandHandlerusingCommandHandler<REQ, RES> - New typed overload on
JobRegisterService.executeJobWithParameters(Long, Set<JobParameterDTO>)replacing the legacyStringJSON variant - Both by-jobId and by-shortname execute endpoints now route through
CommandDispatcher - Deleted legacy
ExecuteJobCommandHandlerand its test - Deleted dead
CommandWrapperBuilder.executeSchedulerJob()builder method - Updated
ExecuteAllDirtyJobsTaskletto use the typedSet<JobParameterDTO>overload - AntMatcher added in
SecurityConfigforPOST /api/*/jobs/*withEXECUTEJOB_SCHEDULERpermission - Backward-compatible:
?command=executeJobquery param still required, HTTP 202 response preserved, 405 short-circuit on non-batch mode preserved
Design choices (open to feedback)
- Parameters carried as typed
List<JobParameterDTO>on the request rather than raw JSON. - Response: minimal
{ resourceId: jobId }returned insideResponse.status(202)for backward compatibility. - Short-name → jobId resolution done in the controller before dispatch (same pattern PR 1 used; happy to relocate if a cleaner alternative emerges).
- Batch-mode guard and query-param check kept in the controller (pre-conditions, not business logic).
Not in this PR
- Update job migration — see PR #5903 (FINERACT-2493 PR 1).
- Deletion of legacy update-job code paths — they remain because PR 1 covers them.
Checklist
Please make sure these boxes are checked before submitting your pull request - thanks!
- [ ] Write the commit message as per our guidelines
- [ ] 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 our 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
- [ ] This PR must not be a "code dump". Large changes can be made in a branch, with assistance. Ask for help on the developer mailing list.
Your assigned reviewer(s) will follow our guidelines for code reviews.
> Task :fineract-e2e-tests-core:compileTestJava
/home/runner/work/fineract/fineract/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/service/JobService.java:32: error: cannot find symbol
import org.apache.fineract.client.models.ExecuteJobRequest;
^
symbol: class ExecuteJobRequest
location: package org.apache.fineract.client.models
/home/runner/work/fineract/fineract/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/testrail/TestRailClient.java:112: warning: [unchecked] unchecked cast
ArrayList<Result> results = (ArrayList<Result>) fieldStepResults.get(objectScenario);
^
required: ArrayList<Result>
found: Object
/home/runner/work/fineract/fineract/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/service/JobService.java:57: error: cannot find symbol
executeVoid(() -> fineractClient.schedulerJob().executeJob(jobId, new ExecuteJobRequest(), queryParams));
^
@nidhiii128 rebase and address failing checks
@nidhiii128 Please review the failing checks.