Package sonia.scm

Class ManagerDecorator<T extends ModelObject>

java.lang.Object
sonia.scm.ManagerDecorator<T>
Type Parameters:
T - model type
All Implemented Interfaces:
Closeable, AutoCloseable, HandlerBase<T>, Initable, LastModifiedAware, Manager<T>
Direct Known Subclasses:
GroupManagerDecorator, RepositoryManagerDecorator, UserManagerDecorator

public class ManagerDecorator<T extends ModelObject> extends Object implements Manager<T>
Basic decorator for manager classes.
Since:
1.23
  • Constructor Details

    • ManagerDecorator

      public ManagerDecorator(Manager<T> decorated)
  • Method Details

    • close

      public void close() throws IOException
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Throws:
      IOException
    • create

      public T create(T object)
      Description copied from interface: HandlerBase
      Persists a new object.
      Specified by:
      create in interface HandlerBase<T extends ModelObject>
    • delete

      public void delete(T object)
      Description copied from interface: HandlerBase
      Removes a persistent object.
      Specified by:
      delete in interface HandlerBase<T extends ModelObject>
    • init

      public void init(SCMContextProvider context)
      Description copied from interface: Initable
      This method is called when the SCM manager is started.
      Specified by:
      init in interface Initable
      Parameters:
      context - - the context provider of the SCM-Manager
    • modify

      public void modify(T object)
      Description copied from interface: HandlerBase
      Modifies a persistent object.
      Specified by:
      modify in interface HandlerBase<T extends ModelObject>
    • refresh

      public void refresh(T object)
      Description copied from interface: Manager
      Reloads an object from store and overwrites all changes.
      Specified by:
      refresh in interface Manager<T extends ModelObject>
      Parameters:
      object - to refresh
    • get

      public T get(String id)
      Description copied from interface: Manager
      Returns the object with the given id.
      Specified by:
      get in interface Manager<T extends ModelObject>
      Parameters:
      id - of the object
      Returns:
      object with the given id
    • getAll

      public Collection<T> getAll()
      Description copied from interface: Manager
      Returns a Collection of all objects in the store.
      Specified by:
      getAll in interface Manager<T extends ModelObject>
    • getAll

      public Collection<T> getAll(Predicate<T> filter, Comparator<T> comparator)
      Description copied from interface: Manager
      Returns all object of the store sorted by the given Comparator
      Specified by:
      getAll in interface Manager<T extends ModelObject>
      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
    • getAll

      public Collection<T> getAll(int start, int limit)
      Description copied from interface: Manager
      Returns objects from the store which are starts at the given start parameter. The objects returned are limited by the limit parameter.
      Specified by:
      getAll in interface Manager<T extends ModelObject>
      Parameters:
      start - parameter
      limit - parameter
      Returns:
      objects from the store which are starts at the given start parameter
    • getAll

      public Collection<T> getAll(Comparator<T> comparator, int start, int limit)
      Description copied from interface: Manager
      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.
      Specified by:
      getAll in interface Manager<T extends ModelObject>
      Parameters:
      comparator - to sort the returned objects
      start - parameter
      limit - parameter
      Returns:
      objects from the store which are starts at the given start parameter
    • getLastModified

      public Long getLastModified()
      Description copied from interface: LastModifiedAware
      Returns a timestamp of the last modified date.
      Specified by:
      getLastModified in interface LastModifiedAware