SbloodyS commented on code in PR #10832:
URL: https://github.com/apache/dolphinscheduler/pull/10832#discussion_r923101405


##########
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/dto/project/ProjectListResponse.java:
##########
@@ -0,0 +1,58 @@
+/*
+ * 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.dao.entity.Project;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * project List response
+ */
+public class ProjectListResponse extends Result {
+
+    private List<Project> data;
+
+    public ProjectListResponse(Result result) {
+        super();
+        this.setCode(result.getCode());
+        this.setMsg(result.getMsg());
+        this.setData(objToList(result.getData()));
+    }
+
+    @Override
+    public List<Project> getData() {
+        return data;
+    }
+
+    public void setData(List<Project> data) {
+        this.data = data;
+    }
+
+    public List<Project> objToList(Object obj) {
+        List<Project> list = new ArrayList<>();
+        if (obj instanceof List<?>) {
+            for (Object o : (List<?>) obj) {
+                list.add((Project) o);
+            }
+        }
+        return list;
+    }

Review Comment:
   It's better to use `JSONUtils` instead of this.



##########
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/dto/project/ProjectListPagingResponse.java:
##########
@@ -0,0 +1,47 @@
+/*
+ * 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;
+
+/**
+ * project List paging response
+ */
+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());
+    }
+
+    @Override
+    public PageInfo<Project> getData() {
+        return data;
+    }
+
+    public void setData(PageInfo<Project> data) {
+        this.data = data;
+    }

Review Comment:
   Can we use lombok here to avoid getter/setter?



##########
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/dto/project/ProjectListResponse.java:
##########
@@ -0,0 +1,58 @@
+/*
+ * 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.dao.entity.Project;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * project List response
+ */
+public class ProjectListResponse extends Result {
+
+    private List<Project> data;
+
+    public ProjectListResponse(Result result) {
+        super();
+        this.setCode(result.getCode());
+        this.setMsg(result.getMsg());
+        this.setData(objToList(result.getData()));
+    }
+
+    @Override
+    public List<Project> getData() {
+        return data;
+    }
+
+    public void setData(List<Project> data) {
+        this.data = data;
+    }

Review Comment:
   Can we use lombok here to avoid getter/setter?



##########
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/dto/project/ProjectDeleteBooleanResponse.java:
##########
@@ -0,0 +1,44 @@
+/*
+ * 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;
+
+/**
+ * boolean response
+ */
+public class ProjectDeleteBooleanResponse extends Result {
+
+    private Boolean data;
+
+    public ProjectDeleteBooleanResponse(Result result) {
+        super();
+        this.setCode(result.getCode());
+        this.setMsg(result.getMsg());
+        this.setData((Boolean) result.getData());
+    }
+
+    @Override
+    public Boolean getData() {
+        return data;
+    }
+
+    public void setData(Boolean data) {
+        this.data = data;
+    }

Review Comment:
   Can we use lombok here to avoid getter/setter?



##########
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProjectServiceImpl.java:
##########
@@ -88,10 +95,11 @@ public class ProjectServiceImpl extends BaseServiceImpl 
implements ProjectServic
      */
     @Override
     @Transactional
-    public Map<String, Object> createProject(User loginUser, String name, 
String desc) {
+    public Result createProject(User loginUser, String name, String desc) {
+        Result result = new Result();
 
-        Map<String, Object> result = checkDesc(desc);
-        if (result.get(Constants.STATUS) != Status.SUCCESS) {
+        if (!StringUtils.isEmpty(desc) && desc.length() > 200) {

Review Comment:
   Why did you change this logic?



-- 
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