src/main/java/br/eng/joaofaro/taskmanager/repository/service/TaskService.java
/**
     * <p>Method responsible to list <code>tasks</code> by User</p>
     * @param user - task user
     * @return - List of tasks
     * @throws TaskManagerException - throws a exception to handle result
     * @throws TaskNotFoundException - throws a exception to handle result
     */
Method responsible to list tasks by User
@param user - task user
@return - List of tasks
@throws TaskManagerException - throws a exception to handle result
@throws TaskNotFoundException - throws a exception to handle result
Method responsible to list tasks by User @param user - task user @return - List of tasks @throws TaskManagerException - throws a exception to handle result @throws TaskNotFoundException - throws a exception to handle result
public List<Task> listAllBy(AccountUser user) throws TaskManagerException, TaskNotFoundException {
        log.info("Searching task by user");
        try {
            List<Task> tasks = repository.findAllByUser(user);
            if (tasks.size() > 0) {
                log.info("Returning tasks");
                return tasks;
            }else {
                log.warn("Tasks not found");
                throw new TaskNotFoundException("Tasks not found in database");
            }
        }catch (Exception e) {
            if (e instanceof TaskNotFoundException) {
                log.warn("Tasks not found in database");
                throw new TaskNotFoundException("Tasks not found in database: "+ e.getMessage());
            }else {
                log.error("Error when trying to find task in database: {}", e.getMessage());
                throw new TaskManagerException("Error when trying to find task in database: "+ e.getMessage());
            }
        }
    }
public List < Task > listAllBy ( AccountUser user ) throws TaskManagerException , TaskNotFoundException { log . info ( "Searching task by user" ) ; try { List < Task > tasks = repository . findAllByUser ( user ) ; if ( tasks . size ( ) > 0 ) { log . info ( "Returning tasks" ) ; return tasks ; } else { log . warn ( "Tasks not found" ) ; throw new TaskNotFoundException ( "Tasks not found in database" ) ; } } catch ( Exception e ) { if ( e instanceof TaskNotFoundException ) { log . warn ( "Tasks not found in database" ) ; throw new TaskNotFoundException ( "Tasks not found in database: " + e . getMessage ( ) ) ; } else { log . error ( "Error when trying to find task in database: {}" , e . getMessage ( ) ) ; throw new TaskManagerException ( "Error when trying to find task in database: " + e . getMessage ( ) ) ; } } }
<p>Method responsible to list <code>tasks</code> by User</p>
 @param user - task user
 @return - List of tasks
 @throws TaskManagerException - throws a exception to handle result
 @throws TaskNotFoundException - throws a exception to handle result
<p > Method responsible to list <code > tasks< / code > by User< / p > @param user - task user @return - List of tasks @throws TaskManagerException - throws a exception to handle result @throws TaskNotFoundException - throws a exception to handle result