summaryrefslogtreecommitdiff
path: root/src/lq/Quote.java
blob: b0595b7c9c57980932ccddaf35bce394ef87f318 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
package lq;

import com.google.appengine.api.datastore.Key;
import com.google.appengine.api.datastore.Text;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.IdentityType;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;

@PersistenceCapable(identityType = IdentityType.APPLICATION)
public class Quote {
    @PrimaryKey
    @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
    private Key key;

    @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
    private Long id;

    @Persistent
    private Date timestamp;

    @Persistent
    private Boolean approved;

    @Persistent
    private Date quoteDate;

    @Persistent
    private String author;

    @Persistent
    private Text content;

    @Persistent
    private String ip;

    @Persistent
    private List<Vote> votes;

    public Quote(Date quoteDate, String author, String content, String ip) {
        this.quoteDate = quoteDate;
        this.author = author;
        this.content = new Text(content);
        this.ip = ip;
        this.votes = new ArrayList<Vote>();

        this.timestamp = new Date();
    }

    public Key getKey() { return key; }
    public Long getId() { return id; }
    public Date getTimestamp() { return timestamp; }
    public Boolean getApproved() { return approved; }
    public Date getQuoteDate() { return quoteDate; }
    public String getAuthor() { return author; }
    public String getContent() { return content.getValue(); }
    public String getIp() { return ip; }
    public List<Vote> getVotes() { return votes; }

    public void setKey(Key key) { this.key = key; }
    public void setId(Long id) { this.id = id; }
    public void setTimestamp(Date timestamp) { this.timestamp = timestamp; }
    public void setApproved(Boolean approved) { this.approved = approved; }
    public void setQuoteDate(Date quoteDate) { this.quoteDate = quoteDate; }
    public void setAuthor(String author) { this.author = author; }
    public void setContent(String content) { this.content = new Text(content); }
    public void setIp(String ip) { this.ip = ip; }
}