new BrokenRuleList(modelName)

Creates a new broken rule list instance.

Parameter

Name Type Optional Description

modelName

string

 

The name of the model.

Throws

Argument error: The model name must be a non-empty string.

Methods

add(brokenRule)

Adds a broken rule to the list.

Parameter

Name Type Optional Description

brokenRule

bo.rules.BrokenRule

 

A broken rule to add.

Throws

Argument error: The rule must be a BrokenRule object.

clear([property])

Removes the broken rules of a property except of the retained ones. If property is omitted, all broken rules are removed except of the retained ones.

Parameter

Name Type Optional Description

property

bo.rules.PropertyInfo

Yes

A property definition.

clearAll(property)

Removes the broken rules of a property, including retained ones. If property is omitted, all broken rules are removed.

Parameter

Name Type Optional Description

property

 

 

isValid() → boolean

Determines if the model is valid. The model is valid when it has no broken rule with error severity.

Returns

boolean - True if the model is valid, otherwise false.

output([namespace]) → bo.rules.BrokenRulesOutput

Transforms the broken rules into a format that can be sent to the client.

Parameter

Name Type Optional Description

namespace

string

Yes

The namespace of the message keys when messages are localizable.

Throws

Argument error: The namespace must be a string.

Returns

bo.rules.BrokenRulesOutput The response object to send.

inner
clearFor(propertyName)

Removes the broken rules of a property except of the retained ones.

Parameter

Name Type Optional Description

propertyName

string

 

The name of the property that broken rules are deleted of.