summaryrefslogtreecommitdiff
path: root/src/main/java/com/p4square/grow/ccb/CCBUser.java
diff options
context:
space:
mode:
authorJesse Morgan <jesse@jesterpm.net>2016-04-09 15:53:24 -0700
committerJesse Morgan <jesse@jesterpm.net>2016-04-09 15:53:24 -0700
commit371ccae3d1f31ec38f4af77fb7fcd175d49b3cd5 (patch)
tree38c4f1e8828f9af9c4b77a173bee0d312b321698 /src/main/java/com/p4square/grow/ccb/CCBUser.java
parentbbf907e51dfcf157bdee24dead1d531122aa25db (diff)
parent3102d8bce3426d9cf41aeaf201c360d342677770 (diff)
Merge pull request #10 from PuyallupFoursquare/maven
Switching from Ivy+Ant to Maven.
Diffstat (limited to 'src/main/java/com/p4square/grow/ccb/CCBUser.java')
-rw-r--r--src/main/java/com/p4square/grow/ccb/CCBUser.java37
1 files changed, 37 insertions, 0 deletions
diff --git a/src/main/java/com/p4square/grow/ccb/CCBUser.java b/src/main/java/com/p4square/grow/ccb/CCBUser.java
new file mode 100644
index 0000000..7313172
--- /dev/null
+++ b/src/main/java/com/p4square/grow/ccb/CCBUser.java
@@ -0,0 +1,37 @@
+package com.p4square.grow.ccb;
+
+import com.p4square.ccbapi.model.IndividualProfile;
+import org.restlet.security.User;
+
+/**
+ * CCBUser is an adapter between a CCB IndividualProfile and a Restlet User.
+ *
+ * Note: CCBUser prefixes the user's identifier with "CCB-". This is done to
+ * ensure the identifier does not collide with identifiers from other
+ * systems.
+ */
+public class CCBUser extends User {
+
+ private final IndividualProfile mProfile;
+
+ /**
+ * Wrap an IndividualProfile inside a User object.
+ *
+ * @param profile The CCB IndividualProfile for the user.
+ */
+ public CCBUser(final IndividualProfile profile) {
+ mProfile = profile;
+
+ setIdentifier("CCB-" + mProfile.getId());
+ setFirstName(mProfile.getFirstName());
+ setLastName(mProfile.getLastName());
+ setEmail(mProfile.getEmail());
+ }
+
+ /**
+ * @return The IndividualProfile of the user.
+ */
+ public IndividualProfile getProfile() {
+ return mProfile;
+ }
+}