@@ -0,0 +1,2658 @@
+package com.aemreunal.service;%0A%0Aimport org.springframework.beans.factory.annotation.Autowired;%0Aimport org.springframework.stereotype.Service;%0Aimport org.springframework.transaction.annotation.Transactional;%0Aimport com.aemreunal.config.GlobalSettings;%0Aimport com.aemreunal.controller.DeleteResponse;%0Aimport com.aemreunal.domain.User;%0Aimport com.aemreunal.repository.user.UserRepo;%0A%0A/*%0A ***************************%0A * Copyright (c) 2014      *%0A *                         *%0A * This code belongs to:   *%0A *                         *%0A * @author Ahmet Emre %C3%9Cnal *%0A * S001974                 *%0A *                         *%0A * aemreunal@gmail.com     *%0A * emre.unal@ozu.edu.tr    *%0A *                         *%0A * aemreunal.com           *%0A ***************************%0A */%0A%0A@Transactional%0A@Service%0Apublic class UserService %7B%0A    @Autowired%0A    private UserRepo userRepo;%0A%0A    /**%0A     * Saves/updates the given user%0A     *%0A     * @param user%0A     *     The user to save/update%0A     *%0A     * @return The saved/updated user%0A     */%0A    public User save(User user) %7B%0A        if (GlobalSettings.DEBUGGING) %7B%0A            System.out.println(%22Saving user with ID = %5C'%22 + user.getUserId() + %22%5C'%22);%0A        %7D%0A%0A        return userRepo.save(user);%0A    %7D%0A%0A    /**%0A     * Finds the user with the given ID%0A     *%0A     * @param id%0A     *     The ID of the user to search for%0A     *%0A     * @return The user the given ID%0A     */%0A    public User findById(Long id) %7B%0A        if (GlobalSettings.DEBUGGING) %7B%0A            System.out.println(%22Finding user with ID = %5C'%22 + id + %22%5C'%22);%0A        %7D%0A%0A        return userRepo.findOne(id);%0A    %7D%0A%0A    /**%0A     * Find the user with the given username%0A     *%0A     * @param username%0A     *     The username of the user to search for%0A     *%0A     * @return The user with the given username%0A     */%0A    public User findByUsername(String username) %7B%0A        if (GlobalSettings.DEBUGGING) %7B%0A            System.out.println(%22Finding user with username = %5C'%22 + username + %22%5C'%22);%0A        %7D%0A%0A        return userRepo.findByUsername(username);%0A    %7D%0A%0A    /**%0A     * Deletes the user with the given ID and deletes everything (projects, etc.)%0A     * associated with the user%0A     *%0A     * @param id%0A     *     The ID of the user to delete%0A     *%0A     * @return Whether the user was deleted or not%0A     */%0A    public DeleteResponse delete(Long id) %7B%0A        if (GlobalSettings.DEBUGGING) %7B%0A            System.out.println(%22Deleting user with ID = %5C'%22 + id + %22%5C'%22);%0A        %7D%0A        if (userRepo.exists(id)) %7B%0A            userRepo.delete(id);%0A            return DeleteResponse.DELETED;%0A        %7D else %7B%0A            return DeleteResponse.NOT_FOUND;%0A        %7D%0A    %7D%0A%7D%0A

Add user service