OSDN Git Service

2f413f3c2f208d8f9aece23a3470d50f2f4aeecc
[rabbit-bts/RabbitBTS.git] / src / jp / sourceforge / rabbitBTS / models / BbsPost.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.NotPersistent;
24 import javax.jdo.annotations.PersistenceCapable;
25 import javax.jdo.annotations.Persistent;
26 import javax.jdo.annotations.PrimaryKey;
27
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 BbsPost {
34         @PrimaryKey
35         @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
36         private Long id;
37         @Persistent
38         private Long authorId;
39         @Persistent
40         @NotBlank
41         @NotNull
42         @Length(max = 10)
43         // TODO: 短い
44         private String content;
45         @Persistent
46         private Date date;
47         @NotPersistent
48         private Account author;
49
50         public BbsPost() {
51
52         }
53
54         public BbsPost(Long author, String content, Date date) {
55                 this.authorId = author;
56                 this.content = content;
57                 this.date = date;
58         }
59
60         public Long getId() {
61                 return this.id;
62         }
63
64         public String getContent() {
65                 return this.content;
66         }
67
68         public Date getDate() {
69                 return this.date;
70         }
71
72         public void setContent(String content) {
73                 this.content = content;
74         }
75
76         public void setDate(Date date) {
77                 this.date = date;
78         }
79
80         /**
81          * @return the authorId
82          */
83         public Long getAuthorId() {
84                 return this.authorId;
85         }
86
87         /**
88          * @param authorId
89          *            the authorId to set
90          */
91         public void setAuthorId(Long author) {
92                 this.authorId = author;
93         }
94
95         /**
96          * @return the author
97          */
98         public Account getAuthor() {
99                 return this.author;
100         }
101
102         /**
103          * @param author
104          *            the author to set
105          */
106         public void setAuthor(Account author) {
107                 this.author = author;
108         }
109 }