<commit_before>package com.github.neunkasulle.chronocommand.control;

import com.github.neunkasulle.chronocommand.model.Role;
import com.github.neunkasulle.chronocommand.model.User;
import com.github.neunkasulle.chronocommand.model.UserDAO;

/**
 * Created by Janze on 18.01.2016.
 * User creation Stuff
 */
public class CreateUserControl extends Control {
    private static CreateUserControl ourInstance = new CreateUserControl();
    
    private CreateUserControl() {

    }



    public static CreateUserControl getInstance() {
        return ourInstance;
    }


    public boolean createUser(Role userType, String name, String email, String password, User supervisor, int hoursPerMonth) {
        UserDAO userDAO = UserDAO.getInstance();

        if(userDAO.findUser(name) != null) {
            return false; //user with this name exists
        }

        if (userDAO.findUserByMail(email) != null) {
            return false; // email is currently in use
        }

        userDAO.addUser(new User(userType, name, email, password, supervisor, hoursPerMonth));

        return true;
    }

    private void showErrorMessage(String errorCode) {

    }<commit_msg>implemented create userControler<commit_after>package com.github.neunkasulle.chronocommand.control;

import com.github.neunkasulle.chronocommand.model.Role;
import com.github.neunkasulle.chronocommand.model.User;
import com.github.neunkasulle.chronocommand.model.UserDAO;

/**
 * Created by Janze on 18.01.2016.
 * User creation Stuff
 */
public class CreateUserControl extends Control {
    private static CreateUserControl ourInstance = new CreateUserControl();
    
    private CreateUserControl() {

    }



    public static CreateUserControl getInstance() {
        return ourInstance;
    }


    public boolean createUser(Role userType, String name, String email, String password, User supervisor, int hoursPerMonth) {
        UserDAO userDAO = UserDAO.getInstance();

        if(userDAO.findUser(name) != null) {
            return false; //user with this name exists
        }

        if (userDAO.findUserByMail(email) != null) {
            return false; // email is currently in use
        }

        userDAO.saveUser(new User(userType, name, email, password, supervisor, hoursPerMonth));

        return true;
    }

    private void showErrorMessage(String errorCode) {

    }
{'fraction_non_alphanumeric': 0.08791208791208792, 'fraction_numerical': 0.006762468300929839, 'mean_word_length': 3.1599297012302285, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '5455790', 'n_tokens_mistral': 694, 'n_tokens_neox': 652, 'n_words': 170}