OutgoingSms

public class OutgoingSms

Represents an outgoing SMS

Constructors

OutgoingSms

public OutgoingSms()

Constructs a new instance without setting any fields.

OutgoingSms

public OutgoingSms(MotechEvent event)

Constructs an instance using the field map from the provided event.

Parameters:
  • event – the event to parse into the SMS instance

See also: SmsEventParams

OutgoingSms

public OutgoingSms(String config, List<String> recipients, String message, DateTime deliveryTime)

Creates a new instance using the provided parameters.

Parameters:
  • config – use this config to send the SMS, otherwise use the default config
  • recipients – one or more recipients
  • message – the message to send
  • deliveryTime – the expected delivery time of the sms

OutgoingSms

public OutgoingSms(String config, String recipient, String message, DateTime deliveryTime)

Creates a new instance using the provided parameters.

Parameters:
  • config – use this config to send the SMS, otherwise use the default config
  • recipient – the recipient of the SMS
  • message – the message to send
  • deliveryTime – the expected delivery time of the sms

OutgoingSms

public OutgoingSms(String config, List<String> recipients, String message)

Creates a new instance using the provided parameters.

Parameters:
  • config – use this config to send the SMS, otherwise use the default config
  • recipients – the recipients of the SMS
  • message – the message to send

OutgoingSms

public OutgoingSms(String config, String recipient, String message)

OutgoingSms

public OutgoingSms(List<String> recipients, String message, DateTime deliveryTime)

Creates a new instance using the provided parameters.

Parameters:
  • recipients – the recipients of the SMS
  • message – the message to send
  • deliveryTime – the expected delivery time of the sms

OutgoingSms

public OutgoingSms(String recipient, String message, DateTime deliveryTime)

Creates a new instance using the provided parameters.

Parameters:
  • recipient – the recipient of the SMS
  • message – the message to send
  • deliveryTime – the expected delivery time of the sms

OutgoingSms

public OutgoingSms(List<String> recipients, String message)

Creates a new instance using the provided parameters.

Parameters:
  • recipients – the recipients of the SMS
  • message – the message to send

OutgoingSms

public OutgoingSms(String recipient, String message)

Creates a new instance using the provided parameters.

Parameters:
  • recipient – the recipient of the SMS
  • message – the message to send

Methods

equals

public boolean equals(Object obj)

getConfig

public String getConfig()

If specified, use this config to send the SMS, otherwise use the default config.

Returns:the config that will be used for sending this SMS

getCustomParams

public Map<String, String> getCustomParams()
Returns:map of custom parameters for the template

getDeliveryTime

public DateTime getDeliveryTime()

Gets the delivery time for this SMS. If specified, will schedule the message for future delivery using the MOTECH scheduler.

Returns:the delivery time for this SMS

getFailureCount

public Integer getFailureCount()

Gets the failure counter, used by the SMS module to keep track of the failures and execute retries.

Returns:the internal failure counter for this SMS

getMessage

public String getMessage()
Returns:the content of the message to send

getMotechId

public String getMotechId()

Gets the MOTECH specific message GUID of this SMS.

Returns:the motech specific GUID for this SMS

getProviderId

public String getProviderId()
Returns:the provider specific message id

getRecipients

public List<String> getRecipients()

Gets the recipients for this message. An SMS can have one or more recipients.

Returns:the recipients fo the SMS

hasConfig

public Boolean hasConfig()

Checks if this SMS specifies a config for sending the SMS, or whether the default configuration should be used.

Returns:true if there’s a config specified for this SMS, false if the default config is to be used

hasDeliveryTime

public Boolean hasDeliveryTime()

Checks whether this SMS has a specified delivery time. If specified, will schedule the message for future delivery using the MOTECH scheduler. If not, the message should be immediately delivered.

Returns:true if this SMS has a specific delivery time, false otherwise

hasMotechId

public Boolean hasMotechId()

hashCode

public int hashCode()

setConfig

public void setConfig(String config)

If specified, use this config to send the SMS, otherwise use the default config.

Parameters:
  • config – the config that will be used for sending this SMS

setCustomParams

public void setCustomParams(Map<String, String> customParams)
Parameters:
  • customParams – map of custom parameters for the template

setDeliveryTime

public void setDeliveryTime(DateTime deliveryTime)

Gets the delivery time for this SMS. If specified will schedule the message for future delivery using the MOTECH scheduler.

Parameters:
  • deliveryTime – the delivery time for this SMS

setFailureCount

public void setFailureCount(Integer failureCount)

Sets the failure counter, used by the SMS module to keep track of the failures and execute retries.

Parameters:
  • failureCount – the internal failure counter for this SMS

setMessage

public void setMessage(String message)
Parameters:
  • message – the content of the message to send

setMotechId

public void setMotechId(String motechId)

Sets the MOTECH specific message GUID of this SMS.

Parameters:
  • motechId – the motech specific GUID for this SMS

setProviderId

public void setProviderId(String providerId)
Parameters:
  • providerId – the provider specific message id

setRecipients

public void setRecipients(List<String> recipients)

Gets the recipients for this message. An SMS can have one or more recipients.

Parameters:
  • recipients – the recipients fo the SMS

toString

public String toString()