aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/missioncontrol/dao/VehicleDAO.java
blob: 46d18533a8bfcb77fa7c9580cce47c9010bd7481 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
package at.ac.tuwien.sepm.assignment.groupphase.missioncontrol.dao;

import at.ac.tuwien.sepm.assignment.groupphase.exception.ElementNotFoundException;
import at.ac.tuwien.sepm.assignment.groupphase.exception.PersistenceException;
import at.ac.tuwien.sepm.assignment.groupphase.missioncontrol.dto.Vehicle;
import java.util.Set;

public interface VehicleDAO {

    /**
     * Persist the given vehicle.
     *
     * @param vehicle that should be stored
     * @return the id that was assigned
     * @throws PersistenceException if the vehicle could not be persisted
     */
    long add(Vehicle vehicle) throws PersistenceException;

    /**
     * Update the given vehicle.
     *
     * @param vehicle that should be updated
     * @throws ElementNotFoundException if no vehicle with the given id exists
     * @throws PersistenceException if the vehicle could not be updated
     */
    void update(Vehicle vehicle) throws ElementNotFoundException, PersistenceException;

    /**
     * Get all stored vehicles.
     *
     * @return list containing all stored vehicles
     * @throws PersistenceException if loading the stored vehicles failed
     */
    Set<Vehicle> list() throws PersistenceException;

    /**
     * Returns the vehicle with the given id.
     *
     * @param vehicleId id of the vehicle that should be returned
     * @return vehicle with the given id
     * @throws ElementNotFoundException if no vehicle with the given id exists
     * @throws PersistenceException if the vehicle could not be loaded
     */
    Vehicle get(long vehicleId) throws ElementNotFoundException, PersistenceException;

    /**
     * Remove vehicle with the given id from the store.
     *
     * @param id of the vehicle that should be removed
     * @throws ElementNotFoundException if no vehicle with the given id exists
     * @throws PersistenceException if the vehicle could not be removed
     */
    void remove(long id) throws ElementNotFoundException, PersistenceException;
}