2021-01-07 11:34:56 +07:00

72 lines
1.3 KiB
Java

package com.jasamedika.medifirst2000.service;
import java.util.List;
import java.util.Map;
import org.springframework.orm.jpa.JpaSystemException;
import com.jasamedika.medifirst2000.exception.ServiceVOException;
/**
* View Object service
*
* @param <T>
* Model
* @param <V>
* View Object
* @param <K>
* Key
* @author Roberto
*/
public interface BaseVoService<T, V, K> {
/**
* Add model from VO
*
* @param vo
* @return
*/
public V add(V vo) throws JpaSystemException, ServiceVOException;
/**
* Update model from vo
*
* @param vo
* @return
*/
public V update(V vo) throws JpaSystemException, ServiceVOException;
/**
* Delete model by primary key
*
* @param key
* @return
*/
public Boolean delete(K key) throws JpaSystemException;
/**
* Find by Id
*
* @param key
* primary key
* @return
*/
public V findById(K key) throws JpaSystemException;
/**
* Find all model to vo
*
* @return
*/
public List<V> findAll() throws JpaSystemException;
/**
* Find all model to vo by page and limit and sort and dir parameter
*
* @return
*/
public Map<String, Object> findAllWithPageAndLimitAndSortByAndDirectionParameter(
Integer page, Integer limit, String sort, String dir);
}