UserServiceSpring.java 683 Bytes
package org.legrog.web.user;

import org.legrog.entities.Person;
import org.legrog.entities.PersonRepository;

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

@Stateless
public class UserServiceSpring implements UserService {
    @Inject
    PersonRepository personRepository;

    public void addUser(Person person) {
        personRepository.save(person);
    }

    public List<Person> getAllUsers() {
        return personRepository.findAll();
    }

    public Person findUserById(int id) {
        return personRepository.findOne(new Integer(id));
    }

    public void updateUser(Person person) {
        personRepository.save(person);
    }
}