From 5de271e750a7315dfb85533c29f0893ea6091484 Mon Sep 17 00:00:00 2001 From: silenceland Date: Thu, 18 Jan 2024 01:14:12 +0800 Subject: [PATCH] [DS-15489][style]rename the vo object suffix - the naming suffix of the objects under the package dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/vo is not unified, such as AlertPluginInstanceVO and ScheduleVO, etc. - this issue solve it, and uniformly modified to the VO suffix --- .../controller/DataAnalysisController.java | 12 +++---- .../api/service/DataAnalysisService.java | 18 +++++----- .../service/impl/DataAnalysisServiceImpl.java | 36 +++++++++---------- .../service/impl/SchedulerServiceImpl.java | 12 +++---- .../impl/TaskDefinitionServiceImpl.java | 4 +-- .../vo/{ScheduleVo.java => ScheduleVO.java} | 4 +-- ...efinitionVo.java => TaskDefinitionVO.java} | 10 +++--- ...eCountVo.java => TaskInstanceCountVO.java} | 8 ++--- ...Vo.java => WorkflowDefinitionCountVO.java} | 10 +++--- ...ntVo.java => WorkflowInstanceCountVO.java} | 8 ++--- .../DataAnalysisControllerTest.java | 12 +++---- .../api/service/DataAnalysisServiceTest.java | 4 +-- 12 files changed, 69 insertions(+), 69 deletions(-) rename dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/vo/{ScheduleVo.java => ScheduleVO.java} (98%) rename dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/vo/{TaskDefinitionVo.java => TaskDefinitionVO.java} (85%) rename dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/vo/{TaskInstanceCountVo.java => TaskInstanceCountVO.java} (91%) rename dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/vo/{WorkflowDefinitionCountVo.java => WorkflowDefinitionCountVO.java} (84%) rename dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/vo/{WorkflowInstanceCountVo.java => WorkflowInstanceCountVO.java} (91%) diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/DataAnalysisController.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/DataAnalysisController.java index a735433b739a..c69c1d969ccd 100644 --- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/DataAnalysisController.java +++ b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/DataAnalysisController.java @@ -27,9 +27,9 @@ import org.apache.dolphinscheduler.api.exceptions.ApiException; import org.apache.dolphinscheduler.api.service.DataAnalysisService; import org.apache.dolphinscheduler.api.utils.Result; -import org.apache.dolphinscheduler.api.vo.TaskInstanceCountVo; -import org.apache.dolphinscheduler.api.vo.WorkflowDefinitionCountVo; -import org.apache.dolphinscheduler.api.vo.WorkflowInstanceCountVo; +import org.apache.dolphinscheduler.api.vo.TaskInstanceCountVO; +import org.apache.dolphinscheduler.api.vo.WorkflowDefinitionCountVO; +import org.apache.dolphinscheduler.api.vo.WorkflowInstanceCountVO; import org.apache.dolphinscheduler.common.constants.Constants; import org.apache.dolphinscheduler.dao.entity.User; @@ -71,7 +71,7 @@ public class DataAnalysisController extends BaseController { @GetMapping(value = "/task-state-count") @ResponseStatus(HttpStatus.OK) @ApiException(TASK_INSTANCE_STATE_COUNT_ERROR) - public Result getTaskInstanceStateCount(@Parameter(hidden = true) @RequestAttribute(value = Constants.SESSION_USER) User loginUser, + public Result getTaskInstanceStateCount(@Parameter(hidden = true) @RequestAttribute(value = Constants.SESSION_USER) User loginUser, @RequestParam(value = "startDate", required = false) String startDate, @RequestParam(value = "endDate", required = false) String endDate, @RequestParam(value = "projectCode", required = false) Long projectCode) { @@ -91,7 +91,7 @@ public Result getTaskInstanceStateCount(@Parameter(hidden = @GetMapping(value = "/process-state-count") @ResponseStatus(HttpStatus.OK) @ApiException(COUNT_PROCESS_INSTANCE_STATE_ERROR) - public Result getWorkflowInstanceStateCount(@Parameter(hidden = true) @RequestAttribute(value = Constants.SESSION_USER) User loginUser, + public Result getWorkflowInstanceStateCount(@Parameter(hidden = true) @RequestAttribute(value = Constants.SESSION_USER) User loginUser, @RequestParam(value = "startDate", required = false) String startDate, @RequestParam(value = "endDate", required = false) String endDate, @RequestParam(value = "projectCode", required = false) Long projectCode) { @@ -109,7 +109,7 @@ public Result getWorkflowInstanceStateCount(@Parameter( @GetMapping(value = "/define-user-count") @ResponseStatus(HttpStatus.OK) @ApiException(COUNT_PROCESS_DEFINITION_USER_ERROR) - public Result countDefinitionByUser(@Parameter(hidden = true) @RequestAttribute(value = Constants.SESSION_USER) User loginUser, + public Result countDefinitionByUser(@Parameter(hidden = true) @RequestAttribute(value = Constants.SESSION_USER) User loginUser, @RequestParam(value = "projectCode", required = false) Long projectCode) { if (projectCode == null) { return Result.success(dataAnalysisService.getAllWorkflowDefinitionCount(loginUser)); diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/DataAnalysisService.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/DataAnalysisService.java index 11488776f1a8..351a3d5c9191 100644 --- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/DataAnalysisService.java +++ b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/DataAnalysisService.java @@ -21,9 +21,9 @@ import org.apache.dolphinscheduler.api.dto.DefineUserDto; import org.apache.dolphinscheduler.api.dto.TaskCountDto; import org.apache.dolphinscheduler.api.dto.project.StatisticsStateRequest; -import org.apache.dolphinscheduler.api.vo.TaskInstanceCountVo; -import org.apache.dolphinscheduler.api.vo.WorkflowDefinitionCountVo; -import org.apache.dolphinscheduler.api.vo.WorkflowInstanceCountVo; +import org.apache.dolphinscheduler.api.vo.TaskInstanceCountVO; +import org.apache.dolphinscheduler.api.vo.WorkflowDefinitionCountVO; +import org.apache.dolphinscheduler.api.vo.WorkflowInstanceCountVO; import org.apache.dolphinscheduler.dao.entity.User; import java.util.List; @@ -34,27 +34,27 @@ */ public interface DataAnalysisService { - TaskInstanceCountVo getTaskInstanceStateCountByProject(User loginUser, + TaskInstanceCountVO getTaskInstanceStateCountByProject(User loginUser, Long projectCode, String startDate, String endDate); - TaskInstanceCountVo getAllTaskInstanceStateCount(User loginUser, + TaskInstanceCountVO getAllTaskInstanceStateCount(User loginUser, String startDate, String endDate); - WorkflowInstanceCountVo getWorkflowInstanceStateCountByProject(User loginUser, + WorkflowInstanceCountVO getWorkflowInstanceStateCountByProject(User loginUser, Long projectCodes, String startDate, String endDate); - WorkflowInstanceCountVo getAllWorkflowInstanceStateCount(User loginUser, + WorkflowInstanceCountVO getAllWorkflowInstanceStateCount(User loginUser, String startDate, String endDate); - WorkflowDefinitionCountVo getWorkflowDefinitionCountByProject(User loginUser, Long projectCode); + WorkflowDefinitionCountVO getWorkflowDefinitionCountByProject(User loginUser, Long projectCode); - WorkflowDefinitionCountVo getAllWorkflowDefinitionCount(User loginUser); + WorkflowDefinitionCountVO getAllWorkflowDefinitionCount(User loginUser); /** * statistics the workflow quantities of certain user diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/DataAnalysisServiceImpl.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/DataAnalysisServiceImpl.java index 84c5ca17f852..36c9c2b8c13b 100644 --- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/DataAnalysisServiceImpl.java +++ b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/DataAnalysisServiceImpl.java @@ -27,9 +27,9 @@ import org.apache.dolphinscheduler.api.exceptions.ServiceException; import org.apache.dolphinscheduler.api.service.DataAnalysisService; import org.apache.dolphinscheduler.api.service.ProjectService; -import org.apache.dolphinscheduler.api.vo.TaskInstanceCountVo; -import org.apache.dolphinscheduler.api.vo.WorkflowDefinitionCountVo; -import org.apache.dolphinscheduler.api.vo.WorkflowInstanceCountVo; +import org.apache.dolphinscheduler.api.vo.TaskInstanceCountVO; +import org.apache.dolphinscheduler.api.vo.WorkflowDefinitionCountVO; +import org.apache.dolphinscheduler.api.vo.WorkflowInstanceCountVO; import org.apache.dolphinscheduler.common.constants.Constants; import org.apache.dolphinscheduler.common.enums.AuthorizationType; import org.apache.dolphinscheduler.common.enums.CommandType; @@ -105,7 +105,7 @@ public class DataAnalysisServiceImpl extends BaseServiceImpl implements DataAnal private TaskDefinitionMapper taskDefinitionMapper; @Override - public TaskInstanceCountVo getTaskInstanceStateCountByProject(User loginUser, + public TaskInstanceCountVO getTaskInstanceStateCountByProject(User loginUser, Long projectCode, String startDate, String endDate) { @@ -114,26 +114,26 @@ public TaskInstanceCountVo getTaskInstanceStateCountByProject(User loginUser, Date end = endDate == null ? null : transformDate(endDate); List taskInstanceStatusCounts = taskInstanceMapper.countTaskInstanceStateByProjectCodes(start, end, Lists.newArrayList(projectCode)); - return TaskInstanceCountVo.of(taskInstanceStatusCounts); + return TaskInstanceCountVO.of(taskInstanceStatusCounts); } @Override - public TaskInstanceCountVo getAllTaskInstanceStateCount(User loginUser, + public TaskInstanceCountVO getAllTaskInstanceStateCount(User loginUser, String startDate, String endDate) { List projectCodes = projectService.getAuthorizedProjectCodes(loginUser); if (CollectionUtils.isEmpty(projectCodes)) { - return TaskInstanceCountVo.empty(); + return TaskInstanceCountVO.empty(); } Date start = startDate == null ? null : transformDate(startDate); Date end = endDate == null ? null : transformDate(endDate); List taskInstanceStatusCounts = taskInstanceMapper.countTaskInstanceStateByProjectCodes(start, end, projectCodes); - return TaskInstanceCountVo.of(taskInstanceStatusCounts); + return TaskInstanceCountVO.of(taskInstanceStatusCounts); } @Override - public WorkflowInstanceCountVo getWorkflowInstanceStateCountByProject(User loginUser, + public WorkflowInstanceCountVO getWorkflowInstanceStateCountByProject(User loginUser, Long projectCode, String startDate, String endDate) { @@ -142,40 +142,40 @@ public WorkflowInstanceCountVo getWorkflowInstanceStateCountByProject(User login Date end = endDate == null ? null : transformDate(endDate); List workflowInstanceStatusCountDtos = processInstanceMapper .countWorkflowInstanceStateByProjectCodes(start, end, Lists.newArrayList(projectCode)); - return WorkflowInstanceCountVo.of(workflowInstanceStatusCountDtos); + return WorkflowInstanceCountVO.of(workflowInstanceStatusCountDtos); } @Override - public WorkflowInstanceCountVo getAllWorkflowInstanceStateCount(User loginUser, + public WorkflowInstanceCountVO getAllWorkflowInstanceStateCount(User loginUser, String startDate, String endDate) { List projectCodes = projectService.getAuthorizedProjectCodes(loginUser); if (CollectionUtils.isEmpty(projectCodes)) { - return WorkflowInstanceCountVo.empty(); + return WorkflowInstanceCountVO.empty(); } Date start = startDate == null ? null : transformDate(startDate); Date end = endDate == null ? null : transformDate(endDate); List workflowInstanceStatusCountDtos = processInstanceMapper.countWorkflowInstanceStateByProjectCodes(start, end, projectCodes); - return WorkflowInstanceCountVo.of(workflowInstanceStatusCountDtos); + return WorkflowInstanceCountVO.of(workflowInstanceStatusCountDtos); } @Override - public WorkflowDefinitionCountVo getWorkflowDefinitionCountByProject(User loginUser, Long projectCode) { + public WorkflowDefinitionCountVO getWorkflowDefinitionCountByProject(User loginUser, Long projectCode) { projectService.checkProjectAndAuthThrowException(loginUser, projectCode, PROJECT_OVERVIEW); List workflowDefinitionCounts = processDefinitionMapper.countDefinitionByProjectCodes(Lists.newArrayList(projectCode)); - return WorkflowDefinitionCountVo.of(workflowDefinitionCounts); + return WorkflowDefinitionCountVO.of(workflowDefinitionCounts); } @Override - public WorkflowDefinitionCountVo getAllWorkflowDefinitionCount(User loginUser) { + public WorkflowDefinitionCountVO getAllWorkflowDefinitionCount(User loginUser) { List projectCodes = projectService.getAuthorizedProjectCodes(loginUser); if (CollectionUtils.isEmpty(projectCodes)) { - return WorkflowDefinitionCountVo.empty(); + return WorkflowDefinitionCountVO.empty(); } - return WorkflowDefinitionCountVo.of(processDefinitionMapper.countDefinitionByProjectCodes(projectCodes)); + return WorkflowDefinitionCountVO.of(processDefinitionMapper.countDefinitionByProjectCodes(projectCodes)); } @Override diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/SchedulerServiceImpl.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/SchedulerServiceImpl.java index ead8aa35b680..80e59670f7f9 100644 --- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/SchedulerServiceImpl.java +++ b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/SchedulerServiceImpl.java @@ -31,7 +31,7 @@ import org.apache.dolphinscheduler.api.service.SchedulerService; import org.apache.dolphinscheduler.api.utils.PageInfo; import org.apache.dolphinscheduler.api.utils.Result; -import org.apache.dolphinscheduler.api.vo.ScheduleVo; +import org.apache.dolphinscheduler.api.vo.ScheduleVO; import org.apache.dolphinscheduler.common.constants.Constants; import org.apache.dolphinscheduler.common.enums.FailureStrategy; import org.apache.dolphinscheduler.common.enums.Priority; @@ -462,12 +462,12 @@ public Result querySchedule(User loginUser, long projectCode, long processDefine scheduleMapper.queryByProjectAndProcessDefineCodePaging(page, projectCode, processDefineCode, searchVal); - List scheduleList = new ArrayList<>(); + List scheduleList = new ArrayList<>(); for (Schedule schedule : schedulePage.getRecords()) { - scheduleList.add(new ScheduleVo(schedule)); + scheduleList.add(new ScheduleVO(schedule)); } - PageInfo pageInfo = new PageInfo<>(pageNo, pageSize); + PageInfo pageInfo = new PageInfo<>(pageNo, pageSize); pageInfo.setTotal((int) schedulePage.getTotal()); pageInfo.setTotalList(scheduleList); result.setData(pageInfo); @@ -528,9 +528,9 @@ public Map queryScheduleList(User loginUser, long projectCode) { } List schedules = scheduleMapper.querySchedulerListByProjectName(project.getName()); - List scheduleList = new ArrayList<>(); + List scheduleList = new ArrayList<>(); for (Schedule schedule : schedules) { - scheduleList.add(new ScheduleVo(schedule)); + scheduleList.add(new ScheduleVO(schedule)); } result.put(Constants.DATA_LIST, scheduleList); diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskDefinitionServiceImpl.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskDefinitionServiceImpl.java index ba4f584c0155..4a0c3f8b68d7 100644 --- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskDefinitionServiceImpl.java +++ b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskDefinitionServiceImpl.java @@ -39,7 +39,7 @@ import org.apache.dolphinscheduler.api.service.TaskDefinitionService; import org.apache.dolphinscheduler.api.utils.PageInfo; import org.apache.dolphinscheduler.api.utils.Result; -import org.apache.dolphinscheduler.api.vo.TaskDefinitionVo; +import org.apache.dolphinscheduler.api.vo.TaskDefinitionVO; import org.apache.dolphinscheduler.common.constants.Constants; import org.apache.dolphinscheduler.common.enums.AuthorizationType; import org.apache.dolphinscheduler.common.enums.ConditionType; @@ -1167,7 +1167,7 @@ public Map queryTaskDefinitionDetail(User loginUser, long projec taskRelationList = taskRelationList.stream() .filter(v -> v.getPreTaskCode() != 0).collect(Collectors.toList()); } - TaskDefinitionVo taskDefinitionVo = TaskDefinitionVo.fromTaskDefinition(taskDefinition); + TaskDefinitionVO taskDefinitionVo = TaskDefinitionVO.fromTaskDefinition(taskDefinition); taskDefinitionVo.setProcessTaskRelationList(taskRelationList); result.put(Constants.DATA_LIST, taskDefinitionVo); putMsg(result, Status.SUCCESS); diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/vo/ScheduleVo.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/vo/ScheduleVO.java similarity index 98% rename from dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/vo/ScheduleVo.java rename to dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/vo/ScheduleVO.java index 2c5429e53a97..2b5dd55adbec 100644 --- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/vo/ScheduleVo.java +++ b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/vo/ScheduleVO.java @@ -30,7 +30,7 @@ import lombok.Data; @Data -public class ScheduleVo { +public class ScheduleVO { private int id; @@ -140,7 +140,7 @@ public class ScheduleVo { */ private String environmentName; - public ScheduleVo(Schedule schedule) { + public ScheduleVO(Schedule schedule) { this.setId(schedule.getId()); this.setCrontab(schedule.getCrontab()); this.setProjectName(schedule.getProjectName()); diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/vo/TaskDefinitionVo.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/vo/TaskDefinitionVO.java similarity index 85% rename from dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/vo/TaskDefinitionVo.java rename to dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/vo/TaskDefinitionVO.java index 4a3884234918..801bfc01bc2b 100644 --- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/vo/TaskDefinitionVo.java +++ b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/vo/TaskDefinitionVO.java @@ -31,22 +31,22 @@ * @author fanwanlong */ @Data -public class TaskDefinitionVo extends TaskDefinition { +public class TaskDefinitionVO extends TaskDefinition { /** * process task related list */ private List processTaskRelationList; - public TaskDefinitionVo() { + public TaskDefinitionVO() { } - public TaskDefinitionVo(List processTaskRelationList) { + public TaskDefinitionVO(List processTaskRelationList) { this.processTaskRelationList = processTaskRelationList; } - public static TaskDefinitionVo fromTaskDefinition(TaskDefinition taskDefinition) { - TaskDefinitionVo taskDefinitionVo = new TaskDefinitionVo(); + public static TaskDefinitionVO fromTaskDefinition(TaskDefinition taskDefinition) { + TaskDefinitionVO taskDefinitionVo = new TaskDefinitionVO(); BeanUtils.copyProperties(taskDefinition, taskDefinitionVo); if (TimeoutFlag.CLOSE == taskDefinition.getTimeoutFlag()) { taskDefinitionVo.setTimeoutNotifyStrategy(null); diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/vo/TaskInstanceCountVo.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/vo/TaskInstanceCountVO.java similarity index 91% rename from dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/vo/TaskInstanceCountVo.java rename to dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/vo/TaskInstanceCountVO.java index d55cfc4f780e..599385b00640 100644 --- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/vo/TaskInstanceCountVo.java +++ b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/vo/TaskInstanceCountVO.java @@ -34,17 +34,17 @@ @Data @NoArgsConstructor @AllArgsConstructor -public class TaskInstanceCountVo { +public class TaskInstanceCountVO { private int totalCount; private List taskInstanceStatusCounts; - public static TaskInstanceCountVo empty() { + public static TaskInstanceCountVO empty() { return of(Collections.emptyList()); } - public static TaskInstanceCountVo of(List taskInstanceStatusCounts) { + public static TaskInstanceCountVO of(List taskInstanceStatusCounts) { taskInstanceStatusCounts = new ArrayList<>(taskInstanceStatusCounts); Map taskInstanceStatusCountMap = @@ -57,7 +57,7 @@ public static TaskInstanceCountVo of(List taskInstan } } - TaskInstanceCountVo taskInstanceCountVo = new TaskInstanceCountVo(); + TaskInstanceCountVO taskInstanceCountVo = new TaskInstanceCountVO(); taskInstanceCountVo.setTaskInstanceStatusCounts(taskInstanceStatusCounts); taskInstanceCountVo .setTotalCount(taskInstanceStatusCounts.stream().mapToInt(TaskInstanceStatusCountDto::getCount).sum()); diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/vo/WorkflowDefinitionCountVo.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/vo/WorkflowDefinitionCountVO.java similarity index 84% rename from dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/vo/WorkflowDefinitionCountVo.java rename to dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/vo/WorkflowDefinitionCountVO.java index 85435375d999..62db841f6efc 100644 --- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/vo/WorkflowDefinitionCountVo.java +++ b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/vo/WorkflowDefinitionCountVO.java @@ -31,21 +31,21 @@ @Data @NoArgsConstructor @AllArgsConstructor -public class WorkflowDefinitionCountVo { +public class WorkflowDefinitionCountVO { private int count; private List userList; - public static WorkflowDefinitionCountVo empty() { - return new WorkflowDefinitionCountVo(0, Collections.emptyList()); + public static WorkflowDefinitionCountVO empty() { + return new WorkflowDefinitionCountVO(0, Collections.emptyList()); } - public static WorkflowDefinitionCountVo of(List workflowDefinitionCounts) { + public static WorkflowDefinitionCountVO of(List workflowDefinitionCounts) { if (CollectionUtils.isEmpty(workflowDefinitionCounts)) { return empty(); } - WorkflowDefinitionCountVo workflowDefinitionCountVo = new WorkflowDefinitionCountVo(); + WorkflowDefinitionCountVO workflowDefinitionCountVo = new WorkflowDefinitionCountVO(); workflowDefinitionCountVo.setUserList(workflowDefinitionCounts); workflowDefinitionCountVo .setCount(workflowDefinitionCounts.stream().mapToInt(WorkflowDefinitionCountDto::getCount).sum()); diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/vo/WorkflowInstanceCountVo.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/vo/WorkflowInstanceCountVO.java similarity index 91% rename from dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/vo/WorkflowInstanceCountVo.java rename to dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/vo/WorkflowInstanceCountVO.java index 92380982ade8..cd6e8b1d02a8 100644 --- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/vo/WorkflowInstanceCountVo.java +++ b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/vo/WorkflowInstanceCountVO.java @@ -34,17 +34,17 @@ @Data @NoArgsConstructor @AllArgsConstructor -public class WorkflowInstanceCountVo { +public class WorkflowInstanceCountVO { private int totalCount; private List workflowInstanceStatusCounts; - public static WorkflowInstanceCountVo empty() { + public static WorkflowInstanceCountVO empty() { return of(Collections.emptyList()); } - public static WorkflowInstanceCountVo of(List workflowInstanceStatusCountDtos) { + public static WorkflowInstanceCountVO of(List workflowInstanceStatusCountDtos) { workflowInstanceStatusCountDtos = new ArrayList<>(workflowInstanceStatusCountDtos); Map workflowExecutionStatusWorkflowInstanceStatusCountMap = @@ -56,7 +56,7 @@ public static WorkflowInstanceCountVo of(List wo } } - WorkflowInstanceCountVo workflowInstanceCountVo = new WorkflowInstanceCountVo(); + WorkflowInstanceCountVO workflowInstanceCountVo = new WorkflowInstanceCountVO(); workflowInstanceCountVo.setWorkflowInstanceStatusCounts(workflowInstanceStatusCountDtos); workflowInstanceCountVo.setTotalCount( workflowInstanceStatusCountDtos.stream().mapToInt(WorkflowInstanceStatusCountDto::getCount).sum()); diff --git a/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/controller/DataAnalysisControllerTest.java b/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/controller/DataAnalysisControllerTest.java index 30b30da60784..2e9961b5d2ce 100644 --- a/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/controller/DataAnalysisControllerTest.java +++ b/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/controller/DataAnalysisControllerTest.java @@ -24,8 +24,8 @@ import org.apache.dolphinscheduler.api.enums.Status; import org.apache.dolphinscheduler.api.utils.Result; -import org.apache.dolphinscheduler.api.vo.TaskInstanceCountVo; -import org.apache.dolphinscheduler.api.vo.WorkflowInstanceCountVo; +import org.apache.dolphinscheduler.api.vo.TaskInstanceCountVO; +import org.apache.dolphinscheduler.api.vo.WorkflowInstanceCountVO; import org.apache.dolphinscheduler.common.utils.JSONUtils; import org.apache.dolphinscheduler.dao.entity.Project; import org.apache.dolphinscheduler.dao.mapper.ProjectMapper; @@ -77,8 +77,8 @@ public void testGetTaskInstanceStateCount() throws Exception { .andExpect(status().isOk()) .andExpect(content().contentType(MediaType.APPLICATION_JSON)) .andReturn(); - Result result = JSONUtils.parseObject(mvcResult.getResponse().getContentAsString(), - new TypeReference>() { + Result result = JSONUtils.parseObject(mvcResult.getResponse().getContentAsString(), + new TypeReference>() { }); assertThat(result.getCode()) .isNotNull() @@ -101,8 +101,8 @@ public void testGetWorkflowInstanceStateCount() throws Exception { .andExpect(status().isOk()) .andExpect(content().contentType(MediaType.APPLICATION_JSON)) .andReturn(); - Result result = JSONUtils.parseObject(mvcResult.getResponse().getContentAsString(), - new TypeReference>() { + Result result = JSONUtils.parseObject(mvcResult.getResponse().getContentAsString(), + new TypeReference>() { }); assertThat(result.getCode()) .isEqualTo(Status.SUCCESS.getCode()); diff --git a/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/DataAnalysisServiceTest.java b/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/DataAnalysisServiceTest.java index 112a69db9ddd..32033cc2afa1 100644 --- a/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/DataAnalysisServiceTest.java +++ b/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/DataAnalysisServiceTest.java @@ -32,7 +32,7 @@ import org.apache.dolphinscheduler.api.exceptions.ServiceException; import org.apache.dolphinscheduler.api.permission.ResourcePermissionCheckService; import org.apache.dolphinscheduler.api.service.impl.DataAnalysisServiceImpl; -import org.apache.dolphinscheduler.api.vo.TaskInstanceCountVo; +import org.apache.dolphinscheduler.api.vo.TaskInstanceCountVO; import org.apache.dolphinscheduler.common.constants.Constants; import org.apache.dolphinscheduler.common.enums.AuthorizationType; import org.apache.dolphinscheduler.common.enums.CommandType; @@ -201,7 +201,7 @@ public void testCountTaskStateByProject_noData() { user.setUserType(UserType.GENERAL_USER); when(taskInstanceMapper.countTaskInstanceStateByProjectCodes(any(), any(), any())) .thenReturn(Collections.emptyList()); - TaskInstanceCountVo taskInstanceStateCountByProject = + TaskInstanceCountVO taskInstanceStateCountByProject = dataAnalysisServiceImpl.getTaskInstanceStateCountByProject(user, 1L, null, null); assertThat(taskInstanceStateCountByProject).isNotNull(); }