(empty log message)
@@ -1,74 +0,0 @@ | ||
1 | -package sample.org.phosphoresce.webcore.ext.struts.common.service; | |
2 | - | |
3 | -import org.phosphoresce.lib.commons.util.StringUtil; | |
4 | -import org.phosphoresce.webcore.ext.hibernate4.model.SUser; | |
5 | -import org.phosphoresce.webcore.ext.hibernate4.util.SCodeManager; | |
6 | - | |
7 | -import sample.org.phosphoresce.webcore.ext.struts.common.action.SampleHibernateService; | |
8 | -import sample.org.phosphoresce.webcore.ext.struts.common.action.SampleHibernateTransactionContext; | |
9 | - | |
10 | -/** | |
11 | - * ユーザーマスタテーブルサンプルサービスクラスです。<br> | |
12 | - * | |
13 | - * @author Kitagawa<br> | |
14 | - * | |
15 | - *<!-- | |
16 | - * 更新日 更新者 更新内容 | |
17 | - * 2013/07/11 Kitagawa 新規作成 | |
18 | - *--> | |
19 | - */ | |
20 | -public class SampleSUserService extends SampleHibernateService { | |
21 | - | |
22 | - /** | |
23 | - * コンストラクタ<br> | |
24 | - * @param transactionContext トランザクション処理コンテキストオブジェクト | |
25 | - */ | |
26 | - public SampleSUserService(SampleHibernateTransactionContext transactionContext) { | |
27 | - super(transactionContext); | |
28 | - } | |
29 | - | |
30 | - /** | |
31 | - * 指定されたユーザーコードとパスワードで一致するユーザー情報を取得します。<br> | |
32 | - * パスワード一致比較は平文による比較及び、MD5ハッシュによる比較が行われ、いずれかで一致した場合に合致ユーザであると判断します。<br> | |
33 | - * @param code ユーザーコード | |
34 | - * @param password パスワード | |
35 | - * @return 合致するユーザーが存在した場合にそのエンティティを返却します | |
36 | - */ | |
37 | - public SUser searchByCodeAndPassword(String code, String password) { | |
38 | - SUser sUser = sUserDAO.findByCode(code); | |
39 | - if (sUser != null) { | |
40 | - if (StringUtil.equals(password, sUser.getPassword())) { | |
41 | - return sUser; | |
42 | - } else if (StringUtil.equals(StringUtil.toMD5Hash(password), sUser.getPassword())) { | |
43 | - return sUser; | |
44 | - } | |
45 | - } | |
46 | - | |
47 | - return null; | |
48 | - } | |
49 | - | |
50 | - public long countAllUser() { | |
51 | - return sUserDAO.countAll(); | |
52 | - } | |
53 | - | |
54 | - /** | |
55 | - * 指定された内容で新規にユーザーを登録します。<br> | |
56 | - * @param code ユーザーID | |
57 | - * @param password パスワード | |
58 | - * @param firstName 氏名(名) | |
59 | - * @param lastName 氏名(姓) | |
60 | - * @return 登録されたユーザーエンティティ | |
61 | - */ | |
62 | - public SUser createNewUser(String code, String password, String firstName, String lastName) { | |
63 | - SUser sUser = new SUser(); | |
64 | - sUser.setCode(code); | |
65 | - sUser.setPassword(StringUtil.toMD5Hash(password)); | |
66 | - sUser.setFirstName(firstName); | |
67 | - sUser.setLastName(lastName); | |
68 | - sUser.setRoleType(SCodeManager.getCode("S0002", "0")); | |
69 | - | |
70 | - save(sUser); | |
71 | - | |
72 | - return sUser; | |
73 | - } | |
74 | -} |
@@ -0,0 +1,74 @@ | ||
1 | +package sample.org.phosphoresce.webcore.ext.struts.common.service; | |
2 | + | |
3 | +import org.phosphoresce.lib.commons.util.StringUtil; | |
4 | +import org.phosphoresce.webcore.ext.hibernate4.model.SUser; | |
5 | +import org.phosphoresce.webcore.ext.hibernate4.util.SCodeManager; | |
6 | + | |
7 | +import sample.org.phosphoresce.webcore.ext.struts.common.action.SampleHibernateService; | |
8 | +import sample.org.phosphoresce.webcore.ext.struts.common.action.SampleHibernateTransactionContext; | |
9 | + | |
10 | +/** | |
11 | + * ユーザーマスタテーブルサンプルサービスクラスです。<br> | |
12 | + * | |
13 | + * @author Kitagawa<br> | |
14 | + * | |
15 | + *<!-- | |
16 | + * 更新日 更新者 更新内容 | |
17 | + * 2013/07/11 Kitagawa 新規作成 | |
18 | + *--> | |
19 | + */ | |
20 | +public class SampleSUserService extends SampleHibernateService { | |
21 | + | |
22 | + /** | |
23 | + * コンストラクタ<br> | |
24 | + * @param transactionContext トランザクション処理コンテキストオブジェクト | |
25 | + */ | |
26 | + public SampleSUserService(SampleHibernateTransactionContext transactionContext) { | |
27 | + super(transactionContext); | |
28 | + } | |
29 | + | |
30 | + /** | |
31 | + * 指定されたユーザーコードとパスワードで一致するユーザー情報を取得します。<br> | |
32 | + * パスワード一致比較は平文による比較及び、MD5ハッシュによる比較が行われ、いずれかで一致した場合に合致ユーザであると判断します。<br> | |
33 | + * @param code ユーザーコード | |
34 | + * @param password パスワード | |
35 | + * @return 合致するユーザーが存在した場合にそのエンティティを返却します | |
36 | + */ | |
37 | + public SUser searchByCodeAndPassword(String code, String password) { | |
38 | + SUser sUser = sUserDAO.findByCode(code); | |
39 | + if (sUser != null) { | |
40 | + if (StringUtil.equals(password, sUser.getPassword())) { | |
41 | + return sUser; | |
42 | + } else if (StringUtil.equals(StringUtil.toMD5Hash(password), sUser.getPassword())) { | |
43 | + return sUser; | |
44 | + } | |
45 | + } | |
46 | + | |
47 | + return null; | |
48 | + } | |
49 | + | |
50 | + public long countAllUser() { | |
51 | + return sUserDAO.countAll(); | |
52 | + } | |
53 | + | |
54 | + /** | |
55 | + * 指定された内容で新規にユーザーを登録します。<br> | |
56 | + * @param code ユーザーID | |
57 | + * @param password パスワード | |
58 | + * @param firstName 氏名(名) | |
59 | + * @param lastName 氏名(姓) | |
60 | + * @return 登録されたユーザーエンティティ | |
61 | + */ | |
62 | + public SUser createNewUser(String code, String password, String firstName, String lastName) { | |
63 | + SUser sUser = new SUser(); | |
64 | + sUser.setCode(code); | |
65 | + sUser.setPassword(StringUtil.toMD5Hash(password)); | |
66 | + sUser.setFirstName(firstName); | |
67 | + sUser.setLastName(lastName); | |
68 | + sUser.setRoleType(SCodeManager.getCode("S0002", "0")); | |
69 | + | |
70 | + save(sUser); | |
71 | + | |
72 | + return sUser; | |
73 | + } | |
74 | +} |