OSDN Git Service

全てのjavaファイルにモードライン追加。
[rabbit-bts/RabbitBTS.git] / src / jp / sourceforge / rabbitBTS / models / BbsPost.java
1 // vim:set ts=4 sts=4 sw=4 noet fenc=utf-8:
2 /*
3    Copyright 2009 senju@users.sourceforge.jp
4
5    Licensed under the Apache License, Version 2.0 (the "License");
6    you may not use this file except in compliance with the License.
7    You may obtain a copy of the License at
8
9        http://www.apache.org/licenses/LICENSE-2.0
10
11    Unless required by applicable law or agreed to in writing, software
12    distributed under the License is distributed on an "AS IS" BASIS,
13    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14    See the License for the specific language governing permissions and
15    limitations under the License.
16  */
17
18 package jp.sourceforge.rabbitBTS.models;
19
20 import java.util.Date;
21
22 import javax.jdo.annotations.IdGeneratorStrategy;
23 import javax.jdo.annotations.IdentityType;
24 import javax.jdo.annotations.NotPersistent;
25 import javax.jdo.annotations.PersistenceCapable;
26 import javax.jdo.annotations.Persistent;
27 import javax.jdo.annotations.PrimaryKey;
28
29 import org.springmodules.validation.bean.conf.loader.annotation.handler.Length;
30 import org.springmodules.validation.bean.conf.loader.annotation.handler.NotBlank;
31 import org.springmodules.validation.bean.conf.loader.annotation.handler.NotNull;
32
33 @PersistenceCapable(identityType = IdentityType.APPLICATION)
34 public class BbsPost {
35         @PrimaryKey
36         @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
37         private Long id;
38         @Persistent
39         private Long authorId;
40         @Persistent
41         @NotBlank
42         @NotNull
43         @Length(max = 10)
44         // TODO: 短い
45         private String content;
46         @Persistent
47         private Date date;
48         @NotPersistent
49         private Account author;
50
51         public BbsPost() {
52
53         }
54
55         public BbsPost(Long author, String content, Date date) {
56                 this.authorId = author;
57                 this.content = content;
58                 this.date = date;
59         }
60
61         public Long getId() {
62                 return this.id;
63         }
64
65         public String getContent() {
66                 return this.content;
67         }
68
69         public Date getDate() {
70                 return this.date;
71         }
72
73         public void setContent(String content) {
74                 this.content = content;
75         }
76
77         public void setDate(Date date) {
78                 this.date = date;
79         }
80
81         /**
82          * @return the authorId
83          */
84         public Long getAuthorId() {
85                 return this.authorId;
86         }
87
88         /**
89          * @param authorId
90          *            the authorId to set
91          */
92         public void setAuthorId(Long author) {
93                 this.authorId = author;
94         }
95
96         /**
97          * @return the author
98          */
99         public Account getAuthor() {
100                 return this.author;
101         }
102
103         /**
104          * @param author
105          *            the author to set
106          */
107         public void setAuthor(Account author) {
108                 this.author = author;
109         }
110 }