ArchValidationResults(coreValidationResultsViewModel)

new ArchValidationResults(coreValidationResultsViewModel)

Creates an instance of an ArchValidationResults object. The validation results object will be returned from flow validation and contain information about warnings and errors that were reported during validation. There are issues within this results object that can further be accessed to get at more specifics about errors, warnings and the Architect Scripting objects they're associated with.

Parameters:
Name Type Description
coreValidationResultsViewModel Object

Internal The core validation results object

Extends

Members

static, readonly displayTypeName :string

Returns the display type name string 'ArchValidationResults'.

static, readonly isArchValidationResults :boolean

readonly errorCountTotal :number

Returns the total number of errors by iterating through each validation result contained in this results instance and adding up the errorCount property for each validation issue.

readonly hasErrors :boolean

Returns true is there are any validation issues with errors in these results, otherwise false.

readonly hasErrorsOrWarnings :boolean

Returns true is there are any validation issues with errors, rollup errors, warnings or rollup warnings in these results, otherwise false.

readonly hasNoErrors :boolean

Returns true is there are no validation issues with errors or rollup errors in this validation results instance, otherwise false.

readonly hasNoErrorsOrWarnings :boolean

Returns true if there are no errors or warnings in this validation results instance.

readonly hasNoWarnings :boolean

Returns true is there are no validation issues with warnings or rollup warnings in this validation results instance, otherwise false.

readonly hasWarnings :boolean

Returns true is there are any validation issues with warnings or rollup warnings in these results, otherwise false.

readonly isArchBaseCoreObject :boolean

Returns true indicating that this is an ArchBaseCoreObject instance.

Inherited From:

readonly issues :Array.<ArchValidationIssue>

The validation issue array associated with these validation results. Issues in the array will have more information like the Architect object associated with the issue and the error or warning messages for that object.

readonly logStr :string

Returns a logging string for this validation result that will show information about the referenced Architect Scripting object and the error / warning count.

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:

readonly parentFlow :ArchBaseFlow

Returns the parent flow for these validation results.

readonly rollupErrorCountTotal :number

Returns the total number of rollup errors by iterating through each validation result contained in this results instance and adding up the rollupErrorCount property for each validation issue.

readonly rollupWarningCountTotal :number

Returns the total number of rollup warnings by iterating through each validation result contained in this results instance and adding up the rollupWarningCount property for each validation issue.

readonly warningCountTotal :number

Returns the total number of warnings by iterating through each validation result contained in this results instance and adding up the warningCount property for each validation issue.

Methods

getErrorsForObject(archObjectWithId) → {Array.<string>}

Returns a string array of the errors for the supplied Architect Scripting object. This method will attempt to find the validation issue for the specified object in this validation results instance. If found, the ArchValidationIssue.errors property from the looked up ArchValidationIssue will be returned. Otherwise no value is returned.

Parameters:
Name Type Description
archObjectWithId ArchBaseCoreObjectWithId

the Architect Scripting object for which you wish to get the error strings.

Returns:
Array.<string>

getIssueForObject(archObjectWithId) → {ArchValidationIssue}

Returns the validation issue for the supplied Architect Scripting object. If no validation issue is found for the supplied Architect Scripting object, nothing is returned.

Parameters:
Name Type Description
archObjectWithId ArchBaseCoreObjectWithId

the Architect Scripting object for which you wish to get the validation result.

getRollupErrorsForObject(archObjectWithId) → {Array.<string>}

Returns a string array of the rollup errors for the supplied Architect Scripting object. This method will attempt to find the validation issue for the specified object in this validation results instance. If found, the ArchValidationIssue.rollupErrors property from the looked up ArchValidationIssue will be returned. Otherwise no value is returned.

Parameters:
Name Type Description
archObjectWithId ArchBaseCoreObjectWithId

the Architect Scripting object for which you wish to get the rollup error strings.

Returns:
Array.<string>

getRollupWarningsForObject(archObjectWithId) → {Array.<string>}

Returns a string array of the rollup warnings for the supplied Architect Scripting object. This method will attempt to find the validation issue for the specified object in this validation results instance. If found, the ArchValidationIssue.rollupWarnings property from the looked up ArchValidationIssue will be returned. Otherwise no value is returned.

Parameters:
Name Type Description
archObjectWithId ArchBaseCoreObjectWithId

the Architect Scripting object for which you wish to get the rollup error strings.

Returns:
Array.<string>

getSummaryStr(wantDetails, addLogStropt, prefixopt) → {string}

Returns a summary string containing information about this validation results along with summary information about issues contained in this results object.

Parameters:
Name Type Attributes Description
wantDetails boolean

whether or not to emit the warning and error strings on issues.

addLogStr boolean <optional>

whether or not to add a log string at the beginning of the returned string.

prefix string <optional>

a string to prefix before each line in the returned string.

Returns:
string

getWarningsForObject(archObjectWithId) → {Array.<string>}

Returns a string array of the warnings for the supplied Architect Scripting object. This method will attempt to find the validation issue for the specified object in this validation results instance. If found, the ArchValidationIssue.warnings property from the looked up ArchValidationIssue will be returned. Otherwise no value is returned.

Parameters:
Name Type Description
archObjectWithId ArchBaseCoreObjectWithId

the Architect Scripting object for which you wish to get the warning strings.

Returns:
Array.<string>

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:

objectErrorCount(archObjectWithId) → {boolean}

Returns number of errors the object has

Parameters:
Name Type Description
archObjectWithId ArchBaseCoreObjectWithId

the Architect Scripting object to check.

Returns:
boolean

objectHasErrors(archObjectWithId) → {boolean}

Returns true if the the supplied Architect Scripting object has an error or rollup error in this set of validation results. This method looks up a validation issue for the specified Architect base object and if found will check to see if the error or rollup error count are greater than 0.

Parameters:
Name Type Description
archObjectWithId ArchBaseCoreObjectWithId

the Architect Scripting object to check.

Returns:
boolean

objectHasErrorsOrWarnings(archObjectWithId) → {boolean}

Returns true if the the supplied Architect Scripting object has an error, rollup error, warning or rollup warning in this set of validation results. This method looks up a validation issue for the specified Architect base object and if found will check to see if the error, rollup error, warning or rollup warning count are greater than 0.

Parameters:
Name Type Description
archObjectWithId ArchBaseCoreObjectWithId

the Architect Scripting object to check.

Returns:
boolean

objectHasErrorString(archObjectWithId, errorString) → {boolean}

Returns whether or not the supplied Architect Scripting object has an error or rollup error that matches the supplied error string.

Parameters:
Name Type Description
archObjectWithId ArchBaseCoreObjectWithId

the Architect Scripting object to check.

errorString string

the error string to look up. This must be a non-blank string.

Returns:
boolean

objectHasNoErrors(archObjectWithId) → {boolean}

Returns whether or not the supplied Architect Scripting object has no errors or rollup errors in this set of validation results. This method looks up a validation issue for the specified Architect base object and if found will check to make sure that the validation issue's error count and rollup error count are equal to 0.

Parameters:
Name Type Description
archObjectWithId ArchBaseCoreObjectWithId

the Architect Scripting object to check.

Returns:
boolean

objectHasNoErrorsOrWarnings(archObjectWithId) → {boolean}

Returns true if the the supplied Architect Scripting object has no errors, rollup errors, warnings or rollup warnings in this set of validation results. This method looks up a validation issue for the specified Architect base object and if found will check to make sure that the validation issue's error, rollup error, warning and rollup warning counts are 0.

Parameters:
Name Type Description
archObjectWithId ArchBaseCoreObjectWithId

the Architect Scripting object to check.

Returns:
boolean

objectHasNoWarnings(archObjectWithId) → {boolean}

Returns whether or not the supplied Architect Scripting object has no warnings or rollup warnings in this set of validation results. This method looks up a validation issue for the specified Architect base object and if found will check to make sure that the validation issue's warning count and rollup warning count are equal to 0.

Parameters:
Name Type Description
archObjectWithId ArchBaseCoreObjectWithId

the Architect Scripting object to check.

Returns:
boolean

objectHasWarningString(archObjectWithId, warningString) → {boolean}

Returns whether or not the supplied Architect Scripting object has a warning or rollup warning that matches the supplied warning string.

Parameters:
Name Type Description
archObjectWithId ArchBaseCoreObjectWithId

the Architect Scripting object to check.

warningString string

the warning string to look up. This must be a non-blank string.

Returns:
boolean

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: