Fluent builder for assembling and firing a custom repository app trigger event, obtained by calling EventWrapper.eventBuilder and used from GraalJS via chained setter calls. Accumulates a target profile, website, trigger id, attribute map, conditions and email attachments; fireEvent then builds a RepositoryAppTriggerEvent from the accumulated state and dispatches it through the owning EventWrapper. Each setX method has a matching withX method that performs the same assignment and returns this builder, allowing calls to be chained.
Group: Builders
Methods
setProfile(String userId) · withProfile(String userId) · setProfile(ProfileBean profile) · withProfile(ProfileBean profile) · setProfile(Profile profile) · withProfile(Profile profile) · setWebsite(String websiteName) · withWebsite(String websiteName) · setWebsite(Website website) · withWebsite(Website website) · setTriggerId(String triggerId) · withTriggerId(String triggerId) · setAttributes(Map<String,Object> attributes) · withAttributes(Map<String,Object> attributes) · addAttribute(String key, Object value) · addAttributeUrn(String key, String type, Relational entity) · setConditions(String conditions) · withConditions(String conditions) · setAttachments(List<EmailAttachmentBean> attachments) · withAttachments(List<EmailAttachmentBean> attachments) · addAttachment(String fileName, String hash, String contentType) · addAttachment(String fileName, String hash) · addAttachment(String fileName, String contentType, InputStream inputStream) · addAttachment(Attachment attachment) · addAttachment(String fileName, String hash, String contentType, String disposition) · fireEvent()
setProfile(String userId)
Returns: void
Attempts to locate a profile by user name or email address within the current organisation and sets it as the event's target profile. Does nothing if there is no current root folder, and leaves the target profile null if no match is found.
| Parameter | Description |
|---|---|
userId | the user name or email address to look up |
withProfile(String userId)
Returns: EventBuilder
Looks up a profile by user name or email address, as per setProfile, and returns this builder for chaining.
| Parameter | Description |
|---|---|
userId | the user name or email address to look up |
setProfile(ProfileBean profile)
Returns: void
Sets the event's target profile from a profile bean.
| Parameter | Description |
|---|---|
profile | the profile bean wrapping the profile to use |
withProfile(ProfileBean profile)
Returns: EventBuilder
Sets the event's target profile from a profile bean and returns this builder for chaining.
| Parameter | Description |
|---|---|
profile | the profile bean wrapping the profile to use |
setProfile(Profile profile)
Returns: void
Sets the event's target profile.
| Parameter | Description |
|---|---|
profile | the profile to use as the event's target |
withProfile(Profile profile)
Returns: EventBuilder
Sets the event's target profile and returns this builder for chaining.
| Parameter | Description |
|---|---|
profile | the profile to use as the event's target |
setWebsite(String websiteName)
Returns: void
Looks up a website by name within the current organisation and sets it as the event's target website.
| Parameter | Description |
|---|---|
websiteName | the name of the website to look up |
withWebsite(String websiteName)
Returns: EventBuilder
Looks up a website by name, as per setWebsite, and returns this builder for chaining.
| Parameter | Description |
|---|---|
websiteName | the name of the website to look up |
setWebsite(Website website)
Returns: void
Sets the event's target website.
| Parameter | Description |
|---|---|
website | the website to use as the event's target |
withWebsite(Website website)
Returns: EventBuilder
Sets the event's target website and returns this builder for chaining.
| Parameter | Description |
|---|---|
website | the website to use as the event's target |
setTriggerId(String triggerId)
Returns: void
Sets the id of the trigger that the built event should match against.
| Parameter | Description |
|---|---|
triggerId | the trigger id |
withTriggerId(String triggerId)
Returns: EventBuilder
Sets the trigger id and returns this builder for chaining.
| Parameter | Description |
|---|---|
triggerId | the trigger id |
setAttributes(Map<String,Object> attributes)
Returns: void
Sets the map of custom attributes to attach to the event, replacing any attributes set previously.
| Parameter | Description |
|---|---|
attributes | the attribute names and values to attach to the event |
withAttributes(Map<String,Object> attributes)
Returns: EventBuilder
Sets the attribute map, as per setAttributes, and returns this builder for chaining.
| Parameter | Description |
|---|---|
attributes | the attribute names and values to attach to the event |
addAttribute(String key, Object value)
Returns: EventBuilder
Adds a single attribute to the event, creating the attribute map on first use, and returns this builder for chaining.
| Parameter | Description |
|---|---|
key | the attribute name |
value | the attribute value |
addAttributeUrn(String key, String type, Relational entity)
Returns: EventBuilder
Adds an attribute which refers to a persistent entity, recorded as a URN such as urn:profile:123 rather than as the entity itself. This is what to use when an event is about something in the database. The reference survives being stored and read back later, and whatever reads the event expands it again, so the reader sees current data rather than a snapshot taken when the event fired.
| Parameter | Description |
|---|---|
key | the attribute name |
type | the entity type as the reader knows it, eg profile, org, lead |
entity | the entity to refer to; ignored if null |
setConditions(String conditions)
Returns: void
Sets the condition strings that must be satisfied for the event's trigger to fire.
| Parameter | Description |
|---|---|
conditions | the condition strings to require |
withConditions(String conditions)
Returns: EventBuilder
Sets the condition strings, as per setConditions, and returns this builder for chaining.
| Parameter | Description |
|---|---|
conditions | the condition strings to require |
setAttachments(List<EmailAttachmentBean> attachments)
Returns: void
Sets the list of email attachments to include with the event, replacing any attachments set previously.
| Parameter | Description |
|---|---|
attachments | the attachments to include |
withAttachments(List<EmailAttachmentBean> attachments)
Returns: EventBuilder
Sets the attachment list, as per setAttachments, and returns this builder for chaining.
| Parameter | Description |
|---|---|
attachments | the attachments to include |
addAttachment(String fileName, String hash, String contentType)
Returns: EventBuilder
Adds an attachment referencing existing content by its hash, with disposition "attachment", and returns this builder for chaining.
| Parameter | Description |
|---|---|
fileName | the file name to present the attachment as |
hash | the content hash of the already-stored attachment data |
contentType | the MIME type of the attachment |
addAttachment(String fileName, String hash)
Returns: EventBuilder
Adds an attachment referencing existing content by its hash, with content type "application/octet-stream" and disposition "attachment", and returns this builder for chaining.
| Parameter | Description |
|---|---|
fileName | the file name to present the attachment as |
hash | the content hash of the already-stored attachment data |
addAttachment(String fileName, String contentType, InputStream inputStream)
Returns: EventBuilder
Reads the given stream into content storage and adds it as an attachment with disposition "attachment", returning this builder for chaining. A null content type is replaced with "application/octet-stream".
| Parameter | Description |
|---|---|
fileName | the file name to present the attachment as |
contentType | the MIME type of the attachment, or null to default to application/octet-stream |
inputStream | the attachment data to store |
addAttachment(Attachment attachment)
Returns: EventBuilder
Reads the data from a mail attachment and adds it as an event attachment, as per addAttachment(String, String, InputStream), returning this builder for chaining.
| Parameter | Description |
|---|---|
attachment | the mail attachment to copy into content storage and attach to the event |
addAttachment(String fileName, String hash, String contentType, String disposition)
Returns: EventBuilder
Adds an attachment referencing existing content by its hash with an explicit disposition, and returns this builder for chaining.
| Parameter | Description |
|---|---|
fileName | the file name to present the attachment as |
hash | the content hash of the already-stored attachment data |
contentType | the MIME type of the attachment |
disposition | the MIME part disposition, e.g. "attachment" or "inline" |
fireEvent()
Returns: void
Builds a RepositoryAppTriggerEvent from the profile, website, trigger id, attributes, attachments and conditions accumulated on this builder, and fires it through the owning EventWrapper.