HorseService.java 1.7 KB
Newer Older
1 2 3 4
package at.ac.tuwien.sepm.assignment.individual.service;

import at.ac.tuwien.sepm.assignment.individual.entity.Horse;
import at.ac.tuwien.sepm.assignment.individual.exception.NotFoundException;
5 6
import at.ac.tuwien.sepm.assignment.individual.util.ValidationException;
import org.springframework.dao.DataAccessException;
7 8 9
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;
10 11 12 13 14 15 16 17 18 19 20 21

public interface HorseService {
    /**
     * @param id of the horse to find.
     * @return the horse with the specified id.
     * @throws RuntimeException  will be thrown if something goes wrong during data processing.
     * @throws NotFoundException will be thrown if the horse could not be found in the system.
     */
    Horse findOneById(Long id);

    /**
     * @param horse to add.
22 23 24
     * @return the new horse.
     * @throws ValidationException  will be thrown if something goes wrong during verification.
     * @throws DataAccessException will be thrown if the horse could not be saved in the database.
25 26
     */
    Horse addHorse(Horse horse);
27

28 29 30 31 32 33 34 35
    /**
     * @param horse that specifies the new horse values alongside with the id of the horse to update
     * @return the updated horse
     * @throws ValidationException  will be thrown if something goes wrong during verification.
     * @throws DataAccessException will be thrown if the horse could not be saved in the database.
     */
    Horse updateHorse(Horse horse);

36 37 38
    /**
     * @param img image to upload
     * @throws IOException will be thrown if something goes wrong with saving the file
39
     * @throws ValidationException will be thrown if the file is in the incorrect format
40 41
     */
    void saveImage(MultipartFile img) throws IOException;
42
}