src/main/java/br/eng/joaofaro/taskmanager/repository/service/TaskService.java
/**
     * <p>Method responsible to list <code>tasks</code></p>
     * <p>Could be complemented with status</p>
     * @param status - Task status
     * @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
Could be complemented with status
@param status - Task status
@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 Could be complemented with status @param status - Task status @return - List of tasks @throws TaskManagerException - throws a exception to handle result @throws TaskNotFoundException - throws a exception to handle result
public List<Task> listAll(TaskStatus status) throws TaskManagerException, TaskNotFoundException {
        log.info("Searching task by status");
        try {
            List<Task> tasks;
            if (status != null) {
                tasks = repository.findAllByStatus(status);
            }else {
                tasks = repository.findAll();
            }
            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 > listAll ( TaskStatus status ) throws TaskManagerException , TaskNotFoundException { log . info ( "Searching task by status" ) ; try { List < Task > tasks ; if ( status != null ) { tasks = repository . findAllByStatus ( status ) ; } else { tasks = repository . findAll ( ) ; } 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></p>
 <p>Could be complemented with status</p>
 @param status - Task status
 @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 > < / p > <p > Could be complemented with status< / p > @param status - Task status @return - List of tasks @throws TaskManagerException - throws a exception to handle result @throws TaskNotFoundException - throws a exception to handle result