namespaceexternal
Source: doc-external.
External is a virtual namespace to describe types to implement in external objects to be used by business objects.
Abstract types
Abstract types
staticcbCollectionItem(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. |
staticcbCompare(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
staticcbConnectionManager(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. |
staticcbDataPortal(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 |
|
The error that occurred in the data portal action. |
|
result |
object |
|
The business object instance with the new state. |
staticcbFromCto(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. |
staticconfigurationFile
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:
|
staticdaoBuilder(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.
staticdataCreate(context, callback)
Initializes the property values of a new business object instance from the data source.
Parameters
Name | Type | Optional | Description |
---|---|---|---|
context |
|
The context for custom data portal conversions. |
|
callback |
function() |
|
Callback function to return error (in asynchronous models). |
staticdataExecute(context, method, callback) → object
Executes a command on the data source.
Parameters
Name | Type | Optional | Description |
---|---|---|---|
context |
|
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).
staticdataFetch(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 |
|
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).
staticdataInsert(context, callback)
Saves the property values of a new business object instance into the data source.
Parameters
Name | Type | Optional | Description |
---|---|---|---|
context |
|
The context for custom data portal conversions. |
|
callback |
function() |
|
Callback function to return error (in asynchronous models). |
staticdataRemove(context, callback)
Deletes the property values of an existing business object instance from the data source.
Parameters
Name | Type | Optional | Description |
---|---|---|---|
context |
|
The context for custom data portal conversions. |
|
callback |
function() |
|
Callback function to return error (in asynchronous models). |
staticdataUpdate(context, callback)
Saves the property values of an existing business object instance into the data source.
Parameters
Name | Type | Optional | Description |
---|---|---|---|
context |
|
The context for custom data portal conversions. |
|
callback |
function() |
|
Callback function to return error (in asynchronous models). |
staticeventHandler(context)
Executes some actions on an event of a business object instance.
Parameter
Name | Type | Optional | Description |
---|---|---|---|
context |
|
The context for data portal events. |
staticfromCto(context, cto)
Rebuilds the business object from a plain object sent by the client.
Parameters
Name | Type | Optional | Description |
---|---|---|---|
context |
|
The context for custom transfer object conversions. |
|
cto |
object |
|
The client transfer object. |
staticfromDto(context, dto)
Rebuilds the business object from a plain object sent by the data access object.
Parameters
Name | Type | Optional | Description |
---|---|---|---|
context |
|
The context for custom transfer object conversions. |
|
dto |
object |
|
The data transfer object. |
staticgetLocale() → string
Returns the current locale.
- Returns
-
string
The current locale or an empty string.
staticgetUser() → bo.system.UserInfo
Returns the current user.
- Returns
-
bo.system.UserInfo
The current user or null.
staticpropertyGetter(context) → any type
Gets the value of a model property.
Parameter
Name | Type | Optional | Description |
---|---|---|---|
context |
|
The context for custom property functions. |
- Returns
-
any type
The current value of the property.
staticpropertySetter(context, value) → boolean
Sets the value of a model property.
Parameters
Name | Type | Optional | Description |
---|---|---|---|
context |
|
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.
statictoCto(context) → object
Transforms the business object instance to a plain object to send to the client.
Parameter
Name | Type | Optional | Description |
---|---|---|---|
context |
|
The context for custom transfer object conversions. |
- Returns
-
object
The client transfer object.
statictoDto(context) → object
Transforms the business object instance to a plain object to send to the data access object.
Parameter
Name | Type | Optional | Description |
---|---|---|---|
context |
|
The context for custom transfer object conversions. |
- Returns
-
object
The data transfer object.