Hisoka-X commented on code in PR #7522:
URL: https://github.com/apache/seatunnel/pull/7522#discussion_r1737866030


##########
seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/rest/RestHttpPostCommandProcessor.java:
##########
@@ -103,11 +112,41 @@ private SeaTunnelServer getSeaTunnelServer() {
         return (SeaTunnelServer) 
extensionServices.get(Constant.SEATUNNEL_SERVICE_NAME);
     }
 
+    private void handleSubmitJobs(HttpPostCommand httpPostCommand) throws 
IllegalArgumentException {
+        List<Tuple2<Map<String, String>, Config>> configTuples =
+                RestUtil.buildConfigList(requestHandle(httpPostCommand), 
false);
+
+        JsonArray jsonArray =
+                configTuples.stream()
+                        .map(
+                                tuple -> {
+                                    String urlParams = 
mapToUrlParams(tuple._1);
+                                    Map<String, String> requestParams = new 
HashMap<>();
+                                    RestUtil.buildRequestParams(requestParams, 
urlParams);
+                                    return createJsonObject(tuple._2, 
requestParams);
+                                })
+                        .collect(JsonArray::new, JsonArray::add, 
JsonArray::add);
+
+        prepareResponse(httpPostCommand, jsonArray);
+    }
+
+    private String mapToUrlParams(Map<String, String> params) {
+        return params.entrySet().stream()
+                .map(entry -> entry.getKey() + "=" + entry.getValue())
+                .collect(Collectors.joining("&", "?", ""));
+    }
+
     private void handleSubmitJob(HttpPostCommand httpPostCommand, String uri)
             throws IllegalArgumentException {
         Map<String, String> requestParams = new HashMap<>();
         RestUtil.buildRequestParams(requestParams, uri);
         Config config = RestUtil.buildConfig(requestHandle(httpPostCommand), 
false);
+
+        JsonObject jsonObject = createJsonObject(config, requestParams);
+        this.prepareResponse(httpPostCommand, jsonObject);
+    }
+
+    private JsonObject createJsonObject(Config config, Map<String, String> 
requestParams) {

Review Comment:
   ```suggestion
       private JsonObject submitJobInternal(Config config, Map<String, String> 
requestParams) {
   ```



-- 
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: commits-unsubscr...@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to