blob: f8e303d1cd4cbe3df1c2b894cb0ad594e4513750 (
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
|
package at.ac.tuwien.sepm.assignment.groupphase.missioncontrol.service;
import at.ac.tuwien.sepm.assignment.groupphase.exception.InvalidVehicleException;
import at.ac.tuwien.sepm.assignment.groupphase.exception.ServiceException;
import at.ac.tuwien.sepm.assignment.groupphase.missioncontrol.dto.Vehicle;
import at.ac.tuwien.sepm.assignment.groupphase.missioncontrol.dto.Vehicle.Status;
import java.util.EnumSet;
import java.util.Set;
public interface VehicleService {
/**
* Add given vehicle to the store.
*
* @param vehicle that should be added to the store
* @return the id that was assigned
* @throws InvalidVehicleException if the vehicle is invalid
* @throws ServiceException if the vehicle could not be persisted
*/
long add(Vehicle vehicle) throws InvalidVehicleException, ServiceException;
/**
* Update the given vehicle.
*
* @param vehicle that should be updated
* @return the updated vehicle
* @throws InvalidVehicleException if the vehicle is invalid
* @throws ServiceException if the updated vehicle could not be persisted
*/
Vehicle update(Vehicle vehicle) throws InvalidVehicleException, ServiceException;
/**
* Get all stored vehicles with matching status.
*
* @param statuses set containing all statuses that should be matched
* @return list containing all stored vehicles
* @throws ServiceException if loading the stored vehicles failed
*/
Set<Vehicle> list(EnumSet<Status> statuses) throws ServiceException;
/**
* Remove vehicle with the given id from the store.
*
* @param id of the vehicle that should be removed
* @throws InvalidVehicleException if given vehicle id is invalid or does not exist
* @throws ServiceException if the vehicle could not be removed from the store
*/
void remove(long id) throws InvalidVehicleException, ServiceException;
}
|