aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/missioncontrol/dao/OperationDAO.java
blob: e496898521745488f61ae6541e44274984ddb980 (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
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.Operation;
import at.ac.tuwien.sepm.assignment.groupphase.missioncontrol.dto.Operation.Status;
import java.util.EnumSet;
import java.util.Set;

public interface OperationDAO {

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

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

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

    /**
     * Get all stored operations with matching status.
     *
     * @param statuses set containing all statuses that should be matched
     * @return list containing all matched operations
     * @throws PersistenceException if loading the stored operations failed
     */
    Set<Operation> list(EnumSet<Status> statuses) throws PersistenceException;
}