OSDN Git Service

8bd0c9daae90edfebb8a41be095e8dc9f9aee353
[rabbit-bts/RabbitBTS.git] / src / jp / sourceforge / rabbitBTS / models / Account.java
1 /*
2    Copyright 2009 senju@users.sourceforge.jp
3
4    Licensed under the Apache License, Version 2.0 (the "License");
5    you may not use this file except in compliance with the License.
6    You may obtain a copy of the License at
7
8        http://www.apache.org/licenses/LICENSE-2.0
9
10    Unless required by applicable law or agreed to in writing, software
11    distributed under the License is distributed on an "AS IS" BASIS,
12    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13    See the License for the specific language governing permissions and
14    limitations under the License.
15  */
16
17 package jp.sourceforge.rabbitBTS.models;
18
19 import java.util.Date;
20
21 import javax.jdo.annotations.IdGeneratorStrategy;
22 import javax.jdo.annotations.IdentityType;
23 import javax.jdo.annotations.PersistenceCapable;
24 import javax.jdo.annotations.Persistent;
25 import javax.jdo.annotations.PrimaryKey;
26
27 import org.springmodules.validation.bean.conf.loader.annotation.handler.Email;
28 import org.springmodules.validation.bean.conf.loader.annotation.handler.Length;
29 import org.springmodules.validation.bean.conf.loader.annotation.handler.NotBlank;
30 import org.springmodules.validation.bean.conf.loader.annotation.handler.NotNull;
31
32 @PersistenceCapable(identityType = IdentityType.APPLICATION)
33 public class Account {
34         @PrimaryKey
35         @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
36         private Long accountId;
37
38         /**
39          * ユーザーのニックネーム。変更可能とする。
40          */
41         @Persistent
42         @NotBlank
43         @NotNull
44         @Length(max = 10)
45         // TODO: 短い
46         private String nickName;
47
48         /**
49          * ユーザーのemail。googleアカウント使用時は変更不可とする。
50          */
51         @Persistent
52         @Email
53         @NotBlank
54         @NotNull
55         private String email;
56
57         /**
58          * 自己紹介
59          */
60         @Persistent
61         @NotBlank
62         @NotNull
63         @Length(max = 255)
64         // TODO:サロゲートありで満杯までいれると500byte越えるかもね。
65         private String bio;
66
67         /**
68          * 最後にシステムにアクセスした日時
69          */
70         @Persistent
71         @NotNull
72         private Date lastAccess;
73
74         /**
75          * 管理者権限を持つかどうか
76          */
77         @Persistent
78         private boolean admin;
79
80         public Long getAccountId() {
81                 return this.accountId;
82         }
83
84         public Date getLastAccess() {
85                 return this.lastAccess;
86         }
87
88         /**
89          * @return the bio
90          */
91         public String getBio() {
92                 return this.bio;
93         }
94
95         public void setLastAccess(Date lastAccess) {
96                 this.lastAccess = lastAccess;
97         }
98
99         /**
100          * @param bio
101          *            the bio to set
102          */
103         public void setBio(String bio) {
104                 this.bio = bio;
105         }
106
107         /**
108          * @param accountId
109          *            the accountId to set
110          */
111         public void setAccountId(Long accountId) {
112                 this.accountId = accountId;
113         }
114
115         /**
116          * @return the nickName
117          */
118         public String getNickName() {
119                 return this.nickName;
120         }
121
122         /**
123          * @return the email
124          */
125         public String getEmail() {
126                 return this.email;
127         }
128
129         /**
130          * @param nickName
131          *            the nickName to set
132          */
133         public void setNickName(String nickName) {
134                 this.nickName = nickName;
135         }
136
137         /**
138          * @param email
139          *            the email to set
140          */
141         public void setEmail(String email) {
142                 this.email = email;
143         }
144
145         /**
146          * @return the admin
147          */
148         public boolean isAdmin() {
149                 return this.admin;
150         }
151
152         /**
153          * @param admin
154          *            the admin to set
155          */
156         public void setAdmin(boolean isAdmin) {
157                 this.admin = isAdmin;
158         }
159 }