From bfb7f0ebd2c19b0fdd729de526e36794812c35cd Mon Sep 17 00:00:00 2001
From: Tharre <tharre3@gmail.com>
Date: Sun, 29 Apr 2018 00:56:09 +0200
Subject: Implement interfaces and the correspondant DTOs

---
 .../einsatzverwaltung/dao/EmployeeDAO.java         | 44 +++++++++++++
 .../einsatzverwaltung/dao/OperationDAO.java        | 48 ++++++++++++++
 .../einsatzverwaltung/dao/RegistrationDAO.java     | 27 ++++++++
 .../einsatzverwaltung/dao/VehicleDAO.java          | 44 +++++++++++++
 .../groupphase/einsatzverwaltung/dto/Employee.java | 51 +++++++++++++++
 .../einsatzverwaltung/dto/Operation.java           | 68 ++++++++++++++++++++
 .../einsatzverwaltung/dto/Registration.java        | 34 ++++++++++
 .../groupphase/einsatzverwaltung/dto/Vehicle.java  | 73 ++++++++++++++++++++++
 .../einsatzverwaltung/service/EmployeeService.java | 46 ++++++++++++++
 .../service/OperationService.java                  | 70 +++++++++++++++++++++
 .../service/RegistrationService.java               | 31 +++++++++
 .../einsatzverwaltung/service/VehicleService.java  | 49 +++++++++++++++
 .../exception/ElementNotFoundException.java        | 16 +++++
 .../exception/InvalidEmployeeException.java        | 16 +++++
 .../exception/InvalidOperationException.java       | 16 +++++
 .../exception/InvalidRegistrationException.java    | 16 +++++
 .../exception/InvalidVehicleException.java         | 16 +++++
 .../groupphase/exception/PersistenceException.java | 16 +++++
 .../groupphase/exception/ServiceException.java     | 16 +++++
 19 files changed, 697 insertions(+)
 create mode 100644 src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/dao/EmployeeDAO.java
 create mode 100644 src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/dao/OperationDAO.java
 create mode 100644 src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/dao/RegistrationDAO.java
 create mode 100644 src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/dao/VehicleDAO.java
 create mode 100644 src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/dto/Employee.java
 create mode 100644 src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/dto/Operation.java
 create mode 100644 src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/dto/Registration.java
 create mode 100644 src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/dto/Vehicle.java
 create mode 100644 src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/service/EmployeeService.java
 create mode 100644 src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/service/OperationService.java
 create mode 100644 src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/service/RegistrationService.java
 create mode 100644 src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/service/VehicleService.java
 create mode 100644 src/main/java/at/ac/tuwien/sepm/assignment/groupphase/exception/ElementNotFoundException.java
 create mode 100644 src/main/java/at/ac/tuwien/sepm/assignment/groupphase/exception/InvalidEmployeeException.java
 create mode 100644 src/main/java/at/ac/tuwien/sepm/assignment/groupphase/exception/InvalidOperationException.java
 create mode 100644 src/main/java/at/ac/tuwien/sepm/assignment/groupphase/exception/InvalidRegistrationException.java
 create mode 100644 src/main/java/at/ac/tuwien/sepm/assignment/groupphase/exception/InvalidVehicleException.java
 create mode 100644 src/main/java/at/ac/tuwien/sepm/assignment/groupphase/exception/PersistenceException.java
 create mode 100644 src/main/java/at/ac/tuwien/sepm/assignment/groupphase/exception/ServiceException.java

(limited to 'src/main/java')

diff --git a/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/dao/EmployeeDAO.java b/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/dao/EmployeeDAO.java
new file mode 100644
index 0000000..564ce7c
--- /dev/null
+++ b/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/dao/EmployeeDAO.java
@@ -0,0 +1,44 @@
+package at.ac.tuwien.sepm.assignment.groupphase.einsatzverwaltung.dao;
+
+import at.ac.tuwien.sepm.assignment.groupphase.einsatzverwaltung.dto.Employee;
+import at.ac.tuwien.sepm.assignment.groupphase.exception.ElementNotFoundException;
+import at.ac.tuwien.sepm.assignment.groupphase.exception.PersistenceException;
+import java.util.List;
+
+public interface EmployeeDAO {
+
+    /**
+     * Persist the given employee.
+     *
+     * @param employee that should be stored
+     * @return the id that was assigned
+     * @throws PersistenceException if the employee could not be persisted
+     */
+    long add(Employee employee) throws PersistenceException;
+
+    /**
+     * Update the given employee.
+     *
+     * @param employee that should be updated
+     * @throws ElementNotFoundException if no employee with the given id exists
+     * @throws PersistenceException if the employee could not be updated
+     */
+    void update(Employee employee) throws ElementNotFoundException, PersistenceException;
+
+    /**
+     * Get all stored employees.
+     *
+     * @return list containing all stored employees
+     * @throws PersistenceException if loading the stored employees failed
+     */
+    List<Employee> list() throws PersistenceException;
+
+    /**
+     * Remove employee with the given id from the store.
+     *
+     * @param id of the employee that should be removed
+     * @throws ElementNotFoundException if no employee with the given id exists
+     * @throws PersistenceException if the employee could not be removed
+     */
+    void remove(long id) throws ElementNotFoundException, PersistenceException;
+}
diff --git a/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/dao/OperationDAO.java b/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/dao/OperationDAO.java
new file mode 100644
index 0000000..7f28005
--- /dev/null
+++ b/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/dao/OperationDAO.java
@@ -0,0 +1,48 @@
+package at.ac.tuwien.sepm.assignment.groupphase.einsatzverwaltung.dao;
+
+import at.ac.tuwien.sepm.assignment.groupphase.einsatzverwaltung.dto.Operation;
+import at.ac.tuwien.sepm.assignment.groupphase.einsatzverwaltung.dto.Operation.Status;
+import at.ac.tuwien.sepm.assignment.groupphase.exception.ElementNotFoundException;
+import at.ac.tuwien.sepm.assignment.groupphase.exception.PersistenceException;
+import java.util.EnumSet;
+import java.util.List;
+
+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
+     */
+    List<Operation> list(EnumSet<Status> statuses) throws PersistenceException;
+}
diff --git a/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/dao/RegistrationDAO.java b/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/dao/RegistrationDAO.java
new file mode 100644
index 0000000..f2c461a
--- /dev/null
+++ b/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/dao/RegistrationDAO.java
@@ -0,0 +1,27 @@
+package at.ac.tuwien.sepm.assignment.groupphase.einsatzverwaltung.dao;
+
+import at.ac.tuwien.sepm.assignment.groupphase.einsatzverwaltung.dto.Registration;
+import at.ac.tuwien.sepm.assignment.groupphase.exception.ElementNotFoundException;
+import at.ac.tuwien.sepm.assignment.groupphase.exception.PersistenceException;
+
+public interface RegistrationDAO {
+
+    /**
+     * Persist the given registration.
+     *
+     * @param vehicleId the id of the target vehicle
+     * @param registration that should be stored
+     * @return the id that was assigned
+     * @throws PersistenceException if the registration could not be persisted
+     */
+    long add(long vehicleId, Registration registration) throws PersistenceException;
+
+    /**
+     * Make registration with the given id inactive.
+     *
+     * @param id of the registration that should be made inactive
+     * @throws ElementNotFoundException if no registration with the given id exists
+     * @throws PersistenceException if the registration could not be made inactive
+     */
+    void remove(long id) throws ElementNotFoundException, PersistenceException;
+}
diff --git a/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/dao/VehicleDAO.java b/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/dao/VehicleDAO.java
new file mode 100644
index 0000000..fe12952
--- /dev/null
+++ b/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/dao/VehicleDAO.java
@@ -0,0 +1,44 @@
+package at.ac.tuwien.sepm.assignment.groupphase.einsatzverwaltung.dao;
+
+import at.ac.tuwien.sepm.assignment.groupphase.einsatzverwaltung.dto.Vehicle;
+import at.ac.tuwien.sepm.assignment.groupphase.exception.ElementNotFoundException;
+import at.ac.tuwien.sepm.assignment.groupphase.exception.PersistenceException;
+import java.util.List;
+
+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
+     */
+    List<Vehicle> list() throws 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;
+}
diff --git a/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/dto/Employee.java b/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/dto/Employee.java
new file mode 100644
index 0000000..bbb5117
--- /dev/null
+++ b/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/dto/Employee.java
@@ -0,0 +1,51 @@
+package at.ac.tuwien.sepm.assignment.groupphase.einsatzverwaltung.dto;
+
+import com.google.auto.value.AutoValue;
+import java.time.LocalDate;
+
+@AutoValue
+public abstract class Employee {
+    public enum EducationLevel {
+        RS,
+        NFS,
+        NKV,
+        NKA,
+        NKI,
+        NA
+    }
+
+    abstract long id();
+
+    abstract String name();
+
+    abstract LocalDate birthday();
+
+    abstract EducationLevel educationLevel();
+
+    abstract boolean isDriver();
+
+    abstract boolean isPilot();
+
+    public static Builder builder() {
+        return new AutoValue_Employee.Builder().id(0);
+    }
+
+    @AutoValue.Builder
+    public abstract static class Builder {
+        public abstract Builder id(long id);
+
+        public abstract Builder name(String name);
+
+        public abstract Builder birthday(LocalDate birthday);
+
+        public abstract Builder educationLevel(EducationLevel educationLevel);
+
+        public abstract Builder isDriver(boolean isDriver);
+
+        public abstract Builder isPilot(boolean isPilot);
+
+        public abstract Employee build();
+    }
+
+    public abstract Builder toBuilder();
+}
diff --git a/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/dto/Operation.java b/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/dto/Operation.java
new file mode 100644
index 0000000..bfb03c7
--- /dev/null
+++ b/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/dto/Operation.java
@@ -0,0 +1,68 @@
+package at.ac.tuwien.sepm.assignment.groupphase.einsatzverwaltung.dto;
+
+import com.google.auto.value.AutoValue;
+import java.time.Instant;
+import java.util.List;
+import javax.annotation.Nullable;
+
+@AutoValue
+public abstract class Operation {
+    public enum Severity {
+        A,
+        B,
+        C,
+        D,
+        E,
+        O,
+    }
+
+    public enum Status {
+        ACTIVE,
+        COMPLETED,
+        CANCELLED,
+    }
+
+    abstract long id();
+
+    abstract String opCode();
+
+    abstract Severity severity();
+
+    abstract Status status();
+
+    abstract List<Vehicle> vehicles();
+
+    @Nullable
+    abstract Instant created();
+
+    abstract String destination();
+
+    abstract String additionalInfo();
+
+    public static Builder builder() {
+        return new AutoValue_Operation.Builder().id(0);
+    }
+
+    @AutoValue.Builder
+    public abstract static class Builder {
+        public abstract Builder id(long id);
+
+        public abstract Builder opCode(String opCode);
+
+        public abstract Builder severity(Severity severity);
+
+        public abstract Builder status(Status status);
+
+        public abstract Builder vehicles(List<Vehicle> vehicles);
+
+        public abstract Builder created(Instant created);
+
+        public abstract Builder destination(String destination);
+
+        public abstract Builder additionalInfo(String additionalInfo);
+
+        public abstract Operation build();
+    }
+
+    public abstract Builder toBuilder();
+}
diff --git a/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/dto/Registration.java b/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/dto/Registration.java
new file mode 100644
index 0000000..f917406
--- /dev/null
+++ b/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/dto/Registration.java
@@ -0,0 +1,34 @@
+package at.ac.tuwien.sepm.assignment.groupphase.einsatzverwaltung.dto;
+
+import com.google.auto.value.AutoValue;
+import java.time.Instant;
+
+@AutoValue
+public abstract class Registration {
+    abstract long id();
+
+    abstract Instant start();
+
+    abstract Instant end();
+
+    abstract Employee employee();
+
+    public static Builder builder() {
+        return new AutoValue_Registration.Builder().id(0);
+    }
+
+    @AutoValue.Builder
+    public abstract static class Builder {
+        public abstract Builder id(long id);
+
+        public abstract Builder start(Instant start);
+
+        public abstract Builder end(Instant end);
+
+        public abstract Builder employee(Employee employee);
+
+        public abstract Registration build();
+    }
+
+    public abstract Builder toBuilder();
+}
diff --git a/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/dto/Vehicle.java b/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/dto/Vehicle.java
new file mode 100644
index 0000000..29698da
--- /dev/null
+++ b/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/dto/Vehicle.java
@@ -0,0 +1,73 @@
+package at.ac.tuwien.sepm.assignment.groupphase.einsatzverwaltung.dto;
+
+import com.google.auto.value.AutoValue;
+import java.util.List;
+import javax.annotation.Nullable;
+
+@AutoValue
+public abstract class Vehicle {
+    public enum ConstructionType {
+        NORMAL,
+        HOCHDACH,
+        MITTELHOCHDACH,
+    }
+
+    public enum VehicleType {
+        BKTW,
+        KTW_B,
+        KTW,
+        RTW,
+        NEF,
+        NAH,
+    }
+
+    public enum Status {
+        ABGEMELDET,
+        FREI_WACHE,
+        ZUM_BERUFUNGSORT,
+        AM_BERUFUNGSORT,
+        ZUM_ZIELORT,
+        AM_ZIELORT,
+        FREI_FUNK,
+    }
+
+    abstract long id();
+
+    abstract String name();
+
+    abstract ConstructionType constructionType();
+
+    abstract VehicleType type();
+
+    abstract Status status();
+
+    abstract boolean hasNef();
+
+    @Nullable
+    abstract List<Registration> registrations();
+
+    public static Builder builder() {
+        return new AutoValue_Vehicle.Builder().id(0);
+    }
+
+    @AutoValue.Builder
+    public abstract static class Builder {
+        public abstract Builder id(long id);
+
+        public abstract Builder name(String name);
+
+        public abstract Builder constructionType(ConstructionType constructionType);
+
+        public abstract Builder type(VehicleType type);
+
+        public abstract Builder status(Status status);
+
+        public abstract Builder hasNef(boolean hasNef);
+
+        public abstract Builder registrations(List<Registration> registrations);
+
+        public abstract Vehicle build();
+    }
+
+    public abstract Builder toBuilder();
+}
diff --git a/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/service/EmployeeService.java b/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/service/EmployeeService.java
new file mode 100644
index 0000000..8753504
--- /dev/null
+++ b/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/service/EmployeeService.java
@@ -0,0 +1,46 @@
+package at.ac.tuwien.sepm.assignment.groupphase.einsatzverwaltung.service;
+
+import at.ac.tuwien.sepm.assignment.groupphase.einsatzverwaltung.dto.Employee;
+import at.ac.tuwien.sepm.assignment.groupphase.exception.InvalidEmployeeException;
+import at.ac.tuwien.sepm.assignment.groupphase.exception.ServiceException;
+import java.util.List;
+
+public interface EmployeeService {
+
+    /**
+     * Add given employee to the store.
+     *
+     * @param employee that should be added to the store
+     * @return the id that was assigned
+     * @throws InvalidEmployeeException if the employee is invalid
+     * @throws ServiceException if the employee could not be persisted
+     */
+    long add(Employee employee) throws InvalidEmployeeException, ServiceException;
+
+    /**
+     * Update the given employee.
+     *
+     * @param employee that should be updated
+     * @return the updated employee
+     * @throws InvalidEmployeeException if the employee is invalid
+     * @throws ServiceException if the updated employee could not be persisted
+     */
+    Employee update(Employee employee) throws InvalidEmployeeException, ServiceException;
+
+    /**
+     * Get all stored employees.
+     *
+     * @return list containing all stored employees
+     * @throws ServiceException if loading the stored employees failed
+     */
+    List<Employee> list() throws ServiceException;
+
+    /**
+     * Remove employee with the given id from the store.
+     *
+     * @param id of the employee that should be removed
+     * @throws InvalidEmployeeException if given employee id is invalid or does not exist
+     * @throws ServiceException if the employee could not be removed from the store
+     */
+    void remove(long id) throws InvalidEmployeeException, ServiceException;
+}
diff --git a/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/service/OperationService.java b/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/service/OperationService.java
new file mode 100644
index 0000000..e21c10b
--- /dev/null
+++ b/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/service/OperationService.java
@@ -0,0 +1,70 @@
+package at.ac.tuwien.sepm.assignment.groupphase.einsatzverwaltung.service;
+
+import at.ac.tuwien.sepm.assignment.groupphase.einsatzverwaltung.dto.Operation;
+import at.ac.tuwien.sepm.assignment.groupphase.einsatzverwaltung.dto.Operation.Status;
+import at.ac.tuwien.sepm.assignment.groupphase.einsatzverwaltung.dto.Vehicle;
+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 java.util.EnumSet;
+import java.util.List;
+import javafx.collections.transformation.SortedList;
+
+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, List<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 operation, starting with
+     * the best fitting.
+     *
+     * @param operationId id of the operation that is used to determine the ranking
+     * @return a sorted list containing all available vehicles
+     * @throws InvalidOperationException if the operationId is invalid or does not exist
+     * @throws ServiceException if loading the stored vehicles failed
+     */
+    SortedList<Vehicle> rankVehicles(long operationId)
+            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
+     */
+    List<Operation> list(EnumSet<Status> statuses) throws ServiceException;
+}
diff --git a/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/service/RegistrationService.java b/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/service/RegistrationService.java
new file mode 100644
index 0000000..6723f32
--- /dev/null
+++ b/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/service/RegistrationService.java
@@ -0,0 +1,31 @@
+package at.ac.tuwien.sepm.assignment.groupphase.einsatzverwaltung.service;
+
+import at.ac.tuwien.sepm.assignment.groupphase.einsatzverwaltung.dto.Registration;
+import at.ac.tuwien.sepm.assignment.groupphase.exception.InvalidRegistrationException;
+import at.ac.tuwien.sepm.assignment.groupphase.exception.InvalidVehicleException;
+import at.ac.tuwien.sepm.assignment.groupphase.exception.ServiceException;
+
+public interface RegistrationService {
+
+    /**
+     * Register employee to a vehicle.
+     *
+     * @param vehicleId the id of the target vehicle
+     * @param registration that should be added to the vehicle
+     * @return the id that was assigned
+     * @throws InvalidVehicleException if the vehicleId is invalid or does not exist
+     * @throws InvalidRegistrationException if the registration is invalid
+     * @throws ServiceException if the registration could not be persisted
+     */
+    long add(long vehicleId, Registration registration)
+            throws InvalidVehicleException, InvalidRegistrationException, ServiceException;
+
+    /**
+     * Remove given registration from the store.
+     *
+     * @param registrationId the id of the registration that should be removed
+     * @throws InvalidRegistrationException if the registration is invalid or does not exist
+     * @throws ServiceException if the registration could not be removed from the store
+     */
+    void remove(long registrationId) throws InvalidRegistrationException, ServiceException;
+}
diff --git a/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/service/VehicleService.java b/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/service/VehicleService.java
new file mode 100644
index 0000000..6a96bc5
--- /dev/null
+++ b/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/service/VehicleService.java
@@ -0,0 +1,49 @@
+package at.ac.tuwien.sepm.assignment.groupphase.einsatzverwaltung.service;
+
+import at.ac.tuwien.sepm.assignment.groupphase.einsatzverwaltung.dto.Vehicle;
+import at.ac.tuwien.sepm.assignment.groupphase.einsatzverwaltung.dto.Vehicle.Status;
+import at.ac.tuwien.sepm.assignment.groupphase.exception.InvalidVehicleException;
+import at.ac.tuwien.sepm.assignment.groupphase.exception.ServiceException;
+import java.util.EnumSet;
+import java.util.List;
+
+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
+     */
+    List<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;
+}
diff --git a/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/exception/ElementNotFoundException.java b/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/exception/ElementNotFoundException.java
new file mode 100644
index 0000000..97fb6c4
--- /dev/null
+++ b/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/exception/ElementNotFoundException.java
@@ -0,0 +1,16 @@
+package at.ac.tuwien.sepm.assignment.groupphase.exception;
+
+public class ElementNotFoundException extends Exception {
+
+    public ElementNotFoundException(String message) {
+        super(message);
+    }
+
+    public ElementNotFoundException(String message, Throwable cause) {
+        super(message, cause);
+    }
+
+    public ElementNotFoundException(Throwable cause) {
+        super(cause);
+    }
+}
diff --git a/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/exception/InvalidEmployeeException.java b/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/exception/InvalidEmployeeException.java
new file mode 100644
index 0000000..cd86cea
--- /dev/null
+++ b/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/exception/InvalidEmployeeException.java
@@ -0,0 +1,16 @@
+package at.ac.tuwien.sepm.assignment.groupphase.exception;
+
+public class InvalidEmployeeException extends Exception {
+
+    public InvalidEmployeeException(String message) {
+        super(message);
+    }
+
+    public InvalidEmployeeException(String message, Throwable cause) {
+        super(message, cause);
+    }
+
+    public InvalidEmployeeException(Throwable cause) {
+        super(cause);
+    }
+}
diff --git a/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/exception/InvalidOperationException.java b/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/exception/InvalidOperationException.java
new file mode 100644
index 0000000..11fe2b5
--- /dev/null
+++ b/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/exception/InvalidOperationException.java
@@ -0,0 +1,16 @@
+package at.ac.tuwien.sepm.assignment.groupphase.exception;
+
+public class InvalidOperationException extends Exception {
+
+    public InvalidOperationException(String message) {
+        super(message);
+    }
+
+    public InvalidOperationException(String message, Throwable cause) {
+        super(message, cause);
+    }
+
+    public InvalidOperationException(Throwable cause) {
+        super(cause);
+    }
+}
diff --git a/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/exception/InvalidRegistrationException.java b/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/exception/InvalidRegistrationException.java
new file mode 100644
index 0000000..7aa25f6
--- /dev/null
+++ b/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/exception/InvalidRegistrationException.java
@@ -0,0 +1,16 @@
+package at.ac.tuwien.sepm.assignment.groupphase.exception;
+
+public class InvalidRegistrationException extends Exception {
+
+    public InvalidRegistrationException(String message) {
+        super(message);
+    }
+
+    public InvalidRegistrationException(String message, Throwable cause) {
+        super(message, cause);
+    }
+
+    public InvalidRegistrationException(Throwable cause) {
+        super(cause);
+    }
+}
diff --git a/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/exception/InvalidVehicleException.java b/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/exception/InvalidVehicleException.java
new file mode 100644
index 0000000..a7642f9
--- /dev/null
+++ b/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/exception/InvalidVehicleException.java
@@ -0,0 +1,16 @@
+package at.ac.tuwien.sepm.assignment.groupphase.exception;
+
+public class InvalidVehicleException extends Exception {
+
+    public InvalidVehicleException(String message) {
+        super(message);
+    }
+
+    public InvalidVehicleException(String message, Throwable cause) {
+        super(message, cause);
+    }
+
+    public InvalidVehicleException(Throwable cause) {
+        super(cause);
+    }
+}
diff --git a/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/exception/PersistenceException.java b/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/exception/PersistenceException.java
new file mode 100644
index 0000000..33024b0
--- /dev/null
+++ b/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/exception/PersistenceException.java
@@ -0,0 +1,16 @@
+package at.ac.tuwien.sepm.assignment.groupphase.exception;
+
+public class PersistenceException extends Exception {
+
+    public PersistenceException(String message) {
+        super(message);
+    }
+
+    public PersistenceException(String message, Throwable cause) {
+        super(message, cause);
+    }
+
+    public PersistenceException(Throwable cause) {
+        super(cause);
+    }
+}
diff --git a/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/exception/ServiceException.java b/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/exception/ServiceException.java
new file mode 100644
index 0000000..2222cb5
--- /dev/null
+++ b/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/exception/ServiceException.java
@@ -0,0 +1,16 @@
+package at.ac.tuwien.sepm.assignment.groupphase.exception;
+
+public class ServiceException extends Exception {
+
+    public ServiceException(String message) {
+        super(message);
+    }
+
+    public ServiceException(String message, Throwable cause) {
+        super(message, cause);
+    }
+
+    public ServiceException(Throwable cause) {
+        super(cause);
+    }
+}
-- 
cgit v1.2.3-70-g09d2