[Improvement-18224][API] Migrate WorkflowDefinitionService Map<String,Object> returns to typed returns#18236
Merged
SbloodyS merged 1 commit intoMay 11, 2026
Conversation
| Map<String, Object> result = | ||
| workflowDefinitionService.switchWorkflowDefinitionVersion(loginUser, projectCode, code, version); | ||
| return returnDataList(result); | ||
| public Result<Void> switchWorkflowDefinitionVersion(@Parameter(hidden = true) @RequestAttribute(value = Constants.SESSION_USER) User loginUser, |
| workflowDefinitionListInProject.get(0).getProjectCode(), codesInProject); | ||
| putMsg(result, Status.WORKFLOW_DEFINITION_NOT_EXIST, codes); | ||
| return result; | ||
| log.error("workflow definitions do not exist in project, codes:{}.", codes); |
| @Parameter(name = "projectCode", description = "PROJECT_CODE", required = true) @PathVariable long projectCode) { | ||
| Map<String, Object> result = workflowDefinitionService.queryWorkflowDefinitionListByProjectCode(projectCode); | ||
| return returnDataList(result); | ||
| public Result<List<DependentSimplifyDefinition>> getWorkflowListByProjectCode(@Parameter(hidden = true) @RequestAttribute(value = Constants.SESSION_USER) User loginUser, |
| Map<String, Object> result = workflowDefinitionService | ||
| .queryTaskDefinitionListByWorkflowDefinitionCode(projectCode, workflowDefinitionCode); | ||
| return returnDataList(result); | ||
| public Result<List<DependentSimplifyDefinition>> getTaskListByWorkflowDefinitionCode(@Parameter(hidden = true) @RequestAttribute(value = Constants.SESSION_USER) User loginUser, |
| @Parameter(name = "projectCode", description = "PROJECT_CODE", required = true) @PathVariable long projectCode, | ||
| @PathVariable("code") long code) { | ||
| public Result<Void> deleteWorkflowDefinitionByCode(@Parameter(hidden = true) @RequestAttribute(value = Constants.SESSION_USER) User loginUser, | ||
| @Parameter(name = "projectCode", description = "PROJECT_CODE", required = true) @PathVariable long projectCode, |
| int timeout, | ||
| String taskRelationJson, | ||
| String taskDefinitionJson, | ||
| String otherParamsJson, |
| return result; | ||
| private void requireProjectAndWritePerm(User loginUser, Project project) { | ||
| Map<String, Object> permResult = new HashMap<>(); | ||
| if (!projectService.hasProjectAndWritePerm(loginUser, project, permResult)) { |
9b68d3c to
c215d2e
Compare
c215d2e to
beadfb9
Compare
0de7d65 to
47df46a
Compare
…,Object> returns to typed returns Migrate 19 methods from Map<String, Object> returns to typed returns or void with ServiceException, following the established pattern. Methods migrated: - createWorkflowDefinition / updateWorkflowDefinition -> WorkflowDefinition - queryWorkflowDefinitionList / queryAllWorkflowDefinitionByProjectCode -> List<DagData> - queryWorkflowDefinitionSimpleList -> ArrayNode - queryWorkflowDefinitionByCode / queryWorkflowDefinitionByName -> DagData - getTaskNodeListByDefinitionCode -> List<TaskDefinition> - getNodeListMapByDefinitionCodes -> Map<Long, List<TaskDefinition>> - queryWorkflowDefinitionListByProjectCode -> List<DependentSimplifyDefinition> - queryTaskDefinitionListByWorkflowDefinitionCode -> List<DependentSimplifyDefinition> - viewTree -> TreeViewDto - viewVariables -> WorkflowDefinitionVariablesDTO (new DTO) - verifyWorkflowDefinitionName -> void (throws on NAME_EXIST) - checkWorkflowNodeList -> void (throws on validation failure) - switchWorkflowDefinitionVersion -> void - batchCopyWorkflowDefinition / batchMoveWorkflowDefinition -> void - batchDeleteWorkflowDefinitionByCodes -> void A new private requireProjectAndWritePerm helper unwraps the Map-style permission check from ProjectService into ServiceException. Cascading caller updates: - WorkflowDefinitionController: 25+ endpoints updated to forward typed returns via Result.success / Result.success(...) - PythonGateway.createWorkflowDefinition: simplified to direct typed return; errors auto-throw via ServiceException - PythonGateway.getWorkflow: replaced Map status check with try/catch on ServiceException to detect WORKFLOW_DEFINITION_NAME_EXIST - WorkflowInstanceServiceImpl.updateWorkflowInstance: drops Map result check around checkWorkflowNodeList - validation failures propagate via ServiceException - doBatchOperateWorkflowDefinition: switches per-workflow Map status inspection to try/catch + failedWorkflowList accumulation Full module test suite: 682 tests, 0 failures.
47df46a to
15d6d61
Compare
|
SbloodyS
approved these changes
May 11, 2026
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.


Was this PR generated or assisted by AI?
YES, ops 4.7
Purpose of the pull request
Migrate 19 methods from Map<String, Object> returns to typed returns or void with ServiceException, following the established pattern.
Methods migrated:
A new private requireProjectAndWritePerm helper unwraps the Map-style permission check from ProjectService into ServiceException.
Cascading caller updates:
Full module test suite: 682 tests, 0 failures.
Brief change log
Verify this pull request
This pull request is code cleanup without any test coverage.
(or)
This pull request is already covered by existing tests, such as (please describe tests).
(or)
This change added tests and can be verified as follows:
(or)
Pull Request Notice
Pull Request Notice
If your pull request contains incompatible change, you should also add it to
docs/docs/en/guide/upgrade/incompatible.md