Package cz.cvut.fel.wa2.interior.service

Source Code of cz.cvut.fel.wa2.interior.service.UserService

package cz.cvut.fel.wa2.interior.service;

import cz.cvut.fel.wa2.interior.dao.UserDAO;
import cz.cvut.fel.wa2.interior.entity.GaeUser;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
*
* @author Ondrej Panek
*/
@Service
public class UserService {

    @Autowired
    private UserDAO userDAO;

    public void create(String email) {
        GaeUser user = new GaeUser("panekon1@gmail.com");
        userDAO.persist(user);
    }

    public List<GaeUser> findAll() {
        return userDAO.findAll(GaeUser.class, "email", true);
    }

    public GaeUser findByEmail(String email) {
        List<GaeUser> users = userDAO.findByProperty(GaeUser.class, "email", String.class, email);
        return users.isEmpty() ? null : users.get(0);
    }

}
TOP

Related Classes of cz.cvut.fel.wa2.interior.service.UserService

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.