class UserStore {

    public boolean add(User user) {
        boolean done = false;
        if (user != null && this.findByLogin(user.getLogin()) == null) {
            try (Connection connect = CON.getConnect();
                 PreparedStatement st = connect.prepareStatement(QUERIES.getProperty("insertUser"))) {
                int roleId = ROLE_STORE.findRoleId(user.getRole());
                if (roleId == 0) {
                    roleId = ROLE_STORE.add(user.getRole());
                }
                st.setInt(1, roleId);
                st.setString(2, user.getPassword());
                st.setString(3, user.getLogin());
                st.setString(4, user.getName());
                int userId = 0;
                try (ResultSet rstSet = st.executeQuery()) {
                    if (rstSet.next()) {
                        userId = rstSet.getInt("id");
                        ADDRESS_STORE.add(userId, user.getAddress());
                        done = true;
                    }
                }
                this.insertUserType(userId, user);
            } catch (SQLException e) {
                LOG.error(e.getMessage(), e);
            }
        }
        return done;
    }

}