diff options
author | Tharre <tharre3@gmail.com> | 2018-06-20 22:07:36 +0200 |
---|---|---|
committer | Tharre <tharre3@gmail.com> | 2018-06-20 22:07:36 +0200 |
commit | 0c995a05985da749d93aa56eba976c7fc621a4fa (patch) | |
tree | 5b80394920705aae5e2b6004c3dfbd839c8b8fa3 /src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/service/RegistrationServiceImpl.java | |
parent | f5bc7925a8fbbe247972a6f0e0571cc7e92fbefa (diff) | |
parent | e21feb3ac772a5394dc5381b58142c3c061de716 (diff) | |
download | sepm-groupproject-master.tar.gz sepm-groupproject-master.tar.xz sepm-groupproject-master.zip |
Diffstat (limited to 'src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/service/RegistrationServiceImpl.java')
-rw-r--r-- | src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/service/RegistrationServiceImpl.java | 57 |
1 files changed, 0 insertions, 57 deletions
diff --git a/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/service/RegistrationServiceImpl.java b/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/service/RegistrationServiceImpl.java deleted file mode 100644 index 54d46e7..0000000 --- a/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/service/RegistrationServiceImpl.java +++ /dev/null @@ -1,57 +0,0 @@ -package at.ac.tuwien.sepm.assignment.groupphase.einsatzverwaltung.service; - -import at.ac.tuwien.sepm.assignment.groupphase.einsatzverwaltung.dao.RegistrationDAO; -import at.ac.tuwien.sepm.assignment.groupphase.einsatzverwaltung.dao.VehicleDAO; -import at.ac.tuwien.sepm.assignment.groupphase.einsatzverwaltung.dto.Registration; -import at.ac.tuwien.sepm.assignment.groupphase.einsatzverwaltung.dto.RegistrationValidator; -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.InvalidRegistrationException; -import at.ac.tuwien.sepm.assignment.groupphase.exception.InvalidVehicleException; -import at.ac.tuwien.sepm.assignment.groupphase.exception.PersistenceException; -import at.ac.tuwien.sepm.assignment.groupphase.exception.ServiceException; -import java.util.Set; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -@Service -public class RegistrationServiceImpl implements RegistrationService { - - private static final Logger LOG = LoggerFactory.getLogger(RegistrationServiceImpl.class); - - private final RegistrationDAO registrationDAO; - private final VehicleDAO vehicleDAO; - - @Autowired - public RegistrationServiceImpl(RegistrationDAO registrationDAO, VehicleDAO vehicleDAO) { - this.registrationDAO = registrationDAO; - this.vehicleDAO = vehicleDAO; - } - - @Override - public Set<Long> add(long vehicleId, Set<Registration> registrations) - throws InvalidVehicleException, InvalidRegistrationException, ServiceException { - - if (vehicleId <= 0) throw new InvalidVehicleException("VehicleId invalid"); - - try { - Vehicle vehicle = vehicleDAO.get(vehicleId); - - RegistrationValidator.validate(vehicle, registrations); - - return registrationDAO.add(vehicle.id(), registrations); - } catch (PersistenceException e) { - LOG.warn("PersistenceException caught, throwing matching ServiceException"); - throw new ServiceException(e); - } catch (ElementNotFoundException e) { - throw new InvalidVehicleException(e); - } - } - - @Override - public void remove(long registrationId) throws InvalidRegistrationException, ServiceException { - throw new UnsupportedOperationException(); - } -} |