ArchTaskLoop(coreLoopingTaskViewModel)

new ArchTaskLoop(coreLoopingTaskViewModel)

Creates an Architect looping task. This is the task that is used in in-queue flows because when execution completes for the actions defined in the task, the task will start over.

Parameters:
Name Type Description
coreLoopingTaskViewModel Object

( Internal ) an Architect core looping task view model.

Extends

Members

static, readonly displayTypeName :string

Returns the display type name string 'ArchTaskLoop'.

static, readonly isArchTaskLoop :boolean

Returns true indicating that this is an ArchTaskLoop instance.

readonly actionCount :number

Returns the number of actions in this multi action container.

Inherited From:

readonly actionFirst :ArchBaseAction

Returns the first / starting action in this container's action list. For a task or state, this would be the starting action. If there is no first action, nothing is returned.

Inherited From:

readonly actionLast :ArchBaseAction

Returns the last action in this container's action list. If there is no last action, nothing is returned. Remember, this does not mean this would be the last action to execute at runtime because the last action may have outputs with actions contained underneath them.

Inherited From:

readonly actions :Array.<ArchBaseAction>

Returns an ordered array that contains the top level actions contained in this container. By top level this means that actions which are contained in outputs of actions will not be included in this array. If there are no actions, an empty array is returned. The action at index 0 will be the first action in this container. For example, if this were actions contained in a task or state, the action at index 0 is the starting / first action.

Inherited From:

readonly branchCount :number

Returns the number of output branches defined for this task. If this task does not support output branches, accessing this property getter will return 0.

Inherited From:

readonly branches :Array.<ArchBranch>

This returns an array of the branches currently defined on the task. Items in the returned array will be branch instances.

Inherited From:

readonly id :string

The identifier string for this object.

Inherited From:

readonly idMayBeBlank :string

Returns whether or not the id property may be blank or undefined for this object. For example, the returned settings from ArchMenu#settingsMenu will have a blank identifier along with the settings returned from ArchMenu#settingsSpeechRec. Note that this is an extremely rare case.

Inherited From:
See:

readonly isArchBaseCoreObject :boolean

Returns true indicating that this is an ArchBaseCoreObject instance.

Inherited From:

readonly isArchTask :boolean

Returns true indicating that this is an ArchTask instance.

Inherited From:

readonly isMenuChoiceContainer :boolean

Returns whether or not this action container is in a menu choice. If so, you cannot add actions to it. Actions are added to menu choices when menu choices are created by different methods on the ArchFactoryMenus.

Inherited From:
See:

readonly isReusableTask :boolean

Returns whether or not this task is a reusable task. An example of a non-reusable task is when the task is in a menu choice directly or is the startup object of a flow.

Inherited From:

readonly isSecure :boolean

Returns whether or not the task is secure. That means it contains something that is secure like a secure variable or secure action.

Inherited From:

readonly isTerminated :boolean

Returns whether or not all paths of execution are terminated ( i.e. have terminating actions ).

Inherited From:

readonly isVariableContainer :boolean

Returns whether or not this object acts as a variable container which means you can add variables to it.

Inherited From:

readonly logStr :string

A string suitable for logging

Overrides:

readonly logStrTypeOnly :string

This is a string suitable for logging information about this object where it's just the object's type. This is normally used when logging errors that occur in constructor parameter checking because the scripting object isn't set up and the normal logging str contents wouldn't be set up.

Inherited From:

name :string

Gets or sets the name for the task. This cannot be blank.

Inherited From:

readonly parentFlow :ArchBaseFlow

Returns the parent flow for this task.

Inherited From:

readonly supportsBranches :boolean

Returns whether or not this task supports branches. Task branches provide meta data about how a task can end via. ArchBranch instances. Do note that task branches are not supported in all Architect flow types and if you try to add or delete branches in a task that does not support branches then the operation will immediately fail.

Inherited From:

readonly trackingId :number

The integer tracking identifier for this task. This is the numeric identifier is displayed in the Architect user interface.

Inherited From:

readonly variables :Array.<ArchBaseVariable>

Returns an array of variables defined in this task.

Inherited From:

Methods

addBranch(branchName) → {ArchBranch}

Creates a new branch for this task.

Parameters:
Name Type Description
branchName string

the name of the branch to add. This name should not be blank and should be unique for the branches added to this task.

Returns:
ArchBranch
Inherited From:

addVariable(name, type, descriptionopt) → {ArchBaseVariable}

This adds a new variable to the task.

Parameters:
Name Type Attributes Description
name string

the name of the variable to add. Remember that variable names must start with a letter and can then be followed by one or more letters, numbers or underscore characters to be valid. Submitting the variable scope on the name is optional. If specified, it must be 'Task.' in order to be valid since you're adding the variable to a task.

type ArchDataType

the data type for the new variable. Remember that type must be supported in the flow type for which you're looking to add the variable. If you are not sure if a type is creatable, see the ArchDataType#isScriptCreatableForFlowType or ArchDataType#isScriptCreatableForFlow methods.

description string <optional>

the description for the new variable.

Returns:
ArchBaseVariable
Inherited From:

canAddAction(archDefinitionAction) → {boolean}

Returns whether or not the specified action can be added to this container.

Parameters:
Name Type Description
archDefinitionAction ArchDefinitionAction

the action definition to check.

Returns:
boolean
Inherited From:

deleteAction(archActionToDelete)

Deletes the specified action from this container.

Parameters:
Name Type Description
archActionToDelete ArchBaseAction

the action to delete.

Inherited From:

deleteBranch(branchToDelete) → {boolean}

Deletes the specified branch from the task.

Parameters:
Name Type Description
branchToDelete ArchBranch | string

if a string, this should be the output ID.

Returns:
boolean -
  • whether or not the branch was deleted.
Inherited From:

getBranchByDefaultOutput() → {ArchBranch}

This method will call in to @link ArchTask.getBranchByOutputId passing in ArchEnums#OUTPUT_IDS.default for the outputId.

Returns:
ArchBranch
Inherited From:

getBranchByName(branchName) → {ArchBranch}

Searches the branches configured on this task looking for the one whose name matches the value specified in branchName. Branch name lookups are performed case insensitively. If found, an ArchBranch instance is returned for it. Otherwise, null.

Parameters:
Name Type Description
branchName string

the name of the branch to find.

Returns:
ArchBranch
Inherited From:

getBranchByOutputId(outputId) → {ArchBranch}

Searches the branches configured on this task looking for the one whose output identifier matches the value specified in outputId. If found, an ArchBranch instance is returned for it. Otherwise, null.

Parameters:
Name Type Description
outputId string

the output identifier to find.

Returns:
ArchBranch
Inherited From:

getVariableByName(variableName) → {ArchBaseVariable}

Returns the task scoped variable for the supplied fully scoped variable name ( if it exists ). Remember, looking up variables by name is case insensitive.

Parameters:
Name Type Description
variableName string

the fully scoped variable name to look up such as Task.MyVar.

Returns:
ArchBaseVariable
Inherited From:

isFilterMatch(archFilterObject) → {boolean}

Returns whether or not this Architect Scripting object is a match for the supplied ArchFilterObject instance.

Parameters:
Name Type Description
archFilterObject ArchFilterObject

the object filter to use to determine if it's a match.

Returns:
boolean
Inherited From:

logError(errorStr)

Logs an error to the logging service with a log header from this object's logStr property value when ArchLogging#logErrors is true.

Parameters:
Name Type Description
errorStr string

the error string to log.

Inherited From:

logErrorAndThrow(errorStr)

Logs an error to the logging service with a log header from this object's logStr property value when ArchLogging#logErrors is true and then throws the string in the errorStr parameter.

Parameters:
Name Type Description
errorStr string

the error string to log. This should be a non-blank string.

Throws:
  • Throws the submitted error string.
Inherited From:

logNote(noteStr)

Logs a note to the logging service with a log header from this object's logStr property value when ArchLogging#logNotes is true.

Parameters:
Name Type Description
noteStr string

the note string to log. This should be a non-blank string.

Inherited From:

logNoteVerbose(noteStr)

Logs a note to the logging service with a log header from this object's logStr property value when ArchLogging#logNotesVerbose is true.

Parameters:
Name Type Description
noteStr string

the note string to log. This should be a non-blank string.

Inherited From:

logWarning(warningStr)

Logs a warning to the logging service with a log header from this object's logStr property value when ArchLogging#logWarnings is true.

Parameters:
Name Type Description
warningStr string

the warning string to log. This should be a non-blank string.

Inherited From:

moveAction(archActionToMove, archActionNewPreviousActionopt)

Moves an action in the action container to a different position.

Parameters:
Name Type Attributes Default Description
archActionToMove ArchBaseAction

the action to move in this container.

archActionNewPreviousAction ArchBaseAction <optional>
If not specified, moves the action to the top of this action container.

the destination action in this container above which the action specified in the archActionToMove parameter should be moved.

Inherited From:

traverse(callbackFunction, traverseFilteropt) → {number}

This method iterates over this object and ArchBaseCoreObject instances within it. For each object it will call the ArchBaseObject#isFilterMatch method with a filter and call the supplied callback function if isMatch returns true. The callback will be passed an ArchTraverseInfo with details about the match such as the match object itself along with current contextual information such as the object hierarchy for the match object relative to the object on which this traverse call is being made.

The traverse filter is one which you can create by calling ArchFactoryFilters#createFilterObject and then add desired clauses or clause containers to it. If not specified, this function will use a default filter.

Here is an example that does a simple flow traversal using the default filter and logs information about objects in the callback from the traverse object that's passed back:

archInboundCallFlow.traverse(function(traverseInfo) {
   archLogging.logNote('  Object     : ' + traverseInfo.matchObject.logStr);
   archLogging.logNote('    Hierarchy: ' + traverseInfo.context.hierarchyStr);
});

This might be enough for most uses and you can check various aspects about the object in the callback such as "is this an Architect action?" by seeing if traverseInfo.matchObject.isArchBaseAction is true. You can specify a filter for the traversal code to use as well and only have it call your callback when the object's ArchBaseCoreObject#isFilterMatch method returns true for the filter. Here's an example that creates a filter for callbacks on any type of transfer action, any decision action or objects whose name property case insensitively matches the word 'foo'. While this could all be done with one property callback clause the example will use multiple clauses for the sake of simplicity:

const myTraverseFilter = filterFactory.createFilterObject(archEnums.FILTER_CONTAINER_OPERATORS.or);
myTraverseFilter.addClausePropertyValueEquals('isArchBaseActionTransfer', true);
myTraverseFilter.addClausePropertyValueEquals('isArchActionDecision',     true);
myTraverseFilter.addClausePropertyCallback('name', function(propValue, archContainingObject, propName) {
      // We fully spelled out the function signature above but archContainingObject and propName are
      // not needed in this case.  The archContainingObject is the object that contains the
      // property and propName is the property name itself.  We pass in propName because the same
      // function could be used for multiple property callback clauses.
      // Remember to return a boolean true, false or undefined from ths callback.  :)
      return propValue && propValue.toLowerCase() === 'foo';
});
archTask.traverse(function(traverseContext) {
   // You will only be called back here for ArchBaseCoreObject instances that
   // have the isArchBaseActionTransfer or isArchActionDecision property values equal to true.
}, myTraverseFilter);

If you supply a filter with no clauses, this tells the traverse method to call the supplied callback function for every ArchBaseCoreObject it traverses.

If you want traversal itself to stop after a callback, simply return boolean false from the callback function you supply to the traverse call.

The traverse method does not process deprecated property names such as orgId, orgName or languageSettings. Additionally it does not traverse in to properties that would "jump out" of the current traversal. An example of this would be if the code was traversing an ArchActionJumpToMenu action that it would not start traversing in to the menu that it jumps to. Another example would be a ArchActionChangeState action where it would not traverse in to the target state of the action. This also means traversal does not traverse in to the ArchBaseValue#flowLevelDefault property.

And lastly, as Scripting evolves over time with new versions, you can expect to get callbacks for new object types such as new actions or new properties on objects. As such, it's important not to assume any particular order in callbacks to keep code most compatible with traversal callbacks. Or if you use inequality checks in filter clauses remember that new "stuff" may satisfy an inequality check which may or may not be anticipated in your logic.

Note: This traverse method is a helper method and is very handy for iterating over Architect Scripting objects and their properties in a generic fashion with filtering capabilities. Obviously you can write your own custom traversal code if this implementation doesn't cut it for some reason. :)

This function returns the number of times it called the callback function.

Parameters:
Name Type Attributes Default Description
callbackFunction callbackTraverseInfo

the callback function to call for objects that match the traverse filter.

traverseFilter ArchFilterObject <optional>
ArchFactoryFilters#createFilterTraverseDefault

the filter to use when performing the traversal to determine which ArchBaseCoreObject instances you wish to be called back for. If no filter is specified, this function will call ArchFactoryFilters#createFilterTraverseDefault and use that traversal default filter. The wantArchBaseValues parameter on that call is set to true.

Returns:
number
Inherited From: