You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@fineract.apache.org by "b0c1 (via GitHub)" <gi...@apache.org> on 2023/05/25 09:41:52 UTC

[GitHub] [fineract] b0c1 opened a new pull request, #3202: FINERACT-1926: Fineract Asset Externalization - GET Pagination

b0c1 opened a new pull request, #3202:
URL: https://github.com/apache/fineract/pull/3202

   - [x] Added Pagination to response
   - [x] Added limit and offset to the request
   
   ## Description
   
   Describe the changes made and why they were made.
   
   Ignore if these details are present on the associated [Apache Fineract JIRA ticket](https://github.com/apache/fineract/pull/1284).
   
   
   ## Checklist
   
   Please make sure these boxes are checked before submitting your pull request - thanks!
   
   - [ ] Write the commit message as per https://github.com/apache/fineract/#pull-requests
   
   - [ ] Acknowledge that we will not review PRs that are not passing the build _("green")_ - it is your responsibility to get a proposed PR to pass the build, not primarily the project's maintainers.
   
   - [ ] Create/update unit or integration tests for verifying the changes made.
   
   - [ ] Follow coding conventions at https://cwiki.apache.org/confluence/display/FINERACT/Coding+Conventions.
   
   - [ ] Add required Swagger annotation and update API documentation at fineract-provider/src/main/resources/static/legacy-docs/apiLive.htm with details of any API changes
   
   - [ ] Submission is not a "code dump".  (Large changes can be made "in repository" via a branch.  Ask on the developer mailing list for guidance, if required.)
   
   FYI our guidelines for code reviews are at https://cwiki.apache.org/confluence/display/FINERACT/Code+Review+Guide.
   


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

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


[GitHub] [fineract] adamsaghy closed pull request #3202: FINERACT-1926: Fineract Asset Externalization - GET Pagination

Posted by "adamsaghy (via GitHub)" <gi...@apache.org>.
adamsaghy closed pull request #3202: FINERACT-1926: Fineract Asset Externalization - GET Pagination
URL: https://github.com/apache/fineract/pull/3202


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

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


[GitHub] [fineract] galovics commented on a diff in pull request #3202: FINERACT-1926: Fineract Asset Externalization - GET Pagination

Posted by "galovics (via GitHub)" <gi...@apache.org>.
galovics commented on code in PR #3202:
URL: https://github.com/apache/fineract/pull/3202#discussion_r1206384084


##########
fineract-core/src/main/java/org/apache/fineract/infrastructure/core/service/Page.java:
##########
@@ -38,4 +38,8 @@ public int getTotalFilteredRecords() {
     public List<E> getPageItems() {
         return this.pageItems;
     }
+
+    public static <E> Page<E> convertFromSpringPage(final org.springframework.data.domain.Page<E> springPage) {

Review Comment:
   Let's remove this.



##########
fineract-investor/src/main/java/org/apache/fineract/investor/service/ExternalAssetOwnersReadServiceImpl.java:
##########
@@ -37,15 +37,27 @@ public class ExternalAssetOwnersReadServiceImpl implements ExternalAssetOwnersRe
     private final ExternalAssetOwnersTransferMapper mapper;
 
     @Override
-    public List<ExternalTransferData> retrieveTransferData(Long loanId, String externalLoanId, String transferExternalId) {
-        List<ExternalAssetOwnerTransfer> result = new ArrayList<>();
+    public Page<ExternalTransferData> retrieveTransferData(Long loanId, String externalLoanId, String transferExternalId, Integer offset,
+            Integer limit) {
+        org.springframework.data.domain.Page<ExternalAssetOwnerTransfer> result;

Review Comment:
   No need for qualified name.



##########
integration-tests/src/test/java/org/apache/fineract/integrationtests/investor/externalassetowner/InitiateExternalAssetOwnerTransferTest.java:
##########
@@ -114,17 +115,16 @@ public void saleActiveLoanToExternalAssetOwner() {
             assertEquals(responseMap.get("resourceExternalId"), transferExternalId);
 
             String retrieveResponse = externalAssetOwnerHelper.retrieveTransferByLoanId(loanID.longValue());
-            Type retrieveType = new TypeToken<List<Map<String, Object>>>() {}.getType();
-            List<Map<String, Object>> retrieveResponseMap = new Gson().fromJson(retrieveResponse, retrieveType);
-            assertEquals(1, retrieveResponseMap.size());
-            assertEquals(retrieveResponseMap.get(0).get("transferExternalId"), transferExternalId);
-            assertEquals(retrieveResponseMap.get(0).get("status"), "PENDING");
+            Type retrieveType = new TypeToken<Page<Map<String, Object>>>() {}.getType();
+            Page<Map<String, Object>> retrieveResponseMap = new Gson().fromJson(retrieveResponse, retrieveType);

Review Comment:
   I think we need an additional test case to verify that paging is working. Don't you think?



##########
fineract-investor/src/main/java/org/apache/fineract/investor/service/ExternalAssetOwnersReadServiceImpl.java:
##########
@@ -37,15 +37,27 @@ public class ExternalAssetOwnersReadServiceImpl implements ExternalAssetOwnersRe
     private final ExternalAssetOwnersTransferMapper mapper;
 
     @Override
-    public List<ExternalTransferData> retrieveTransferData(Long loanId, String externalLoanId, String transferExternalId) {
-        List<ExternalAssetOwnerTransfer> result = new ArrayList<>();
+    public Page<ExternalTransferData> retrieveTransferData(Long loanId, String externalLoanId, String transferExternalId, Integer offset,
+            Integer limit) {
+        org.springframework.data.domain.Page<ExternalAssetOwnerTransfer> result;
+        if (offset == null) {
+            offset = 0;
+        }
+        if (limit == null) {
+            limit = 100;
+        }
+        PageRequest pageRequest = PageRequest.of(offset, limit);
         if (loanId != null) {
-            result.addAll(externalAssetOwnerTransferRepository.findAllByLoanId(loanId));
+            result = externalAssetOwnerTransferRepository.findAllByLoanId(loanId, pageRequest);

Review Comment:
   I think for all these repository calls where we use pageable we are missing a crucial thing, a consistent ordering of the result. Let's do an ID based ordering at least for the query to produce consistent results between runs.



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

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


[GitHub] [fineract] adamsaghy commented on pull request #3202: FINERACT-1926: Fineract Asset Externalization - GET Pagination

Posted by "adamsaghy (via GitHub)" <gi...@apache.org>.
adamsaghy commented on PR #3202:
URL: https://github.com/apache/fineract/pull/3202#issuecomment-1567954624

   @b0c1 Kindly asking you to check the failing tests!


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

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


[GitHub] [fineract] adamsaghy merged pull request #3202: FINERACT-1926: Fineract Asset Externalization - GET Pagination

Posted by "adamsaghy (via GitHub)" <gi...@apache.org>.
adamsaghy merged PR #3202:
URL: https://github.com/apache/fineract/pull/3202


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

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