blob: 42b23bb3913cab3343c2d582aeed833e95473c69 (
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
package at.ac.tuwien.sepm.assignment.groupphase.missioncontrol.service;
import at.ac.tuwien.sepm.assignment.groupphase.exception.InvalidOperationException;
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.Operation;
import at.ac.tuwien.sepm.assignment.groupphase.missioncontrol.dto.Operation.Status;
import at.ac.tuwien.sepm.assignment.groupphase.missioncontrol.dto.Vehicle;
import java.util.EnumSet;
import java.util.Set;
import java.util.SortedSet;
public interface OperationService {
/**
* Add given operation to the store.
*
* @param operation that should be added to the store
* @return the id that was assigned
* @throws InvalidOperationException if the operation is invalid
* @throws ServiceException if the operation could not be persisted
*/
long add(Operation operation) throws InvalidOperationException, ServiceException;
/**
* Request new vehicles to the given operation.
*
* @param operationId id of the operation that the vehicles should be send to
* @param vehicleIds the ids of the vehicles that should be send to the given operation
* @throws InvalidOperationException if the operationId is invalid or does not exist
* @throws InvalidVehicleException if one of the vehicle ids is invalid or does not exist
* @throws ServiceException if the vehicles could not be loaded or the operation could not be
* persisted
*/
void requestVehicles(long operationId, Set<Long> vehicleIds)
throws InvalidOperationException, InvalidVehicleException, ServiceException;
/**
* Completes the given operation with the specified status.
*
* @param operationId id of the operation that should be completed
* @param status of the completed operation, either {@link Status#COMPLETED} or {@link
* Status#CANCELLED}
* @throws InvalidOperationException if the operationId is invalid or does not exist
* @throws ServiceException if the operation could not be persisted
*/
void complete(long operationId, Status status)
throws InvalidOperationException, ServiceException;
/**
* Get all available vehicles, sorted by how well they fit to the given opCode, starting with
* the best fitting.
*
* @param opCode the operation code that is used to determine the ranking
* @return a sorted list containing all available vehicles
* @throws InvalidOperationException if the opCode is invalid
* @throws ServiceException if loading the stored vehicles failed
*/
SortedSet<Vehicle> rankVehicles(String opCode)
throws InvalidOperationException, ServiceException;
/**
* Get all stored operations with matching status.
*
* @param statuses set containing all statuses that should be matched
* @return list containing all matched operations
* @throws ServiceException if loading the stored operations failed
*/
Set<Operation> list(EnumSet<Status> statuses) throws ServiceException;
}
|