OSDN Git Service

クラス名が分りづらいので変更
authorsenju <senju@users.sourceforge.jp>
Sun, 2 Aug 2009 06:58:57 +0000 (15:58 +0900)
committersenju <senju@users.sourceforge.jp>
Sun, 2 Aug 2009 06:58:57 +0000 (15:58 +0900)
UserProfileからAccountに変更

src/jp/sourceforge/rabbitBTS/controllers/RegisterController.java
src/jp/sourceforge/rabbitBTS/models/Account.java [moved from src/jp/sourceforge/rabbitBTS/models/UserProfile.java with 98% similarity]
src/jp/sourceforge/rabbitBTS/services/AccountServices.java
war/WEB-INF/appengine-generated/datastore-indexes-auto.xml
war/WEB-INF/views/register/index.jsp

index f9c4b1c..ed33675 100644 (file)
@@ -23,7 +23,7 @@ import javax.servlet.http.HttpServletRequest;
 import jp.sourceforge.rabbitBTS.Sht;
 import jp.sourceforge.rabbitBTS.exceptions.NotRegisteredException;
 import jp.sourceforge.rabbitBTS.exceptions.RabbitBTSException;
-import jp.sourceforge.rabbitBTS.models.UserProfile;
+import jp.sourceforge.rabbitBTS.models.Account;
 import jp.sourceforge.rabbitBTS.services.AccountServices;
 
 import org.springframework.beans.factory.annotation.Autowired;
@@ -59,7 +59,7 @@ public class RegisterController implements IController {
        public String index(HttpServletRequest req, ModelMap map) {
                String ret = null;
                try {
-                       final UserProfile up = this.accountServices.fetchUserProfile();
+                       final Account up = this.accountServices.fetchAccount();
                        if (up == null) {
                                // googleにログインしてない場合
                                Sht.log(this).finer("ログインが必要");
@@ -71,7 +71,7 @@ public class RegisterController implements IController {
                        }
                } catch (final NotRegisteredException e) {
                        // 正常系
-                       map.addAttribute(new UserProfile());
+                       map.addAttribute(new Account());
                        ret = null;
                }
                return ret;
@@ -99,7 +99,7 @@ public class RegisterController implements IController {
         * @return
         */
        @RequestMapping(method = RequestMethod.POST)
-       public String index(UserProfile user, BindingResult result, ModelMap map) {
+       public String index(Account user, BindingResult result, ModelMap map) {
                this.validator.validate(user, result);
                if (result.hasErrors()) {
                        Sht.log(this).finer("ユーザ登録画面にてバリデートに失敗");
@@ -107,7 +107,7 @@ public class RegisterController implements IController {
                }
 
                try {
-                       this.accountServices.registUserProfile(user);
+                       this.accountServices.registAccount(user);
                } catch (final RabbitBTSException e) {
                        Sht.log(this).log(Level.WARNING, "ユーザー登録で例外発生", e);
                        map.addAttribute("errorMessage", "登録に失敗しました。再度やりなおしてください。");
@@ -31,7 +31,7 @@ import org.springmodules.validation.bean.conf.loader.annotation.handler.NotBlank
 import com.google.appengine.api.users.User;
 
 @PersistenceCapable(identityType = IdentityType.APPLICATION)
-public class UserProfile {
+public class Account {
        @PrimaryKey
        @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
        private Long userProfileId;
index 292f75b..6ef8b27 100644 (file)
@@ -27,14 +27,14 @@ import jp.sourceforge.rabbitBTS.PMF;
 import jp.sourceforge.rabbitBTS.Sht;
 import jp.sourceforge.rabbitBTS.exceptions.NotRegisteredException;
 import jp.sourceforge.rabbitBTS.exceptions.RabbitBTSException;
-import jp.sourceforge.rabbitBTS.models.UserProfile;
+import jp.sourceforge.rabbitBTS.models.Account;
 
 import org.springframework.stereotype.Service;
 
 import com.google.appengine.api.users.User;
 
 /**
- * ã\82¢ã\82«ã\82¦ã\83³ã\83\88\83¦ã\83¼ã\82¶ã\83¼ã\83\97ã\83­ã\83\95ã\82¡ã\82¤ã\83«まわりのサービス
+ * ã\82¢ã\82«ã\82¦ã\83³ã\83\88\82¢ã\82«ã\82¦ã\83³ã\83\88まわりのサービス
  * 
  * @author senju
  */
@@ -42,24 +42,24 @@ import com.google.appengine.api.users.User;
 public class AccountServices {
 
        /**
-        * ç\8f¾å\9c¨ã\83­ã\82°ã\82¤ã\83³ä¸­ã\81®googleã\82¢ã\82«ã\82¦ã\83³ã\83\88ã\81®ã\83¦ã\83¼ã\82¶ã\83¼ã\83\97ã\83­ã\83\95ã\82¡ã\82¤ã\83«を取得する。
+        * ç\8f¾å\9c¨ã\83­ã\82°ã\82¤ã\83³ä¸­ã\81®googleã\82¢ã\82«ã\82¦ã\83³ã\83\88ã\81®ã\82¢ã\82«ã\82¦ã\83³ã\83\88を取得する。
         * 
-        * @return å\8f\96å¾\97ã\81\97ã\81\9fã\83¦ã\83¼ã\82¶ã\83¼ã\83\97ã\83­ã\83\95ã\82¡ã\82¤ã\83«。ログインしていない場合はnull
+        * @return å\8f\96å¾\97ã\81\97ã\81\9fã\82¢ã\82«ã\82¦ã\83³ã\83\88。ログインしていない場合はnull
         * @throws NotRegisteredException
         *             未登録ユーザーの場合
         */
        @SuppressWarnings("unchecked")
-       public UserProfile fetchUserProfile() throws NotRegisteredException {
+       public Account fetchAccount() throws NotRegisteredException {
                final User gu = Sht.user();
                if (gu == null) {
                        return null;
                }
                final Query q = PMF.get().getPersistenceManager().newQuery(
-                               UserProfile.class);
+                               Account.class);
                q.setFilter("gu == u");
                q.declareImports("import com.google.appengine.api.users.User;");
                q.declareParameters("User u");
-               final List<UserProfile> up = (List<UserProfile>) q.execute(gu);
+               final List<Account> up = (List<Account>) q.execute(gu);
                if (up.size() == 0) {
                        throw new NotRegisteredException();
                }
@@ -68,14 +68,14 @@ public class AccountServices {
        }
 
        /**
-        * æ\8c\87å®\9aã\81\95ã\82\8cã\81\9fã\83¦ã\83¼ã\82¶ã\83¼ã\83\97ã\83­ã\83\95ã\82¡ã\82¤ã\83«を登録する。
+        * æ\8c\87å®\9aã\81\95ã\82\8cã\81\9fã\82¢ã\82«ã\82¦ã\83³ã\83\88を登録する。
         * 
-        * @param userProfile
-        *            ç\99»é\8c²ã\81\99ã\82\8bã\83¦ã\83¼ã\82¶ã\83¼ã\83\97ã\83­ã\83\95ã\82¡ã\82¤ã\83«
+        * @param account
+        *            ç\99»é\8c²ã\81\99ã\82\8bã\82¢ã\82«ã\82¦ã\83³ã\83\88
         * @throws RabbitBTSException
         *             既に登録済みの場合
         */
-       public void registUserProfile(UserProfile userProfile)
+       public void registAccount(Account account)
                        throws RabbitBTSException {
 
                final PersistenceManager pm = PMF.get().getPersistenceManager();
@@ -84,7 +84,7 @@ public class AccountServices {
                        tx.begin();
                        try {
                                // 登録済みチェック
-                               final UserProfile up = this.fetchUserProfile();
+                               final Account up = this.fetchAccount();
                                if (up != null) {
                                        throw new RabbitBTSException("既に登録されています。");
                                } else {
@@ -95,9 +95,9 @@ public class AccountServices {
                        }
 
                        // 登録処理
-                       userProfile.setGu(Sht.user());
-                       userProfile.setLastAccess(new Date());
-                       pm.makePersistent(userProfile);
+                       account.setGu(Sht.user());
+                       account.setLastAccess(new Date());
+                       pm.makePersistent(account);
 
                        // TODO: メッセージ追加
 
index 521e6fd..ae8ffb7 100644 (file)
@@ -1,4 +1,4 @@
-<!-- Indices written at Thu, 30 Jul 2009 17:32:47 UTC -->
+<!-- Indices written at Sun, 2 Aug 2009 06:56:27 UTC -->
 
 <datastore-indexes/>
 
index ab47339..843788a 100644 (file)
@@ -11,7 +11,7 @@
 <h1>Rabbit BTSへようこそ</h1>
 <p>新しくRabbit BTSアカウントを作成します。以下のフォームを入力し、作成ボタンをクリックしてください。</p>
 <c:if test="${errorMessage != null}">${errorMessage}</c:if>
-<form:form modelAttribute="userProfile" method="post">
+<form:form modelAttribute="account" method="post">
 <ul>
 <li>自己紹介 <form:errors path="bio"></form:errors> <form:textarea path="bio" /></li>
 <li><input type="submit" value="作成" /></li>