| | |
| | | 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; |
| | | |
| | | /** |
| | | * |
| | | * Klasse zur Verwaltung von Benutzern in einer Datenbank |
| | | * |
| | | * @author Ulrich Hilger |
| | | */ |
| | | public class UserMgr { |
| | |
| | | |
| | | 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 static final String SQL_DELETE_USER = "deleteUser"; |
| | | |
| | | public User createUser(User user) { |
| | | String kw = user.getPw(); |
| | | String digestedPw = RealmBase.Digest(kw, MD5, null); |
| | |
| | | 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 User deleteUser(User user) { |
| | | return (User) App.getDatabase().delete(user, UserMapper); |
| | | } |
| | | |
| | | /* |
| | | 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"; |
| | | } |
| | | |
| | | } |