You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@seatunnel.apache.org by GitBox <gi...@apache.org> on 2022/08/18 13:06:41 UTC

[GitHub] [incubator-seatunnel] dijiekstra opened a new pull request, #2466: [seatunnel-1947][seatunnel-server] wrapper paging for some list interface

dijiekstra opened a new pull request, #2466:
URL: https://github.com/apache/incubator-seatunnel/pull/2466

   <!--
   
   Thank you for contributing to SeaTunnel! Please make sure that your code changes
   are covered with tests. And in case of new features or big changes
   remember to adjust the documentation.
   
   Feel free to ping committers for the review!
   
   ## Contribution Checklist
   
     - Make sure that the pull request corresponds to a [GITHUB issue](https://github.com/apache/incubator-seatunnel/issues).
   
     - Name the pull request in the form "[Feature] [component] Title of the pull request", where *Feature* can be replaced by `Hotfix`, `Bug`, etc.
   
     - Minor fixes should be named following this pattern: `[hotfix] [docs] Fix typo in README.md doc`.
   
   -->
   
   ## Purpose of this pull request
   
   wrapper paging for some list interface
   
   ## Check list
   
   * [X] Code changed are covered with tests, or it does not need tests for reason:
   * [X] If any new Jar binary package adding in your PR, please add License Notice according
     [New License Guide](https://github.com/apache/incubator-seatunnel/blob/dev/docs/en/contribution/new-license.md)
   * [ ] If necessary, please update the documentation to describe the new feature. https://github.com/apache/incubator-seatunnel/tree/dev/docs
   


-- 
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-unsubscribe@seatunnel.apache.org

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


[GitHub] [incubator-seatunnel] CalvinKirs merged pull request #2466: [seatunnel-1947][seatunnel-server] wrapper paging for some list interface

Posted by GitBox <gi...@apache.org>.
CalvinKirs merged PR #2466:
URL: https://github.com/apache/incubator-seatunnel/pull/2466


-- 
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-unsubscribe@seatunnel.apache.org

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


[GitHub] [incubator-seatunnel] hailin0 commented on a diff in pull request #2466: [seatunnel-1947][seatunnel-server] wrapper paging for some list interface

Posted by GitBox <gi...@apache.org>.
hailin0 commented on code in PR #2466:
URL: https://github.com/apache/incubator-seatunnel/pull/2466#discussion_r950800900


##########
seatunnel-server/seatunnel-app/src/main/java/org/apache/seatunnel/app/domain/response/PageInfo.java:
##########
@@ -0,0 +1,76 @@
+/*
+ * 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.seatunnel.app.domain.response;
+
+import io.swagger.annotations.ApiModel;
+
+import java.util.List;
+
+@ApiModel(value = "pageInfo", description = "page info")
+@SuppressWarnings("MagicNumber")
+public class PageInfo<T> {
+    private List<T> data;
+    private Integer totalCount = 0;
+    private Integer totalPage = 0;
+    private Integer pageNo = 1;
+    private Integer pageSize = 20;
+
+    public List<T> getData() {
+        return data;
+    }
+
+    public void setData(List<T> data) {
+        this.data = data;
+    }
+
+    public Integer getTotalCount() {
+        return totalCount;
+    }
+
+    public void setTotalCount(Integer totalCount) {
+        this.totalCount = totalCount;
+
+        if (pageSize == null || pageSize == 0) {
+            pageSize = 20;
+        }
+        if (this.totalCount % this.pageSize == 0) {
+            this.totalPage = this.totalCount / this.pageSize == 0 ? 1 : this.totalCount / this.pageSize;
+        }
+        this.totalPage = this.totalCount / this.pageSize + 1;

Review Comment:
   Double counting `totalPage`?



-- 
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-unsubscribe@seatunnel.apache.org

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


[GitHub] [incubator-seatunnel] dijiekstra commented on a diff in pull request #2466: [seatunnel-1947][seatunnel-server] wrapper paging for some list interface

Posted by GitBox <gi...@apache.org>.
dijiekstra commented on code in PR #2466:
URL: https://github.com/apache/incubator-seatunnel/pull/2466#discussion_r950813130


##########
seatunnel-server/seatunnel-app/src/main/java/org/apache/seatunnel/app/domain/response/PageInfo.java:
##########
@@ -0,0 +1,76 @@
+/*
+ * 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.seatunnel.app.domain.response;
+
+import io.swagger.annotations.ApiModel;
+
+import java.util.List;
+
+@ApiModel(value = "pageInfo", description = "page info")
+@SuppressWarnings("MagicNumber")
+public class PageInfo<T> {
+    private List<T> data;
+    private Integer totalCount = 0;
+    private Integer totalPage = 0;
+    private Integer pageNo = 1;
+    private Integer pageSize = 20;
+
+    public List<T> getData() {
+        return data;
+    }
+
+    public void setData(List<T> data) {
+        this.data = data;
+    }
+
+    public Integer getTotalCount() {
+        return totalCount;
+    }
+
+    public void setTotalCount(Integer totalCount) {
+        this.totalCount = totalCount;
+
+        if (pageSize == null || pageSize == 0) {
+            pageSize = 20;
+        }
+        if (this.totalCount % this.pageSize == 0) {
+            this.totalPage = this.totalCount / this.pageSize == 0 ? 1 : this.totalCount / this.pageSize;
+        }
+        this.totalPage = this.totalCount / this.pageSize + 1;

Review Comment:
   > Double counting `totalPage`?
   
   already fxi.



##########
seatunnel-server/seatunnel-app/src/main/java/org/apache/seatunnel/app/domain/response/PageInfo.java:
##########
@@ -0,0 +1,76 @@
+/*
+ * 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.seatunnel.app.domain.response;
+
+import io.swagger.annotations.ApiModel;
+
+import java.util.List;
+
+@ApiModel(value = "pageInfo", description = "page info")
+@SuppressWarnings("MagicNumber")
+public class PageInfo<T> {
+    private List<T> data;
+    private Integer totalCount = 0;
+    private Integer totalPage = 0;
+    private Integer pageNo = 1;
+    private Integer pageSize = 20;
+
+    public List<T> getData() {
+        return data;
+    }
+
+    public void setData(List<T> data) {
+        this.data = data;
+    }
+
+    public Integer getTotalCount() {
+        return totalCount;
+    }
+
+    public void setTotalCount(Integer totalCount) {
+        this.totalCount = totalCount;
+
+        if (pageSize == null || pageSize == 0) {
+            pageSize = 20;
+        }
+        if (this.totalCount % this.pageSize == 0) {
+            this.totalPage = this.totalCount / this.pageSize == 0 ? 1 : this.totalCount / this.pageSize;
+        }
+        this.totalPage = this.totalCount / this.pageSize + 1;

Review Comment:
   > Double counting `totalPage`?
   
   already fix



-- 
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-unsubscribe@seatunnel.apache.org

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