This is an automated email from the ASF dual-hosted git repository.

zihaoxiang pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/dolphinscheduler.git


The following commit(s) were added to refs/heads/dev by this push:
     new fbc2f3c469 [Improvement-18056] Remove unused code in api module 
(#18105)
fbc2f3c469 is described below

commit fbc2f3c4692621f944a4e6733667147460787c3c
Author: xiangzihao <[email protected]>
AuthorDate: Tue Mar 31 20:54:35 2026 +0800

    [Improvement-18056] Remove unused code in api module (#18105)
---
 .../dolphinscheduler/api/dto/DefineUserDto.java    | 41 ----------
 .../dolphinscheduler/api/dto/TaskCountDto.java     | 74 ------------------
 .../dolphinscheduler/api/dto/TaskStateCount.java   | 34 ---------
 .../api/dto/project/ProjectListPagingResponse.java | 40 ----------
 .../api/dto/project/ProjectListResponse.java       | 42 -----------
 .../api/dto/resources/filter/IFilter.java          | 30 --------
 .../api/dto/resources/filter/ResourceFilter.java   | 88 ----------------------
 .../dto/resources/filter/ResourceFilterTest.java   | 58 --------------
 8 files changed, 407 deletions(-)

diff --git 
a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/dto/DefineUserDto.java
 
b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/dto/DefineUserDto.java
deleted file mode 100644
index 0ecd85ba63..0000000000
--- 
a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/dto/DefineUserDto.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.dolphinscheduler.api.dto;
-
-import org.apache.dolphinscheduler.dao.model.WorkflowDefinitionCountDto;
-
-import java.util.List;
-
-import lombok.Data;
-
-@Data
-public class DefineUserDto {
-
-    private int count;
-
-    private List<WorkflowDefinitionCountDto> userList;
-
-    public DefineUserDto(List<WorkflowDefinitionCountDto> defineGroupByUsers) {
-
-        for (WorkflowDefinitionCountDto define : defineGroupByUsers) {
-            count += define.getCount();
-        }
-        this.userList = defineGroupByUsers;
-    }
-
-}
diff --git 
a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/dto/TaskCountDto.java
 
b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/dto/TaskCountDto.java
deleted file mode 100644
index 9e456109be..0000000000
--- 
a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/dto/TaskCountDto.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.dolphinscheduler.api.dto;
-
-import org.apache.dolphinscheduler.dao.entity.ExecuteStatusCount;
-import org.apache.dolphinscheduler.plugin.task.api.enums.TaskExecutionStatus;
-
-import java.util.Arrays;
-import java.util.List;
-import java.util.Map;
-import java.util.stream.Collectors;
-
-import lombok.AllArgsConstructor;
-import lombok.Data;
-import lombok.NoArgsConstructor;
-
-@Data
-@NoArgsConstructor
-@AllArgsConstructor
-public class TaskCountDto {
-
-    /**
-     * total count
-     */
-    private int totalCount;
-
-    /**
-     * task state count list
-     */
-    private List<TaskStateCount> taskCountDtos;
-
-    public TaskCountDto(List<ExecuteStatusCount> taskInstanceStateCounts) {
-        countTaskDtos(taskInstanceStateCounts);
-    }
-
-    private void countTaskDtos(List<ExecuteStatusCount> 
taskInstanceStateCounts) {
-        Map<TaskExecutionStatus, Integer> statusCountMap = 
taskInstanceStateCounts.stream()
-                .collect(Collectors.toMap(ExecuteStatusCount::getState, 
ExecuteStatusCount::getCount, Integer::sum));
-
-        taskCountDtos = Arrays.stream(TaskExecutionStatus.values())
-                .map(status -> new TaskStateCount(status, 
statusCountMap.getOrDefault(status, 0)))
-                .collect(Collectors.toList());
-
-        totalCount = taskCountDtos.stream()
-                .mapToInt(TaskStateCount::getCount)
-                .sum();
-    }
-
-    // remove the specified state
-    public void removeStateFromCountList(TaskExecutionStatus status) {
-        for (TaskStateCount count : this.taskCountDtos) {
-            if (count.getTaskStateType().equals(status)) {
-                this.taskCountDtos.remove(count);
-                break;
-            }
-        }
-    }
-
-}
diff --git 
a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/dto/TaskStateCount.java
 
b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/dto/TaskStateCount.java
deleted file mode 100644
index eb935659c9..0000000000
--- 
a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/dto/TaskStateCount.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.dolphinscheduler.api.dto;
-
-import org.apache.dolphinscheduler.plugin.task.api.enums.TaskExecutionStatus;
-
-import lombok.AllArgsConstructor;
-import lombok.Data;
-import lombok.NoArgsConstructor;
-
-@Data
-@NoArgsConstructor
-@AllArgsConstructor
-public class TaskStateCount {
-
-    private TaskExecutionStatus taskStateType;
-    private int count;
-
-}
diff --git 
a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/dto/project/ProjectListPagingResponse.java
 
b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/dto/project/ProjectListPagingResponse.java
deleted file mode 100644
index 53f670d240..0000000000
--- 
a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/dto/project/ProjectListPagingResponse.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.dolphinscheduler.api.dto.project;
-
-import org.apache.dolphinscheduler.api.utils.PageInfo;
-import org.apache.dolphinscheduler.api.utils.Result;
-import org.apache.dolphinscheduler.dao.entity.Project;
-
-import lombok.Data;
-
-/**
- * project List paging response
- */
-@Data
-public class ProjectListPagingResponse extends Result {
-
-    private PageInfo<Project> data;
-
-    public ProjectListPagingResponse(Result result) {
-        super();
-        this.setCode(result.getCode());
-        this.setMsg(result.getMsg());
-        this.setData(result.getData());
-    }
-}
diff --git 
a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/dto/project/ProjectListResponse.java
 
b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/dto/project/ProjectListResponse.java
deleted file mode 100644
index 433675b837..0000000000
--- 
a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/dto/project/ProjectListResponse.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.dolphinscheduler.api.dto.project;
-
-import org.apache.dolphinscheduler.api.utils.Result;
-import org.apache.dolphinscheduler.common.utils.JSONUtils;
-import org.apache.dolphinscheduler.dao.entity.Project;
-
-import java.util.List;
-
-import lombok.Data;
-
-/**
- * project List response
- */
-@Data
-public class ProjectListResponse extends Result {
-
-    private List<Project> data;
-
-    public ProjectListResponse(Result result) {
-        super();
-        this.setCode(result.getCode());
-        this.setMsg(result.getMsg());
-        
this.setData(JSONUtils.toList(JSONUtils.toJsonString(result.getData()), 
Project.class));
-    }
-}
diff --git 
a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/dto/resources/filter/IFilter.java
 
b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/dto/resources/filter/IFilter.java
deleted file mode 100644
index 52923ed93b..0000000000
--- 
a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/dto/resources/filter/IFilter.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.dolphinscheduler.api.dto.resources.filter;
-
-import org.apache.dolphinscheduler.plugin.storage.api.StorageEntity;
-
-import java.util.List;
-
-/**
- * interface filter
- */
-public interface IFilter {
-
-    List<StorageEntity> filter();
-}
diff --git 
a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/dto/resources/filter/ResourceFilter.java
 
b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/dto/resources/filter/ResourceFilter.java
deleted file mode 100644
index ddec1f4402..0000000000
--- 
a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/dto/resources/filter/ResourceFilter.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.dolphinscheduler.api.dto.resources.filter;
-
-import org.apache.dolphinscheduler.plugin.storage.api.StorageEntity;
-
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-import java.util.stream.Collectors;
-
-/**
- * resource filter
- */
-public class ResourceFilter implements IFilter {
-
-    /**
-     * resource suffix
-     */
-    private String suffix;
-    /**
-     * resource list
-     */
-    private List<StorageEntity> resourceList;
-
-    /**
-     * parent list
-     */
-    // Set<Resource> parentList = new HashSet<>();
-
-    /**
-     * constructor
-     * @param suffix        resource suffix
-     * @param resourceList  resource list
-     */
-    public ResourceFilter(String suffix, List<StorageEntity> resourceList) {
-        this.suffix = suffix;
-        this.resourceList = resourceList;
-    }
-
-    /**
-     * file filter
-     * @return file filtered by suffix
-     */
-    public Set<StorageEntity> fileFilter() {
-        return resourceList.stream().filter(t -> 
t.getFullName().endsWith(suffix)).collect(Collectors.toSet());
-    }
-
-    /**
-     * list all parent dir
-     * @return parent resource dir set
-     */
-    Set<StorageEntity> listAllParent() {
-        Set<StorageEntity> parentList = new HashSet<>();
-        Set<StorageEntity> filterFileList = fileFilter();
-        for (StorageEntity file : filterFileList) {
-            String fullName = file.getFullName();
-            for (StorageEntity resource : resourceList) {
-                if (fullName.startsWith(resource.getFullName())) {
-                    parentList.add(resource);
-                }
-            }
-        }
-
-        return parentList;
-    }
-
-    @Override
-    public List<StorageEntity> filter() {
-        return new ArrayList<>(listAllParent());
-    }
-}
diff --git 
a/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/dto/resources/filter/ResourceFilterTest.java
 
b/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/dto/resources/filter/ResourceFilterTest.java
deleted file mode 100644
index a997195301..0000000000
--- 
a/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/dto/resources/filter/ResourceFilterTest.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.dolphinscheduler.api.dto.resources.filter;
-
-import org.apache.dolphinscheduler.plugin.storage.api.StorageEntity;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.junit.jupiter.api.Assertions;
-import org.junit.jupiter.api.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * resource filter test
- */
-public class ResourceFilterTest {
-
-    private static Logger logger = 
LoggerFactory.getLogger(ResourceFilterTest.class);
-    @Test
-    public void filterTest() {
-        List<StorageEntity> allList = new ArrayList<>();
-
-        StorageEntity resource1 = new StorageEntity();
-        resource1.setFullName("a1.txt");
-        StorageEntity resource2 = new StorageEntity();
-        resource2.setFullName("b1.txt");
-        StorageEntity resource3 = new StorageEntity();
-        resource3.setFullName("b2.jar");
-        StorageEntity resource4 = new StorageEntity();
-        resource4.setFullName("c2.jar");
-        allList.add(resource1);
-        allList.add(resource2);
-        allList.add(resource3);
-        allList.add(resource4);
-
-        ResourceFilter resourceFilter = new ResourceFilter(".jar", allList);
-        List<StorageEntity> resourceList = resourceFilter.filter();
-        Assertions.assertNotNull(resourceList);
-        resourceList.forEach(t -> logger.info(t.toString()));
-    }
-}

Reply via email to