commit a2d2386e35aea2485c9b6775482df018679185ee
Author: Pavel Fidransky <pavel.fidransky@yoso.fi>
Date:   Sat Jun 27 19:56:20 2020 +0200

    re #31 extract repository interfaces

diff --git a/server/src/main/java/org/danekja/ymanager/repository/RequestRepository.java b/server/src/main/java/org/danekja/ymanager/repository/RequestRepository.java
index f95efe8..d448864 100644
--- a/server/src/main/java/org/danekja/ymanager/repository/RequestRepository.java
+++ b/server/src/main/java/org/danekja/ymanager/repository/RequestRepository.java
@@ -1,18 +1,10 @@
 package org.danekja.ymanager.repository;
 
 import org.danekja.ymanager.domain.Status;
-import org.danekja.ymanager.domain.VacationType;
-import org.danekja.ymanager.dto.*;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.jdbc.core.JdbcTemplate;
-import org.springframework.jdbc.core.RowMapper;
-import org.springframework.stereotype.Repository;
+import org.danekja.ymanager.dto.AuthorizationRequestDTO;
+import org.danekja.ymanager.dto.BasicRequestDTO;
+import org.danekja.ymanager.dto.VacationRequestDTO;
 
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.sql.Time;
 import java.util.List;
 
 /**
@@ -22,95 +14,7 @@ import java.util.List;
  * request which works like the authorization request but for vacations and contains informations showed to an employer
  * to help him approve or reject the vacation.
  */
-@Repository
-public class RequestRepository {
-    /**
-     * The mapper maps a row from a result of a query to an AuthorizationRequest.
-     */
-    private class AuthorizationRequestMapper implements RowMapper<AuthorizationRequestDTO> {
-
-        /**
-         * Maps a row from a result of a query to an AuthorizationRequest.
-         * @param resultSet the row from the result
-         * @param i the index of the row
-         * @return the AuthorizationRequest object
-         * @throws SQLException if the columnLabel is not valid; if a database access error occurs or this method is called on a closed result set
-         */
-        @Override
-        public AuthorizationRequestDTO mapRow(ResultSet resultSet, int i) throws SQLException {
-            final AuthorizationRequestDTO request = new AuthorizationRequestDTO();
-            request.setId(resultSet.getLong("id"));
-            request.setFirstName(resultSet.getString("first_name"));
-            request.setLastName(resultSet.getString("last_name"));
-            request.setTimestamp(resultSet.getTimestamp("creation_date").toLocalDateTime());
-            request.setStatus(Status.valueOf(resultSet.getString("status")));
-            return request;
-        }
-    }
-
-    /**
-     * The mapper maps each row from a result of a query to a VacationRequest.
-     */
-    private class VacationRequestMapper implements RowMapper<VacationRequestDTO> {
-
-        /**
-         * Maps a row from a result of a query to an VacationRequest.
-         * @param resultSet the row from the result
-         * @param i the index of the row
-         * @return the VacationRequest object
-         * @throws SQLException if the columnLabel is not valid; if a database access error occurs or this method is called on a closed result set
-         */
-        @Override
-        public VacationRequestDTO mapRow(ResultSet resultSet, int i) throws SQLException {
-            final VacationRequestDTO request = new VacationRequestDTO();
-            request.setId(resultSet.getLong("v.id"));
-            request.setFirstName(resultSet.getString("u.first_name"));
-            request.setLastName(resultSet.getString("u.last_name"));
-            request.setDate(resultSet.getDate("v.vacation_date").toLocalDate());
-
-            /*
-                When a result contains a sick day it doesn't have specified a start and end time because
-                it can be taken only as a whole day. In this case the v.time_from and v.time_to are null.
-                Which must be handled.
-            */
-            final Time timeFrom = resultSet.getTime("v.time_from");
-            if (timeFrom != null) {
-                request.setFrom(timeFrom.toLocalTime());
-            }
-
-            final Time timeTo = resultSet.getTime("v.time_to");
-            if (timeTo != null) {
-                request.setTo(timeTo.toLocalTime());
-            }
-
-            request.setTimestamp(resultSet.getTimestamp("v.creation_date").toLocalDateTime());
-            request.setType(VacationType.getVacationType(resultSet.getString("v.vacation_type")));
-            request.setStatus(Status.valueOf(resultSet.getString("v.status")));
-            return request;
-        }
-    }
-
-    /**
-     * The logger.
-     */
-    private static final Logger log = LoggerFactory.getLogger(RequestRepository.class);
-
-    /**
-     * The connection to a database.
-     */
-    private final JdbcTemplate jdbc;
-
-    /**
-     * Creates a manager which can select and update requests in a database with the specified connection.
-     *
-     * @param jdbc the connection to the database
-     */
-    @Autowired
-    public RequestRepository(final JdbcTemplate jdbc) {
-        RequestRepository.log.trace("Creating a new instance of the class RequestRepository");
-
-        this.jdbc = jdbc;
-    }
+public interface RequestRepository {
 
     /**
      * Gets all authorization requests from a database. Method returns all authorization requests despite
@@ -120,11 +24,7 @@ public class RequestRepository {
      *
      * @return the list of all authorization requests
      */
-    public List<AuthorizationRequestDTO> getAllAuthorizations() {
-        RequestRepository.log.trace("Selecting all authorization requests from a database.");
-
-        return this.jdbc.query("SELECT id, first_name, last_name, creation_date, status FROM end_user", new AuthorizationRequestMapper());
-    }
+    List<AuthorizationRequestDTO> getAllAuthorizations();
 
     /**
      * Gets all authorization request with the given authorization status from a database.
@@ -135,12 +35,7 @@ public class RequestRepository {
      * @param status the approval status of the requests
      * @return the list of all authorization requests with the given status
      */
-    public List<AuthorizationRequestDTO> getAllAuthorizations(final Status status) {
-        RequestRepository.log.trace("Selecting all authorization requests from a database with requested status.");
-        RequestRepository.log.debug("Status: {}", status);
-
-        return this.jdbc.query("SELECT id, first_name, last_name, creation_date, status FROM end_user WHERE status = ?", new Object[]{status.name()}, new AuthorizationRequestMapper());
-    }
+    List<AuthorizationRequestDTO> getAllAuthorizations(final Status status);
 
     /**
      * Updates the status of an authorization request with the given id.
@@ -148,21 +43,14 @@ public class RequestRepository {
      * @param id     the id of the request
      * @param status the new status of the request
      */
-    public void updateAuthorization(final long id, final Status status) {
-        RequestRepository.log.trace("Updating status of an authorization request.");
-        RequestRepository.log.debug("Id: {}, status: {}.", id, status);
-
-        this.jdbc.update("UPDATE end_user SET status=? WHERE id=?", status.name(), id);
-    }
+    void updateAuthorization(final long id, final Status status);
 
     /**
      * Updates the status of an authorization request from the specified BasicRequest object.
      *
      * @param request the BasicRequest object with new values of the vacation request
      */
-    public void updateAuthorization(final BasicRequestDTO request) {
-        this.updateAuthorization(request.getId(), request.getStatus());
-    }
+    void updateAuthorization(final BasicRequestDTO request);
 
     /**
      * Gets all vacation requests from a database. Method returns all vacation requests despite
@@ -172,13 +60,7 @@ public class RequestRepository {
      *
      * @return the list of all vacation requests
      */
-    public List<VacationRequestDTO> getAllVacationRequests() {
-        RequestRepository.log.trace("Selecting all vacation requests from a database.");
-
-        return this.jdbc.query("SELECT v.id, v.vacation_date, v.time_from, v.time_to, v.creation_date, v.vacation_type, v.status, u.first_name, u.last_name " +
-                "FROM vacation_day v " +
-                "INNER JOIN end_user u ON v.user_id = u.id", new VacationRequestMapper());
-    }
+    List<VacationRequestDTO> getAllVacationRequests();
 
     /**
      * Gets all vacation requests with the given approval status from a database.
@@ -188,16 +70,7 @@ public class RequestRepository {
      * @param status the approval status of the requests
      * @return the list of all vacation requests with the given status
      */
-    public List<VacationRequestDTO> getAllVacationRequests(final Status status) {
-        RequestRepository.log.trace("Selecting all vacation requests from a database with requested status.");
-        RequestRepository.log.debug("Status: {}", status);
-
-        return this.jdbc.query("SELECT v.id, v.vacation_date, v.time_from, v.time_to, v.creation_date, v.vacation_type, v.status, u.first_name, u.last_name " +
-                        "FROM vacation_day v " +
-                        "INNER JOIN end_user u ON v.user_id = u.id " +
-                        "WHERE v.status=?",
-                new Object[]{status.name()}, new VacationRequestMapper());
-    }
+    List<VacationRequestDTO> getAllVacationRequests(final Status status);
 
     /**
      * Updates a status of a vacation request with the given id.
@@ -205,19 +78,12 @@ public class RequestRepository {
      * @param id     the id of the request
      * @param status the new status of the request
      */
-    public void updateVacationRequest(final long id, final Status status) {
-        RequestRepository.log.trace("Updating status of a vacation request");
-        RequestRepository.log.debug("Id: {}, status: {}.", id, status);
-
-        this.jdbc.update("UPDATE vacation_day SET status=? WHERE id=?", status.name(), id);
-    }
+    void updateVacationRequest(final long id, final Status status);
 
     /**
      * Updates a status of a vacation request from a BasicRequest object.
      *
      * @param request the BasicRequest object with new values of the vacation request
      */
-    public void updateVacationRequest(final BasicRequestDTO request) {
-        this.updateVacationRequest(request.getId(), request.getStatus());
-    }
+    void updateVacationRequest(final BasicRequestDTO request);
 }
diff --git a/server/src/main/java/org/danekja/ymanager/repository/UserRepository.java b/server/src/main/java/org/danekja/ymanager/repository/UserRepository.java
index ee76c53..8815f6e 100644
--- a/server/src/main/java/org/danekja/ymanager/repository/UserRepository.java
+++ b/server/src/main/java/org/danekja/ymanager/repository/UserRepository.java
@@ -3,116 +3,13 @@ package org.danekja.ymanager.repository;
 import org.danekja.ymanager.domain.*;
 import org.danekja.ymanager.dto.BasicProfileUserDTO;
 import org.danekja.ymanager.dto.FullUserProfileDTO;
-import org.danekja.ymanager.repository.jdbc.mappers.UserDataRowMapper;
-import org.danekja.ymanager.repository.jdbc.mappers.UserRowMapper;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.jdbc.core.*;
-import org.springframework.jdbc.support.GeneratedKeyHolder;
-import org.springframework.stereotype.Repository;
 
-import java.sql.*;
-import java.util.ArrayList;
 import java.util.List;
-import java.util.Map;
-import java.util.Objects;
-
-import static org.danekja.ymanager.domain.UserRole.getUserRole;
 
 /**
  * An instance of the class UserRepository handles queries which selects and updates users and their settings in a database.
  */
-@Repository
-public class UserRepository {
-
-    private final RowMapper<UserData> USER_DATA_MAPPER = new UserDataRowMapper();
-    private final RowMapper<RegisteredUser> USER_MAPPER = new UserRowMapper(USER_DATA_MAPPER);
-
-
-    /**
-     * The mapper maps a row from a result of a query to an BasicProfileUser.
-     */
-    private class BasicProfileUserMapper implements RowMapper<BasicProfileUserDTO> {
-
-        /**
-         * Maps a row from a result of a query to an BasicProfileUser.
-         * @param resultSet the row from the result
-         * @param i the index of the row
-         * @return the BasicProfileUser object
-         * @throws SQLException if the columnLabel is not valid; if a database access error occurs or this method is called on a closed result set
-         */
-        @Override
-        public BasicProfileUserDTO mapRow(ResultSet resultSet, int i) throws SQLException {
-            final BasicProfileUserDTO user = new BasicProfileUserDTO();
-            user.setId(resultSet.getLong("id"));
-            user.setFirstName(resultSet.getString("first_name"));
-            user.setLastName(resultSet.getString("last_name"));
-            user.setPhoto(resultSet.getString("photo"));
-            return user;
-        }
-    }
-
-    /**
-     * The logger.
-     */
-    private static final Logger log = LoggerFactory.getLogger(UserRepository.class);
-
-    /**
-     * The connection to a database.
-     */
-    private final JdbcTemplate jdbc;
-
-    /**
-     * Creates a new instance of the class UserRepository which selects and updates users and their settings in a database.
-     *
-     * @param jdbc A connection to the database.
-     */
-    @Autowired
-    public UserRepository(final JdbcTemplate jdbc) {
-        UserRepository.log.trace("Creating a new instance of the class UserRepository");
-        this.jdbc = jdbc;
-    }
-
-    private Map<String, Object> getUserColumns(final long id) {
-        final List<SqlParameter> paramList = new ArrayList<>();
-        paramList.add(new SqlParameter("in_id", Types.BIGINT));
-        paramList.add(new SqlOutParameter("out_id", Types.BIGINT));
-        paramList.add(new SqlOutParameter("out_first_name", Types.VARCHAR));
-        paramList.add(new SqlOutParameter("out_last_name", Types.VARCHAR));
-        paramList.add(new SqlOutParameter("out_no_vacations", Types.FLOAT));
-        paramList.add(new SqlOutParameter("out_no_sick_days", Types.INTEGER));
-        paramList.add(new SqlOutParameter("out_taken_sick_days", Types.INTEGER));
-        paramList.add(new SqlOutParameter("out_alert", Types.TIMESTAMP));
-        paramList.add(new SqlOutParameter("out_token", Types.LONGVARCHAR));
-        paramList.add(new SqlOutParameter("out_email", Types.VARCHAR));
-        paramList.add(new SqlOutParameter("out_photo", Types.LONGVARCHAR));
-        paramList.add(new SqlOutParameter("out_creation_date", Types.TIMESTAMP));
-        paramList.add(new SqlOutParameter("out_role", Types.VARCHAR));
-        paramList.add(new SqlOutParameter("out_status", Types.VARCHAR));
-
-        return jdbc.call(con -> {
-            final CallableStatement callableStatement = con.prepareCall("{call GetUserId(?,?,?,?,?,?,?,?,?,?,?,?,?,?)}");
-            callableStatement.setLong(1, id);
-            callableStatement.registerOutParameter(2, Types.BIGINT);
-            callableStatement.registerOutParameter(3, Types.VARCHAR);
-            callableStatement.registerOutParameter(4, Types.VARCHAR);
-            callableStatement.registerOutParameter(5, Types.FLOAT);
-            callableStatement.registerOutParameter(6, Types.INTEGER);
-            callableStatement.registerOutParameter(7, Types.INTEGER);
-            callableStatement.registerOutParameter(8, Types.TIMESTAMP);
-            callableStatement.registerOutParameter(9, Types.LONGVARCHAR);
-            callableStatement.registerOutParameter(10, Types.VARCHAR);
-            callableStatement.registerOutParameter(11, Types.LONGVARCHAR);
-            callableStatement.registerOutParameter(12, Types.TIMESTAMP);
-            callableStatement.registerOutParameter(13, Types.VARCHAR);
-            callableStatement.registerOutParameter(14, Types.VARCHAR);
-            return callableStatement;
-        }, paramList);
-    }
-
-    //---------------------------------- DTO -----------------------------------
-
+public interface UserRepository {
     /**
      * Gets basic profile of each user from a database. The basic profile contains default, the most important
      * informations which helps identify a user like a name or photo. Every line of output is converted to a BasicProfileUser
@@ -120,11 +17,7 @@ public class UserRepository {
      *
      * @return A list of all basic profiles.
      */
-    public List<BasicProfileUserDTO> getAllBasicUsers() {
-        UserRepository.log.trace("Selecting basic profiles of all users from a database.");
-
-        return this.jdbc.query("SELECT id, first_name, last_name, photo FROM end_user", new BasicProfileUserMapper());
-    }
+    List<BasicProfileUserDTO> getAllBasicUsers();
 
     /**
      * Gets basic profile of each user with the given authorization status from a database. The basic profile contains
@@ -135,49 +28,16 @@ public class UserRepository {
      * @param status The authentication status.
      * @return A list of all basic profiles with the given status.
      */
-    public List<BasicProfileUserDTO> getAllBasicUsers(final Status status) {
-        UserRepository.log.trace("Selecting basic profiles of all users with a required status from a database.");
-        UserRepository.log.debug("Status: {}", status);
+    List<BasicProfileUserDTO> getAllBasicUsers(final Status status);
 
-        return this.jdbc.query("SELECT id, first_name, last_name, photo FROM end_user WHERE status = ?",
-                new Object[]{status.name()}, new BasicProfileUserMapper());
-    }
-
-    public UserRole getPermission(Long id) {
-        return jdbc.queryForObject("SELECT user_role FROM end_user WHERE id = ?" ,new Object[]{id}, (rs, rowNum) ->
-            getUserRole(rs.getString("user_role"))
-        );
-    }
+    UserRole getPermission(Long id);
 
     /**
      *
      * @param id
      * @return
      */
-    public FullUserProfileDTO getFullUser(final long id) {
-        UserRepository.log.debug("Selecting full profile of a user with the specified id from a database: {}", id);
-
-        final Map<String, Object> resultMap = this.getUserColumns(id);
-
-        final FullUserProfileDTO user = new FullUserProfileDTO();
-        user.setId(id);
-        user.setFirstName((String) resultMap.get("out_first_name"));
-        user.setLastName((String) resultMap.get("out_last_name"));
-        user.setVacationCount(((Double) resultMap.get("out_no_vacations")).floatValue());
-        user.setSickDayCount((Integer) resultMap.get("out_no_sick_days"));
-        user.setTakenSickDayCount((Integer) resultMap.get("out_taken_sick_days"));
-        user.setNotification(((Timestamp) resultMap.get("out_alert")).toLocalDateTime());
-        user.setEmail((String) resultMap.get("out_email"));
-        user.setPhoto((String) resultMap.get("out_photo"));
-        user.setRole(getUserRole((String) resultMap.get("out_role")));
-        user.setStatus(Status.valueOf((String) resultMap.get("out_status")));
-        return user;
-
-    }
-
-
-
-    //---------------------------------- DOMAIN -----------------------------------
+    FullUserProfileDTO getFullUser(final long id);
 
     /**
      * Gets user from database based on its email
@@ -185,9 +45,7 @@ public class UserRepository {
      * @param email email value, used as search key
      * @return found user object or null (if not found)
      */
-    public RegisteredUser getUser(final String email) {
-        return this.jdbc.queryForObject("SELECT * FROM end_user WHERE email = ?", USER_MAPPER, email);
-    }
+    RegisteredUser getUser(final String email);
 
     /**
      * Gets user from database based on its id
@@ -195,9 +53,7 @@ public class UserRepository {
      * @param id id value, used as search key
      * @return found user object or null (if not found)
      */
-    public RegisteredUser getUser(final long id) {
-        return this.jdbc.queryForObject("SELECT * FROM end_user WHERE id = ?", USER_MAPPER, id);
-    }
+    RegisteredUser getUser(final long id);
 
     /**
      * Gets user data by user's id
@@ -205,55 +61,17 @@ public class UserRepository {
      * @param id TODO replace by subject Id for google and numeric id for registered (multiple queries)
      * @return
      */
-    public UserData getUserData(final long id) {
-        return this.jdbc.queryForObject("SELECT * FROM end_user WHERE id = ?", USER_DATA_MAPPER, id);
-    }
-
-    public void updateUser(final User user) {
-        this.jdbc.update("UPDATE end_user SET first_name = ?, last_name = ?, no_vacations = ?, taken_sick_days = ?, email = ?, photo = ?, user_role = ?, status = ? WHERE id = ?",
-                user.getFirstName(), user.getLastName(), user.getVacationCount(), user.getTakenSickDayCount(), user.getEmail(), user.getPhoto(), user.getRole().name(), user.getStatus().name(), user.getId());
-    }
-
-    public long insertUser(final User user) {
-        PreparedStatementCreatorFactory factory = new PreparedStatementCreatorFactory("INSERT INTO end_user (first_name, last_name, no_vacations, no_sick_days, taken_sick_days, alert, email, photo, user_role, status) VALUES (?,?,?,?,?,?,?,?,?,?)",
-                Types.VARCHAR,
-                Types.VARCHAR,
-                Types.FLOAT,
-                Types.INTEGER,
-                Types.INTEGER,
-                Types.TIMESTAMP,
-                Types.VARCHAR,
-                Types.VARCHAR,
-                Types.VARCHAR,
-                Types.VARCHAR);
-
-
-        factory.setReturnGeneratedKeys(true);
-
-        PreparedStatementCreator stmt = factory.newPreparedStatementCreator(new Object[]{user.getFirstName(), user.getLastName(), user.getVacationCount(), user.getTotalSickDayCount(), user.getTakenSickDayCount(), user.getNotification(), user.getEmail(), user.getPhoto(), user.getRole().name(), user.getStatus().name()});
+    UserData getUserData(final long id);
 
-        GeneratedKeyHolder key = new GeneratedKeyHolder();
-        this.jdbc.update(stmt, key);
+    void updateUser(final User user);
 
-        return Objects.requireNonNull(key.getKey()).longValue();
-    }
+    long insertUser(final User user);
 
-    public void insertSettings(final DefaultSettings settings) {
-        this.jdbc.update("INSERT INTO default_settings (no_sick_days, alert) VALUES (?, ?)", settings.getSickDayCount(), settings.getNotification());
-    }
+    void insertSettings(final DefaultSettings settings);
 
-    public void updateUserSettings(User user) {
-        jdbc.update("UPDATE end_user SET alert = ?, user_role = ?, no_sick_days = ?, no_vacations = ? WHERE id = ?",
-                user.getNotification(), user.getRole().name(), user.getTotalSickDayCount(), user.getVacationCount(), user.getId());
-    }
+    void updateUserSettings(User user);
 
-    public void updateUserTakenVacation(User user) {
-        jdbc.update("UPDATE end_user SET no_vacations = ? WHERE id = ?",
-                user.getVacationCount(), user.getId());
-    }
+    void updateUserTakenVacation(User user);
 
-    public void updateUserTakenSickDay(User user) {
-        jdbc.update("UPDATE end_user SET taken_sick_days = ? WHERE id = ?",
-                user.getTakenSickDayCount(), user.getId());
-    }
+    void updateUserTakenSickDay(User user);
 }
diff --git a/server/src/main/java/org/danekja/ymanager/repository/VacationRepository.java b/server/src/main/java/org/danekja/ymanager/repository/VacationRepository.java
index f76dc6e..280fc27 100644
--- a/server/src/main/java/org/danekja/ymanager/repository/VacationRepository.java
+++ b/server/src/main/java/org/danekja/ymanager/repository/VacationRepository.java
@@ -2,167 +2,29 @@ package org.danekja.ymanager.repository;
 
 import org.danekja.ymanager.domain.Status;
 import org.danekja.ymanager.domain.Vacation;
-import org.danekja.ymanager.domain.VacationType;
 import org.danekja.ymanager.dto.VacationDayDTO;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.jdbc.core.JdbcTemplate;
-import org.springframework.jdbc.core.RowMapper;
-import org.springframework.stereotype.Repository;
 
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.sql.Time;
 import java.time.LocalDate;
 import java.util.List;
 import java.util.Optional;
 
-import static java.util.Optional.ofNullable;
+public interface VacationRepository {
 
-@Repository
-public class VacationRepository {
-    /**
-     * The mapper maps a row from a result of a query to an Vacation.
-     */
-    private class VacationDayMapper implements RowMapper<VacationDayDTO> {
+    List<VacationDayDTO> getVacationDays(final long userId, final LocalDate from);
 
-        /**
-         * Maps a row from a result of a query to an Vacation.
-         * @param resultSet the row from the result
-         * @param i the index of the row
-         * @return the Vacation object
-         * @throws SQLException if the columnLabel is not valid; if a database access error occurs or this method is called on a closed result set
-         */
-        @Override
-        public VacationDayDTO mapRow(ResultSet resultSet, int i) throws SQLException {
-            final VacationDayDTO item = new VacationDayDTO();
-            item.setId(resultSet.getLong("v.id"));
-            item.setDate(resultSet.getDate("v.vacation_date").toLocalDate());
+    List<VacationDayDTO> getVacationDays(final long userId, final LocalDate from, final Status status);
 
-            /*
-                When a result contains a sick day it doesn't have specified a start and end time because
-                it can be taken only as a whole day. In this case the v.time_from and v.time_to are null.
-                Which must be handled.
-            */
-            final Time timeFrom = resultSet.getTime("v.time_from");
-            if (timeFrom != null) {
-                item.setFrom(timeFrom.toLocalTime());
-            }
+    List<VacationDayDTO> getVacationDays(final long userId, final LocalDate from, final LocalDate to);
 
-            final Time timeTo = resultSet.getTime("v.time_to");
-            if (timeTo != null) {
-                item.setTo(timeTo.toLocalTime());
-            }
+    List<VacationDayDTO> getVacationDays(final long userId, final LocalDate from, final LocalDate to, final Status status);
 
-            item.setStatus(Status.valueOf(resultSet.getString("v.status")));
-            item.setType(VacationType.getVacationType(resultSet.getString("v.vacation_type")));
-            return item;
-        }
-    }
+    Optional<Vacation> getVacationDay(final long id);
 
-    /**
-     * The logger.
-     */
-    private static final Logger log = LoggerFactory.getLogger(VacationRepository.class);
+    void insertVacationDay(final Long userId, final Vacation day);
 
-    /**
-     * The connection to a database.
-     */
-    private final JdbcTemplate jdbc;
+    void updateVacationDay(final Vacation item);
 
-    /**
-     * Creates a new instance of the class VacationRepository which selects and updates users in a database.
-     *
-     * @param jdbc A connection to the database.
-     */
-    @Autowired
-    public VacationRepository(final JdbcTemplate jdbc) {
-        VacationRepository.log.trace("Creating a new instance of the class VacationRepository");
+    void deleteVacationDay(final long id);
 
-        this.jdbc = jdbc;
-    }
-
-    public List<VacationDayDTO> getVacationDays(final long userId, final LocalDate from) {
-        return jdbc.query("SELECT v.id, v.vacation_date, v.time_from, v.time_to, v.status, v.vacation_type " +
-                        "FROM vacation_day v " +
-                        "INNER JOIN end_user u ON v.user_id = u.id " +
-                        "WHERE v.user_id = ? AND v.vacation_date >= ?",
-                new Object[]{userId, from}, new VacationDayMapper());
-    }
-
-    public List<VacationDayDTO> getVacationDays(final long userId, final LocalDate from, final Status status) {
-        return jdbc.query("SELECT v.id, v.vacation_date, v.time_from, v.time_to, v.status, v.vacation_type " +
-                        "FROM vacation_day v " +
-                        "INNER JOIN end_user u ON v.user_id = u.id " +
-                        "WHERE v.user_id = ? AND v.vacation_date >= ? AND v.status = ?",
-                new Object[]{userId, from, status.name()}, new VacationDayMapper());
-    }
-
-    public List<VacationDayDTO> getVacationDays(final long userId, final LocalDate from, final LocalDate to) {
-        return jdbc.query("SELECT v.id, v.vacation_date, v.time_from, v.time_to, v.status, v.vacation_type " +
-                        "FROM vacation_day v " +
-                        "INNER JOIN end_user u ON v.user_id = u.id " +
-                        "WHERE v.user_id=? AND v.vacation_date >= ? AND v.vacation_date <= ?",
-                new Object[]{userId, from, to}, new VacationDayMapper());
-
-    }
-
-    public List<VacationDayDTO> getVacationDays(final long userId, final LocalDate from, final LocalDate to, final Status status) {
-        return jdbc.query("SELECT v.id, v.vacation_date, v.time_from, v.time_to, v.status, v.vacation_type " +
-                        "FROM vacation_day v " +
-                        "INNER JOIN end_user u ON v.user_id = u.id " +
-                        "WHERE v.user_id=? AND v.vacation_date >= ? AND v.vacation_date <= ? AND v.status = ?",
-                new Object[]{userId, from, to, status.name()}, new VacationDayMapper());
-    }
-
-    public Optional<Vacation> getVacationDay(final long id) {
-        return ofNullable(jdbc.queryForObject("SELECT id, vacation_date, time_from, time_to, creation_date, status, vacation_type, user_id " +
-                        "FROM vacation_day WHERE id = ?", new Object[]{id},
-                (ResultSet rs, int rowNum) -> {
-                    Vacation vacation = new Vacation();
-                    vacation.setId(rs.getLong("id"));
-                    vacation.setDate(rs.getDate("vacation_date").toLocalDate());
-                    /*
-                        When a result contains a sick day it doesn't have specified a start and end time because
-                        it can be taken only as a whole day. In this case the v.time_from and v.time_to are null.
-                        Which must be handled.
-                    */
-                    final Time timeFrom = rs.getTime("time_from");
-                    if (timeFrom != null) {
-                        vacation.setFrom(timeFrom.toLocalTime());
-                    }
-
-                    final Time timeTo = rs.getTime("time_to");
-                    if (timeTo != null) {
-                        vacation.setTo(timeTo.toLocalTime());
-                    }
-
-                    vacation.setCreationDate(rs.getTimestamp("creation_date").toLocalDateTime());
-                    vacation.setStatus(Status.valueOf(rs.getString("status")));
-                    vacation.setType(VacationType.getVacationType(rs.getString("vacation_type")));
-                    vacation.setUserId(rs.getLong("user_id"));
-                    return vacation;
-                }));
-    }
-
-    public void insertVacationDay(final Long userId, final Vacation day) {
-        jdbc.update("INSERT INTO vacation_day (vacation_date, time_from, time_to, status, vacation_type, user_id) VALUES (?,?,?,?,?,?)",
-                day.getDate(), day.getFrom(), day.getTo(), day.getStatus().name(), day.getType().name(), userId);
-    }
-
-    public void updateVacationDay(final Vacation item) {
-        jdbc.update("UPDATE vacation_day SET vacation_date=?, time_from=?, time_to=?, status=?, vacation_type=? WHERE id=?",
-                item.getDate(), item.getFrom(), item.getTo(), item.getStatus().name(), item.getType().name(), item.getId());
-    }
-
-    public void deleteVacationDay(final long id) {
-        jdbc.update("DELETE FROM vacation_day WHERE id=?", id);
-    }
-
-
-    public boolean isExistVacationForUser(Long userId, LocalDate date) {
-        return jdbc.queryForObject("SELECT count(id) AS exist FROM vacation_day WHERE vacation_date = ? AND user_id = ?",
-                new Object[]{date, userId}, (rs, rowNum) -> rs.getBoolean("exist"));
-    }
+    boolean isExistVacationForUser(Long userId, LocalDate date);
 }
diff --git a/server/src/main/java/org/danekja/ymanager/repository/jdbc/JdbcRequestRepository.java b/server/src/main/java/org/danekja/ymanager/repository/jdbc/JdbcRequestRepository.java
new file mode 100644
index 0000000..fbf908e
--- /dev/null
+++ b/server/src/main/java/org/danekja/ymanager/repository/jdbc/JdbcRequestRepository.java
@@ -0,0 +1,106 @@
+package org.danekja.ymanager.repository.jdbc;
+
+import org.danekja.ymanager.domain.Status;
+import org.danekja.ymanager.dto.AuthorizationRequestDTO;
+import org.danekja.ymanager.dto.BasicRequestDTO;
+import org.danekja.ymanager.dto.VacationRequestDTO;
+import org.danekja.ymanager.repository.RequestRepository;
+import org.danekja.ymanager.repository.jdbc.mappers.AuthorizationRequestMapper;
+import org.danekja.ymanager.repository.jdbc.mappers.VacationRequestMapper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.jdbc.core.JdbcTemplate;
+import org.springframework.stereotype.Repository;
+
+import java.util.List;
+
+@Repository
+public class JdbcRequestRepository implements RequestRepository {
+
+    /**
+     * The logger.
+     */
+    private static final Logger log = LoggerFactory.getLogger(JdbcRequestRepository.class);
+
+    private static final VacationRequestMapper VACATION_REQUEST_MAPPER = new VacationRequestMapper();
+    private static final AuthorizationRequestMapper AUTHORIZATION_REQUEST_MAPPER = new AuthorizationRequestMapper();
+
+    /**
+     * The connection to a database.
+     */
+    private final JdbcTemplate jdbc;
+
+    /**
+     * Creates a manager which can select and update requests in a database with the specified connection.
+     *
+     * @param jdbc the connection to the database
+     */
+    @Autowired
+    public JdbcRequestRepository(final JdbcTemplate jdbc) {
+        JdbcRequestRepository.log.trace("Creating a new instance of the class RequestRepository");
+
+        this.jdbc = jdbc;
+    }
+
+    @Override
+    public List<AuthorizationRequestDTO> getAllAuthorizations() {
+        JdbcRequestRepository.log.trace("Selecting all authorization requests from a database.");
+
+        return this.jdbc.query("SELECT id, first_name, last_name, creation_date, status FROM end_user", AUTHORIZATION_REQUEST_MAPPER);
+    }
+
+    @Override
+    public List<AuthorizationRequestDTO> getAllAuthorizations(final Status status) {
+        JdbcRequestRepository.log.trace("Selecting all authorization requests from a database with requested status.");
+        JdbcRequestRepository.log.debug("Status: {}", status);
+
+        return this.jdbc.query("SELECT id, first_name, last_name, creation_date, status FROM end_user WHERE status = ?", AUTHORIZATION_REQUEST_MAPPER, status.name());
+    }
+
+    @Override
+    public void updateAuthorization(final long id, final Status status) {
+        JdbcRequestRepository.log.trace("Updating status of an authorization request.");
+        JdbcRequestRepository.log.debug("Id: {}, status: {}.", id, status);
+
+        this.jdbc.update("UPDATE end_user SET status=? WHERE id=?", status.name(), id);
+    }
+
+    @Override
+    public void updateAuthorization(final BasicRequestDTO request) {
+        this.updateAuthorization(request.getId(), request.getStatus());
+    }
+
+    @Override
+    public List<VacationRequestDTO> getAllVacationRequests() {
+        JdbcRequestRepository.log.trace("Selecting all vacation requests from a database.");
+
+        return this.jdbc.query("SELECT v.id, v.vacation_date, v.time_from, v.time_to, v.creation_date, v.vacation_type, v.status, u.first_name, u.last_name " +
+                "FROM vacation_day v " +
+                "INNER JOIN end_user u ON v.user_id = u.id", VACATION_REQUEST_MAPPER);
+    }
+
+    @Override
+    public List<VacationRequestDTO> getAllVacationRequests(final Status status) {
+        JdbcRequestRepository.log.trace("Selecting all vacation requests from a database with requested status.");
+        JdbcRequestRepository.log.debug("Status: {}", status);
+
+        return this.jdbc.query("SELECT v.id, v.vacation_date, v.time_from, v.time_to, v.creation_date, v.vacation_type, v.status, u.first_name, u.last_name " +
+                        "FROM vacation_day v " +
+                        "INNER JOIN end_user u ON v.user_id = u.id " +
+                        "WHERE v.status=?", VACATION_REQUEST_MAPPER, status.name());
+    }
+
+    @Override
+    public void updateVacationRequest(final long id, final Status status) {
+        JdbcRequestRepository.log.trace("Updating status of a vacation request");
+        JdbcRequestRepository.log.debug("Id: {}, status: {}.", id, status);
+
+        this.jdbc.update("UPDATE vacation_day SET status=? WHERE id=?", status.name(), id);
+    }
+
+    @Override
+    public void updateVacationRequest(final BasicRequestDTO request) {
+        this.updateVacationRequest(request.getId(), request.getStatus());
+    }
+}
diff --git a/server/src/main/java/org/danekja/ymanager/repository/jdbc/JdbcUserRepository.java b/server/src/main/java/org/danekja/ymanager/repository/jdbc/JdbcUserRepository.java
new file mode 100644
index 0000000..1a1ae6e
--- /dev/null
+++ b/server/src/main/java/org/danekja/ymanager/repository/jdbc/JdbcUserRepository.java
@@ -0,0 +1,209 @@
+package org.danekja.ymanager.repository.jdbc;
+
+import org.danekja.ymanager.domain.*;
+import org.danekja.ymanager.dto.BasicProfileUserDTO;
+import org.danekja.ymanager.dto.FullUserProfileDTO;
+import org.danekja.ymanager.repository.UserRepository;
+import org.danekja.ymanager.repository.jdbc.mappers.BasicProfileUserMapper;
+import org.danekja.ymanager.repository.jdbc.mappers.UserDataRowMapper;
+import org.danekja.ymanager.repository.jdbc.mappers.UserRowMapper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.jdbc.core.*;
+import org.springframework.jdbc.support.GeneratedKeyHolder;
+import org.springframework.stereotype.Repository;
+
+import java.sql.CallableStatement;
+import java.sql.Timestamp;
+import java.sql.Types;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+
+import static org.danekja.ymanager.domain.UserRole.getUserRole;
+
+@Repository
+public class JdbcUserRepository implements UserRepository {
+
+    private static final RowMapper<BasicProfileUserDTO> BASIC_PROFILE_USER_MAPPER = new BasicProfileUserMapper();
+    private static final RowMapper<UserData> USER_DATA_MAPPER = new UserDataRowMapper();
+    private static final RowMapper<RegisteredUser> USER_MAPPER = new UserRowMapper(USER_DATA_MAPPER);
+
+    /**
+     * The logger.
+     */
+    private static final Logger log = LoggerFactory.getLogger(JdbcUserRepository.class);
+
+    /**
+     * The connection to a database.
+     */
+    private final JdbcTemplate jdbc;
+
+    /**
+     * Creates a new instance of the class UserRepository which selects and updates users and their settings in a database.
+     *
+     * @param jdbc A connection to the database.
+     */
+    @Autowired
+    public JdbcUserRepository(final JdbcTemplate jdbc) {
+        JdbcUserRepository.log.trace("Creating a new instance of the class UserRepository");
+        this.jdbc = jdbc;
+    }
+
+    private Map<String, Object> getUserColumns(final long id) {
+        final List<SqlParameter> paramList = new ArrayList<>();
+        paramList.add(new SqlParameter("in_id", Types.BIGINT));
+        paramList.add(new SqlOutParameter("out_id", Types.BIGINT));
+        paramList.add(new SqlOutParameter("out_first_name", Types.VARCHAR));
+        paramList.add(new SqlOutParameter("out_last_name", Types.VARCHAR));
+        paramList.add(new SqlOutParameter("out_no_vacations", Types.FLOAT));
+        paramList.add(new SqlOutParameter("out_no_sick_days", Types.INTEGER));
+        paramList.add(new SqlOutParameter("out_taken_sick_days", Types.INTEGER));
+        paramList.add(new SqlOutParameter("out_alert", Types.TIMESTAMP));
+        paramList.add(new SqlOutParameter("out_token", Types.LONGVARCHAR));
+        paramList.add(new SqlOutParameter("out_email", Types.VARCHAR));
+        paramList.add(new SqlOutParameter("out_photo", Types.LONGVARCHAR));
+        paramList.add(new SqlOutParameter("out_creation_date", Types.TIMESTAMP));
+        paramList.add(new SqlOutParameter("out_role", Types.VARCHAR));
+        paramList.add(new SqlOutParameter("out_status", Types.VARCHAR));
+
+        return jdbc.call(con -> {
+            final CallableStatement callableStatement = con.prepareCall("{call GetUserId(?,?,?,?,?,?,?,?,?,?,?,?,?,?)}");
+            callableStatement.setLong(1, id);
+            callableStatement.registerOutParameter(2, Types.BIGINT);
+            callableStatement.registerOutParameter(3, Types.VARCHAR);
+            callableStatement.registerOutParameter(4, Types.VARCHAR);
+            callableStatement.registerOutParameter(5, Types.FLOAT);
+            callableStatement.registerOutParameter(6, Types.INTEGER);
+            callableStatement.registerOutParameter(7, Types.INTEGER);
+            callableStatement.registerOutParameter(8, Types.TIMESTAMP);
+            callableStatement.registerOutParameter(9, Types.LONGVARCHAR);
+            callableStatement.registerOutParameter(10, Types.VARCHAR);
+            callableStatement.registerOutParameter(11, Types.LONGVARCHAR);
+            callableStatement.registerOutParameter(12, Types.TIMESTAMP);
+            callableStatement.registerOutParameter(13, Types.VARCHAR);
+            callableStatement.registerOutParameter(14, Types.VARCHAR);
+            return callableStatement;
+        }, paramList);
+    }
+
+    //---------------------------------- DTO -----------------------------------
+
+    @Override
+    public List<BasicProfileUserDTO> getAllBasicUsers() {
+        JdbcUserRepository.log.trace("Selecting basic profiles of all users from a database.");
+
+        return this.jdbc.query("SELECT id, first_name, last_name, photo FROM end_user", BASIC_PROFILE_USER_MAPPER);
+    }
+
+    @Override
+    public List<BasicProfileUserDTO> getAllBasicUsers(final Status status) {
+        JdbcUserRepository.log.trace("Selecting basic profiles of all users with a required status from a database.");
+        JdbcUserRepository.log.debug("Status: {}", status);
+
+        return this.jdbc.query("SELECT id, first_name, last_name, photo FROM end_user WHERE status = ?",
+                BASIC_PROFILE_USER_MAPPER, status.name());
+    }
+
+    @Override
+    public UserRole getPermission(Long id) {
+        return jdbc.queryForObject("SELECT user_role FROM end_user WHERE id = ?" ,new Object[]{id}, (rs, rowNum) ->
+            getUserRole(rs.getString("user_role"))
+        );
+    }
+
+    @Override
+    public FullUserProfileDTO getFullUser(final long id) {
+        JdbcUserRepository.log.debug("Selecting full profile of a user with the specified id from a database: {}", id);
+
+        final Map<String, Object> resultMap = this.getUserColumns(id);
+
+        final FullUserProfileDTO user = new FullUserProfileDTO();
+        user.setId(id);
+        user.setFirstName((String) resultMap.get("out_first_name"));
+        user.setLastName((String) resultMap.get("out_last_name"));
+        user.setVacationCount(((Double) resultMap.get("out_no_vacations")).floatValue());
+        user.setSickDayCount((Integer) resultMap.get("out_no_sick_days"));
+        user.setTakenSickDayCount((Integer) resultMap.get("out_taken_sick_days"));
+        user.setNotification(((Timestamp) resultMap.get("out_alert")).toLocalDateTime());
+        user.setEmail((String) resultMap.get("out_email"));
+        user.setPhoto((String) resultMap.get("out_photo"));
+        user.setRole(getUserRole((String) resultMap.get("out_role")));
+        user.setStatus(Status.valueOf((String) resultMap.get("out_status")));
+        return user;
+
+    }
+
+    //---------------------------------- DOMAIN -----------------------------------
+
+    @Override
+    public RegisteredUser getUser(final String email) {
+        return this.jdbc.queryForObject("SELECT * FROM end_user WHERE email = ?", USER_MAPPER, email);
+    }
+
+    @Override
+    public RegisteredUser getUser(final long id) {
+        return this.jdbc.queryForObject("SELECT * FROM end_user WHERE id = ?", USER_MAPPER, id);
+    }
+
+    @Override
+    public UserData getUserData(final long id) {
+        return this.jdbc.queryForObject("SELECT * FROM end_user WHERE id = ?", USER_DATA_MAPPER, id);
+    }
+
+    @Override
+    public void updateUser(final User user) {
+        this.jdbc.update("UPDATE end_user SET first_name = ?, last_name = ?, no_vacations = ?, taken_sick_days = ?, email = ?, photo = ?, user_role = ?, status = ? WHERE id = ?",
+                user.getFirstName(), user.getLastName(), user.getVacationCount(), user.getTakenSickDayCount(), user.getEmail(), user.getPhoto(), user.getRole().name(), user.getStatus().name(), user.getId());
+    }
+
+    @Override
+    public long insertUser(final User user) {
+        PreparedStatementCreatorFactory factory = new PreparedStatementCreatorFactory("INSERT INTO end_user (first_name, last_name, no_vacations, no_sick_days, taken_sick_days, alert, email, photo, user_role, status) VALUES (?,?,?,?,?,?,?,?,?,?)",
+                Types.VARCHAR,
+                Types.VARCHAR,
+                Types.FLOAT,
+                Types.INTEGER,
+                Types.INTEGER,
+                Types.TIMESTAMP,
+                Types.VARCHAR,
+                Types.VARCHAR,
+                Types.VARCHAR,
+                Types.VARCHAR);
+
+
+        factory.setReturnGeneratedKeys(true);
+
+        PreparedStatementCreator stmt = factory.newPreparedStatementCreator(new Object[]{user.getFirstName(), user.getLastName(), user.getVacationCount(), user.getTotalSickDayCount(), user.getTakenSickDayCount(), user.getNotification(), user.getEmail(), user.getPhoto(), user.getRole().name(), user.getStatus().name()});
+
+        GeneratedKeyHolder key = new GeneratedKeyHolder();
+        this.jdbc.update(stmt, key);
+
+        return Objects.requireNonNull(key.getKey()).longValue();
+    }
+
+    @Override
+    public void insertSettings(final DefaultSettings settings) {
+        this.jdbc.update("INSERT INTO default_settings (no_sick_days, alert) VALUES (?, ?)", settings.getSickDayCount(), settings.getNotification());
+    }
+
+    @Override
+    public void updateUserSettings(User user) {
+        jdbc.update("UPDATE end_user SET alert = ?, user_role = ?, no_sick_days = ?, no_vacations = ? WHERE id = ?",
+                user.getNotification(), user.getRole().name(), user.getTotalSickDayCount(), user.getVacationCount(), user.getId());
+    }
+
+    @Override
+    public void updateUserTakenVacation(User user) {
+        jdbc.update("UPDATE end_user SET no_vacations = ? WHERE id = ?",
+                user.getVacationCount(), user.getId());
+    }
+
+    @Override
+    public void updateUserTakenSickDay(User user) {
+        jdbc.update("UPDATE end_user SET taken_sick_days = ? WHERE id = ?",
+                user.getTakenSickDayCount(), user.getId());
+    }
+}
diff --git a/server/src/main/java/org/danekja/ymanager/repository/jdbc/JdbcVacationRepository.java b/server/src/main/java/org/danekja/ymanager/repository/jdbc/JdbcVacationRepository.java
new file mode 100644
index 0000000..474ebc2
--- /dev/null
+++ b/server/src/main/java/org/danekja/ymanager/repository/jdbc/JdbcVacationRepository.java
@@ -0,0 +1,117 @@
+package org.danekja.ymanager.repository.jdbc;
+
+import org.danekja.ymanager.domain.Status;
+import org.danekja.ymanager.domain.Vacation;
+import org.danekja.ymanager.domain.VacationType;
+import org.danekja.ymanager.dto.VacationDayDTO;
+import org.danekja.ymanager.repository.VacationRepository;
+import org.danekja.ymanager.repository.jdbc.mappers.VacationDayMapper;
+import org.danekja.ymanager.repository.jdbc.mappers.VacationMapper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.jdbc.core.JdbcTemplate;
+import org.springframework.jdbc.core.RowMapper;
+import org.springframework.stereotype.Repository;
+
+import java.sql.ResultSet;
+import java.sql.Time;
+import java.time.LocalDate;
+import java.util.List;
+import java.util.Optional;
+
+import static java.util.Optional.ofNullable;
+
+@Repository
+public class JdbcVacationRepository implements VacationRepository {
+
+    private static final RowMapper<Vacation> VACATION_MAPPER = new VacationMapper();
+    private static final RowMapper<VacationDayDTO> VACATION_DAY_MAPPER = new VacationDayMapper();
+
+    /**
+     * The logger.
+     */
+    private static final Logger log = LoggerFactory.getLogger(JdbcVacationRepository.class);
+
+    /**
+     * The connection to a database.
+     */
+    private final JdbcTemplate jdbc;
+
+    /**
+     * Creates a new instance of the class VacationRepository which selects and updates users in a database.
+     *
+     * @param jdbc A connection to the database.
+     */
+    @Autowired
+    public JdbcVacationRepository(final JdbcTemplate jdbc) {
+        JdbcVacationRepository.log.trace("Creating a new instance of the class VacationRepository");
+
+        this.jdbc = jdbc;
+    }
+
+    @Override
+    public List<VacationDayDTO> getVacationDays(final long userId, final LocalDate from) {
+        return jdbc.query("SELECT v.id, v.vacation_date, v.time_from, v.time_to, v.status, v.vacation_type " +
+                        "FROM vacation_day v " +
+                        "INNER JOIN end_user u ON v.user_id = u.id " +
+                        "WHERE v.user_id = ? AND v.vacation_date >= ?",
+                VACATION_DAY_MAPPER, userId, from);
+    }
+
+    @Override
+    public List<VacationDayDTO> getVacationDays(final long userId, final LocalDate from, final Status status) {
+        return jdbc.query("SELECT v.id, v.vacation_date, v.time_from, v.time_to, v.status, v.vacation_type " +
+                        "FROM vacation_day v " +
+                        "INNER JOIN end_user u ON v.user_id = u.id " +
+                        "WHERE v.user_id = ? AND v.vacation_date >= ? AND v.status = ?",
+                VACATION_DAY_MAPPER, userId, from, status.name());
+    }
+
+    @Override
+    public List<VacationDayDTO> getVacationDays(final long userId, final LocalDate from, final LocalDate to) {
+        return jdbc.query("SELECT v.id, v.vacation_date, v.time_from, v.time_to, v.status, v.vacation_type " +
+                        "FROM vacation_day v " +
+                        "INNER JOIN end_user u ON v.user_id = u.id " +
+                        "WHERE v.user_id=? AND v.vacation_date >= ? AND v.vacation_date <= ?",
+                VACATION_DAY_MAPPER, userId, from, to);
+
+    }
+
+    @Override
+    public List<VacationDayDTO> getVacationDays(final long userId, final LocalDate from, final LocalDate to, final Status status) {
+        return jdbc.query("SELECT v.id, v.vacation_date, v.time_from, v.time_to, v.status, v.vacation_type " +
+                        "FROM vacation_day v " +
+                        "INNER JOIN end_user u ON v.user_id = u.id " +
+                        "WHERE v.user_id=? AND v.vacation_date >= ? AND v.vacation_date <= ? AND v.status = ?",
+                VACATION_DAY_MAPPER, userId, from, to, status.name());
+    }
+
+    @Override
+    public Optional<Vacation> getVacationDay(final long id) {
+        return ofNullable(jdbc.queryForObject("SELECT * FROM vacation_day WHERE id = ?", VACATION_MAPPER, id));
+    }
+
+    @Override
+    public void insertVacationDay(final Long userId, final Vacation day) {
+        jdbc.update("INSERT INTO vacation_day (vacation_date, time_from, time_to, status, vacation_type, user_id) VALUES (?,?,?,?,?,?)",
+                day.getDate(), day.getFrom(), day.getTo(), day.getStatus().name(), day.getType().name(), userId);
+    }
+
+    @Override
+    public void updateVacationDay(final Vacation item) {
+        jdbc.update("UPDATE vacation_day SET vacation_date=?, time_from=?, time_to=?, status=?, vacation_type=? WHERE id=?",
+                item.getDate(), item.getFrom(), item.getTo(), item.getStatus().name(), item.getType().name(), item.getId());
+    }
+
+    @Override
+    public void deleteVacationDay(final long id) {
+        jdbc.update("DELETE FROM vacation_day WHERE id=?", id);
+    }
+
+    @Override
+    public boolean isExistVacationForUser(Long userId, LocalDate date) {
+        return jdbc.queryForObject("SELECT count(id) AS exist FROM vacation_day WHERE vacation_date = ? AND user_id = ?",
+                new Object[]{date, userId}, (rs, rowNum) -> rs.getBoolean("exist"));
+    }
+}
diff --git a/server/src/main/java/org/danekja/ymanager/repository/jdbc/mappers/AuthorizationRequestMapper.java b/server/src/main/java/org/danekja/ymanager/repository/jdbc/mappers/AuthorizationRequestMapper.java
new file mode 100644
index 0000000..63eb228
--- /dev/null
+++ b/server/src/main/java/org/danekja/ymanager/repository/jdbc/mappers/AuthorizationRequestMapper.java
@@ -0,0 +1,32 @@
+package org.danekja.ymanager.repository.jdbc.mappers;
+
+import org.danekja.ymanager.domain.Status;
+import org.danekja.ymanager.dto.AuthorizationRequestDTO;
+import org.springframework.jdbc.core.RowMapper;
+
+import java.sql.ResultSet;
+import java.sql.SQLException;
+
+/**
+ * The mapper maps a row from a result of a query to an AuthorizationRequest.
+ */
+public class AuthorizationRequestMapper implements RowMapper<AuthorizationRequestDTO> {
+
+    /**
+     * Maps a row from a result of a query to an AuthorizationRequest.
+     * @param resultSet the row from the result
+     * @param i the index of the row
+     * @return the AuthorizationRequest object
+     * @throws SQLException if the columnLabel is not valid; if a database access error occurs or this method is called on a closed result set
+     */
+    @Override
+    public AuthorizationRequestDTO mapRow(ResultSet resultSet, int i) throws SQLException {
+        final AuthorizationRequestDTO request = new AuthorizationRequestDTO();
+        request.setId(resultSet.getLong("id"));
+        request.setFirstName(resultSet.getString("first_name"));
+        request.setLastName(resultSet.getString("last_name"));
+        request.setTimestamp(resultSet.getTimestamp("creation_date").toLocalDateTime());
+        request.setStatus(Status.valueOf(resultSet.getString("status")));
+        return request;
+    }
+}
diff --git a/server/src/main/java/org/danekja/ymanager/repository/jdbc/mappers/BasicProfileUserMapper.java b/server/src/main/java/org/danekja/ymanager/repository/jdbc/mappers/BasicProfileUserMapper.java
new file mode 100644
index 0000000..3c36b9e
--- /dev/null
+++ b/server/src/main/java/org/danekja/ymanager/repository/jdbc/mappers/BasicProfileUserMapper.java
@@ -0,0 +1,30 @@
+package org.danekja.ymanager.repository.jdbc.mappers;
+
+import org.danekja.ymanager.dto.BasicProfileUserDTO;
+import org.springframework.jdbc.core.RowMapper;
+
+import java.sql.ResultSet;
+import java.sql.SQLException;
+
+/**
+ * The mapper maps a row from a result of a query to an BasicProfileUser.
+ */
+public class BasicProfileUserMapper implements RowMapper<BasicProfileUserDTO> {
+
+    /**
+     * Maps a row from a result of a query to an BasicProfileUser.
+     * @param resultSet the row from the result
+     * @param i the index of the row
+     * @return the BasicProfileUser object
+     * @throws SQLException if the columnLabel is not valid; if a database access error occurs or this method is called on a closed result set
+     */
+    @Override
+    public BasicProfileUserDTO mapRow(ResultSet resultSet, int i) throws SQLException {
+        final BasicProfileUserDTO user = new BasicProfileUserDTO();
+        user.setId(resultSet.getLong("id"));
+        user.setFirstName(resultSet.getString("first_name"));
+        user.setLastName(resultSet.getString("last_name"));
+        user.setPhoto(resultSet.getString("photo"));
+        return user;
+    }
+}
diff --git a/server/src/main/java/org/danekja/ymanager/repository/jdbc/mappers/VacationDayMapper.java b/server/src/main/java/org/danekja/ymanager/repository/jdbc/mappers/VacationDayMapper.java
new file mode 100644
index 0000000..a1e6732
--- /dev/null
+++ b/server/src/main/java/org/danekja/ymanager/repository/jdbc/mappers/VacationDayMapper.java
@@ -0,0 +1,49 @@
+package org.danekja.ymanager.repository.jdbc.mappers;
+
+import org.danekja.ymanager.domain.Status;
+import org.danekja.ymanager.domain.VacationType;
+import org.danekja.ymanager.dto.VacationDayDTO;
+import org.springframework.jdbc.core.RowMapper;
+
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Time;
+
+/**
+ * The mapper maps a row from a result of a query to an Vacation.
+ */
+public class VacationDayMapper implements RowMapper<VacationDayDTO> {
+
+    /**
+     * Maps a row from a result of a query to an Vacation.
+     * @param resultSet the row from the result
+     * @param i the index of the row
+     * @return the Vacation object
+     * @throws SQLException if the columnLabel is not valid; if a database access error occurs or this method is called on a closed result set
+     */
+    @Override
+    public VacationDayDTO mapRow(ResultSet resultSet, int i) throws SQLException {
+        final VacationDayDTO item = new VacationDayDTO();
+        item.setId(resultSet.getLong("v.id"));
+        item.setDate(resultSet.getDate("v.vacation_date").toLocalDate());
+
+        /*
+            When a result contains a sick day it doesn't have specified a start and end time because
+            it can be taken only as a whole day. In this case the v.time_from and v.time_to are null.
+            Which must be handled.
+        */
+        final Time timeFrom = resultSet.getTime("v.time_from");
+        if (timeFrom != null) {
+            item.setFrom(timeFrom.toLocalTime());
+        }
+
+        final Time timeTo = resultSet.getTime("v.time_to");
+        if (timeTo != null) {
+            item.setTo(timeTo.toLocalTime());
+        }
+
+        item.setStatus(Status.valueOf(resultSet.getString("v.status")));
+        item.setType(VacationType.getVacationType(resultSet.getString("v.vacation_type")));
+        return item;
+    }
+}
diff --git a/server/src/main/java/org/danekja/ymanager/repository/jdbc/mappers/VacationMapper.java b/server/src/main/java/org/danekja/ymanager/repository/jdbc/mappers/VacationMapper.java
new file mode 100644
index 0000000..06a95e0
--- /dev/null
+++ b/server/src/main/java/org/danekja/ymanager/repository/jdbc/mappers/VacationMapper.java
@@ -0,0 +1,43 @@
+package org.danekja.ymanager.repository.jdbc.mappers;
+
+import org.danekja.ymanager.domain.Status;
+import org.danekja.ymanager.domain.Vacation;
+import org.danekja.ymanager.domain.VacationType;
+import org.springframework.jdbc.core.RowMapper;
+
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Time;
+
+/**
+ * Maps "vacation_day" query rows into Vacation object.
+ */
+public class VacationMapper implements RowMapper<Vacation> {
+    @Override
+    public Vacation mapRow(ResultSet rs, int i) throws SQLException {
+        Vacation vacation = new Vacation();
+        vacation.setId(rs.getLong("id"));
+        vacation.setDate(rs.getDate("vacation_date").toLocalDate());
+
+        /*
+            When a result contains a sick day it doesn't have specified a start and end time because
+            it can be taken only as a whole day. In this case the v.time_from and v.time_to are null.
+            Which must be handled.
+        */
+        final Time timeFrom = rs.getTime("time_from");
+        if (timeFrom != null) {
+            vacation.setFrom(timeFrom.toLocalTime());
+        }
+
+        final Time timeTo = rs.getTime("time_to");
+        if (timeTo != null) {
+            vacation.setTo(timeTo.toLocalTime());
+        }
+
+        vacation.setCreationDate(rs.getTimestamp("creation_date").toLocalDateTime());
+        vacation.setStatus(Status.valueOf(rs.getString("status")));
+        vacation.setType(VacationType.getVacationType(rs.getString("vacation_type")));
+        vacation.setUserId(rs.getLong("user_id"));
+        return vacation;
+    }
+}
diff --git a/server/src/main/java/org/danekja/ymanager/repository/jdbc/mappers/VacationRequestMapper.java b/server/src/main/java/org/danekja/ymanager/repository/jdbc/mappers/VacationRequestMapper.java
new file mode 100644
index 0000000..52a5342
--- /dev/null
+++ b/server/src/main/java/org/danekja/ymanager/repository/jdbc/mappers/VacationRequestMapper.java
@@ -0,0 +1,52 @@
+package org.danekja.ymanager.repository.jdbc.mappers;
+
+import org.danekja.ymanager.domain.Status;
+import org.danekja.ymanager.domain.VacationType;
+import org.danekja.ymanager.dto.VacationRequestDTO;
+import org.springframework.jdbc.core.RowMapper;
+
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Time;
+
+/**
+ * The mapper maps each row from a result of a query to a VacationRequest.
+ */
+public class VacationRequestMapper implements RowMapper<VacationRequestDTO> {
+
+    /**
+     * Maps a row from a result of a query to an VacationRequest.
+     * @param resultSet the row from the result
+     * @param i the index of the row
+     * @return the VacationRequest object
+     * @throws SQLException if the columnLabel is not valid; if a database access error occurs or this method is called on a closed result set
+     */
+    @Override
+    public VacationRequestDTO mapRow(ResultSet resultSet, int i) throws SQLException {
+        final VacationRequestDTO request = new VacationRequestDTO();
+        request.setId(resultSet.getLong("v.id"));
+        request.setFirstName(resultSet.getString("u.first_name"));
+        request.setLastName(resultSet.getString("u.last_name"));
+        request.setDate(resultSet.getDate("v.vacation_date").toLocalDate());
+
+        /*
+            When a result contains a sick day it doesn't have specified a start and end time because
+            it can be taken only as a whole day. In this case the v.time_from and v.time_to are null.
+            Which must be handled.
+        */
+        final Time timeFrom = resultSet.getTime("v.time_from");
+        if (timeFrom != null) {
+            request.setFrom(timeFrom.toLocalTime());
+        }
+
+        final Time timeTo = resultSet.getTime("v.time_to");
+        if (timeTo != null) {
+            request.setTo(timeTo.toLocalTime());
+        }
+
+        request.setTimestamp(resultSet.getTimestamp("v.creation_date").toLocalDateTime());
+        request.setType(VacationType.getVacationType(resultSet.getString("v.vacation_type")));
+        request.setStatus(Status.valueOf(resultSet.getString("v.status")));
+        return request;
+    }
+}
