MilestoneEvent

public class MilestoneEvent

The MilestoneEvent is used to create a Motech event. The event payload contains details about milestone.

See also: org.motechproject.scheduletracking.service.impl.EnrollmentAlertService

Constructors

MilestoneEvent

public MilestoneEvent(String externalId, String scheduleName, MilestoneAlert milestoneAlert, String windowName, DateTime referenceDateTime, Map<String, String> milestoneData)

Creates a MilestoneEvent with the enrollmentId attribute set to enrollmentId, the scheduleName attribute to scheduleName, the milestoneAlert attribute to milestoneAlert, the windowName attribute to windowName, the referenceDateTime attribute to referenceDateTime, the milestoneData attribute to milestoneData.

Parameters:
  • externalId – the user external id
  • scheduleName – the name of the schedule
  • milestoneAlert – the milestone alert
  • windowName – the name of the milestone window
  • referenceDateTime – the reference date and time
  • milestoneData – the milestone additional data

MilestoneEvent

public MilestoneEvent(MotechEvent motechEvent)

Creates a MilestoneEvent from an enrollment by passing in an Motech event.

Parameters:
  • motechEvent – the Motech event with details

MilestoneEvent

public MilestoneEvent(Enrollment enrollment, MilestoneAlert milestoneAlert, MilestoneWindow milestoneWindow)

Creates a MilestoneEvent from an enrollment, alert and milestone window.

Parameters:
  • enrollment – the enrollment
  • milestoneAlert – the alert which will be triggered
  • milestoneWindow – the milestone window

Methods

getExternalId

public String getExternalId()

Returns the external id of the MilestoneEvent.

Returns:the external id

getMilestoneAlert

public MilestoneAlert getMilestoneAlert()

Returns the milestone alert of the MilestoneEvent.

Returns:the milestone alert

getMilestoneData

public Map<String, String> getMilestoneData()

Returns the milestone data of the MilestoneEvent.

Returns:the milestone data

getReferenceDateTime

public DateTime getReferenceDateTime()

Returns the reference date and time of the MilestoneEvent.

Returns:the reference date and time

getScheduleName

public String getScheduleName()

Returns the schedule name of the MilestoneEvent.

Returns:the name of the schedule

getWindowName

public String getWindowName()

Returns the window name of the MilestoneEvent.

Returns:the milestone window name

toMotechEvent

public MotechEvent toMotechEvent()

Creates a Motech event with alert details.

Returns:the Motech event with alert details