Package sonia.scm

Interface GenericDAO<T>

Type Parameters:
T - type of object
All Superinterfaces:
CreationTimeAware, LastModifiedAware, TypedObject
All Known Subinterfaces:
GroupDAO, RepositoryDAO, RepositoryRoleDAO, UserDAO

public interface GenericDAO<T> extends LastModifiedAware, CreationTimeAware, TypedObject
Generic data access object. A DAO does not check the permission of the current user. A DAO should only be used by a Manager class.
Since:
1.14
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    add(T item)
    Persists a new item.
    boolean
    Returns true if the item with the specified id already exists in the backend.
    boolean
    contains(T item)
    Returns true if the item already exists in the backend.
    void
    delete(T item)
    Removes the specified item from the backend.
    get(String id)
    Returns the item by its id or returns null if no item with the specified id exists in the backend.
    Returns all items stored in the backend.
    void
    modify(T item)
    Updates an existing item.

    Methods inherited from interface sonia.scm.CreationTimeAware

    getCreationTime

    Methods inherited from interface sonia.scm.LastModifiedAware

    getLastModified

    Methods inherited from interface sonia.scm.TypedObject

    getType
  • Method Details

    • add

      void add(T item)
      Persists a new item.
      Parameters:
      item - item to persist
    • contains

      boolean contains(T item)
      Returns true if the item already exists in the backend.
      Parameters:
      item - item to check
    • contains

      boolean contains(String id)
      Returns true if the item with the specified id already exists in the backend.
      Parameters:
      id - id of the item to check
    • modify

      void modify(T item)
      Updates an existing item.
      Parameters:
      item - item to update
    • delete

      void delete(T item)
      Removes the specified item from the backend.
      Parameters:
      item - item to remove
    • get

      T get(String id)
      Returns the item by its id or returns null if no item with the specified id exists in the backend.
    • getAll

      Collection<T> getAll()
      Returns all items stored in the backend.