Class BaseRsqlCrudEntityService<P>

  • Type Parameters:
    P - The business domain type
    All Implemented Interfaces:
    CrudEntityService<P>, RsqlCrudEntityService<P>

    public class BaseRsqlCrudEntityService<P>
    extends BaseCrudEntityService<P>
    implements RsqlCrudEntityService<P>
    Real-world service implementations of RsqlCrudEntityService can extend from this class as a convenience to inherit CRUD behavior for a particular business domain type. By default, this class in turn defers to RsqlCrudEntityHelper in order to allow easier refactoring of core functionality.

    If a service implementation spans several repository types, then it is recommended to inject the RsqlCrudEntityHelper rather than extend this class.

    Author:
    Nathan Moore (nathandmoore)
    • Method Detail

      • readAll

        public List<P> readAll​(@NonNull
                               cz.jirutka.rsql.parser.ast.Node filters,
                               org.springframework.data.domain.Sort sort,
                               ContextInfo context)
        Description copied from interface: RsqlCrudEntityService
        Retrieve all domain instances using a structured query string to drive the query criteria. The filters string is parsed by an internal implementation and the result is added to the query before executing the fetch against the persistence store. See FilterParser for more information.

        This version also accepts a formatted sort string that declares the sorting characteristics for the query. See SortParser for more information.

        Specified by:
        readAll in interface RsqlCrudEntityService<P>
        Parameters:
        filters - the RSQL Node used to restrict result, must not be null
        sort - The string containing the structured list of sorts to apply
        context - Request context information around sandbox and multitenant state
        Returns:
        The list of narrowed, sorted entities
      • readAll

        public List<P> readAll​(@NonNull
                               cz.jirutka.rsql.parser.ast.Node filters,
                               ContextInfo context)
        Description copied from interface: RsqlCrudEntityService
        Retrieve all domain instances using a structured query string to drive the query criteria. The filters string is parsed by an internal implementation and the result is added to the query before executing the fetch against the persistence store. See FilterParser for more information.
        Specified by:
        readAll in interface RsqlCrudEntityService<P>
        Parameters:
        filters - the RSQL Node used to restrict result, must not be null
        context - Request context information around sandbox and multitenant state
        Returns:
        The list of narrowed, sorted entities
      • readAll

        public org.springframework.data.domain.Page<P> readAll​(@NonNull
                                                               cz.jirutka.rsql.parser.ast.Node filters,
                                                               org.springframework.data.domain.Sort sort,
                                                               @NonNull
                                                               org.springframework.data.domain.Pageable pageable,
                                                               ContextInfo context)
        Description copied from interface: RsqlCrudEntityService
        Retrieve all domain instances using a structured query string to drive the query criteria. The filters string is parsed by an internal implementation and the result is added to the query before executing the fetch against the persistence store. See FilterParser for more information.

        This version also accepts a Sort to apply to the result set

        Specified by:
        readAll in interface RsqlCrudEntityService<P>
        Parameters:
        filters - the RSQL Node used to restrict result, must not be null
        sort - sort to apply to the query
        pageable - may be Pageable.unpaged(), must not be null.
        context - Request context information around sandbox and multitenant state
        Returns:
        The subset (page) of narrowed entities
      • readAll

        public org.springframework.data.domain.Page<P> readAll​(@NonNull
                                                               cz.jirutka.rsql.parser.ast.Node filters,
                                                               @NonNull
                                                               org.springframework.data.domain.Pageable pageable,
                                                               ContextInfo context)
        Description copied from interface: RsqlCrudEntityService
        Retrieve all domain instances using a structured query string to drive the query criteria. The filters string is parsed by an internal implementation and the result is added to the query before executing the fetch against the persistence store. See FilterParser for more information.
        Specified by:
        readAll in interface RsqlCrudEntityService<P>
        Parameters:
        filters - the RSQL Node used to restrict result, must not be null
        pageable - may be Pageable.unpaged(), must not be null.
        context - Request context information around sandbox and multitenant state
        Returns:
        The subset (page) of narrowed entities