Package sonia.scm

Interface Manager<T extends ModelObject>

Type Parameters:
T - type of the model object
All Superinterfaces:
AutoCloseable, Closeable, HandlerBase<T>, Initable, LastModifiedAware
All Known Subinterfaces:
GroupManager, RepositoryManager, RepositoryRoleManager, TypeManager<T,H>, UserManager
All Known Implementing Classes:
AbstractGroupManager, AbstractRepositoryManager, AbstractRepositoryRoleManager, AbstractUserManager, GroupManagerDecorator, ManagerDecorator, RepositoryManagerDecorator, UserManagerDecorator

public interface Manager<T extends ModelObject> extends HandlerBase<T>, LastModifiedAware
Base interface for all manager classes.
  • Method Details

    • refresh

      void refresh(T object)
      Reloads an object from store and overwrites all changes.
      Parameters:
      object - to refresh
      Throws:
      NotFoundException
    • get

      T get(String id)
      Returns the object with the given id.
      Parameters:
      id - of the object
      Returns:
      object with the given id
    • getAll

      Collection<T> getAll()
      Returns a Collection of all objects in the store.
    • getAll

      default Collection<T> getAll(Predicate<T> filter)
      Returns all object of the store unsorted
      Parameters:
      filter - to filter the returned objects
      Returns:
      all object of the store sorted by the given Comparator
      Since:
      3.1.0
    • getAll

      Collection<T> getAll(Predicate<T> filter, Comparator<T> comparator)
      Returns all object of the store sorted by the given Comparator
      Parameters:
      filter - to filter the returned objects
      comparator - to sort the returned objects (may be null if no sorting is needed)
      Returns:
      all object of the store sorted by the given Comparator
      Since:
      1.4
    • getAll

      Collection<T> getAll(int start, int limit)
      Returns objects from the store which are starts at the given start parameter. The objects returned are limited by the limit parameter.
      Parameters:
      start - parameter
      limit - parameter
      Returns:
      objects from the store which are starts at the given start parameter
      Since:
      1.4
    • getAll

      Collection<T> getAll(Comparator<T> comparator, int start, int limit)
      Returns objects from the store which are starts at the given start parameter sorted by the given Comparator. The objects returned are limited by the limit parameter.
      Parameters:
      comparator - to sort the returned objects
      start - parameter
      limit - parameter
      Returns:
      objects from the store which are starts at the given start parameter
      Since:
      1.4
    • getPage

      default PageResult<T> getPage(Predicate<T> filter, Comparator<T> comparator, int pageNumber, int pageSize)
      Returns objects from the store divided into pages with the given page size for the given page number (zero based) and sorted by the given Comparator.

      This default implementation reads all items, first, so you might want to adapt this whenever reading is expensive!

      Parameters:
      filter - to filter returned objects
      comparator - to sort the returned objects
      pageNumber - the number of the page to be returned (zero based)
      pageSize - the size of the pages
      Returns:
      PageResult with the objects from the store for the requested page. If the requested page number exceeds the existing pages, an empty page result is returned.
      Since:
      2.0