ScheduleTrackingService

public interface ScheduleTrackingService

Schedule Tracking Service interface provides methods to enroll an external id into a schedule, fulfill milestones in a schedule and uneroll an external id from a schedule. It also provides querying functionality on Enrollments using various search criteria.

Methods

add

void add(String scheduleJson)

Saves the given schedule in database.

Parameters:
  • scheduleJson – the schedule in JSON format

enroll

Long enroll(EnrollmentRequest enrollmentRequest)

Enrolls a client with external id into a schedule using the details in the EnrollmentRequest and schedules alerts. If the client has already enrolled for the same schedule which is currently active, then we update the existing details and reschedule alerts.

Parameters:
  • enrollmentRequest – the enrollment details
Returns:

the enrollment id

fulfillCurrentMilestone

void fulfillCurrentMilestone(String externalId, String scheduleName, LocalDate fulfillmentDate, Time fulfillmentTime)

Fulfills the current milestone of the enrollment(with fulfillmentDate and time as the the given date and time) which belongs to the given externalId and schedule name.

Parameters:
  • externalId – the client external id
  • scheduleName – the schedule name
  • fulfillmentDate – the fulfillment date
  • fulfillmentTime – the fulfillment time

fulfillCurrentMilestone

void fulfillCurrentMilestone(String externalId, String scheduleName, LocalDate fulfillmentDate)

Fulfills the current milestone of the enrollment(with fulfillmentDate and time as midnight) which belongs to the given externalId and schedule name.

Parameters:
  • externalId – the client external id
  • scheduleName – the schedule name
  • fulfillmentDate – the fulfillment date

getAlertTimings

MilestoneAlerts getAlertTimings(EnrollmentRequest enrollmentRequest)

Gives the alert timings of all the windows in the milestone without actually scheduling the alert jobs

Parameters:
  • enrollmentRequest – the enrollment request
Returns:

the alert timings for all the windows of the milestone

getAllSchedules

List<Schedule> getAllSchedules()

Returns all schedules.

Returns:schedules list

getEnrollment

EnrollmentRecord getEnrollment(String externalId, String scheduleName)

Returns the enrollment record corresponds to the given external id and schedule name.

Parameters:
  • externalId – the client external id
  • scheduleName – the schedule name
Returns:

the enrolment

getScheduleByName

Schedule getScheduleByName(String scheduleName)

Returns the schedule with the given name.

Parameters:
  • scheduleName – the name of the schedule
Returns:

schedule

remove

void remove(String scheduleName)

Removes the specified schedule from the database.

Parameters:
  • scheduleName – the name of the schedule to remove

searchWithWindowDates

List<EnrollmentRecord> searchWithWindowDates(EnrollmentsQuery query)

Searches and returns the enrollment records(with all window start dates populated in them) as per the criteria in the given enrollments query.

Parameters:
  • query – the enrolments query which contains search criteria
Returns:

the enrolments list

unenroll

void unenroll(String externalId, List<String> scheduleNames)

Unenrolls / Removes all the scheduled jobs of enrollments which belongs to the given external id and schedule names.

Parameters:
  • externalId – the client external id
  • scheduleNames – the schedule names

updateEnrollment

void updateEnrollment(String externalId, String scheduleName, UpdateCriteria updateCriteria)

Updates an active enrollment which has the given external id and schedule name.

Parameters:
  • updateCriteria – states the fields to be updated in the enrollment