Class: CommandObjectSync

CommandObjectSync

Represents the definition of a synchronous command object model.

new CommandObjectSync(eventHandlers)

Creates a new synchronous command object model instance.

The name of the model type available as: <instance>.constructor.modelType, returns 'CommandObjectSync'.

Parameters:
Name Type Argument Description
eventHandlers bo.shared.EventHandlerList <optional>

The event handlers of the instance.

Fires:
Throws:
Argument error: The event handlers must be an EventHandlerList object or null.

Extends

Members

<readonly> $modelName :string

The name of the model. However, it can be hidden by a model property with the same name.

Type:
  • string

Methods

<static> create(eventHandlers) → {CommandObjectSync}

Creates a new command object instance.

Parameters:
Name Type Argument Description
eventHandlers bo.shared.EventHandlerList <optional>

The event handlers of the instance.

Throws:
Argument error: The event handlers must be an EventHandlerList object or null.
Returns:

A new command object.

Type
CommandObjectSync

checkRules()

Executes all the validation rules of the command object, including the ones of its child objects.

execute(method, isTransaction)

Executes the business object's statements in the repository.
If method is not an empty string, <instance>.execute(method) can be called as <instance>.method() as well.

Parameters:
Name Type Argument Description
method string <optional>

An alternative execute method of the data access object.

isTransaction boolean <optional>

Indicates whether transaction is required.

Throws:

getBrokenRules(namespace) → {bo.rules.BrokenRulesOutput}

Gets the broken rules of the command object.

Parameters:
Name Type Argument Description
namespace string <optional>

The namespace of the message keys when messages are localizable.

Returns:

The broken rules of the business object.

Type
bo.rules.BrokenRulesOutput

getResponse(message, namespace) → {bo.rules.BrokenRulesResponse}

Gets the response to send to the client in case of broken rules.

Parameters:
Name Type Argument Description
message string <optional>

Human-readable description of the reason of the failure.

namespace string <optional>

The namespace of the message keys when messages are localizable.

Returns:

The broken rules response to send to the client.

Type
bo.rules.BrokenRulesResponse

isValid() → {boolean}

Indicates whether all the validation rules of the command object, including the ones of its child objects, succeeds. A valid command object may have broken rules with severity of success, information and warning.

Returns:

True when the command object is valid, otherwise false.

Type
boolean

Events

postExecute

The event arises after the command object has been executed in the repository.

Parameters:
Name Type Description
eventArgs bo.shared.DataPortalEventArgs

Data portal event arguments.

newObject CommandObjectSync

The instance of the model after the data portal action.

preExecute

The event arises before the command object will be executed in the repository.

Parameters:
Name Type Description
eventArgs bo.shared.DataPortalEventArgs

Data portal event arguments.

oldObject CommandObjectSync

The instance of the model before the data portal action.

If you find bugs or have feature requests, please let us know.

JavaScript business objects ♦ Copyright © 2014-2016 Logikum, Ltd.
Documentation generated by JSDoc 3.2.2 on 2015. December 31. using the DocStrap template.