SwitchActivity Class

public final class SwitchActivity
extends ControlActivity

This activity evaluates an expression and executes activities under the cases property that correspond to the expression evaluation expected in the equals property.

Constructor Summary

Constructor Description
SwitchActivity()

Creates an instance of SwitchActivity class.

Method Summary

Modifier and Type Method and Description
List<SwitchCase> cases()

Get the cases property: List of cases that correspond to expected values of the 'on' property.

List<Activity> defaultActivities()

Get the defaultActivities property: List of activities to execute if no case condition is satisfied.

static SwitchActivity fromJson(JsonReader jsonReader)

Reads an instance of SwitchActivity from the JsonReader.

Expression on()

Get the on property: An expression that would evaluate to a string or integer.

JsonWriter toJson(JsonWriter jsonWriter)
String type()

Get the type property: Type of activity.

void validate()

Validates the instance.

SwitchActivity withCases(List<SwitchCase> cases)

Set the cases property: List of cases that correspond to expected values of the 'on' property.

SwitchActivity withDefaultActivities(List<Activity> defaultActivities)

Set the defaultActivities property: List of activities to execute if no case condition is satisfied.

SwitchActivity withDependsOn(List<ActivityDependency> dependsOn)

Set the dependsOn property: Activity depends on condition.

SwitchActivity withDescription(String description)

Set the description property: Activity description.

SwitchActivity withName(String name)

Set the name property: Activity name.

SwitchActivity withOn(Expression on)

Set the on property: An expression that would evaluate to a string or integer.

SwitchActivity withOnInactiveMarkAs(ActivityOnInactiveMarkAs onInactiveMarkAs)

Set the onInactiveMarkAs property: Status result of the activity when the state is set to Inactive.

SwitchActivity withState(ActivityState state)

Set the state property: Activity state.

SwitchActivity withUserProperties(List<UserProperty> userProperties)

Set the userProperties property: Activity user properties.

Methods inherited from Activity

Methods inherited from ControlActivity

Methods inherited from java.lang.Object

Constructor Details

SwitchActivity

public SwitchActivity()

Creates an instance of SwitchActivity class.

Method Details

cases

public List<SwitchCase> cases()

Get the cases property: List of cases that correspond to expected values of the 'on' property. This is an optional property and if not provided, the activity will execute activities provided in defaultActivities.

Returns:

the cases value.

defaultActivities

public List<Activity> defaultActivities()

Get the defaultActivities property: List of activities to execute if no case condition is satisfied. This is an optional property and if not provided, the activity will exit without any action.

Returns:

the defaultActivities value.

fromJson

public static SwitchActivity fromJson(JsonReader jsonReader)

Reads an instance of SwitchActivity from the JsonReader.

Parameters:

jsonReader - The JsonReader being read.

Returns:

An instance of SwitchActivity if the JsonReader was pointing to an instance of it, or null if it was pointing to JSON null.

Throws:

IOException

- If the deserialized JSON object was missing any required properties.

on

public Expression on()

Get the on property: An expression that would evaluate to a string or integer. This is used to determine the block of activities in cases that will be executed.

Returns:

the on value.

toJson

public JsonWriter toJson(JsonWriter jsonWriter)

Overrides:

SwitchActivity.toJson(JsonWriter jsonWriter)

Parameters:

jsonWriter

Throws:

type

public String type()

Get the type property: Type of activity.

Overrides:

SwitchActivity.type()

Returns:

the type value.

validate

public void validate()

Validates the instance.

Overrides:

SwitchActivity.validate()

withCases

public SwitchActivity withCases(List<SwitchCase> cases)

Set the cases property: List of cases that correspond to expected values of the 'on' property. This is an optional property and if not provided, the activity will execute activities provided in defaultActivities.

Parameters:

cases - the cases value to set.

Returns:

the SwitchActivity object itself.

withDefaultActivities

public SwitchActivity withDefaultActivities(List<Activity> defaultActivities)

Set the defaultActivities property: List of activities to execute if no case condition is satisfied. This is an optional property and if not provided, the activity will exit without any action.

Parameters:

defaultActivities - the defaultActivities value to set.

Returns:

the SwitchActivity object itself.

withDependsOn

public SwitchActivity withDependsOn(List<ActivityDependency> dependsOn)

Set the dependsOn property: Activity depends on condition.

Overrides:

SwitchActivity.withDependsOn(List<ActivityDependency> dependsOn)

Parameters:

dependsOn

withDescription

public SwitchActivity withDescription(String description)

Set the description property: Activity description.

Overrides:

SwitchActivity.withDescription(String description)

Parameters:

description

withName

public SwitchActivity withName(String name)

Set the name property: Activity name.

Overrides:

SwitchActivity.withName(String name)

Parameters:

name

withOn

public SwitchActivity withOn(Expression on)

Set the on property: An expression that would evaluate to a string or integer. This is used to determine the block of activities in cases that will be executed.

Parameters:

on - the on value to set.

Returns:

the SwitchActivity object itself.

withOnInactiveMarkAs

public SwitchActivity withOnInactiveMarkAs(ActivityOnInactiveMarkAs onInactiveMarkAs)

Set the onInactiveMarkAs property: Status result of the activity when the state is set to Inactive. This is an optional property and if not provided when the activity is inactive, the status will be Succeeded by default.

Overrides:

SwitchActivity.withOnInactiveMarkAs(ActivityOnInactiveMarkAs onInactiveMarkAs)

Parameters:

onInactiveMarkAs

withState

public SwitchActivity withState(ActivityState state)

Set the state property: Activity state. This is an optional property and if not provided, the state will be Active by default.

Overrides:

SwitchActivity.withState(ActivityState state)

Parameters:

state

withUserProperties

public SwitchActivity withUserProperties(List<UserProperty> userProperties)

Set the userProperties property: Activity user properties.

Overrides:

SwitchActivity.withUserProperties(List<UserProperty> userProperties)

Parameters:

userProperties

Applies to