A Flow represents a set of steps within a Processor which are executed for all requests that return true for a given function. If null is passed, all requests will be processed.

Constructor

new(filterFunc:FilterFunc)

Creates a new Flow.

Parameters:

filterFunc

A function which is executed for every request listed by the Processor to which this Flow is attached. All requests for which the function returns true will be processed by this Flow when the Processor runs.

Methods

approveByTemplate(id:String):Void

Changes the status of the request being processed to "approved", sending the id of a Template to render on the portal.

When using the Flow, this method should be used instead of AssetRequest.approveByTemplate() or TierConfigRequest.approveByTemplate(), since this automatically skips any further steps.

approveByTile(text:String):Void

Changes the status of the request being processed to "approved", rendering a tile on the portal with the given Markdown text.

When using the Flow, this method should be used instead of AssetRequest.approveByTile() or TierConfigRequest.approveByTile(), since this automatically skips any further steps.

fail(reason:String):Void

Changes the status of the request being processed to "failed".

When using the Flow, this method should be used instead of AssetRequest.fail() or TierConfigRequest.fail(), since this skips any further steps.

getAssetRequest():AssetRequest

This can be called within your steps to get the request being processed, as long as it is of the AssetRequest type.

Returns:

The AssetRequest being processed, or null if current request is not of Fulfillment api.

getCurrentAttempt():Int

This method is deprecated, and always returns 0.

Returns:

Int Number of times that this step has been executed

getData(key:String):Dynamic

Retrieves Flow data previously set with setData.

Parameters:

key

The name of the key that identifies the data to be obtained.

Returns:

The value of the data, or null if the key does not exist.

getDataKeys():Collection<String>

Returns:

Collection The keys of all the data stored in the Flow.

getListing():Listing

This can be called within your steps to get the element being processed, as long as it is of the Listing type.

Returns:

The Listing being processed, or null if current element is not of Listing api.

getTierConfigRequest():TierConfigRequest

This can be called within your steps to get the request being processed, as long as it is of the TierConfigRequest type.

Returns:

The TierConfigRequest being processed, or null if current request is not of Tier api.

getUsageFile():UsageFile

This can be called within your steps to get the request being processed, as long as it is of the UsageFile type.

Returns:

The UsageFile being processed, or null if current request is not of Usage api.

inquire(templateId:String, params:Collection<Param>):Void

Changes the status of the request being processed to "inquiring".

When using the Flow, this method should be used instead of AssetRequest.inquire() or TierConfigRequest.inquire(), since this skips any further steps. Also, this method calls update on the request before changing its status.

Parameters:

templateId

Id of the template to use in the portal, or null to not use any. This is only used for AssetRequests.

params

A collection of parameters to update. If null is passed, then the parameters that have changed in the request will be updated.

pend():Void

Changes the status of the request being processed to "pending".

When using the Flow, this method should be used instead of AssetRequest.pend() or TierConfigRequest.pend(), since this automatically skips any further steps.

setData(key:String, value:Dynamic):Flow

Steps can pass data to the next one using the return value, but this data could be lost if we need to access it several steps later. For this reason, every Flow has a dictionary of keys and values to store custom data, that can be set with this method and retreived later on with getData. It is recommended for the correct function of the Flow to only rely on the data set using this mechanism, and not to add additional properties when creating a subclass of Flow, since these wouldn't be automatically reset for each request processed.

Parameters:

key

The name of the key that will be used to identify this data.

value

The value to store.

Returns:

this Flow, so calls to this method can be chained.

setSkipRequestOnPendingMigration(enable:Bool):Void

Enables or disables skipping the request when it is pending migration. Defaults to true.

setStoreNumAttempts(enable:Bool):Void

This method is deprecated and has no effect.

setStoreRequestOnFailure(enable:Bool):Void

This method is deprecated and has no effect.

setVolatileData(key:String, value:Dynamic):Flow

This method is deprecated and currently just calls setData.

setup():Void

This method is executed every time a new request is going to begin processing.

skipsRequestOnPendingMigration():Bool

Tells if requests are automatically skipped when they are pending migration.

step(description:String, func:StepFunc):Flow

Defines a step of this Flow. Steps are executed sequentially by the Flow when its run method is invoked.

Parameters:

description

Description of what the step does, so the Flow can indicate it in the log.

func

The function to execute for this step. It receives this Flow as argument, and it cannot return a value.

Returns:

this Flow, so calls to this method can be chained.

storesNumAttempts():Bool

This method is deprecated and always returns false.

storesRequestOnFailure():Bool

This method is deprecated and always returns false.