DialogContainer Class

public abstract class DialogContainer
extends Dialog

A container for a set of Dialogs.

Constructor Summary

Constructor Description
DialogContainer()

Creates a new instance with the default dialog id.

DialogContainer(String dialogId)

Creates a new instance with the default dialog id.

Method Summary

Modifier and Type Method and Description
protected java.util.concurrent.CompletableFuture<java.lang.Void> checkForVersionChange(DialogContext dc)

Checks to see if a containers child dialogs have changed since the current dialog instance was started.

abstract DialogContext createChildContext(DialogContext dc)

Creates an inner dialog context for the containers active child.

Dialog findDialog(String dialogId)

Searches the current DialogSet for a Dialog by its ID.

DialogSet getDialogs()

Returns the Dialogs as a DialogSet.

protected java.lang.String getInternalVersion()

Returns internal version identifier for this container.

java.util.concurrent.CompletableFuture<java.lang.Boolean> onDialogEvent(DialogContext dc, DialogEvent e)

Called when an event has been raised, using `DialogContext.emitEvent()`, by either the current dialog or a dialog that the current dialog started.

void setTelemetryClient(BotTelemetryClient withTelemetryClient)

Sets the BotTelemetryClient to use for logging.

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

DialogContainer

public DialogContainer()

Creates a new instance with the default dialog id.

DialogContainer

public DialogContainer(String dialogId)

Creates a new instance with the default dialog id.

Parameters:

dialogId - Id of the dialog.

Method Details

checkForVersionChange

protected CompletableFuture checkForVersionChange(DialogContext dc)

Checks to see if a containers child dialogs have changed since the current dialog instance was started. This should be called at the start of `beginDialog()`, `continueDialog()`, and `resumeDialog()`.

Parameters:

dc - dialog context

Returns:

CompletableFuture

createChildContext

public abstract DialogContext createChildContext(DialogContext dc)

Creates an inner dialog context for the containers active child.

Parameters:

dc - Parents dialog context.

Returns:

A new dialog context for the active child.

findDialog

public Dialog findDialog(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 DialogSet getDialogs()

Returns the Dialogs as a DialogSet.

Returns:

The DialogSet of Dialogs.

getInternalVersion

protected String getInternalVersion()

Returns internal version identifier for this container.

DialogContainers detect changes of all sub-components in the container and map that to an DialogChanged event. Because they do this, DialogContainers "hide" the internal changes and just have the .id. This isolates changes to the container level unless a container doesn't handle it. To support this DialogContainers define a protected virtual method getInternalVersion() which computes if this dialog or child dialogs have changed which is then examined via calls to checkForVersionChange().

Returns:

version which represents the change of the internals of this container.

onDialogEvent

public CompletableFuture onDialogEvent(DialogContext dc, DialogEvent e)

Called when an event has been raised, using `DialogContext.emitEvent()`, by either the current dialog or a dialog that the current dialog started.

This override will trace version changes.

Overrides:

DialogContainer.onDialogEvent(DialogContext dc, DialogEvent e)

Parameters:

dc - The dialog context for the current turn of conversation.
e - The event being raised.

Returns:

True if the event is handled by the current dialog and bubbling should stop.

setTelemetryClient

public void setTelemetryClient(BotTelemetryClient withTelemetryClient)

Sets the BotTelemetryClient to use for logging. When setting this property, all of the contained dialogs' BotTelemetryClient properties are also set.

Overrides:

DialogContainer.setTelemetryClient(BotTelemetryClient withTelemetryClient)

Parameters:

withTelemetryClient - The BotTelemetryClient to use for logging.

Applies to