An invitation sent by one person to another, either to join the site as a new member or to join a specific group or organisation. A referral records who sent it, the email address and name it was sent to, the message, and a token that uniquely identifies it in the acceptance link. Accepting a referral normally signs the recipient up and links the resulting SignupLog back to the referral; if invitedToGroup or invitedToOrg is set, the recipient is also added there. By default a referral can only be accepted once, unless isMultiAccept is true, and it stops being valid after its expiry date. Referrals raised under a promotion carry the sender's RewardEntry so the sender can be rewarded when the invitation is taken up.
Group: Database Entities
Implements: Serializable, Relational
Properties
| Property | Returns | Description |
|---|---|---|
| centralLoginHash | String | One time hash returned from the central account so an invited administrator can be signed in without a password. Generated when an admin invitation is accepted, along with its time and key. Sensitive, so do not expose it outside the acceptance flow. |
| centralLoginHashKey | String | The secret key used to produce and later validate the central login hash. Sensitive, and never sent to the browser. |
| centralLoginHashTime | Long | The time the central login hash was generated, in milliseconds since the epoch. Used to age the hash out so an old invitation link cannot be replayed. |
| centralLoginProfile | Profile | The profile the central login hash was issued for, which is the administrator being signed in from the central account. Null when no central login has been started. |
| createdDate | Date | When the referral was created, which is the date the invitation was raised rather than the date it was sent or accepted. Mandatory, and the field referral listings sort on, newest first. |
| emailItem | EmailItem | The individual email that carried this invitation, or null if no email has been sent yet. It gives access to the delivery state, so it is how you tell whether the invitation actually reached the recipient. |
| expiryDate | Date | The date after which the invitation, and any membership it grants, is no longer valid. Stored as a date with no time component. Null means the invitation does not expire. |
| fromProfile | Profile | The profile who sent the referral. Optional, since a referral can be raised by a process rather than a person, in which case only the sent from email address is recorded. |
| id | long | Database generated primary key for this referral. Note that the token, not the id, is what identifies a referral in an acceptance link. |
| invitedToGroup | Group | The group the recipient joins when they accept, or null if the invitation is just to sign up. Admin invitations use this to grant the recipient an admin group on acceptance. |
| invitedToOrg | Organisation | The organisation the recipient's membership is granted within when they accept, or null to use the referral's own organisation. Use this when inviting somebody into a specific child organisation. |
| isMultiAccept | Boolean | Whether the invitation link can be accepted more than once. Null is treated as false, so use multiAccept or singleAccept to test it rather than reading this directly. |
| message | String | Personal message from the sender, included in the invitation email. Optional, and limited to 2000 characters. |
| program | ReferralProgram | The referral programme this invitation was raised under, or null for a one off referral. Tokens are looked up within a programme, so a lookup by token normally also supplies the programme. |
| responded | boolean | Whether the recipient has responded to the invitation. Set when the referral is taken up, and it stays false for invitations that were never actioned. |
| senderRewardEntry | RewardEntry | The sender's entry in the promotion this referral was raised under, or null if the referral is not part of a promotion. It is what the sender's reward for a successful referral is credited against. |
| sentFrom | String | Email address of the person requesting the referral be sent, used as the reply to address on the invitation. Mandatory, and taken from the sending profile when one is given. |
| signup | SignupLog | The signup created when the recipient accepted this invitation, or null if it has not been accepted. This is the link from an invitation to the account it produced. |
| toEmail | String | Email address the invitation was sent to. This is the key that referral lookups by recipient match on, and it becomes the new member's email address if they accept. |
| token | String | Random UUID that authenticates the acceptance request. It appears in the invitation link, and it is the only thing proving the person following the link is the invited recipient, so treat it as a secret. |
| toName | String | The name of the recipient, as entered by the sender. Display only, and used to personalise the invitation email. |
| website | Website | The website the referral was sent from, which determines the address the acceptance link points at. Optional, so it can be null for referrals raised outside a website. |
Methods
getId() · setOrganisation(Organisation organisation) · getProgram() · setProgram(ReferralProgram program) · getWebsite() · setWebsite(Website website) · getFromProfile() · setFromProfile(Profile fromProfile) · getToName() · setToName(String toName) · getSentFrom() · setSentFrom(String sentFrom) · getToEmail() · setToEmail(String toEmail) · isResponded() · setResponded(boolean responded) · getSignup() · setSignup(SignupLog signup) · getCreatedDate() · setCreatedDate(Date createdDate) · getEmailItem() · setEmailItem(EmailItem emailItem) · getInvitedToGroup() · setInvitedToGroup(Group invitedToGroup) · getInvitedToOrg() · setInvitedToOrg(Organisation invitedToOrg) · getMessage() · setMessage(String message) · getExpiryDate() · setExpiryDate(Date expiryDate) · getToken() · setToken(String token) · getIsMultiAccept() · setIsMultiAccept(Boolean isMultiAccept) · getSenderRewardEntry() · setSenderRewardEntry(RewardEntry senderRewardEntry) · getCentralLoginHash() · setCentralLoginHash(String centralLoginHash) · getCentralLoginHashTime() · setCentralLoginHashTime(Long centralLoginHashTime) · getCentralLoginHashKey() · setCentralLoginHashKey(String centralLoginHashKey) · getCentralLoginProfile() · setCentralLoginProfile(Profile centralLoginProfile) · multiAccept() · singleAccept()
getId()
Returns: long
Database generated primary key for this referral. Note that the token, not the id, is what identifies a referral in an acceptance link.
setOrganisation(Organisation organisation)
Returns: void
Sets the organisation that owns this referral.
| Parameter | Description |
|---|---|
organisation | the owning organisation, required |
getProgram()
Returns: ReferralProgram
The referral programme this invitation was raised under, or null for a one off referral. Tokens are looked up within a programme, so a lookup by token normally also supplies the programme.
setProgram(ReferralProgram program)
Returns: void
Assigns this referral to a referral programme.
| Parameter | Description |
|---|---|
program | the referral programme, or null for a one off referral |
getWebsite()
Returns: Website
The website the referral was sent from, which determines the address the acceptance link points at. Optional, so it can be null for referrals raised outside a website.
setWebsite(Website website)
Returns: void
Sets the website the referral was sent from.
| Parameter | Description |
|---|---|
website | the sending website, or null |
getFromProfile()
Returns: Profile
The profile who sent the referral. Optional, since a referral can be raised by a process rather than a person, in which case only the sent from email address is recorded.
setFromProfile(Profile fromProfile)
Returns: void
Sets the profile who sent this referral.
| Parameter | Description |
|---|---|
fromProfile | the sending profile, or null |
getToName()
Returns: String
The name of the recipient, as entered by the sender. Display only, and used to personalise the invitation email.
setToName(String toName)
Returns: void
Sets the recipient's display name.
| Parameter | Description |
|---|---|
toName | the recipient's name as entered by the sender, or null |
getSentFrom()
Returns: String
Email address of the person requesting the referral be sent, used as the reply to address on the invitation. Mandatory, and taken from the sending profile when one is given.
setSentFrom(String sentFrom)
Returns: void
Sets the email address of the person the invitation is sent on behalf of. Required.
| Parameter | Description |
|---|---|
sentFrom | the sender's email address |
getToEmail()
Returns: String
Email address the invitation was sent to. This is the key that referral lookups by recipient match on, and it becomes the new member's email address if they accept.
setToEmail(String toEmail)
Returns: void
Sets the email address the invitation is sent to.
| Parameter | Description |
|---|---|
toEmail | the recipient's email address |
isResponded()
Returns: boolean
Whether the recipient has responded to the invitation. Set when the referral is taken up, and it stays false for invitations that were never actioned.
setResponded(boolean responded)
Returns: void
Records whether the recipient has responded to the invitation.
| Parameter | Description |
|---|---|
responded | true once the recipient has responded |
getSignup()
Returns: SignupLog
The signup created when the recipient accepted this invitation, or null if it has not been accepted. This is the link from an invitation to the account it produced.
setSignup(SignupLog signup)
Returns: void
Links this referral to the signup produced by accepting it.
| Parameter | Description |
|---|---|
signup | the signup created on acceptance, or null |
getCreatedDate()
Returns: Date
When the referral was created, which is the date the invitation was raised rather than the date it was sent or accepted. Mandatory, and the field referral listings sort on, newest first.
setCreatedDate(Date createdDate)
Returns: void
Sets the date the referral was created. Required.
| Parameter | Description |
|---|---|
createdDate | the creation date |
getEmailItem()
Returns: EmailItem
The individual email that carried this invitation, or null if no email has been sent yet. It gives access to the delivery state, so it is how you tell whether the invitation actually reached the recipient.
setEmailItem(EmailItem emailItem)
Returns: void
Links this referral to the email that carried the invitation.
| Parameter | Description |
|---|---|
emailItem | the sent invitation email, or null |
getInvitedToGroup()
Returns: Group
The group the recipient joins when they accept, or null if the invitation is just to sign up. Admin invitations use this to grant the recipient an admin group on acceptance.
setInvitedToGroup(Group invitedToGroup)
Returns: void
Sets the group the recipient is added to when they accept the invitation.
| Parameter | Description |
|---|---|
invitedToGroup | the group to join on acceptance, or null |
getInvitedToOrg()
Returns: Organisation
The organisation the recipient's membership is granted within when they accept, or null to use the referral's own organisation. Use this when inviting somebody into a specific child organisation.
setInvitedToOrg(Organisation invitedToOrg)
Returns: void
Sets the organisation the recipient's membership applies within on acceptance.
| Parameter | Description |
|---|---|
invitedToOrg | the organisation to join within, or null |
getMessage()
Returns: String
Personal message from the sender, included in the invitation email. Optional, and limited to 2000 characters.
setMessage(String message)
Returns: void
Sets the personal message included in the invitation email.
| Parameter | Description |
|---|---|
message | the message text, up to 2000 characters, or null |
getExpiryDate()
Returns: Date
The date after which the invitation, and any membership it grants, is no longer valid. Stored as a date with no time component. Null means the invitation does not expire.
setExpiryDate(Date expiryDate)
Returns: void
Sets the date after which this invitation and the membership it grants stop being valid.
| Parameter | Description |
|---|---|
expiryDate | the expiry date, or null for no expiry |
getToken()
Returns: String
Random UUID that authenticates the acceptance request. It appears in the invitation link, and it is the only thing proving the person following the link is the invited recipient, so treat it as a secret.
setToken(String token)
Returns: void
Sets the token that authenticates acceptance of this referral. Should be an unguessable random value.
| Parameter | Description |
|---|---|
token | the acceptance token |
getIsMultiAccept()
Returns: Boolean
Whether the invitation link can be accepted more than once. Null is treated as false, so use multiAccept or singleAccept to test it rather than reading this directly.
setIsMultiAccept(Boolean isMultiAccept)
Returns: void
Sets whether the invitation link may be accepted more than once.
| Parameter | Description |
|---|---|
isMultiAccept | true to allow repeated acceptance, false or null for a single use invitation |
getSenderRewardEntry()
Returns: RewardEntry
The sender's entry in the promotion this referral was raised under, or null if the referral is not part of a promotion. It is what the sender's reward for a successful referral is credited against.
setSenderRewardEntry(RewardEntry senderRewardEntry)
Returns: void
Links this referral to the sender's entry in the promotion that generated it.
| Parameter | Description |
|---|---|
senderRewardEntry | the sender's reward entry, or null |
getCentralLoginHash()
Returns: String
One time hash returned from the central account so an invited administrator can be signed in without a password. Generated when an admin invitation is accepted, along with its time and key. Sensitive, so do not expose it outside the acceptance flow.
setCentralLoginHash(String centralLoginHash)
Returns: void
Stores the one time central login hash generated for this referral.
| Parameter | Description |
|---|---|
centralLoginHash | the hash returned from the central account, or null to clear it |
getCentralLoginHashTime()
Returns: Long
The time the central login hash was generated, in milliseconds since the epoch. Used to age the hash out so an old invitation link cannot be replayed.
setCentralLoginHashTime(Long centralLoginHashTime)
Returns: void
Records when the central login hash was generated.
| Parameter | Description |
|---|---|
centralLoginHashTime | the generation time in epoch milliseconds, or null |
getCentralLoginHashKey()
Returns: String
The secret key used to produce and later validate the central login hash. Sensitive, and never sent to the browser.
setCentralLoginHashKey(String centralLoginHashKey)
Returns: void
Stores the secret key used to validate the central login hash.
| Parameter | Description |
|---|---|
centralLoginHashKey | the validation key, or null to clear it |
getCentralLoginProfile()
Returns: Profile
The profile the central login hash was issued for, which is the administrator being signed in from the central account. Null when no central login has been started.
setCentralLoginProfile(Profile centralLoginProfile)
Returns: void
Sets the profile the central login hash was issued for.
| Parameter | Description |
|---|---|
centralLoginProfile | the profile being signed in, or null |
multiAccept()
Returns: boolean
Whether this invitation may be accepted more than once, treating an unset isMultiAccept as false. Prefer this over reading isMultiAccept directly.
singleAccept()
Returns: boolean
Whether this invitation may only be accepted once. The exact inverse of multiAccept, and true for any referral that has not explicitly been marked as multi accept.