commit | author | age
|
c65695
|
1 |
package de.uhilger.um.api; |
U |
2 |
|
|
3 |
import de.uhilger.baselink.GenericRecord; |
|
4 |
import de.uhilger.baselink.Record; |
|
5 |
import de.uhilger.um.App; |
|
6 |
import de.uhilger.um.daten.User; |
725d10
|
7 |
import java.util.List; |
c65695
|
8 |
import org.apache.catalina.realm.RealmBase; |
U |
9 |
|
|
10 |
/** |
|
11 |
* |
|
12 |
* @author Ulrich Hilger |
|
13 |
*/ |
|
14 |
public class UserMgr { |
|
15 |
|
|
16 |
private static final String MD5 = "MD5"; |
|
17 |
|
|
18 |
private static final Record UserMapper = new GenericRecord(User.class); |
|
19 |
|
725d10
|
20 |
public static final String SQL_GET_USER_LIST = "getUserList"; |
U |
21 |
public static final String SQL_GET_USER_NAME_LIST = "getUserNameList"; |
|
22 |
|
c65695
|
23 |
public User createUser(User user) { |
U |
24 |
String kw = user.getPw(); |
|
25 |
String digestedPw = RealmBase.Digest(kw, MD5, null); |
|
26 |
user.setPw(digestedPw); |
|
27 |
App.getDatabase().insert(user, UserMapper); |
|
28 |
return user; |
|
29 |
} |
|
30 |
|
725d10
|
31 |
public List getUserNameList() { |
U |
32 |
String sql = App.getSqlStatement(SQL_GET_USER_NAME_LIST); |
|
33 |
List userNames = App.getDatabase().select(sql, App.WITHOUT_BLOBS); |
|
34 |
return userNames; |
|
35 |
} |
|
36 |
|
|
37 |
/* |
|
38 |
public List getUserList() { |
|
39 |
String sql = App.getSqlStatement(SQL_GET_USER_LIST); |
|
40 |
List users = App.getDatabase().select(sql, UserMapper, App.WITHOUT_BLOBS); |
|
41 |
return users; |
|
42 |
} |
|
43 |
*/ |
|
44 |
|
f8b605
|
45 |
public String hallo() { |
U |
46 |
return "Hallo Welt"; |
|
47 |
} |
|
48 |
|
c65695
|
49 |
} |