/**
* This file is part of Faktotum.
*
*
* Faktotum is free software: you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation, either version 3 of
* the License, or (at your option) any later version.
*
* Faktotum is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with Faktotum.
*
* If not, see <http://www.gnu.org/licenses/>.
*/
package de.romankreisel.faktotum.dao;
import java.util.List;
import de.romankreisel.faktotum.datamodel.FaktotumEntity;
public interface Dao<E extends FaktotumEntity> {
/**
* Find an entity by its ID
*
* @param id
* The ID to search for
* @param searchedClass
* The class to be searched for
* @return The Entity
*/
public E findById(Long id, Class<E> searchedClass);
/**
* Get all entites of on type
*
* @param searchedClass
* the type to retrieve the entities for
* @return a list of all entities stored in the database for this type
*/
public List<E> getAll(Class<E> searchedClass);
/**
* Get the count of all entites of on type
*
* @param searchedClass
* the type to count the entities for
* @return the number of all entities stored in the database for this type
*/
public Long getCount(Class<E> searchedClass);
/**
* Merge an entity
*
* @param entity
* the entity to be merged
* @return the entity
*/
public E merge(E entity);
/**
* Persist an entity
*
* @param entity
* the entity to be persisted
*/
public void persist(E entity);
/**
* Remove an entity from the database
*
* @param entity
* to be removed
*/
public void remove(E entity);
}