Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix - Pagination Error for Gate Import #219

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -145,21 +145,19 @@ class GateQueryService(
return emptyList()
}

var pageStartAfter: String? = null
var page = 0
val validContent = mutableListOf<LegalEntityGateInputResponse>()
var invalidEntries = 0

do {
val pageResponse = gateClient.legalEntities().getLegalEntitiesByExternalIds(
externalIds = externalIds,
paginationRequest = PaginationRequest(0, bridgeConfigProperties.queryPageSize)
paginationRequest = PaginationRequest(page, bridgeConfigProperties.queryPageSize)
)
//pageStartAfter = pageResponse.nextStartAfter
page++
validContent.addAll(pageResponse.content)
invalidEntries += 0 //pageResponse.invalidEntries //TODO Needs to be changed according to the removal of SaaS
} while (pageStartAfter != null)
} while (pageResponse.content.isNotEmpty())

logger.info { "Gate returned ${validContent.size} valid legal entities, $invalidEntries were invalid" }
logger.info { "Gate returned ${validContent.size} valid legal entities" }
return validContent
}

Expand All @@ -168,21 +166,19 @@ class GateQueryService(
return emptyList()
}

var pageStartAfter: String? = null
var page = 0
val validContent = mutableListOf<SiteGateInputResponse>()
var invalidEntries = 0

do {
val pageResponse = gateClient.sites().getSitesByExternalIds(
externalIds = externalIds,
paginationRequest = PaginationRequest(0, bridgeConfigProperties.queryPageSize)
paginationRequest = PaginationRequest(page, bridgeConfigProperties.queryPageSize)
)
//pageStartAfter = pageResponse.nextStartAfter
validContent.addAll(pageResponse.content) //TODO Needs to be changed according to the removal of SaaS
invalidEntries += 0//pageResponse.invalidEntries
} while (pageStartAfter != null)
page++
validContent.addAll(pageResponse.content)
} while (pageResponse.content.isNotEmpty())

logger.info { "Gate returned ${validContent.size} valid sites, $invalidEntries were invalid" }
logger.info { "Gate returned ${validContent.size} valid sites" }
return validContent
}

Expand All @@ -191,21 +187,19 @@ class GateQueryService(
return emptyList()
}

var pageStartAfter: String? = null
var page = 0
val validContent = mutableListOf<AddressGateInputResponse>()
var invalidEntries = 0

do {
val pageResponse = gateClient.addresses().getAddressesByExternalIds(
externalIds = externalIds,
paginationRequest = PaginationRequest(0, bridgeConfigProperties.queryPageSize)
paginationRequest = PaginationRequest(page, bridgeConfigProperties.queryPageSize)
)
//pageStartAfter = pageResponse.nextStartAfter
page++
validContent.addAll(pageResponse.content)
invalidEntries += 0 //TODO Needs to be changed according to the removal of SaaS
} while (pageStartAfter != null)
} while (pageResponse.content.isNotEmpty())

logger.info { "Gate returned ${validContent.size} valid addresses, $invalidEntries were invalid" }
logger.info { "Gate returned ${validContent.size} valid addresses" }
return validContent
}

Expand Down