/**
* This file is part of xss-jpa.
*
* Copyright 2012 Sebastian Schmelzer
* http://xss.nu/
*
* This library 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 2.1 of the License, or (at your option) any later version.
*
* This library 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 library. If not, see .
*
*/
package nu.xss.jpa.dao;
import java.util.List;
import nu.xss.jpa.query.Pagination;
import nu.xss.jpa.query.Sort;
import nu.xss.jpa.query.filter.Filter;
/**
* The Interface Dao.
*
* @param
* the element type
* @param
* the key type
*/
public interface Dao {
/**
* Save.
*
* @param entity
* the entity
*/
void save(E entity);
/**
* Merge.
*
* @param entity
* the entity
*/
void merge(E entity);
/**
* Delete.
*
* @param entity
* the entity
*/
void delete(E entity);
/**
* Find by id.
*
* @param id
* the id
* @return the e
*/
E findById(K id);
/**
* Count.
*
* @return the int
*/
int count();
/**
* Count.
*
* @param filter
* the filter
* @return the int
*/
int count(Filter... filter);
/**
* Find all.
*
* @return the list
*/
List findAll();
/**
* Find all.
*
* @param sort
* the sort
* @return the list
*/
List findAll(Sort sort);
/**
* Find all.
*
* @param pagination
* the pagination
* @return the list
*/
List findAll(Pagination pagination);
/**
* Find all.
*
* @param sort
* the sort
* @param pagination
* the pagination
* @return the list
*/
List findAll(Sort sort, Pagination pagination);
/**
* Find all.
*
* @param filter
* the filter
* @return the list
*/
List findAll(Filter... filter);
/**
* Find all.
*
* @param sort
* the sort
* @param filter
* the filter
* @return the list
*/
List findAll(Sort sort, Filter... filter);
/**
* Find all.
*
* @param pagination
* the pagination
* @param filter
* the filter
* @return the list
*/
List findAll(Pagination pagination, Filter... filter);
/**
* Find all.
*
* @param sort
* the sort
* @param pagination
* the pagination
* @param filter
* the filter
* @return the list
*/
List findAll(Sort sort, Pagination pagination, Filter... filter);
}