EnrollmentBuilder

public class EnrollmentBuilder

The EnrollmentBuilder is a convenient class, that allows building org.motechproject.scheduletracking.domain.Enrollment instances. Once all required fields are set, call toEnrollment() method to get an instance of enrollment with the properties you have set.

Constructors

EnrollmentBuilder

public EnrollmentBuilder()

Creates an EnrollmentBuilder.

Methods

toEnrollment

public Enrollment toEnrollment()

Returns an instance of enrollment with the properties you have set.

Returns:the enrollment

withCurrentMilestoneName

public EnrollmentBuilder withCurrentMilestoneName(String currentMilestoneName)

Adds the current milestone name to the enrollment in construction.

Parameters:
  • currentMilestoneName – the current milestone name
Returns:

this instance with the current milestone name set up

withEnrolledOn

public EnrollmentBuilder withEnrolledOn(DateTime enrolledOn)

Adds the enrollment date and time to the enrollment in construction.

Parameters:
  • enrolledOn – the enrollment date and time
Returns:

this instance with the enrollment date and time set up

withExternalId

public EnrollmentBuilder withExternalId(String externalId)

Adds the external id to the enrollment in construction.

Parameters:
  • externalId – the client external id
Returns:

this instance with the external id set up

withFulfillments

public EnrollmentBuilder withFulfillments(List<MilestoneFulfillment> fulfillments)

Adds the milestone fulfillments to the enrollment in construction.

Parameters:
  • fulfillments – the milestone fulfillments
Returns:

this instance with the milestone fulfillments set up

withId

public EnrollmentBuilder withId(Long id)

Adds the id to the enrollment in construction.

Parameters:
  • id – the id of the enrollment
Returns:

this instance with the id set up

withMetadata

public EnrollmentBuilder withMetadata(Map<String, String> metadata)

Adds the metadata to the enrollment in construction.

Parameters:
  • metadata – the metadata to add
Returns:

this instance with the metadata set up

withPreferredAlertTime

public EnrollmentBuilder withPreferredAlertTime(Time preferredAlertTime)

Adds the preferred alert time to the enrollment in construction.

Parameters:
  • preferredAlertTime – the preferred alert time
Returns:

this instance with the preferred alert time name set up

withSchedule

public EnrollmentBuilder withSchedule(Schedule schedule)

Adds the schedule to the enrollment in construction.

Parameters:
  • schedule – the schedule to which the enrollment belongs
Returns:

this instance with the schedule set up

withScheduleName

public EnrollmentBuilder withScheduleName(String scheduleName)

Adds the schedule name to the enrollment in construction.

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

this instance with the schedule name set up

withStartOfSchedule

public EnrollmentBuilder withStartOfSchedule(DateTime startOfSchedule)

Adds the start reference date and time to the enrollment in construction.

Parameters:
  • startOfSchedule – the start reference date and time
Returns:

this instance with the start reference date and time set up

withStatus

public EnrollmentBuilder withStatus(EnrollmentStatus status)

Adds the status to the enrollment in construction.

Parameters:
  • status – the status of the enrollment
Returns:

this instance with the status set up