DialogSet Class

  • java.lang.Object
    • com.microsoft.bot.dialogs.DialogSet

public class DialogSet

A collection of Dialog objects that can all call each other.

Constructor Summary

Constructor Description
DialogSet()

Creates a DialogSet without state.

DialogSet(StatePropertyAccessor<DialogState> withDialogState)

Initializes a new instance of the DialogSet class.

Method Summary

Modifier and Type Method and Description
DialogSet add(Dialog dialog)

Adds a new dialog to the set and returns the set to allow fluent chaining.

java.util.concurrent.CompletableFuture<DialogContext> createContext(TurnContext turnContext)

Creates a DialogContext which can be used to work with the dialogs in the DialogSet.

Dialog find(String dialogId)

Searches the current DialogSet for a Dialog by its ID.

java.util.Collection<Dialog> getDialogs()

Returns a collection of Dialogs in this DialogSet.

BotTelemetryClient getTelemetryClient()

Gets the BotTelemetryClient to use for logging.

java.lang.String getVersion()

Gets a unique string which represents the combined versions of all dialogs in this dialogset.

void setTelemetryClient(BotTelemetryClient withBotTelemetryClient)

Sets the BotTelemetryClient to use for logging.

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

DialogSet

public DialogSet()

Creates a DialogSet without state.

DialogSet

public DialogSet(StatePropertyAccessor withDialogState)

Initializes a new instance of the DialogSet class.

To start and control the dialogs in this dialog set, create a DialogContext and use its methods to start, continue, or end dialogs. To create a dialog context, call createContext(TurnContext).

Parameters:

withDialogState - The state property accessor with which to manage the stack for this dialog set.

Method Details

add

public DialogSet add(Dialog dialog)

Adds a new dialog to the set and returns the set to allow fluent chaining. If the Dialog.Id being added already exists in the set, the dialogs id will be updated to include a suffix which makes it unique. So adding 2 dialogs named "duplicate" to the set would result in the first one having an id of "duplicate" and the second one having an id of "duplicate2".

Parameters:

dialog - The dialog to add. The added dialog's Dialog.TelemetryClient is set to the BotTelemetryClient of the dialog set.

Returns:

The dialog set after the operation is complete.

createContext

public CompletableFuture createContext(TurnContext turnContext)

Creates a DialogContext which can be used to work with the dialogs in the DialogSet.

Parameters:

turnContext - Context for the current turn of conversation with the user.

Returns:

A CompletableFuture representing the asynchronous operation.

find

public Dialog find(String dialogId)

Searches the current DialogSet for a Dialog by its ID.

Parameters:

dialogId - ID of the dialog to search for.

Returns:

The dialog if found; otherwise null

getDialogs

public Collection

getDialogs()

Returns a collection of Dialogs in this DialogSet.

Returns:

The Dialogs in this DialogSet.

getTelemetryClient

public BotTelemetryClient getTelemetryClient()

Gets the BotTelemetryClient to use for logging.

Returns:

The BotTelemetryClient to use for logging.

getVersion

public String getVersion()

Gets a unique string which represents the combined versions of all dialogs in this dialogset.

Returns:

Version will change when any of the child dialogs version changes.

setTelemetryClient

public void setTelemetryClient(BotTelemetryClient withBotTelemetryClient)

Sets the BotTelemetryClient to use for logging.

When this property is set, it sets the Dialog.TelemetryClient of each dialog in the set to the new value.

Parameters:

withBotTelemetryClient - The BotTelemetryClient to use for logging.

Applies to