github-advanced-security[bot] commented on code in PR #18444:
URL: 
https://github.com/apache/dolphinscheduler/pull/18444#discussion_r3748484997


##########
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/WorkflowInstanceService.java:
##########
@@ -70,18 +71,18 @@
      * @param otherParamsJson   otherParamsJson handle other params
      * @return workflow instance list
      */
-    Result<PageInfo<WorkflowInstance>> queryWorkflowInstanceList(User 
loginUser,
-                                                                 long 
projectCode,
-                                                                 long 
workflowDefinitionCode,
-                                                                 String 
startDate,
-                                                                 String 
endDate,
-                                                                 String 
searchVal,
-                                                                 String 
executorName,
-                                                                 
WorkflowExecutionStatus stateType,
-                                                                 String host,
-                                                                 String 
otherParamsJson,
-                                                                 Integer 
pageNo,
-                                                                 Integer 
pageSize);
+    Result<PageInfo<WorkflowInstanceQueryDTO>> queryWorkflowInstanceList(User 
loginUser,
+                                                                         long 
projectCode,
+                                                                         long 
workflowDefinitionCode,
+                                                                         
String startDate,
+                                                                         
String endDate,
+                                                                         
String searchVal,
+                                                                         
String executorName,
+                                                                         
WorkflowExecutionStatus stateType,
+                                                                         
String host,
+                                                                         
String otherParamsJson,

Review Comment:
   ## CodeQL / Useless parameter
   
   The parameter 'otherParamsJson' is never used.
   
   [Show more 
details](https://github.com/apache/dolphinscheduler/security/code-scanning/5849)



##########
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/dto/workflowInstance/WorkflowInstanceQueryDTO.java:
##########
@@ -0,0 +1,194 @@
+/*
+ * 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.workflowInstance;
+
+import org.apache.dolphinscheduler.common.enums.CommandType;
+import org.apache.dolphinscheduler.common.enums.FailureStrategy;
+import org.apache.dolphinscheduler.common.enums.Flag;
+import org.apache.dolphinscheduler.common.enums.Priority;
+import org.apache.dolphinscheduler.common.enums.TaskDependType;
+import org.apache.dolphinscheduler.common.enums.WarningType;
+import org.apache.dolphinscheduler.common.enums.WorkflowExecutionStatus;
+import org.apache.dolphinscheduler.dao.entity.WorkflowInstance;
+
+import java.util.Date;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import io.swagger.v3.oas.annotations.media.Schema;
+
+/**
+ * Lightweight response DTO for workflow instance list / top-N / trigger 
queries.
+ *
+ * <p>Unlike {@link WorkflowInstance}, this DTO intentionally omits heavy 
columns
+ * ({@code commandParam}, {@code globalParams}, {@code historyCmd}, {@code 
varPool},
+ * {@code stateHistory}) that are only needed for detail views or internal 
processing.
+ * This allows the corresponding DAO queries to use the optimized {@code 
listSql}
+ * projection instead of the full {@code baseSql}.
+ *
+ * <p><b>Incompatible API change (documented):</b> The following fields that 
were
+ * previously present in list/topN/trigger API responses are no longer 
returned:
+ * <ul>
+ *   <li>{@code commandParam}</li>
+ *   <li>{@code globalParams}</li>
+ *   <li>{@code historyCmd}</li>
+ *   <li>{@code varPool}</li>
+ *   <li>{@code stateHistory}</li>
+ * </ul>
+ * Consumers that require these fields should call the detail endpoint
+ * {@code GET /projects/{projectCode}/workflow-instances/{id}} instead, which
+ * continues to return the full {@link WorkflowInstance}.
+ */
+@Data
+@NoArgsConstructor
+@AllArgsConstructor
+@Schema(name = "WORKFLOW_INSTANCE_QUERY_RESPONSE")
+public class WorkflowInstanceQueryDTO {
+
+    @Schema(description = "workflow instance id")
+    private Integer id;
+
+    @Schema(description = "workflow definition code")
+    private Long workflowDefinitionCode;
+
+    @Schema(description = "workflow definition version")
+    private int workflowDefinitionVersion;
+
+    @Schema(description = "project code")
+    private Long projectCode;
+
+    @Schema(description = "workflow execution status")
+    private WorkflowExecutionStatus state;
+
+    @Schema(description = "recovery flag")
+    private Flag recovery;
+
+    @Schema(description = "start time")
+    private Date startTime;
+
+    @Schema(description = "end time")
+    private Date endTime;
+
+    @Schema(description = "run times")
+    private int runTimes;
+
+    @Schema(description = "workflow instance name")
+    private String name;
+
+    @Schema(description = "host")
+    private String host;
+
+    @Schema(description = "command type")
+    private CommandType commandType;
+
+    @Schema(description = "task depend type")
+    private TaskDependType taskDependType;
+
+    @Schema(description = "max try times")
+    private int maxTryTimes;
+
+    @Schema(description = "failure strategy")
+    private FailureStrategy failureStrategy;
+
+    @Schema(description = "warning type")
+    private WarningType warningType;
+
+    @Schema(description = "warning group id")
+    private Integer warningGroupId;
+
+    @Schema(description = "schedule time")
+    private Date scheduleTime;
+
+    @Schema(description = "command start time")
+    private Date commandStartTime;
+
+    @Schema(description = "is sub workflow")
+    private Flag isSubWorkflow;
+
+    @Schema(description = "executor id")
+    private int executorId;
+
+    @Schema(description = "executor name")
+    private String executorName;
+
+    @Schema(description = "workflow instance priority")
+    private Priority workflowInstancePriority;
+
+    @Schema(description = "worker group")
+    private String workerGroup;
+
+    @Schema(description = "environment code")
+    private Long environmentCode;
+
+    @Schema(description = "timeout")
+    private int timeout;
+
+    @Schema(description = "tenant code")
+    private String tenantCode;
+
+    @Schema(description = "dry run")
+    private int dryRun;
+
+    @Schema(description = "next workflow instance id")
+    private int nextWorkflowInstanceId;
+
+    @Schema(description = "restart time")
+    private Date restartTime;
+
+    @Schema(description = "duration string, e.g. 1h 2m 3s")
+    private String duration;
+
+    /**
+     * Create a {@link WorkflowInstanceQueryDTO} from a {@link 
WorkflowInstance} entity.
+     */
+    public static WorkflowInstanceQueryDTO fromEntity(WorkflowInstance 
instance) {
+        return new WorkflowInstanceQueryDTO(
+                instance.getId(),
+                instance.getWorkflowDefinitionCode(),
+                instance.getWorkflowDefinitionVersion(),
+                instance.getProjectCode(),
+                instance.getState(),
+                instance.getRecovery(),
+                instance.getStartTime(),
+                instance.getEndTime(),
+                instance.getRunTimes(),
+                instance.getName(),
+                instance.getHost(),
+                instance.getCommandType(),
+                instance.getTaskDependType(),
+                instance.getMaxTryTimes(),

Review Comment:
   ## CodeQL / Deprecated method or constructor invocation
   
   Invoking [WorkflowInstance.getMaxTryTimes](1) should be avoided because it 
has been deprecated.
   
   [Show more 
details](https://github.com/apache/dolphinscheduler/security/code-scanning/5850)



##########
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/dto/workflowInstance/WorkflowInstanceQueryDTO.java:
##########
@@ -0,0 +1,194 @@
+/*
+ * 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.workflowInstance;
+
+import org.apache.dolphinscheduler.common.enums.CommandType;
+import org.apache.dolphinscheduler.common.enums.FailureStrategy;
+import org.apache.dolphinscheduler.common.enums.Flag;
+import org.apache.dolphinscheduler.common.enums.Priority;
+import org.apache.dolphinscheduler.common.enums.TaskDependType;
+import org.apache.dolphinscheduler.common.enums.WarningType;
+import org.apache.dolphinscheduler.common.enums.WorkflowExecutionStatus;
+import org.apache.dolphinscheduler.dao.entity.WorkflowInstance;
+
+import java.util.Date;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import io.swagger.v3.oas.annotations.media.Schema;
+
+/**
+ * Lightweight response DTO for workflow instance list / top-N / trigger 
queries.
+ *
+ * <p>Unlike {@link WorkflowInstance}, this DTO intentionally omits heavy 
columns
+ * ({@code commandParam}, {@code globalParams}, {@code historyCmd}, {@code 
varPool},
+ * {@code stateHistory}) that are only needed for detail views or internal 
processing.
+ * This allows the corresponding DAO queries to use the optimized {@code 
listSql}
+ * projection instead of the full {@code baseSql}.
+ *
+ * <p><b>Incompatible API change (documented):</b> The following fields that 
were
+ * previously present in list/topN/trigger API responses are no longer 
returned:
+ * <ul>
+ *   <li>{@code commandParam}</li>
+ *   <li>{@code globalParams}</li>
+ *   <li>{@code historyCmd}</li>
+ *   <li>{@code varPool}</li>
+ *   <li>{@code stateHistory}</li>
+ * </ul>
+ * Consumers that require these fields should call the detail endpoint
+ * {@code GET /projects/{projectCode}/workflow-instances/{id}} instead, which
+ * continues to return the full {@link WorkflowInstance}.
+ */
+@Data
+@NoArgsConstructor
+@AllArgsConstructor
+@Schema(name = "WORKFLOW_INSTANCE_QUERY_RESPONSE")
+public class WorkflowInstanceQueryDTO {
+
+    @Schema(description = "workflow instance id")
+    private Integer id;
+
+    @Schema(description = "workflow definition code")
+    private Long workflowDefinitionCode;
+
+    @Schema(description = "workflow definition version")
+    private int workflowDefinitionVersion;
+
+    @Schema(description = "project code")
+    private Long projectCode;
+
+    @Schema(description = "workflow execution status")
+    private WorkflowExecutionStatus state;
+
+    @Schema(description = "recovery flag")
+    private Flag recovery;
+
+    @Schema(description = "start time")
+    private Date startTime;
+
+    @Schema(description = "end time")
+    private Date endTime;
+
+    @Schema(description = "run times")
+    private int runTimes;
+
+    @Schema(description = "workflow instance name")
+    private String name;
+
+    @Schema(description = "host")
+    private String host;
+
+    @Schema(description = "command type")
+    private CommandType commandType;
+
+    @Schema(description = "task depend type")
+    private TaskDependType taskDependType;
+
+    @Schema(description = "max try times")
+    private int maxTryTimes;
+
+    @Schema(description = "failure strategy")
+    private FailureStrategy failureStrategy;
+
+    @Schema(description = "warning type")
+    private WarningType warningType;
+
+    @Schema(description = "warning group id")
+    private Integer warningGroupId;
+
+    @Schema(description = "schedule time")
+    private Date scheduleTime;
+
+    @Schema(description = "command start time")
+    private Date commandStartTime;
+
+    @Schema(description = "is sub workflow")
+    private Flag isSubWorkflow;
+
+    @Schema(description = "executor id")
+    private int executorId;
+
+    @Schema(description = "executor name")
+    private String executorName;
+
+    @Schema(description = "workflow instance priority")
+    private Priority workflowInstancePriority;
+
+    @Schema(description = "worker group")
+    private String workerGroup;
+
+    @Schema(description = "environment code")
+    private Long environmentCode;
+
+    @Schema(description = "timeout")
+    private int timeout;
+
+    @Schema(description = "tenant code")
+    private String tenantCode;
+
+    @Schema(description = "dry run")
+    private int dryRun;
+
+    @Schema(description = "next workflow instance id")
+    private int nextWorkflowInstanceId;
+
+    @Schema(description = "restart time")
+    private Date restartTime;
+
+    @Schema(description = "duration string, e.g. 1h 2m 3s")
+    private String duration;
+
+    /**
+     * Create a {@link WorkflowInstanceQueryDTO} from a {@link 
WorkflowInstance} entity.
+     */
+    public static WorkflowInstanceQueryDTO fromEntity(WorkflowInstance 
instance) {
+        return new WorkflowInstanceQueryDTO(
+                instance.getId(),
+                instance.getWorkflowDefinitionCode(),
+                instance.getWorkflowDefinitionVersion(),
+                instance.getProjectCode(),
+                instance.getState(),
+                instance.getRecovery(),
+                instance.getStartTime(),
+                instance.getEndTime(),
+                instance.getRunTimes(),
+                instance.getName(),
+                instance.getHost(),
+                instance.getCommandType(),
+                instance.getTaskDependType(),
+                instance.getMaxTryTimes(),
+                instance.getFailureStrategy(),
+                instance.getWarningType(),
+                instance.getWarningGroupId(),
+                instance.getScheduleTime(),
+                instance.getCommandStartTime(),
+                instance.getIsSubWorkflow(),
+                instance.getExecutorId(),
+                instance.getExecutorName(),
+                instance.getWorkflowInstancePriority(),
+                instance.getWorkerGroup(),
+                instance.getEnvironmentCode(),
+                instance.getTimeout(),
+                instance.getTenantCode(),
+                instance.getDryRun(),
+                instance.getNextWorkflowInstanceId(),

Review Comment:
   ## CodeQL / Deprecated method or constructor invocation
   
   Invoking [WorkflowInstance.getNextWorkflowInstanceId](1) should be avoided 
because it has been deprecated.
   
   [Show more 
details](https://github.com/apache/dolphinscheduler/security/code-scanning/5851)



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to