HorseDao.java 1.71 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.Horse;
import at.ac.tuwien.sepm.assignment.individual.exception.NotFoundException;
import org.springframework.dao.DataAccessException;

7 8
import java.io.IOException;

9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
public interface HorseDao {

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

    /**
     * @param horse that specifies the horse to add
     * @return the newly created horse
     * @throws DataAccessException will be thrown if something goes wrong during the database access.
     */
    Horse addHorse(Horse horse);
25 26 27 28

    /**
     * @param horse that specifies the new horse values alongside with the id of the horse to update
     * @return the updated horse
29 30 31 32 33 34 35 36 37 38
     * @throws DataAccessException will be thrown if something goes wrong during the database access.
     * @throws IOException         will be thrown if the old horse image could not be deleted
     */
    Horse updateHorse(Horse horse) throws DataAccessException, IOException;

    /**
     * @param id of the horse to delete
     * @throws DataAccessException will be thrown if something goes wrong during the database access.
     * @throws NotFoundException   will be thrown if the horse could not be found in the database.
     * @throws IOException         will be thrown if the horse image could not be deleted
39
     */
40
    void deleteHorse(Long id) throws DataAccessException, NotFoundException, IOException;
41
}