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 currentValue
Object The current item being processed in the collection.
index
number The index of the current item being processed in the collection.
collection
Array.<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 a
object First object to compare.
b
object 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 err
error The error that occurred in the connection manager.
connection
object 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 err
bo.shared.DataPortalError | bo.rules.AuthorizationError The error that occurred in the data portal action.
result
object 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 err
error 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 connectionManager
string The relative path of the connection manager constructor. The created object must inherit bo.dataAccess.ConnectionManagerBase.
daoBuilder
string <optional>
The relative path of the factory method to create data access objects. The default builder method is bo.dataAccess.daoBuilder.
getUser
string <optional>
The relative path of the method that returns the current user.
getLocale
string <optional>
The relative path of the method that returns the current locale.
pathOfLocales
string <optional>
The relative path of the directory containing project locales.
noAccessBehavior
number | 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 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:
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 context
bo.shared.DataPortalContext The context for custom data portal conversions.
callback
function 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 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:
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 context
bo.shared.DataPortalContext The context for custom data portal conversions.
filter
* 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:
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 context
bo.shared.DataPortalContext The context for custom data portal conversions.
callback
function 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 context
bo.shared.DataPortalContext The context for custom data portal conversions.
callback
function 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 context
bo.shared.DataPortalContext The context for custom data portal conversions.
callback
function 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 context
bo.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 context
bo.shared.TransferContext The context for custom transfer object conversions.
cto
object 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 context
bo.shared.TransferContext The context for custom transfer object conversions.
dto
object 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 context
bo.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 context
bo.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 context
bo.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 context
bo.shared.TransferContext The context for custom transfer object conversions.
Returns:
The data transfer object.
- Type
- object