Base class for every email job in an account: scheduled emails, one-off group emails and email triggers. Holds the configuration shared by all of them - the recipient groups and organisations, subject, from and reply-to addresses, the HTML body, attachments, the optional theme website whose live theme supplies the surrounding email template, and the filter scripts which drop recipients that do not evaluate to true. It carries no sending status of its own, because in this abstract form there is nothing to send; status belongs to the concrete subclasses. Use asScheduledEmail, asGroupEmail or asEmailTrigger to narrow a job to its subclass, each of which returns null unless the job really is of that type.

Group: Database Entities

Implements: Serializable, Relational


Properties

PropertyReturnsDescription
activebooleanIndicates whether email items belonging to this job should be sent. A job may be paused, cancelled or soft deleted, in which case its email items must be left alone. The status fields this is derived from live on the concrete subclasses, so each subclass decides for itself.
assetQueryIdStringIdentifier of a query asset which selects the content the email is built from. When set, the first asset the query returns supplies the subject, from and reply-to values named by the asset field properties.
attachmentsList<EmailJobAttachment>Files attached to every email this job sends. Each attachment refers to blob store content by hash rather than holding the bytes. Null on a job which has never had an attachment added.
categoryBaseEmailCategoryCategory the job is filed under, used to group related jobs within an organisation. Optional.
deletedBooleanSoft deletion flag. A job with items or timers against it is flagged deleted and renamed rather than removed, so its history survives. Null means not deleted.
filterScriptMvelStringRecipient filter expressed as an MVEL expression, up to 1000 characters. Recipients the expression does not evaluate to true for are dropped before sending.
filterScriptXmlStringRecipient filter expressed as the XML rule format, up to 1000 characters. Recipients the rule does not evaluate to true for are dropped before sending.
fromAddressStringAddress the emails are sent from. If blank the sender falls back to the organisation's admin domain, or to a noreply address on the primary domain.
fromAssetFieldStringName of the field on the asset selected by the asset query which supplies the from address, overriding the job's own from address when it resolves to a value.
groupRecipientsList<GroupRecipient>The groups this job sends to. Each entry can be an exclusion instead, in which case members of that group are removed from the recipient set rather than added to it. Lazily loaded, and null on a job which has never had a group recipient added.
htmlStringThe email body, held as an MVEL template of up to 500000 characters and evaluated once per recipient.
idlongDatabase identifier for this job. The subclasses share a single joined inheritance table, so the id is unique across scheduled emails, group emails and triggers alike.
loginTokensBooleanWhether links in the email should carry an auto-login token for the recipient, so that following one signs them in. Null is treated as false.
nameStringUnique, path-safe identifier for the job within its organisation, used as the lookup key and in admin URLs. Required. Soft deleting a job renames it with a '-Deleted-' suffix and a timestamp so the original name becomes available again.
notesStringFree text notes about the job, up to 20000 characters. Copying a job with mimic prepends a 'Copied from' line naming the job it was copied from.
numEmailsIntegerNumber of emails this job has queued for sending, recorded when the batch is generated so progress can be reported against it. Null before a batch has been generated.
organisationRecipientsList<OrganisationRecipient>The organisations this job sends to, with the same include or exclude semantics as the group recipients. Lazily loaded, and null on a job which has never had an organisation recipient added.
recipientSelectorsStringSerialised recipient selection, up to 10000 characters, which is the newer replacement for the group and organisation recipient collections.
replyToAddressStringAddress replies are directed to. If blank the from address is used instead.
replyToAssetFieldStringName of the field on the asset selected by the asset query which supplies the reply-to address, overriding the job's own reply-to address when it resolves to a value.
subjectStringSubject line for the emails this job sends, up to 1024 characters, evaluated as an MVEL template per recipient. If it is blank the sender falls back to a generated subject built from the job title.
subjectAssetFieldStringName of the field on the asset selected by the asset query which supplies the subject line. Only consulted when an asset query id is set; the job subject is used if the field is empty.
themeSiteWebsiteWebsite whose live branch supplies the surrounding email template. When set, the generated body is wrapped in that site's email theme; when null the MVEL result is sent as-is.
timeToSendDateThe time the job is intended to be sent at. Null on jobs which are not scheduled for a particular time.
titleStringFree text display label for the job, shown in the admin UI and used in the fallback subject line. Unlike the name it carries no uniqueness or path-safety guarantee and may be null.
typeStringFree text classification set by the caller and carried across when a job is copied. Not the Hibernate inheritance discriminator, which is a separate column the application does not expose.

Methods

isActive() · asScheduledEmail() · asGroupEmail() · asEmailTrigger() · getId() · getName() · getTitle() · getNotes() · getSubject() · getFromAddress() · getReplyToAddress() · getGroupRecipients() · getOrganisationRecipients() · getThemeSite() · getHtml() · getFilterScriptXml() · getFilterScriptMvel() · getAssetQueryId() · getSubjectAssetField() · getFromAssetField() · getReplyToAssetField() · addGroupRecipient(Group g, boolean exclusion) · getType() · getAttachments() · getLoginTokens() · getDeleted() · getNumEmails() · getTimeToSend() · getRecipientSelectors() · deleted() · getCategory() · numEmails()

isActive()

Returns: boolean

Indicates whether email items belonging to this job should be sent. A job may be paused, cancelled or soft deleted, in which case its email items must be left alone. The status fields this is derived from live on the concrete subclasses, so each subclass decides for itself.

asScheduledEmail()

Returns: ScheduledEmail

Narrows this job to a ScheduledEmail, the recurring job type driven by a frequency and a start date.

asGroupEmail()

Returns: GroupEmailJob

Narrows this job to a GroupEmailJob, the one-off broadcast sent to a set of groups or organisations.

asEmailTrigger()

Returns: EmailTrigger

Narrows this job to an EmailTrigger, the event driven job which also performs non-email actions.

getId()

Returns: long

Database identifier for this job. The subclasses share a single joined inheritance table, so the id is unique across scheduled emails, group emails and triggers alike.

getName()

Returns: String

Unique, path-safe identifier for the job within its organisation, used as the lookup key and in admin URLs. Required. Soft deleting a job renames it with a '-Deleted-' suffix and a timestamp so the original name becomes available again.

getTitle()

Returns: String

Free text display label for the job, shown in the admin UI and used in the fallback subject line. Unlike the name it carries no uniqueness or path-safety guarantee and may be null.

getNotes()

Returns: String

Free text notes about the job, up to 20000 characters. Copying a job with mimic prepends a 'Copied from' line naming the job it was copied from.

getSubject()

Returns: String

Subject line for the emails this job sends, up to 1024 characters, evaluated as an MVEL template per recipient. If it is blank the sender falls back to a generated subject built from the job title.

getFromAddress()

Returns: String

Address the emails are sent from. If blank the sender falls back to the organisation's admin domain, or to a noreply address on the primary domain.

getReplyToAddress()

Returns: String

Address replies are directed to. If blank the from address is used instead.

getGroupRecipients()

Returns: List<GroupRecipient>

The groups this job sends to. Each entry can be an exclusion instead, in which case members of that group are removed from the recipient set rather than added to it. Lazily loaded, and null on a job which has never had a group recipient added.

getOrganisationRecipients()

Returns: List<OrganisationRecipient>

The organisations this job sends to, with the same include or exclude semantics as the group recipients. Lazily loaded, and null on a job which has never had an organisation recipient added.

getThemeSite()

Returns: Website

Website whose live branch supplies the surrounding email template. When set, the generated body is wrapped in that site's email theme; when null the MVEL result is sent as-is.

getHtml()

Returns: String

The email body, held as an MVEL template of up to 500000 characters and evaluated once per recipient.

getFilterScriptXml()

Returns: String

Recipient filter expressed as the XML rule format, up to 1000 characters. Recipients the rule does not evaluate to true for are dropped before sending.

getFilterScriptMvel()

Returns: String

Recipient filter expressed as an MVEL expression, up to 1000 characters. Recipients the expression does not evaluate to true for are dropped before sending.

getAssetQueryId()

Returns: String

Identifier of a query asset which selects the content the email is built from. When set, the first asset the query returns supplies the subject, from and reply-to values named by the asset field properties.

getSubjectAssetField()

Returns: String

Name of the field on the asset selected by the asset query which supplies the subject line. Only consulted when an asset query id is set; the job subject is used if the field is empty.

getFromAssetField()

Returns: String

Name of the field on the asset selected by the asset query which supplies the from address, overriding the job's own from address when it resolves to a value.

getReplyToAssetField()

Returns: String

Name of the field on the asset selected by the asset query which supplies the reply-to address, overriding the job's own reply-to address when it resolves to a value.

addGroupRecipient(Group g, boolean exclusion)

Returns: GroupRecipient

Adds a group to this job's recipient list, creating the recipient collection if the job did not have one. The new link is attached to the in-memory job only; it is not saved, so the caller must persist it.

ParameterDescription
gthe group to send to, or to exclude
exclusiontrue to exclude the group's members rather than include them

getType()

Returns: String

Free text classification set by the caller and carried across when a job is copied. Not the Hibernate inheritance discriminator, which is a separate column the application does not expose.

getAttachments()

Returns: List<EmailJobAttachment>

Files attached to every email this job sends. Each attachment refers to blob store content by hash rather than holding the bytes. Null on a job which has never had an attachment added.

getLoginTokens()

Returns: Boolean

Whether links in the email should carry an auto-login token for the recipient, so that following one signs them in. Null is treated as false.

getDeleted()

Returns: Boolean

Soft deletion flag. A job with items or timers against it is flagged deleted and renamed rather than removed, so its history survives. Null means not deleted.

getNumEmails()

Returns: Integer

Number of emails this job has queued for sending, recorded when the batch is generated so progress can be reported against it. Null before a batch has been generated.

getTimeToSend()

Returns: Date

The time the job is intended to be sent at. Null on jobs which are not scheduled for a particular time.

getRecipientSelectors()

Returns: String

Serialised recipient selection, up to 10000 characters, which is the newer replacement for the group and organisation recipient collections.

deleted()

Returns: boolean

Null safe reading of the soft deletion flag.

getCategory()

Returns: BaseEmailCategory

Category the job is filed under, used to group related jobs within an organisation. Optional.

numEmails()

Returns: Long

The queued email count as a long, for callers which need a widened value.

To get full access to the Kademi Hub existing customers can login here, or new customers can register here.