public static Map<String, Serializable> getTransformLinkProperties( UriInfo uriInfo, Query query, QueryResponse response, String scheme, String host, Integer port ) { Map<String, Serializable> properties = new HashMap<String, Serializable>(); UriBuilder uriBuilder = uriInfo.getRequestUriBuilder(); uriBuilder = updateURLWithPlatformValues( uriBuilder, scheme, host, port ); String selfLink = uriBuilder.toTemplate(); properties.put( SearchConstants.SELF_LINK_REL, selfLink ); LOGGER.debug( "Adding self link parameter[{}] with value [{}] to transform properties to be sent to result transformer", SearchConstants.SELF_LINK_REL, selfLink ); int startIndex = query.getStartIndex(); int pageSize = query.getPageSize(); long totalCount = response.getHits(); if ( startIndex + pageSize <= totalCount ) { String template = uriBuilder.replaceQueryParam( SearchConstants.STARTINDEX_PARAMETER, String.valueOf( startIndex + pageSize ) ).toTemplate(); properties.put( SearchConstants.NEXT_LINK_REL, template ); LOGGER.debug( "Adding next link parameter[{}] with value [{}] to transform properties to be sent to result transformer", SearchConstants.NEXT_LINK_REL, template ); } if ( startIndex > 1 ) { String template = uriBuilder.replaceQueryParam( SearchConstants.STARTINDEX_PARAMETER, String.valueOf( Math.max( 1, startIndex - pageSize ) ) ).toTemplate(); properties.put( SearchConstants.PREV_LINK_REL, template ); LOGGER.debug( "Adding previous link parameter[{}] with value [{}] to transform properties to be sent to result transformer", SearchConstants.PREV_LINK_REL, template ); } return properties; }