<commit_before>package com.momenton;

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.Component;

import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;

/**
 * Created by james_000 on 29/10/2017.
 */
@Component
public class EmployeeList {

    private static final Logger log = LoggerFactory.getLogger(EmployeeList.class);

    //@Autowired
    JdbcTemplate jdbcTemplate;

    @Autowired
    public EmployeeList(JdbcTemplate jdbcTemplate) {
        this.jdbcTemplate = jdbcTemplate;
    }

    public void init() {
        setUpDB();
        //dump table into tree structure
        //multiple trees if more than one person with out manager
        //once done work out max depth
        //depth = columns
        //then start drawing
    }


    public Node<Employee> populateTree() {
        return null;
    }

    public void setUpDB() {

        log.info("Creating table");<commit_msg>get childeren partly done... still WIP<commit_after>package com.momenton;

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.Component;

import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;

/**
 * Created by james_000 on 29/10/2017.
 */
@Component
public class EmployeeList {

    private static final Logger log = LoggerFactory.getLogger(EmployeeList.class);

    JdbcTemplate jdbcTemplate;

    @Autowired
    public EmployeeList(JdbcTemplate jdbcTemplate) {
        this.jdbcTemplate = jdbcTemplate;
    }

    public void init() {
        setUpDB();
        //dump table into tree structure
        //multiple trees if more than one person with out manager
        //once done work out max depth
        //depth = columns
        //then start drawing
    }


    public Node<Employee> populateTree() {
        Node<Employee> employees;
        List<Employee> headManagers = new ArrayList<>(jdbcTemplate.query(
                "SELECT employee_name, id, manager_id FROM employees WHERE manager_id is null",
                (rs, rowNum) -> new Employee(rs.getString("employee_name"), rs.getLong("id"), rs.getLong("manager_id"))
        ));

        for (Employee employee: headManagers) {
            employees = new Node<>(employee);
            employees.addChild(getChildren(employee.getId()));
        }


        return null;
    }

    private Node<Employee> getChildren(Long id) {

    }

    public void setUpDB() {

        log.info("Creating table");
{'fraction_non_alphanumeric': 0.09798270893371758, 'fraction_numerical': 0.009365994236311239, 'mean_word_length': 2.944602272727273, 'pattern_counts': {'":': 0, '<': 10, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3860800', 'n_tokens_mistral': 812, 'n_tokens_neox': 763, 'n_words': 203}