Package org.cyclos.impl.utils.sms
Class InboundSmsRequestHandlerImpl
- java.lang.Object
-
- org.cyclos.impl.utils.sms.InboundSmsRequestHandlerImpl
-
- All Implemented Interfaces:
InboundSmsRequestHandler
public class InboundSmsRequestHandlerImpl extends Object implements InboundSmsRequestHandler
Default implementation forInboundSmsRequestHandler
-
-
Field Summary
Fields Modifier and Type Field Description protected static PatternPARAM_PATTERN
-
Constructor Summary
Constructors Constructor Description InboundSmsRequestHandlerImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected ResponseInfogenerateDefaultResponse()ResponseInfogenerateResponse(ConfigurationAccessor configuration, SmsChannelConfiguration channelConfiguration, RequestInfo request, InboundSmsData smsData, InboundSms sms)Generates the response to the SMS gatewayResponseInfogenerateResponseForError(ConfigurationAccessor configuration, SmsChannelConfiguration channelConfiguration, RequestInfo request, Exception exception)Generates the response to the SMS gateway when there is a general errorResponseInfogenerateResponseForMissingParameters(ConfigurationAccessor configuration, SmsChannelConfiguration channelConfiguration, RequestInfo request)Generates the response to the SMS gateway when the bare minimum parameters - number and message - are missingprotected StringnormalizePhoneNumber(ConfigurationAccessor configuration, SmsChannelConfiguration channelConfiguration, RequestInfo request, String phoneNumber)protected StringprocessParameters(ConfigurationAccessor configuration, SmsChannelConfiguration channelConfiguration, RequestInfo request, String pattern)Replaces all parameter names by their values, in the form {paramName}...InboundSmsBasicDataresolveSmsData(ConfigurationAccessor configuration, SmsChannelConfiguration channelConfiguration, RequestInfo request)Parses, from the given request, the inbound SMS dataprotected List<String>splitMessageParts(ConfigurationAccessor configuration, SmsChannelConfiguration channelConfiguration, RequestInfo request, String message)Splits the message by spaces
-
-
-
Field Detail
-
PARAM_PATTERN
protected static final Pattern PARAM_PATTERN
-
-
Method Detail
-
generateResponse
public ResponseInfo generateResponse(ConfigurationAccessor configuration, SmsChannelConfiguration channelConfiguration, RequestInfo request, InboundSmsData smsData, InboundSms sms)
Description copied from interface:InboundSmsRequestHandlerGenerates the response to the SMS gateway- Specified by:
generateResponsein interfaceInboundSmsRequestHandler
-
generateResponseForError
public ResponseInfo generateResponseForError(ConfigurationAccessor configuration, SmsChannelConfiguration channelConfiguration, RequestInfo request, Exception exception)
Description copied from interface:InboundSmsRequestHandlerGenerates the response to the SMS gateway when there is a general error- Specified by:
generateResponseForErrorin interfaceInboundSmsRequestHandler
-
generateResponseForMissingParameters
public ResponseInfo generateResponseForMissingParameters(ConfigurationAccessor configuration, SmsChannelConfiguration channelConfiguration, RequestInfo request)
Description copied from interface:InboundSmsRequestHandlerGenerates the response to the SMS gateway when the bare minimum parameters - number and message - are missing- Specified by:
generateResponseForMissingParametersin interfaceInboundSmsRequestHandler
-
resolveSmsData
public InboundSmsBasicData resolveSmsData(ConfigurationAccessor configuration, SmsChannelConfiguration channelConfiguration, RequestInfo request)
Description copied from interface:InboundSmsRequestHandlerParses, from the given request, the inbound SMS data- Specified by:
resolveSmsDatain interfaceInboundSmsRequestHandler
-
generateDefaultResponse
protected ResponseInfo generateDefaultResponse()
-
normalizePhoneNumber
protected String normalizePhoneNumber(ConfigurationAccessor configuration, SmsChannelConfiguration channelConfiguration, RequestInfo request, String phoneNumber)
-
processParameters
protected String processParameters(ConfigurationAccessor configuration, SmsChannelConfiguration channelConfiguration, RequestInfo request, String pattern)
Replaces all parameter names by their values, in the form {paramName}... For example: abc{param1}-{param2}def, if param1 = 123 and param2 is null, returns abc123-def
-
splitMessageParts
protected List<String> splitMessageParts(ConfigurationAccessor configuration, SmsChannelConfiguration channelConfiguration, RequestInfo request, String message)
Splits the message by spaces
-
-