Fires custom funnel goals and repository app trigger events from GraalJS, and hands out EventBuilder instances for assembling more complex trigger events. Registered in the templating context as "eventManager", so developer code and templates reach it via that name. The goalAchieved overloads fire a RepositoryAppFunnelEvent for a named custom funnel goal, for either the current user or an explicitly supplied profile. The fireTrigger overloads fire a RepositoryAppTriggerEvent directly, matching triggers registered against the given trigger id. Both dispatch through the EventManager this instance was constructed with, and swallow exceptions raised by listeners.
Group: Managers
Methods
goalAchieved(String name) · goalAchieved(String name, Map<String,String> parameters) · goalAchieved(String name, ProfileBean profile) · goalAchieved(String name, ProfileBean profile, Map<String,String> parameters) · goalAchieved(String name, Profile profile, Map<String,String> parameters) · fireTrigger(String userId, String websiteName, String triggerId, Map<String,Object> attributes, String conditions) · fireTrigger(ProfileBean pb, String websiteName, String triggerId, Map<String,Object> attributes, String conditions) · fireTrigger(Profile profile, Website website, String triggerId, Map<String,Object> attributes, String conditions) · fireTrigger(Profile profile, Website website, String triggerId, Map<String,Object> attributes, List<EmailAttachmentBean> attachments, String conditions) · fireTrigger(Profile profile, Website website, String triggerId, Map<String,Object> attributes, List<EmailAttachmentBean> attachments, boolean serialisable, String conditions) · eventBuilder() · eventBuilder(boolean serialisable)
goalAchieved(String name)
Returns: void
Fires a custom funnel goal-achieved event for the named goal, for the current logged-in user. Requires an active root folder and current user; throws if either is missing.
| Parameter | Description |
|---|---|
name | the name of the custom funnel goal that was achieved |
goalAchieved(String name, Map<String,String> parameters)
Returns: void
Fires a custom funnel goal-achieved event for the named goal, for the current logged-in user, carrying the given event parameters. Requires an active root folder and current user; throws if either is missing.
| Parameter | Description |
|---|---|
name | the name of the custom funnel goal that was achieved |
parameters | additional name/value data to attach to the event |
goalAchieved(String name, ProfileBean profile)
Returns: void
Fires a custom funnel goal-achieved event for the named goal, for the given profile, with no extra parameters.
| Parameter | Description |
|---|---|
name | the name of the custom funnel goal that was achieved |
profile | the profile the goal was achieved for |
goalAchieved(String name, ProfileBean profile, Map<String,String> parameters)
Returns: void
Fires a custom funnel goal-achieved event for the named goal, for the given profile bean, carrying the given event parameters.
| Parameter | Description |
|---|---|
name | the name of the custom funnel goal that was achieved |
profile | the profile bean wrapping the profile the goal was achieved for |
parameters | additional name/value data to attach to the event |
goalAchieved(String name, Profile profile, Map<String,String> parameters)
Returns: void
Fires a custom funnel goal-achieved event for the named goal, for the given profile, carrying the given event parameters. Requires an active root folder; throws if none is available.
| Parameter | Description |
|---|---|
name | the name of the custom funnel goal that was achieved |
profile | the profile the goal was achieved for |
parameters | additional name/value data to attach to the event |
fireTrigger(String userId, String websiteName, String triggerId, Map<String,Object> attributes, String conditions)
Returns: void
Looks up a profile by user name or email address and a website by name within the current organisation, then fires a repository app trigger event for the given trigger id. Does nothing if there is no current root folder.
| Parameter | Description |
|---|---|
userId | the user name or email address of the profile to fire the event for |
websiteName | the name of the website to fire the event against |
triggerId | the trigger id the fired event should match against |
attributes | custom attributes to attach to the event |
conditions | condition strings that must be satisfied for a matching trigger to fire |
fireTrigger(ProfileBean pb, String websiteName, String triggerId, Map<String,Object> attributes, String conditions)
Returns: void
Resolves a website by name within the current organisation and fires a repository app trigger event for the given profile bean and trigger id.
| Parameter | Description |
|---|---|
pb | the profile bean wrapping the profile to fire the event for |
websiteName | the name of the website to fire the event against |
triggerId | the trigger id the fired event should match against |
attributes | custom attributes to attach to the event |
conditions | condition strings that must be satisfied for a matching trigger to fire |
fireTrigger(Profile profile, Website website, String triggerId, Map<String,Object> attributes, String conditions)
Returns: void
Builds and fires a RepositoryAppTriggerEvent for the given profile, website and trigger id, with no attachments.
| Parameter | Description |
|---|---|
profile | the profile to fire the event for |
website | the website to fire the event against |
triggerId | the trigger id the fired event should match against |
attributes | custom attributes to attach to the event |
conditions | condition strings that must be satisfied for a matching trigger to fire |
fireTrigger(Profile profile, Website website, String triggerId, Map<String,Object> attributes, List<EmailAttachmentBean> attachments, String conditions)
Returns: void
Builds and fires a RepositoryAppTriggerEvent for the given profile, website and trigger id, including the given email attachments. This is the overload EventBuilder.fireEvent delegates to.
| Parameter | Description |
|---|---|
profile | the profile to fire the event for |
website | the website to fire the event against |
triggerId | the trigger id the fired event should match against |
attributes | custom attributes to attach to the event |
attachments | email attachments to attach to the event |
conditions | condition strings that must be satisfied for a matching trigger to fire |
fireTrigger(Profile profile, Website website, String triggerId, Map<String,Object> attributes, List<EmailAttachmentBean> attachments, boolean serialisable, String conditions)
Returns: void
Builds and fires a RepositoryAppTriggerEvent, recording on it whether the firing app declared its attributes safe to serialise. This is the overload EventBuilder.fireEvent delegates to.
| Parameter | Description |
|---|---|
profile | the profile to fire the event for |
website | the website to fire the event against |
triggerId | the trigger id the fired event should match against |
attributes | custom attributes to attach to the event |
attachments | email attachments to attach to the event |
serialisable | whether the attributes were declared, and checked, as safe to store with the event |
conditions | condition strings that must be satisfied for a matching trigger to fire |
eventBuilder()
Returns: EventBuilder
Creates a new EventBuilder bound to this EventWrapper and the current root folder, for assembling a repository app trigger event with chained setter calls before firing it.
eventBuilder(boolean serialisable)
Returns: EventBuilder
Creates a new EventBuilder, optionally one which insists the event's attributes can be stored with it. Pass true when anything might want to read this event back later rather than handle it as it fires - an agent subscribing to it, most obviously, since a buffered event is written as JSON and read minutes later in a different session. Each attribute is then checked as it is added, and a persistent entity or any other value which cannot be written is rejected there and then, naming the attribute. The event records the declaration, and the agent framework only delivers events which carry it.
| Parameter | Description |
|---|---|
serialisable | true to require and declare serialisable attributes |