Fired at points in a profile's membership lifecycle for a group: subscribed, pending approval, rejected, accepted, removed, lapsed, payment overdue or reactivated. It is raised by group and user management code across the platform whenever a membership or membership application changes state; which state changed is given by getAction, one of the SubscriptionAction constants. It has event id "subscription" and is a trigger event, keyed on the group id (trigger item 1), website id (trigger item 2) and the action name (trigger item 3). getSignupLog carries the signup record when the event was raised from a signup, and getGroupMembershipApplication carries the pending application for events raised before a membership exists.

Implements: TriggerEvent


Properties

PropertyReturnsDescription
actionSubscriptionActionWhich point in the membership lifecycle this event represents: AUTOAPPROVED, PENDING, REJECTED, ACCEPTED, EXISTING_MEMBER, REMOVED, LAPSED, PAYMENT_OVERDUE or RE_ACTIVATED.
attributesMap<String,Object>The mutable attribute map for this event. Starts empty, and is used as a per-event scratch cache by isActive and getGroupInWebsites; listeners may add their own entries to pass values on to later handlers and to email templates.
eventIdStringThe persistent identifier for this event type, always "subscription". Used by the trigger system to select handlers.
groupMembershipApplicationGroupMembershipApplicationThe pending membership application this event is about, for PENDING and REJECTED events raised before a membership exists.
groupNameStringThe name of the group the membership belongs to.
membershipGroupMembershipThe group membership this event is about. Null for a PENDING or REJECTED event raised before a membership exists, where getGroupMembershipApplication carries the application instead.
signupLogSignupLogThe signup record created when the user signed up, for events raised from a signup. Null for events not raised as part of a signup, such as REMOVED.
sourceProfileProfileThe profile whose membership changed. Null when the event was raised without a membership or application, for example EXISTING_MEMBER events created without one.
triggerItem1StringThe id of the group the membership belongs to, as a string, for trigger matching.
triggerItem2StringThe id of the website the change was made through, as a string, or null if there is no website, for trigger matching.
triggerItem3StringThe name of the subscription action, for trigger matching.
triggerItem4StringNot used by this event, always null.
triggerItem5StringNot used by this event, always null.
websiteWebsiteThe website the change was made through, as supplied to the constructor. May be null.

Inherited from TriggerEvent

Properties

PropertyReturnsDescription
serialisablebooleanWhether this event's attributes were built to survive being persisted, ie every value is a plain serialisable value rather than a persistent entity or some other object that only makes sense inside the firing transaction. Only the firing app can know this, so it declares it - see EventBuilder. An agent that subscribes to an event does not run when it fires. The event is written to storage as JSON, buffered with others, and read back minutes later in a different session, so a value that cannot be written and read back is not merely awkward, it breaks the whole delivery. The agent framework therefore ignores any event which does not say yes here.

Methods

isSerialisable()

Returns: boolean

Whether this event's attributes were built to survive being persisted, ie every value is a plain serialisable value rather than a persistent entity or some other object that only makes sense inside the firing transaction. Only the firing app can know this, so it declares it - see EventBuilder. An agent that subscribes to an event does not run when it fires. The event is written to storage as JSON, buffered with others, and read back minutes later in a different session, so a value that cannot be written and read back is not merely awkward, it breaks the whole delivery. The agent framework therefore ignores any event which does not say yes here.


Methods

getAction() · getMembership() · getWebsite() · getSourceProfile() · getEventId() · getTriggerItem1() · getTriggerItem2() · getTriggerItem3() · getTriggerItem4() · getTriggerItem5() · getAttributes() · isActive(ApplicationManager applicationManager, Application app, Branch branch) · getGroupInWebsites(Group group) · getSignupLog() · getGroupName() · getGroupMembershipApplication()

getAction()

Returns: SubscriptionAction

Which point in the membership lifecycle this event represents: AUTOAPPROVED, PENDING, REJECTED, ACCEPTED, EXISTING_MEMBER, REMOVED, LAPSED, PAYMENT_OVERDUE or RE_ACTIVATED.

getMembership()

Returns: GroupMembership

The group membership this event is about. Null for a PENDING or REJECTED event raised before a membership exists, where getGroupMembershipApplication carries the application instead.

getWebsite()

Returns: Website

The website the change was made through, as supplied to the constructor. May be null.

getSourceProfile()

Returns: Profile

The profile whose membership changed. Null when the event was raised without a membership or application, for example EXISTING_MEMBER events created without one.

getEventId()

Returns: String

The persistent identifier for this event type, always "subscription". Used by the trigger system to select handlers.

getTriggerItem1()

Returns: String

The id of the group the membership belongs to, as a string, for trigger matching.

getTriggerItem2()

Returns: String

The id of the website the change was made through, as a string, or null if there is no website, for trigger matching.

getTriggerItem3()

Returns: String

The name of the subscription action, for trigger matching.

getTriggerItem4()

Returns: String

Not used by this event, always null.

getTriggerItem5()

Returns: String

Not used by this event, always null.

getAttributes()

Returns: Map<String,Object>

The mutable attribute map for this event. Starts empty, and is used as a per-event scratch cache by isActive and getGroupInWebsites; listeners may add their own entries to pass values on to later handlers and to email templates.

isActive(ApplicationManager applicationManager, Application app, Branch branch)

Returns: boolean

Reports whether the given app is active on the given branch, caching the list of active apps in this event's attributes so that repeated calls across several listeners only look it up once.

ParameterDescription
applicationManagerthe application manager used to look up and test the active apps
appthe app to test for
branchthe branch to check the app's activation against

getGroupInWebsites(Group group)

Returns: List<GroupInWebsite>

Finds the websites the given group is enabled on, caching the result in this event's attributes so that repeated calls across several listeners only run the query once. The first call hits the database; the cache is keyed only by this event, not by the group argument, so the result of the first call is returned for every subsequent call regardless of the group passed.

ParameterDescription
groupthe group to look up the website links for

getSignupLog()

Returns: SignupLog

The signup record created when the user signed up, for events raised from a signup. Null for events not raised as part of a signup, such as REMOVED.

getGroupName()

Returns: String

The name of the group the membership belongs to.

getGroupMembershipApplication()

Returns: GroupMembershipApplication

The pending membership application this event is about, for PENDING and REJECTED events raised before a membership exists.

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