diff options
author | Jesse Morgan <jesse@jesterpm.net> | 2016-04-09 14:20:48 -0700 |
---|---|---|
committer | Jesse Morgan <jesse@jesterpm.net> | 2016-04-09 14:20:48 -0700 |
commit | bbf907e51dfcf157bdee24dead1d531122aa25db (patch) | |
tree | 86e8e100046ec3461d8d53e448107cf0145388e2 /src/com/p4square/grow/ccb/CCBUser.java | |
parent | 2e76039d4ecaff8d2ed40b67c309c2498ff4a1d5 (diff) | |
parent | bddf96d0fdd60faa1905d374eef8a122771f57a3 (diff) |
Merge pull request #9 from PuyallupFoursquare/ccb-support
Adding support for Church Community Builder
Diffstat (limited to 'src/com/p4square/grow/ccb/CCBUser.java')
-rw-r--r-- | src/com/p4square/grow/ccb/CCBUser.java | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/src/com/p4square/grow/ccb/CCBUser.java b/src/com/p4square/grow/ccb/CCBUser.java new file mode 100644 index 0000000..7313172 --- /dev/null +++ b/src/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; + } +} |