orbeon-bluedb-integration/registration/registration-form/src/main/java/eu/mooseinc/dell/form/dao/base/Dao.java

68 lines
1.5 KiB
Java

/*********************************************************************************************************************************
* Autorskie Prawa Majątkowe - Moose Spółka z ograniczoną odpowiedzialnością
*
* Copyright 2017 Moose Spółka z ograniczoną odpowiedzialnością
********************************************************************************************************************************/
package eu.mooseinc.dell.form.dao.base;
import eu.mooseinc.dell.form.exception.ObjectNotFoundException;
import java.util.List;
/**
* Base dao
*/
public interface Dao<T> {
/**
* Store object in database and get its identifier.
*
* @param t object to store.
*
* @return stored object.
*/
T persist(T t);
/**
* Delete object from database with provided id.
*
* @param id object id.
*
* @throws ObjectNotFoundException object not found in database.
*/
void delete(long id) throws ObjectNotFoundException;
/**
* Delete object from database.
*
* @param t object to delete.
*/
void remove(T t);
/**
* Returns object with provided id. If there is no such object, it terurns {@code null}.
*
* @param id object id.
*
* @return object with provided id.
*/
T find(long id);
/**
* Returns object from database.
*
* @param id object id.
*
* @return object with provided id.
*
* @throws ObjectNotFoundException object not found in database.
*/
T get(long id) throws ObjectNotFoundException;
/**
* List of all objects in database
*
* @return list of objects.
*/
List<T> getAll();
}