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
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.
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.
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 |
---|---|
params | A collection of parameters to update. If |
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.
setVolatileData(key:String, value:Dynamic):Flow
This method is deprecated and currently just calls setData
.
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 |
Returns:
this
Flow, so calls to this method can be chained.