package de.uhilger.um.api; import de.uhilger.baselink.GenericRecord; import de.uhilger.baselink.Record; import de.uhilger.um.App; import de.uhilger.um.daten.User; import java.util.List; import org.apache.catalina.realm.RealmBase; /** * * @author Ulrich Hilger */ public class UserMgr { private static final String MD5 = "MD5"; private static final Record UserMapper = new GenericRecord(User.class); public static final String SQL_GET_USER_LIST = "getUserList"; public static final String SQL_GET_USER_NAME_LIST = "getUserNameList"; public User createUser(User user) { String kw = user.getPw(); String digestedPw = RealmBase.Digest(kw, MD5, null); user.setPw(digestedPw); App.getDatabase().insert(user, UserMapper); return user; } public List getUserNameList() { String sql = App.getSqlStatement(SQL_GET_USER_NAME_LIST); List userNames = App.getDatabase().select(sql, App.WITHOUT_BLOBS); return userNames; } /* public List getUserList() { String sql = App.getSqlStatement(SQL_GET_USER_LIST); List users = App.getDatabase().select(sql, UserMapper, App.WITHOUT_BLOBS); return users; } */ public String hallo() { return "Hallo Welt"; } }