summaryrefslogtreecommitdiff
path: root/src/lq/Vote.java
blob: ee7c18d83d15a023e1f27241ec20c79c6903421b (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
package lq;

import com.google.appengine.api.datastore.Key;
import java.util.Date;
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
public class Vote {
    @PrimaryKey
    @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
    private Key key;

    @Persistent
    private Long quoteId;

    @Persistent
    private Long rating;

    @Persistent
    private Date timestamp;

    @Persistent
    private String ip;

    public Vote(Long quoteId, Long rating, String ip) {
        this.ip = ip;
        this.rating = rating;
        this.quoteId = quoteId;
        timestamp = new Date();
    }

    public Key getKey() { return key; }
    public Date getTimestamp() { return timestamp; }
    public String getIp() { return ip; }
    public Long getRating() { return rating; }
    public Long getQuoteId() { return quoteId; }

    public void setKey(Key key) { this.key = key; }
    public void setTimestamp(Date timestamp) { this.timestamp = timestamp; }
    public void setIp(String ip) { this.ip = ip; }
    public void setRating(Long rating) { this.rating = rating; }
    public void setQuote(Long quoteId) { this.quoteId = quoteId; }
}