Source:
public Response applicationsGet(String user, Integer limit, Integer offset, String accept, String ifNoneMatch, String appTenantDomain) { String givenUser = user; if (user == null || StringUtils.isEmpty(user)) { user = RestApiUtil.getLoggedInUsername(); } limit = limit != null ? limit : RestApiConstants.PAGINATION_LIMIT_DEFAULT; offset = offset != null ? offset : RestApiConstants.PAGINATION_OFFSET_DEFAULT; ApplicationListDTO applicationListDTO; try { Application[] allMatchedApps; boolean migrationMode = Boolean.getBoolean(RestApiConstants.MIGRATION_MODE); if (!migrationMode) { if (!MultitenantUtils.getTenantDomain(user).equals(RestApiUtil.getLoggedInUserTenantDomain())) { String errorMsg = "User " + user + " is not available for the current tenant domain"; log.error(errorMsg); return Response.status(Response.Status.FORBIDDEN).entity(errorMsg).build(); } APIConsumer apiConsumer = APIManagerFactory.getInstance().getAPIConsumer(user); if (givenUser == null || StringUtils.isEmpty(givenUser)) { APIAdmin apiAdmin = new APIAdminImpl(); int tenantId = APIUtil.getTenantId(user); allMatchedApps = apiAdmin.getApplicationsByTenantIdWithPagination(tenantId, 0, limit, "", "", ApplicationMappingUtil.getApplicationSortByField("name"), RestApiConstants.DEFAULT_SORT_ORDER).toArray(new Application[0]); } else { allMatchedApps = apiConsumer.getApplicationsByOwner(user); } } else { if (StringUtils.isEmpty(appTenantDomain)) { appTenantDomain = MultitenantUtils.getTenantDomain(user); } RestApiUtil.handleMigrationSpecificPermissionViolations(appTenantDomain, RestApiUtil.getLoggedInUsername()); APIAdmin apiAdmin = new APIAdminImpl(); allMatchedApps = apiAdmin.getAllApplicationsOfTenantForMigration(appTenantDomain); } applicationListDTO = ApplicationMappingUtil.fromApplicationsToDTO(allMatchedApps, limit, offset); ApplicationMappingUtil.setPaginationParams(applicationListDTO, limit, offset, allMatchedApps.length); return Response.ok().entity(applicationListDTO).build(); } catch (APIManagementException e) { RestApiUtil.handleInternalServerError("Error while retrieving applications of the user " + user, e, log); } return null; }

Target:
public Response applicationsGet(String user, Integer limit, Integer offset, String accept, String ifNoneMatch, String appTenantDomain) { String givenUser = user; if (user == null || StringUtils.isEmpty(user)) { user = RestApiUtil.getLoggedInUsername(); } limit = limit != null ? limit : RestApiConstants.PAGINATION_LIMIT_DEFAULT; offset = offset != null ? offset : RestApiConstants.PAGINATION_OFFSET_DEFAULT; ApplicationListDTO applicationListDTO; try { Application[] allMatchedApps; boolean migrationMode = Boolean.getBoolean(RestApiConstants.MIGRATION_MODE); if (!migrationMode) { if (!MultitenantUtils.getTenantDomain(user).equals(RestApiUtil.getLoggedInUserTenantDomain())) { String errorMsg = "User " + user + " is not available for the current tenant domain"; log.error(errorMsg); return Response.status(Response.Status.FORBIDDEN).entity(errorMsg).build(); } APIConsumer apiConsumer = APIManagerFactory.getInstance().getAPIConsumer(user); if (givenUser == null || StringUtils.isEmpty(givenUser)) { APIAdmin apiAdmin = new APIAdminImpl(); int tenantId = APIUtil.getTenantId(user); allMatchedApps = apiAdmin.getApplicationsByTenantIdWithPagination(tenantId, 0, limit, "", "", APIConstants.APPLICATION_NAME, RestApiConstants.DEFAULT_SORT_ORDER).toArray(new Application[0]); } else { allMatchedApps = apiConsumer.getApplicationsByOwner(user); } } else { if (StringUtils.isEmpty(appTenantDomain)) { appTenantDomain = MultitenantUtils.getTenantDomain(user); } RestApiUtil.handleMigrationSpecificPermissionViolations(appTenantDomain, RestApiUtil.getLoggedInUsername()); APIAdmin apiAdmin = new APIAdminImpl(); allMatchedApps = apiAdmin.getAllApplicationsOfTenantForMigration(appTenantDomain); } applicationListDTO = ApplicationMappingUtil.fromApplicationsToDTO(allMatchedApps, limit, offset); ApplicationMappingUtil.setPaginationParams(applicationListDTO, limit, offset, allMatchedApps.length); return Response.ok().entity(applicationListDTO).build(); } catch (APIManagementException e) { RestApiUtil.handleInternalServerError("Error while retrieving applications of the user " + user, e, log); } return null; }