Abstract types

static
cbCollectionItem(currentValue, index, collection)

The callback to be called in collection methods.

Parameters

Name Type Optional Description

currentValue

{}

 

The current item being processed in the collection.

index

number

 

The index of the current item being processed in the collection.

collection

Array of object

 

The collection method was called upon.

static
cbCompare(a, b) → number

The callback to be called to define the sort order in a collection.

Parameters

Name Type Optional Description

a

object

 

First object to compare.

b

object

 

Second object to compare.

Returns

number Returns

  • < 0, when a comes first
  • = 0, when a and b are left unchanged
  • > 0, when b comes first

static
cbConnectionManager(err, connection)

The callback to be called when the execution of a connection manager method has finished.

Parameters

Name Type Optional Description

err

error

 

The error that occurred in the connection manager.

connection

object

 

The connection for the data source.

static
cbDataPortal(err, result)

The callback to be called when the execution of a method has finished that calls an asynchronous data portal action.

Parameters

Name Type Optional Description

err

(bo.shared.DataPortalError or bo.rules.AuthorizationError)

 

The error that occurred in the data portal action.

result

object

 

The business object instance with the new state.

static
cbFromCto(err)

The callback to be called when the execution of a model rebuild method has finished.

Parameter

Name Type Optional Description

err

error

 

The error that occurred in the model.

static
configurationFile  object

The configuration file of business objects. It can be a JSON file (.json) or a JavaScript file (.js) that returns an object with the following properties:

Properties

Name Type Optional Description

connectionManager

string

 

The relative path of the connection manager constructor. The created object must inherit bo.dataAccess.ConnectionManagerBase.

daoBuilder

string

Yes

The relative path of the factory method to create data access objects. The default builder method is bo.dataAccess.daoBuilder.

getUser

string

Yes

The relative path of the method that returns the current user.

getLocale

string

Yes

The relative path of the method that returns the current locale.

pathOfLocales

string

Yes

The relative path of the directory containing project locales.

noAccessBehavior

(number or string)

Yes

The default behavior for unauthorized operations. Valid values are:

  • 0 or 'throwError', the default value
  • 1 or 'showError'
  • 2 or 'showWarning'
  • 3 or 'showInformation'

static
daoBuilder(dataSource, modelPath, modelName) → bo.dataAccess.DaoBase

Factory method to create the data access object for a model instance.

Parameters

Name Type Optional Description

dataSource

string

 

The name of the data source.

modelPath

string

 

The model definition path of the business object model instance that the data access object belongs to.

modelName

string

 

The name of the business object model.

Returns

bo.dataAccess.DaoBase The data access object.

static
dataCreate(context, callback)

Initializes the property values of a new business object instance from the data source.

Parameters

Name Type Optional Description

context

bo.shared.DataPortalContext

 

The context for custom data portal conversions.

callback

function()

 

Callback function to return error (in asynchronous models).

static
dataExecute(context, method, callback) → object

Executes a command on the data source.

Parameters

Name Type Optional Description

context

bo.shared.DataPortalContext

 

The context for custom data portal conversions.

method

string

 

The name of the execution method, defaults to 'execute'.

callback

function()

 

Callback function to return child values or error (in asynchronous models).

Returns

object Plain object holding child values (in synchronous models).

static
dataFetch(context, filter, method, callback) → object

Sets the property values of an existing business object instance from the data source.

Parameters

Name Type Optional Description

context

bo.shared.DataPortalContext

 

The context for custom data portal conversions.

filter

any type

 

The criteria of the selection.

method

string

 

The name of the selection method, defaults to 'fetch'.

callback

function()

 

Callback function to return child values or error (in asynchronous models).

Returns

object Plain object holding child values (in synchronous models).

static
dataInsert(context, callback)

Saves the property values of a new business object instance into the data source.

Parameters

Name Type Optional Description

context

bo.shared.DataPortalContext

 

The context for custom data portal conversions.

callback

function()

 

Callback function to return error (in asynchronous models).

static
dataRemove(context, callback)

Deletes the property values of an existing business object instance from the data source.

Parameters

Name Type Optional Description

context

bo.shared.DataPortalContext

 

The context for custom data portal conversions.

callback

function()

 

Callback function to return error (in asynchronous models).

static
dataUpdate(context, callback)

Saves the property values of an existing business object instance into the data source.

Parameters

Name Type Optional Description

context

bo.shared.DataPortalContext

 

The context for custom data portal conversions.

callback

function()

 

Callback function to return error (in asynchronous models).

static
eventHandler(context)

Executes some actions on an event of a business object instance.

Parameter

Name Type Optional Description

context

bo.shared.DataPortalEventArgs

 

The context for data portal events.

static
fromCto(context, cto)

Rebuilds the business object from a plain object sent by the client.

Parameters

Name Type Optional Description

context

bo.shared.TransferContext

 

The context for custom transfer object conversions.

cto

object

 

The client transfer object.

static
fromDto(context, dto)

Rebuilds the business object from a plain object sent by the data access object.

Parameters

Name Type Optional Description

context

bo.shared.TransferContext

 

The context for custom transfer object conversions.

dto

object

 

The data transfer object.

static
getLocale() → string

Returns the current locale.

Returns

string The current locale or an empty string.

static
getUser() → bo.system.UserInfo

Returns the current user.

Returns

bo.system.UserInfo The current user or null.

static
propertyGetter(context) → any type

Gets the value of a model property.

Parameter

Name Type Optional Description

context

bo.shared.PropertyContext

 

The context for custom property functions.

Returns

any type The current value of the property.

static
propertySetter(context, value) → boolean

Sets the value of a model property.

Parameters

Name Type Optional Description

context

bo.shared.PropertyContext

 

The context for custom property functions.

value

any type

 

The new value of the property.

Returns

boolean True if the value of the property has been changed, otherwise false.

static
toCto(context) → object

Transforms the business object instance to a plain object to send to the client.

Parameter

Name Type Optional Description

context

bo.shared.TransferContext

 

The context for custom transfer object conversions.

Returns

object The client transfer object.

static
toDto(context) → object

Transforms the business object instance to a plain object to send to the data access object.

Parameter

Name Type Optional Description

context

bo.shared.TransferContext

 

The context for custom transfer object conversions.

Returns

object The data transfer object.