fineract icon indicating copy to clipboard operation
fineract copied to clipboard

FINERACT-2493: New command processing - execute job

Open nidhiii128 opened this issue 5 months ago • 3 comments

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 / JobExecuteResponse POJOs
  • New JobExecuteCommand and JobExecuteCommandHandler using CommandHandler<REQ, RES>
  • New typed overload on JobRegisterService.executeJobWithParameters(Long, Set<JobParameterDTO>) replacing the legacy String JSON variant
  • Both by-jobId and by-shortname execute endpoints now route through CommandDispatcher
  • Deleted legacy ExecuteJobCommandHandler and its test
  • Deleted dead CommandWrapperBuilder.executeSchedulerJob() builder method
  • Updated ExecuteAllDirtyJobsTasklet to use the typed Set<JobParameterDTO> overload
  • AntMatcher added in SecurityConfig for POST /api/*/jobs/* with EXECUTEJOB_SCHEDULER permission
  • Backward-compatible: ?command=executeJob query 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 inside Response.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.

nidhiii128 avatar Jun 07 '26 11:06 nidhiii128

> 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));
                                                                              ^

adamsaghy avatar Jun 08 '26 13:06 adamsaghy

@nidhiii128 rebase and address failing checks

Aman-Mittal avatar Jun 10 '26 05:06 Aman-Mittal

@nidhiii128 Please review the failing checks.

adamsaghy avatar Jun 26 '26 11:06 adamsaghy