Class RestSearchServiceImpl

java.lang.Object
ch.tocco.nice2.rest.entity.impl.search.RestSearchServiceImpl
All Implemented Interfaces:
RestSearchService

@Component public class RestSearchServiceImpl extends Object implements RestSearchService
  • Constructor Details

  • Method Details

    • buildSearchRequestFromUri

      public SearchRequest.Builder buildSearchRequestFromUri(String modelName, jakarta.ws.rs.core.UriInfo uriInfo, @Nullable Set<String> allowedPaths)
      Description copied from interface: RestSearchService
      build a SearchRequest from arguments passed to the URI to search for entities
      Specified by:
      buildSearchRequestFromUri in interface RestSearchService
      Parameters:
      modelName - the model to build the request for
      uriInfo - the uri info
      allowedPaths - a set of paths, if this set is passed (e.g. != null) only paths in this set will be added
      Returns:
      a builder prefilled with the passed arguments
    • buildCountRequestFromUri

      public SearchRequest.Builder buildCountRequestFromUri(String modelName, jakarta.ws.rs.core.UriInfo uriInfo)
      Description copied from interface: RestSearchService
      build a SearchRequest from arguments passed to the URI to count entities
      Specified by:
      buildCountRequestFromUri in interface RestSearchService
      Parameters:
      modelName - the model to build the request for
      uriInfo - the uri info
      Returns:
      a builder prefilled with the passed arguments
    • buildAggregationRequestFromUri

      public SearchRequest.Builder buildAggregationRequestFromUri(String modelName, jakarta.ws.rs.core.UriInfo uriInfo)
      Description copied from interface: RestSearchService
      build a SearchRequest from arguments passed to the URI to execute an aggregate function
      Specified by:
      buildAggregationRequestFromUri in interface RestSearchService
      Parameters:
      modelName - the model to build the request for
      uriInfo - the uri info
      Returns:
      a builder prefilled with the passed arguments
    • buildSearchRequestFromBean

      public SearchRequest.Builder buildSearchRequestFromBean(String modelName, EntitySearchBean searchBean, @Nullable Set<String> allowedPaths)
      Description copied from interface: RestSearchService
      build a SearchRequest from a search bean to search entities
      Specified by:
      buildSearchRequestFromBean in interface RestSearchService
      Parameters:
      modelName - the model to build the request for
      searchBean - the search bean
      allowedPaths - a set of paths, if this set is passed (e.g. != null) only paths in this set will be added
      Returns:
      a builder prefilled with the passed arguments
    • buildCountRequestFromBean

      public SearchRequest.Builder buildCountRequestFromBean(String modelName, EntitySearchBean searchBean)
      Description copied from interface: RestSearchService
      build a SearchRequest from a search bean to count entities
      Specified by:
      buildCountRequestFromBean in interface RestSearchService
      Parameters:
      modelName - the model to build the request for
      searchBean - the search bean
      Returns:
      a builder prefilled with the passed arguments
    • buildAggregationRequestFromBean

      public SearchRequest.Builder buildAggregationRequestFromBean(String modelName, EntitySearchBean searchBean)
      Description copied from interface: RestSearchService
      build a SearchRequest from a search bean to execute an aggregate function
      Specified by:
      buildAggregationRequestFromBean in interface RestSearchService
      Parameters:
      modelName - the model to build the request for
      searchBean - the search bean
      Returns:
      a builder prefilled with the passed arguments
    • executeSearchRequest

      public SearchResult executeSearchRequest(SearchRequest searchRequest)
      Description copied from interface: RestSearchService
      execute a search but don't wrap result in bean yet
      Specified by:
      executeSearchRequest in interface RestSearchService
      Parameters:
      searchRequest - the search request
      Returns:
      the search result
    • executeSearchRequest

      public CollectionBean executeSearchRequest(SearchRequest searchRequest, jakarta.ws.rs.core.UriBuilder uriBuilder)
      Description copied from interface: RestSearchService
      execute a search
      Specified by:
      executeSearchRequest in interface RestSearchService
      Parameters:
      searchRequest - the search request
      uriBuilder - the uri builder used for paging
      Returns:
      the collection bean filled with the result
    • executeSearchRequestWithSelectors

      public CollectionBean executeSearchRequestWithSelectors(SearchRequest searchRequest, jakarta.ws.rs.core.UriBuilder uriBuilder)
      Description copied from interface: RestSearchService
      execute a path search request with selector support
      Specified by:
      executeSearchRequestWithSelectors in interface RestSearchService
      Parameters:
      searchRequest - the search request
      uriBuilder - the uri builder used for paging
      Returns:
      the collection bean filled with the result
    • createCollectionBean

      public CollectionBean createCollectionBean(SearchResult searchResult, jakarta.ws.rs.core.UriBuilder uriBuilder)
      Specified by:
      createCollectionBean in interface RestSearchService
    • executeAggregateRequest

      public <T> T executeAggregateRequest(SearchRequest searchRequest, AggregateFunction function, Function<Map<String, @Nullable Object>, T> beanFactory)
      Specified by:
      executeAggregateRequest in interface RestSearchService
      Parameters:
      beanFactory - creates the result bean from the aggregated values (field name to value)
    • executeCountRequest

      public CountBean executeCountRequest(SearchRequest searchRequest)
      Description copied from interface: RestSearchService
      execute a count
      Specified by:
      executeCountRequest in interface RestSearchService
      Parameters:
      searchRequest - the count request
      Returns:
      the count bean filled with the result
    • getPagination

      public Pagination getPagination(jakarta.ws.rs.core.UriInfo uriInfo)
      Description copied from interface: RestSearchService
      get pagination from uri info (offset and limit)
      Specified by:
      getPagination in interface RestSearchService
      Parameters:
      uriInfo - the uri info
      Returns:
      the pagination with the given offset and limit (or with the defaults)
    • setMaxLimit

      @Value("${rest.paging.maxLimit}") public void setMaxLimit(Integer maxLimit)
    • setDisableLimitCheck

      @Value("${rest.paging.disableLimitCheck}") public void setDisableLimitCheck(boolean disableLimitCheck)