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

unregister

public void unregister(String externalId, String campaignName)

Sets the enrollment status to inactive.

Parameters:
  • externalId – external ID of the campaign enrollment
  • campaignName – campaign name of the enrollment

unregister

public void unregister(CampaignEnrollment enrollment)

Sets the enrollment status to inactive.

Parameters:
  • enrollment – enrollment to change the status for