~peter-kovac11/play/play-scala-console-improvements

« back to all changes in this revision

Viewing changes to samples-and-tests/yabe-with-scala/app/models/Comment.java

  • Committer: guillaume
  • Date: 2009-11-11 17:19:54 UTC
  • Revision ID: guillaume@macbook-pro-de-guillaume.local-20091111171954-1z761dqr0aw93747
yabe-with-scala

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
package models;
2
 
 
3
 
import java.util.*;
4
 
import javax.persistence.*;
5
 
 
6
 
import play.db.jpa.*;
7
 
import play.data.validation.*;
8
 
 
9
 
@Entity
10
 
public class Comment extends Model {
11
 
 
12
 
    @Required
13
 
    public String author;
14
 
    
15
 
    @Required
16
 
    public Date postedAt;
17
 
     
18
 
    @Lob
19
 
    @Required
20
 
    @MaxSize(10000)
21
 
    public String content;
22
 
    
23
 
    @ManyToOne
24
 
    @Required
25
 
    public Post post;
26
 
    
27
 
    public Comment(Post post, String author, String content) {
28
 
        this.post = post;
29
 
        this.author = author;
30
 
        this.content = content;
31
 
        this.postedAt = new Date();
32
 
    }
33
 
    
34
 
    public String toString() {
35
 
        return content.length() > 50 ? content.substring(0, 50) + "..." : content;
36
 
    }
37
 
 
38
 
}
 
 
b'\\ No newline at end of file'