Search in sources :

Example 1 with SpeechletException

use of com.amazon.speech.speechlet.SpeechletException in project amos-ss17-alexa by c-i-ber.

the class StandingOrderDialog method handle.

@Override
public SpeechletResponse handle(Intent intent, SessionStorage.Storage storage) throws SpeechletException {
    String intentName = intent.getName();
    LOGGER.info("Intent Name: " + intentName);
    if ("StandingOrdersInfoIntent".equals(intentName)) {
        LOGGER.info(getClass().toString() + " Intent started: " + intentName);
        storage.put(CONTEXT, "StandingOrderInfo");
        return getStandingOrdersInfoResponse(intent, storage);
    } else if ("StandingOrdersDeleteIntent".equals(intentName)) {
        LOGGER.info(getClass().toString() + " Intent started: " + intentName);
        storage.put(CONTEXT, "StandingOrderDeletion");
        return askForDDeletionConfirmation(intent, storage);
    } else if ("StandingOrdersModifyIntent".equals(intentName)) {
        LOGGER.info(getClass().toString() + " Intent started: " + intentName);
        storage.put(CONTEXT, "StandingOrderModification");
        return askForModificationConfirmation(intent, storage);
    } else if ("AMAZON.YesIntent".equals(intentName) && storage.get(CONTEXT).equals("StandingOrderInfo")) {
        return getNextStandingOrderInfo(storage);
    } else if ("AMAZON.YesIntent".equals(intentName) && storage.get(CONTEXT).equals("StandingOrderDeletion")) {
        return getStandingOrdersDeleteResponse(intent, storage);
    } else if ("AMAZON.YesIntent".equals(intentName) && storage.get(CONTEXT).equals("StandingOrderModification")) {
        return getStandingOrdersModifyResponse(intent, storage);
    } else {
        throw new SpeechletException("Unhandled intent: " + intentName);
    }
}
Also used : SpeechletException(com.amazon.speech.speechlet.SpeechletException)

Aggregations

SpeechletException (com.amazon.speech.speechlet.SpeechletException)1