UserServiceDefault.java 700 Bytes
package org.legrog.web.user;

import org.legrog.entities.Account;
import org.legrog.entities.AccountRepository;

import javax.ejb.Stateless;
import javax.inject.Inject;
import java.util.List;

@Stateless
public class UserServiceDefault implements UserService {
    @Inject
    AccountRepository accountRepository;

    public void addUser(Account account) {
        accountRepository.save(account);
    }

    public List<Account> getAllUsers() {
        return accountRepository.findAll();
    }

    public Account findUserById(int id) {
        return accountRepository.findOne(new Integer(id));
    }

    public void updateUser(Account account) {
        accountRepository.save(account);
    }
}