External is a virtual namespace to describe types to implement in external objects to be used by business objects.
Type Definitions
-
cbCollectionItem(currentValue, index, collection)
-
The callback to be called in collection methods.
Parameters:
Name Type Description currentValueObject The current item being processed in the collection.
indexnumber The index of the current item being processed in the collection.
collectionArray.<object> The collection method was called upon.
-
cbCompare(a, b) → {number}
-
The callback to be called to define the sort order in a collection.
Parameters:
Name Type Description aobject First object to compare.
bobject Second object to compare.
Returns:
Returns
- < 0, when a comes first
- = 0, when a and b are left unchanged
- > 0, when b comes first
- Type
- number
-
cbConnectionManager(err, connection)
-
The callback to be called when the execution of a connection manager method has finished.
Parameters:
Name Type Description errerror The error that occurred in the connection manager.
connectionobject The connection for the data source.
-
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 Description errbo.shared.DataPortalError | bo.rules.AuthorizationError The error that occurred in the data portal action.
resultobject The business object instance with the new state.
-
cbFromCto(err)
-
The callback to be called when the execution of a model rebuild method has finished.
Parameters:
Name Type Description errerror The error that occurred in the model.
-
configurationFile
-
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:
Type:
- object
- 0 or 'throwError', the default value
- 1 or 'showError'
- 2 or 'showWarning'
- 3 or 'showInformation'
Properties:
Name Type Argument Description connectionManagerstring The relative path of the connection manager constructor. The created object must inherit bo.dataAccess.ConnectionManagerBase.
daoBuilderstring <optional>
The relative path of the factory method to create data access objects. The default builder method is bo.dataAccess.daoBuilder.
getUserstring <optional>
The relative path of the method that returns the current user.
getLocalestring <optional>
The relative path of the method that returns the current locale.
pathOfLocalesstring <optional>
The relative path of the directory containing project locales.
noAccessBehaviornumber | string <optional>
The default behavior for unauthorized operations. Valid values are:
-
daoBuilder(dataSource, modelPath, modelName) → {bo.dataAccess.DaoBase}
-
Factory method to create the data access object for a model instance.
Parameters:
Name Type Description dataSourcestring The name of the data source.
modelPathstring The model definition path of the business object model instance that the data access object belongs to.
modelNamestring The name of the business object model.
Returns:
The data access object.
-
dataCreate(context, callback)
-
Initializes the property values of a new business object instance from the data source.
This:
Parameters:
Name Type Description contextbo.shared.DataPortalContext The context for custom data portal conversions.
callbackfunction Callback function to return error (in asynchronous models).
-
dataExecute(context, method, callback) → {object}
-
Executes a command on the data source.
This:
Parameters:
Name Type Description contextbo.shared.DataPortalContext The context for custom data portal conversions.
methodstring The name of the execution method, defaults to 'execute'.
callbackfunction Callback function to return child values or error (in asynchronous models).
Returns:
Plain object holding child values (in synchronous models).
- Type
- object
-
dataFetch(context, filter, method, callback) → {object}
-
Sets the property values of an existing business object instance from the data source.
This:
Parameters:
Name Type Description contextbo.shared.DataPortalContext The context for custom data portal conversions.
filter* The criteria of the selection.
methodstring The name of the selection method, defaults to 'fetch'.
callbackfunction Callback function to return child values or error (in asynchronous models).
Returns:
Plain object holding child values (in synchronous models).
- Type
- object
-
dataInsert(context, callback)
-
Saves the property values of a new business object instance into the data source.
This:
Parameters:
Name Type Description contextbo.shared.DataPortalContext The context for custom data portal conversions.
callbackfunction Callback function to return error (in asynchronous models).
-
dataRemove(context, callback)
-
Deletes the property values of an existing business object instance from the data source.
This:
Parameters:
Name Type Description contextbo.shared.DataPortalContext The context for custom data portal conversions.
callbackfunction Callback function to return error (in asynchronous models).
-
dataUpdate(context, callback)
-
Saves the property values of an existing business object instance into the data source.
This:
Parameters:
Name Type Description contextbo.shared.DataPortalContext The context for custom data portal conversions.
callbackfunction Callback function to return error (in asynchronous models).
-
eventHandler(context)
-
Executes some actions on an event of a business object instance.
This:
Parameters:
Name Type Description contextbo.shared.DataPortalEventArgs The context for data portal events.
-
fromCto(context, cto)
-
Rebuilds the business object from a plain object sent by the client.
This:
Parameters:
Name Type Description contextbo.shared.TransferContext The context for custom transfer object conversions.
ctoobject The client transfer object.
-
fromDto(context, dto)
-
Rebuilds the business object from a plain object sent by the data access object.
This:
Parameters:
Name Type Description contextbo.shared.TransferContext The context for custom transfer object conversions.
dtoobject The data transfer object.
-
getLocale() → {string}
-
Returns the current locale.
Returns:
The current locale or an empty string.
- Type
- string
-
getUser() → {bo.system.UserInfo}
-
Returns the current user.
Returns:
The current user or null.
- Type
- bo.system.UserInfo
-
propertyGetter(context) → {*}
-
Gets the value of a model property.
Parameters:
Name Type Description contextbo.shared.PropertyContext The context for custom property functions.
Returns:
The current value of the property.
- Type
- *
-
propertySetter(context, value) → {boolean}
-
Sets the value of a model property.
Parameters:
Name Type Description contextbo.shared.PropertyContext The context for custom property functions.
value* The new value of the property.
Returns:
True if the value of the property has been changed, otherwise false.
- Type
- boolean
-
toCto(context) → {object}
-
Transforms the business object instance to a plain object to send to the client.
This:
Parameters:
Name Type Description contextbo.shared.TransferContext The context for custom transfer object conversions.
Returns:
The client transfer object.
- Type
- object
-
toDto(context) → {object}
-
Transforms the business object instance to a plain object to send to the data access object.
This:
Parameters:
Name Type Description contextbo.shared.TransferContext The context for custom transfer object conversions.
Returns:
The data transfer object.
- Type
- object