public class DefaultTextService extends java.lang.Object implements TextService
| Constructor and Description |
|---|
DefaultTextService() |
| Modifier and Type | Method and Description |
|---|---|
void |
discard(MobileMessageContextModel message,
MobileMessageError error,
java.lang.String errorMessage,
java.lang.Throwable cause)
While processing a incoming message this methods allows to mark the message as discarded.
|
void |
done(MobileMessageContextModel message)
While processing a incoming message this methods allows to mark the message as done.
|
java.util.List<MobileShortcodeModel> |
getAvailableShortcodesForSending(CountryModel country)
Locates all shortcodes for the specified country which support sending of outgoing
messages.
|
MobileShortcodeModel |
getExclusiveShortCode(java.lang.String shortCode)
Looks up a exclusive shortcode using its unique code.
|
MobileShortcodeModel |
getSharedShortCode(java.lang.String shortCode,
java.lang.String keywordPrefix)
Looks up a shared short code by a specified code and keywords
|
MobileMessageContextModel |
replyWithLink(MobileMessageContextModel receivedMessage,
java.lang.String subject,
java.lang.String url)
While processing a incoming message this methods allows to send a reply link message using the incoming
message information.
|
MobileMessageContextModel |
replyWithLink(MobileShortcodeModel shortcode,
MobileMessageContextModel receivedMessage,
java.lang.String subject,
java.lang.String url)
While processing a incoming message this methods allows to send a reply link message using the incoming
message information.
|
MobileMessageContextModel |
replyWithMessage(MobileMessageContextModel receivedMessage,
java.lang.String text)
While processing a incoming message this methods allows to send a reply text message using the incoming
message information.
|
MobileMessageContextModel |
replyWithMessage(MobileShortcodeModel shortcode,
MobileMessageContextModel receivedMessage,
java.lang.String text)
While processing a incoming message this methods allows to send a reply text message using the incoming
message information.
|
MobileMessageContextModel |
sendLink(CountryModel country,
PhoneNumberModel phone,
java.lang.String subject,
java.lang.String url)
Convenience method delegating to
TextService.sendLink(String, String, String, String). |
MobileMessageContextModel |
sendLink(MobileShortcodeModel shortcode,
java.lang.String countryIsoCode,
java.lang.String phone,
java.lang.String subject,
java.lang.String url)
Sends a link SMS message to the specified number.
|
MobileMessageContextModel |
sendLink(PhoneNumberModel phone,
java.lang.String subject,
java.lang.String url)
Convenience method delegating to
TextService.sendLink(String, String, String, String). |
MobileMessageContextModel |
sendLink(java.lang.String countryIsoCode,
java.lang.String phone,
java.lang.String subject,
java.lang.String url)
Sends a link SMS message to the specified number.
|
MobileMessageContextModel |
sendMessage(CountryModel country,
PhoneNumberModel phone,
java.lang.String text)
Convenience method delegating to
TextService.sendMessage(String, String, String). |
MobileMessageContextModel |
sendMessage(MobileShortcodeModel shortcode,
java.lang.String countryIsoCode,
java.lang.String phone,
java.lang.String text)
Sends a text SMS message to the specified number.
|
MobileMessageContextModel |
sendMessage(PhoneNumberModel phone,
java.lang.String text)
Convenience method delegating to
TextService.sendMessage(String, String, String). |
MobileMessageContextModel |
sendMessage(java.lang.String countryIsoCode,
java.lang.String phone,
java.lang.String text)
Sends a text SMS message to the specified number.
|
void |
setFlexibleSearchService(FlexibleSearchService flexibleSearchService) |
void |
setMessageScheduler(MessageScheduler messageScheduler) |
void |
setModelService(ModelService modelService) |
protected void |
validateReceivedMessageForReply(MobileMessageContextModel receivedMessage) |
protected void |
validateShortcodeForSending(MobileShortcodeModel shortcode) |
public java.util.List<MobileShortcodeModel> getAvailableShortcodesForSending(CountryModel country)
TextService
Please note that the final routing decision is being done by the OutgoingMessageRoutingStrategy which is currently
set up in the mobile spring configuration. This method will simply list all potential ones.
getAvailableShortcodesForSending in interface TextServicepublic MobileShortcodeModel getExclusiveShortCode(java.lang.String shortCode)
TextServicegetExclusiveShortCode in interface TextServiceshortCode - the code to look forpublic MobileShortcodeModel getSharedShortCode(java.lang.String shortCode, java.lang.String keywordPrefix)
TextServicegetSharedShortCode in interface TextServiceshortCode - the shared codekeywordPrefix - the keywordprotected void validateShortcodeForSending(MobileShortcodeModel shortcode)
public MobileMessageContextModel sendMessage(MobileShortcodeModel shortcode, java.lang.String countryIsoCode, java.lang.String phone, java.lang.String text)
TextServiceMobileShortcodeModel will be
used to send the message on behalf.
Messages are not sent immediately but are enqueue. Therefore the returned model will show intermediate states. Use
MessageHelper.blockUntilProcessed(de.hybris.platform.core.PK, long) if you must wait until sending is done.
sendMessage in interface TextServiceshortcode - the shortcode to be used for sending (defines aggregator and thus engine)countryIsoCode - the country for the given phone numberphone - the phone numbertext - the message contentpublic MobileMessageContextModel sendMessage(java.lang.String countryIsoCode, java.lang.String phone, java.lang.String text)
TextServiceMobileShortcodeModel will be found and the message is being sent
using its aggregator.
Messages are not sent immediately but are enqueue. Therefore the returned model will show intermediate states. Use
MessageHelper.blockUntilProcessed(de.hybris.platform.core.PK, long) if you must wait until sending is done.
sendMessage in interface TextServicecountryIsoCode - the country for the given phone numberphone - the phone numbertext - the message contentpublic MobileMessageContextModel sendLink(MobileShortcodeModel shortcode, java.lang.String countryIsoCode, java.lang.String phone, java.lang.String subject, java.lang.String url)
TextServiceMobileShortcodeModel will be
used to send the message on behalf.
Messages are not sent immediately but are enqueue. Therefore the returned model will show intermediate states.
sendLink in interface TextServiceshortcode - the shortcode to be used for sending (defines aggregator and thus engine)public MobileMessageContextModel sendLink(java.lang.String countryIsoCode, java.lang.String phone, java.lang.String subject, java.lang.String url)
TextServiceMobileShortcodeModel will be found and the message is being sent
using its aggregator.
Messages are not sent immediately but are enqueue. Therefore the returned model will show intermediate states.
sendLink in interface TextServiceprotected void validateReceivedMessageForReply(MobileMessageContextModel receivedMessage)
public MobileMessageContextModel replyWithMessage(MobileShortcodeModel shortcode, MobileMessageContextModel receivedMessage, java.lang.String text)
TextService
The specified MobileShortcodeModel will be used to send the message on behalf.
Reply messages are not sent immediately but are enqueue. Therefore the returned model will show intermediate states.
Use MessageHelper.blockUntilProcessed(de.hybris.platform.core.PK, long) if you must wait until sending is done.
replyWithMessage in interface TextServiceshortcode - the shortcode to be used for sending (defines aggregator and thus engine)receivedMessage - the previously received messagetext - the reply textpublic MobileMessageContextModel replyWithMessage(MobileMessageContextModel receivedMessage, java.lang.String text)
TextService
Internally the receiving MobileShortcodeModel may be used for sending or, if more appropriate a suitable short code
will be chosen.
Reply messages are not sent immediately but are enqueue. Therefore the returned model will show intermediate states.
Use MessageHelper.blockUntilProcessed(de.hybris.platform.core.PK, long) if you must wait until sending is done.
replyWithMessage in interface TextServicereceivedMessage - the previously received messagetext - the reply textpublic MobileMessageContextModel replyWithLink(MobileShortcodeModel shortcode, MobileMessageContextModel receivedMessage, java.lang.String subject, java.lang.String url)
TextService
The specified MobileShortcodeModel will be used to send the message on behalf.
Reply messages are not sent immediately but are enqueue. Therefore the returned model will show intermediate states.
Use MessageHelper.blockUntilProcessed(de.hybris.platform.core.PK, long) if you must wait until sending is done.
replyWithLink in interface TextServiceshortcode - the shortcode to be used for sending (defines aggregator and thus engine)receivedMessage - the previously received messagesubject - the reply link subjecturl - the reply link urlpublic MobileMessageContextModel replyWithLink(MobileMessageContextModel receivedMessage, java.lang.String subject, java.lang.String url)
TextService
Internally the receiving MobileShortcodeModel may be used for sending or, if more appropriate a suitable short code
will be chosen.
Reply messages are not sent immediately but are enqueue. Therefore the returned model will show intermediate states.
Use MessageHelper.blockUntilProcessed(de.hybris.platform.core.PK, long) if you must wait until sending is done.
replyWithLink in interface TextServicereceivedMessage - the previously received messagesubject - the reply link subjecturl - the reply link urlpublic void done(MobileMessageContextModel message)
TextService
Since message processing is done by custom actions it is recommended that implementors signal
the end of processing by calling either TextService.done(MobileMessageContextModel) or
TextService.discard(MobileMessageContextModel, MobileMessageError, String, Throwable) in case no reply is being
triggered.
done in interface TextServicemessage - the message to be marked as done.public void discard(MobileMessageContextModel message, MobileMessageError error, java.lang.String errorMessage, java.lang.Throwable cause)
TextService
Since message processing is done by custom actions it is recommended that implementors signal
the end of processing by calling either TextService.done(MobileMessageContextModel) or
TextService.discard(MobileMessageContextModel, MobileMessageError, String, Throwable) in case no reply is being
triggered.
discard in interface TextServicemessage - the message to be marked as done.public MobileMessageContextModel sendLink(CountryModel country, PhoneNumberModel phone, java.lang.String subject, java.lang.String url)
TextServiceTextService.sendLink(String, String, String, String).sendLink in interface TextServicecountry - is providing the country iso code for the given phone numberphone - the phone numbersubject - the link subjecturl - the link urlpublic MobileMessageContextModel sendLink(PhoneNumberModel phone, java.lang.String subject, java.lang.String url)
TextServiceTextService.sendLink(String, String, String, String).sendLink in interface TextServicephone - the phone number model which contains both country and number datasubject - the link subjecturl - the link urlpublic MobileMessageContextModel sendMessage(CountryModel country, PhoneNumberModel phone, java.lang.String text)
TextServiceTextService.sendMessage(String, String, String).sendMessage in interface TextServicecountry - is providing the country iso code for the given phone numberphone - the phone numbertext - the message contentpublic MobileMessageContextModel sendMessage(PhoneNumberModel phone, java.lang.String text)
TextServiceTextService.sendMessage(String, String, String).sendMessage in interface TextServicephone - the phone number model which contains both country and number datatext - the message contentpublic void setModelService(ModelService modelService)
public void setFlexibleSearchService(FlexibleSearchService flexibleSearchService)
public void setMessageScheduler(MessageScheduler messageScheduler)
Copyright © 2018 SAP SE. All Rights Reserved.