summaryrefslogtreecommitdiff
path: root/src/com/p4square/grow/model/Message.java
blob: 9d333204400d6669bf2f67173f91d18060807e04 (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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
/*
 * Copyright 2013 Jesse Morgan
 */

package com.p4square.grow.model;

import java.util.Date;
import java.util.UUID;

/**
 * A feed message.
 *
 * @author Jesse Morgan <jesse@jesterpm.net>
 */
public class Message {
    private String mThreadId;
    private String mId;
    private UserRecord mAuthor;
    private Date mCreated;
    private String mMessage;

    /**
     * @return a new message id.
     */
    public static String generateId() {
        return String.format("%x-%s", System.currentTimeMillis(), UUID.randomUUID().toString());
    }

    /**
     * @return The id of the thread that the message belongs to.
     */
    public String getThreadId() {
        return mThreadId;
    }

    /**
     * Set the id of the thread that the message belongs to.
     * @param id The new thread id.
     */
    public void setThreadId(String id) {
        mThreadId = id;
    }

    /**
     * @return The id the message.
     */
    public String getId() {
        return mId;
    }

    /**
     * Set the id of the message.
     * @param id The new message id.
     */
    public void setId(String id) {
        mId = id;
    }

    /**
     * @return The author of the message.
     */
    public UserRecord getAuthor() {
        return mAuthor;
    }

    /**
     * Set the author of the message.
     * @param author The new author.
     */
    public void setAuthor(UserRecord author) {
        mAuthor = author;
    }

    /**
     * @return The Date the message was created.
     */
    public Date getCreated() {
        return mCreated;
    }

    /**
     * Set the Date the message was created.
     * @param date The new creation date.
     */
    public void setCreated(Date date) {
        mCreated = date;
    }

    /**
     * @return The message text.
     */
    public String getMessage() {
        return mMessage;
    }

    /**
     * Set the message text.
     * @param text The message text.
     */
    public void setMessage(String text) {
        mMessage = text;
    }
}