SkillDialog Class

public class SkillDialog
extends Dialog

A specialized Dialog that can wrap remote calls to a skill. The options parameter in BeginDialog must be a BeginSkillDialogOptions instancewith the initial parameters for the dialog.

Constructor Summary

Constructor Description
SkillDialog(SkillDialogOptions dialogOptions, String dialogId)

Initializes a new instance of the SkillDialog class to wrap remote calls to a skill.

Method Summary

Modifier and Type Method and Description
java.util.concurrent.CompletableFuture<DialogTurnResult> beginDialog(DialogContext dc, Object options)

Called when the skill dialog is started and pushed onto the dialog stack.

java.util.concurrent.CompletableFuture<DialogTurnResult> continueDialog(DialogContext dc)

Called when the skill dialog is _continued_, where it is the active dialog and the user replies with a new activity.

java.util.concurrent.CompletableFuture<java.lang.Void> endDialog(TurnContext turnContext, DialogInstance instance, DialogReason reason)

Called when the skill dialog is ending.

protected SkillDialogOptions getDialogOptions()

Gets the options used to execute the skill dialog.

protected boolean onValidateActivity(Activity activity)

Validates the activity sent during ContinueDialog .

java.util.concurrent.CompletableFuture<java.lang.Void> repromptDialog(TurnContext turnContext, DialogInstance instance)

Called when the skill dialog should re-prompt the user for input.

java.util.concurrent.CompletableFuture<DialogTurnResult> resumeDialog(DialogContext dc, DialogReason reason, Object result)

Called when a child skill dialog completed its turn, returning control to this dialog.

Methods inherited from Dialog

Methods inherited from java.lang.Object

java.lang.Object.clone java.lang.Object.equals java.lang.Object.finalize java.lang.Object.getClass java.lang.Object.hashCode java.lang.Object.notify java.lang.Object.notifyAll java.lang.Object.toString java.lang.Object.wait java.lang.Object.wait java.lang.Object.wait

Constructor Details

SkillDialog

public SkillDialog(SkillDialogOptions dialogOptions, String dialogId)

Initializes a new instance of the SkillDialog class to wrap remote calls to a skill.

Parameters:

dialogOptions - The options to execute the skill dialog.
dialogId - The id of the dialog.

Method Details

beginDialog

public CompletableFuture beginDialog(DialogContext dc, Object options)

Called when the skill dialog is started and pushed onto the dialog stack.

Overrides:

SkillDialog.beginDialog(DialogContext dc, Object options)

Parameters:

dc - The DialogContext for the current turn of conversation.
options - Optional, initial information to pass to the dialog.

Returns:

A CompletableFuture representing the asynchronous operation.
     If the task is successful, the result indicates whether the dialog is
     still active after the turn has been processed by the dialog.

continueDialog

public CompletableFuture continueDialog(DialogContext dc)

Called when the skill dialog is _continued_, where it is the active dialog and the user replies with a new activity.

Overrides:

SkillDialog.continueDialog(DialogContext dc)

Parameters:

dc - The DialogContext for the current turn of conversation.

Returns:

A CompletableFuture representing the asynchronous operation.
     If the task is successful, the result indicates whether the dialog is
     still active after the turn has been processed by the dialog. The
     result may also contain a return value.

endDialog

public CompletableFuture endDialog(TurnContext turnContext, DialogInstance instance, DialogReason reason)

Called when the skill dialog is ending.

Overrides:

SkillDialog.endDialog(TurnContext turnContext, DialogInstance instance, DialogReason reason)

Parameters:

turnContext - The context Object for this turn.
instance - State information associated with the instance of this dialog on the dialog stack.
reason - Reason why the dialog ended.

Returns:

A CompletableFuture representing the asynchronous operation.

getDialogOptions

protected SkillDialogOptions getDialogOptions()

Gets the options used to execute the skill dialog.

Returns:

the DialogOptions value as a SkillDialogOptions.

onValidateActivity

protected boolean onValidateActivity(Activity activity)

Validates the activity sent during ContinueDialog .

Parameters:

activity - The Activity for the current turn of conversation.
             Override this method to implement a custom validator for the
             activity being sent during the ContinueDialog . This
             method can be used to ignore activities of a certain type if
             needed. If this method returns false, the dialog will end the
             turn without processing the activity.

Returns:

true if the activity is valid, false if not.

repromptDialog

public CompletableFuture repromptDialog(TurnContext turnContext, DialogInstance instance)

Called when the skill dialog should re-prompt the user for input.

Overrides:

SkillDialog.repromptDialog(TurnContext turnContext, DialogInstance instance)

Parameters:

turnContext - The context Object for this turn.
instance - State information for this dialog.

Returns:

A CompletableFuture representing the asynchronous operation.

resumeDialog

public CompletableFuture resumeDialog(DialogContext dc, DialogReason reason, Object result)

Called when a child skill dialog completed its turn, returning control to this dialog.

Overrides:

SkillDialog.resumeDialog(DialogContext dc, DialogReason reason, Object result)

Parameters:

dc - The dialog context for the current turn of the conversation.
reason - Reason why the dialog resumed.
result - Optional, value returned from the dialog that was called. The type of the value returned is dependent on the child dialog.

Returns:

A CompletableFuture representing the asynchronous operation.

Applies to