Package org.cyclos.impl.utils.sms
Class BaseSmsOperation
- java.lang.Object
-
- org.cyclos.impl.utils.sms.BaseSmsOperation
-
- All Implemented Interfaces:
SmsOperation
- Direct Known Subclasses:
AcceptPaymentRequestSmsOperation,AccountInformationSmsOperation,CustomSmsOperation,DenyPaymentRequestSmsOperation,HelpSmsOperation,PaymentSmsOperation,PerformExternalPaymentSmsOperation,RedeemVoucherSmsOperation,RegisterSmsOperation,SendPaymentRequestSmsOperation,TextSmsOperation
public abstract class BaseSmsOperation extends Object implements SmsOperation
Base class for SMS operations
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static classBaseSmsOperation.BaseErrorCommons built-in sms operation errors.
-
Field Summary
Fields Modifier and Type Field Description protected AccountHandleraccountHandlerprotected AgreementLogServiceLocalagreementLogServiceprotected ConfigurationHandlerconfigurationHandlerprotected ConversionHandlerconversionHandlerprotected DataTranslationHandlerdataTranslationHandlerprotected EntityManagerHandlerentityManagerHandlerprotected InvokerHandlerinvokerHandlerprotected OutboundSmsHandleroutboundSmsHandlerprotected PasswordHandlerpasswordHandlerprotected ProfileFieldHandlerprofileFieldHandlerprotected TranslationHandlertranslationHandlerprotected UserLocatorHandleruserLocatorHandler
-
Constructor Summary
Constructors Constructor Description BaseSmsOperation()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract voidcheckParametersCount(SmsOperationConfiguration operationConfiguration, List<String> parameters)This method must be implemented to check the minimum and maximum expected parametersprotected abstract voiddoExecute(SmsOperationConfiguration operationConfiguration, MobilePhone phone, InboundSmsData sms, SmsParameterProcessor processor)voidexecute(SmsOperationConfiguration operationConfiguration, MobilePhone phone, InboundSmsData sms)Executes this operation for the given contextprotected StringformatShort(AccountOwner accountOwner)protected SmsOperationFormatterImplgetFormatter()StringgetHelp(SmsOperationConfiguration operationConfiguration, String alias)protected abstract List<String>getHelpComponents(SmsOperationConfiguration operationConfiguration)protected StringgetLongestAlias(SmsOperationConfiguration operationConfiguration)SmsOperationExecutiongetOperationExecution(SmsOperationConfiguration operationConfiguration)Returns who can execute this operationprotected SessionDatagetSessionData()protected voidhandleError(MobilePhone phone, String phoneNumber, SmsOperationConfiguration operationConfiguration, Exception err)protected Stringmessage(MessageKey key, Object... args)protected voidsendEvenIfDisabled(MobilePhone phone, String response)protected voidsendResponse(MobilePhone phone, String response)protected voidsendToUnregistered(String phoneNumber, String response)
-
-
-
Field Detail
-
passwordHandler
@Autowired protected PasswordHandler passwordHandler
-
invokerHandler
@Autowired protected InvokerHandler invokerHandler
-
userLocatorHandler
@Autowired protected UserLocatorHandler userLocatorHandler
-
outboundSmsHandler
@Autowired protected OutboundSmsHandler outboundSmsHandler
-
translationHandler
@Autowired protected TranslationHandler translationHandler
-
dataTranslationHandler
@Autowired protected DataTranslationHandler dataTranslationHandler
-
configurationHandler
@Autowired protected ConfigurationHandler configurationHandler
-
conversionHandler
@Autowired protected ConversionHandler conversionHandler
-
accountHandler
@Autowired protected AccountHandler accountHandler
-
profileFieldHandler
@Autowired protected ProfileFieldHandler profileFieldHandler
-
entityManagerHandler
@Autowired protected EntityManagerHandler entityManagerHandler
-
agreementLogService
@Autowired protected AgreementLogServiceLocal agreementLogService
-
-
Method Detail
-
execute
public final void execute(SmsOperationConfiguration operationConfiguration, MobilePhone phone, InboundSmsData sms) throws SmsOperationException
Description copied from interface:SmsOperationExecutes this operation for the given context- Specified by:
executein interfaceSmsOperation- Throws:
SmsOperationException- if any error has occurred processing the operation
-
getHelp
public final String getHelp(SmsOperationConfiguration operationConfiguration, String alias)
- Specified by:
getHelpin interfaceSmsOperation- Returns:
- a help message for the operation
-
getOperationExecution
public SmsOperationExecution getOperationExecution(SmsOperationConfiguration operationConfiguration)
Description copied from interface:SmsOperationReturns who can execute this operation- Specified by:
getOperationExecutionin interfaceSmsOperation
-
checkParametersCount
protected abstract void checkParametersCount(SmsOperationConfiguration operationConfiguration, List<String> parameters) throws SmsOperationException
This method must be implemented to check the minimum and maximum expected parameters- Throws:
SmsOperationException
-
doExecute
protected abstract void doExecute(SmsOperationConfiguration operationConfiguration, MobilePhone phone, InboundSmsData sms, SmsParameterProcessor processor) throws CyclosException
- Throws:
CyclosException
-
formatShort
protected String formatShort(AccountOwner accountOwner)
-
getFormatter
protected SmsOperationFormatterImpl getFormatter()
-
getHelpComponents
protected abstract List<String> getHelpComponents(SmsOperationConfiguration operationConfiguration)
-
getLongestAlias
protected String getLongestAlias(SmsOperationConfiguration operationConfiguration)
-
getSessionData
protected SessionData getSessionData()
-
handleError
protected void handleError(MobilePhone phone, String phoneNumber, SmsOperationConfiguration operationConfiguration, Exception err) throws SmsOperationException
- Throws:
SmsOperationException
-
message
protected String message(MessageKey key, Object... args)
-
sendEvenIfDisabled
protected void sendEvenIfDisabled(MobilePhone phone, String response)
-
sendResponse
protected void sendResponse(MobilePhone phone, String response)
-
-