OwnerDao.java 2.21 KB
Newer Older
1 2 3 4 5 6
package at.ac.tuwien.sepm.assignment.individual.persistence;

import at.ac.tuwien.sepm.assignment.individual.entity.Owner;
import at.ac.tuwien.sepm.assignment.individual.exception.NotFoundException;
import org.springframework.dao.DataAccessException;

7 8
import java.util.List;
import java.util.Map;
9

10 11 12 13 14 15 16 17 18 19
public interface OwnerDao {

    /**
     * @param id of the owner to find.
     * @return the owner with the specified id.
     * @throws DataAccessException will be thrown if something goes wrong during the database access.
     * @throws NotFoundException   will be thrown if the owner could not be found in the database.
     */
    Owner findOneById(Long id);

20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
    /**
     * @return a list of all owners in the system
     * @throws NotFoundException   will be thrown if no owners are present in the database
     * @throws DataAccessException will be thrown if something goes wrong during the database access
     */
    List<Owner> getAll() throws NotFoundException;

    /**
     * @param filters to use for filtering the owners
     * @return a list of all owners that fill the criteria
     * @throws NotFoundException wil be thrown if no owners fill the criteria
     * @throws DataAccessException will be thrown if something goes wrong during the database access
     */
    List<Owner> getFiltered(Map<String, String> filters) throws NotFoundException;

35 36
    /**
     * @param owner that specifies the owner to add
37
     * @return the newly created owner
38 39 40 41
     * @throws DataAccessException will be thrown if something goes wrong during the database access.
     */
    Owner addOwner(Owner owner);

42 43 44 45 46 47
    /**
     * @param owner that specifies the new owner values alongside with the id of the owner to update
     * @return the updated owner
     * @throws DataAccessException will be thrown if something goes wrong during the database access.
     */
    Owner updateOwner(Owner owner) throws DataAccessException;
48 49 50 51 52 53 54

    /**
     * @param id of the owner to delete
     * @throws DataAccessException will be thrown if something goes wrong during the database access.
     * @throws NotFoundException   will be thrown if the owner could not be found in the database.
     */
    void deleteOwner(Long id) throws DataAccessException, NotFoundException;
55
}