EnrollmentService¶
-
public class
EnrollmentService
¶ The
EnrollmentService
is used by the Message Campaign module to manage campaign enrollments.
Methods¶
delete¶
-
public void
delete
(CampaignEnrollment enrollment)¶ Removes the given enrollment from the database.
Parameters: - enrollment – enrollment to remove
markEnrollmentAsCompleted¶
-
public CampaignEnrollment
markEnrollmentAsCompleted
(String externalId, String campaignName)¶ Marks an enrollment as complete. If the enrollment to mark is not found, null will be returned and nothing will be marked as completed.
Parameters: - externalId – external id of the enrollment to mark as completed
- campaignName – name of the campaign name to which the enrollment belongs
Returns: the updated enrollment, or null if it wasn’t found
register¶
-
public void
register
(CampaignEnrollment enrollment)¶ Creates or updates
CampaignEnrollment
. A new enrollment will be created as long, as there’s no enrollment with the given external ID and campaign name. The update of an enrollment is only possible if the current enrollment status is set to inactive.Parameters: - enrollment – enrollment to create or update
Throws: - IllegalArgumentException – in case of an attempt to register duplicate campaign with different reference date or deliver time
search¶
-
public List<CampaignEnrollment>
search
(CampaignEnrollmentsQuery query)¶ Fetches
CampaignEnrollment
s, based on the providedCampaignEnrollmentsQuery
. The primary criterion is used while fetching the records from the database. Secondary criterion are used to filter the records in memory.Parameters: - query – the query to use while looking for records
Returns: campaign enrollments matching provided query
unregister¶
unregister¶
-
public void
unregister
(CampaignEnrollment enrollment)¶ Sets the enrollment status to inactive.
Parameters: - enrollment – enrollment to change the status for