Skip to content

Commit

Permalink
OP-11496 : Added Maping URL for pagination APIs in dashboard, platfor…
Browse files Browse the repository at this point in the history
…m and SAPOR (#120) (#123)

* OP-11496 : Added Maping URL for pagination APIs in dashboard, platform and SAPOR

* OP-11496 : Updated service class queries

* OP-11496 : Modified code

* OP-11496 : Modified code
  • Loading branch information
sriharshakancharla authored Jan 28, 2022
1 parent 39663ef commit 527a015
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,16 +60,20 @@ class OpsmxDashboardController {
@ApiOperation(value = "Endpoint for dashboard rest services")
@RequestMapping(value = "/{version}/{type}", method = RequestMethod.GET)
Object getDashboardResponse1(@PathVariable("version") String version,
@PathVariable("type") String type, HttpServletRequest httpServletRequest) {
@PathVariable("type") String type,
@RequestParam(value = "datasourceType", required = false) String datasourceType,
@RequestParam(value = "pageNo", required = false) Integer pageNo,
@RequestParam(value = "pageLimit", required = false) Integer pageLimit,
@RequestParam(value = "search", required = false) String search, HttpServletRequest httpServletRequest) {

Object response = null
String path = httpServletRequest.getRequestURI()

if (CacheUtil.isRegisteredCachingEndpoint(path)) {
DashboardCachingService dashboardCachingService = dashboardCachingServiceBeanFactory.getBean(path)
response = handleCaching(httpServletRequest, version, type, dashboardCachingService)
response = handleCaching(httpServletRequest, version, type, datasourceType, pageNo, pageLimit, search, dashboardCachingService)
} else {
response = opsmxDashboardService.getDashboardResponse1(version, type)
response = opsmxDashboardService.getDashboardResponse1(version, type, datasourceType, pageNo, pageLimit, search)
}

return response
Expand All @@ -79,6 +83,10 @@ class OpsmxDashboardController {
HttpServletRequest httpServletRequest,
String version,
String type,
String datasourceType,
Integer pageNo,
Integer pageLimit,
String search,
DashboardCachingService dashboardCachingService) {

String userName = httpServletRequest.getUserPrincipal().getName()
Expand All @@ -87,7 +95,7 @@ class OpsmxDashboardController {
if (dashboardCachingService.isCacheNotEmpty(userName)) {
response = dashboardCachingService.fetchResponseFromCache(userName)
} else {
response = opsmxDashboardService.getDashboardResponse1(version, type)
response = opsmxDashboardService.getDashboardResponse1(version, type, datasourceType, pageNo, pageLimit, search)
dashboardCachingService.cacheResponse(response, userName)
}
return response
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,11 @@ interface OpsmxDashboardService {

@GET("/dashboardservice/{version}/{type}")
Object getDashboardResponse1(@Path('version') String version,
@Path('type') String type)
@Path('type') String type,
@Query("datasourceType") String datasourceType,
@Query("pageNo") Integer pageNo,
@Query("pageLimit") Integer pageLimit,
@Query("search") String search)

@GET("/dashboardservice/{version}/{type}/{source}")
Object getDashboardResponse(@Path('version') String version,
Expand Down

0 comments on commit 527a015

Please sign in to comment.