summaryrefslogtreecommitdiff
path: root/src/com/p4square/grow/model
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/p4square/grow/model')
-rw-r--r--src/com/p4square/grow/model/Message.java6
-rw-r--r--src/com/p4square/grow/model/UserRecord.java93
2 files changed, 96 insertions, 3 deletions
diff --git a/src/com/p4square/grow/model/Message.java b/src/com/p4square/grow/model/Message.java
index 6e07150..ad02af9 100644
--- a/src/com/p4square/grow/model/Message.java
+++ b/src/com/p4square/grow/model/Message.java
@@ -14,7 +14,7 @@ import java.util.Date;
public class Message {
private String mThreadId;
private String mId;
- private String mAuthor;
+ private UserRecord mAuthor;
private Date mCreated;
private String mMessage;
@@ -51,7 +51,7 @@ public class Message {
/**
* @return The author of the message.
*/
- public String getAuthor() {
+ public UserRecord getAuthor() {
return mAuthor;
}
@@ -59,7 +59,7 @@ public class Message {
* Set the author of the message.
* @param author The new author.
*/
- public void setAuthor(String author) {
+ public void setAuthor(UserRecord author) {
mAuthor = author;
}
diff --git a/src/com/p4square/grow/model/UserRecord.java b/src/com/p4square/grow/model/UserRecord.java
new file mode 100644
index 0000000..0702eb1
--- /dev/null
+++ b/src/com/p4square/grow/model/UserRecord.java
@@ -0,0 +1,93 @@
+/*
+ * Copyright 2014 Jesse Morgan
+ */
+
+package com.p4square.grow.model;
+
+import org.restlet.security.User;
+
+/**
+ * A simple user representation without any secrets.
+ */
+public class UserRecord {
+ private String mId;
+ private String mFirstName;
+ private String mLastName;
+ private String mEmail;
+
+ /**
+ * Create an empty UserRecord.
+ */
+ public UserRecord() {
+ }
+
+ /**
+ * Create a new UserRecord with the information from a User.
+ */
+ public UserRecord(final User user) {
+ mId = user.getIdentifier();
+ mFirstName = user.getFirstName();
+ mLastName = user.getLastName();
+ mEmail = user.getEmail();
+ }
+
+ /**
+ * @return The user's identifier.
+ */
+ public String getId() {
+ return mId;
+ }
+
+ /**
+ * Set the user's identifier.
+ * @param value The new id.
+ */
+ public void setId (final String value) {
+ mId = value;
+ }
+
+ /**
+ * @return The user's email.
+ */
+ public String getEmail() {
+ return mEmail;
+ }
+
+ /**
+ * Set the user's email.
+ * @param value The new email.
+ */
+ public void setEmail (final String value) {
+ mEmail = value;
+ }
+
+ /**
+ * @return The user's first name.
+ */
+ public String getFirstName() {
+ return mFirstName;
+ }
+
+ /**
+ * Set the user's first name.
+ * @param value The new first name.
+ */
+ public void setFirstName (final String value) {
+ mFirstName = value;
+ }
+
+ /**
+ * @return The user's last name.
+ */
+ public String getLastName() {
+ return mLastName;
+ }
+
+ /**
+ * Set the user's last name.
+ * @param value The new last name.
+ */
+ public void setLastName (final String value) {
+ mLastName = value;
+ }
+}