SPI object representing a single Entity Provider.
Provides list of Entities (an abstract representation of data structure used by REST service in it's input and output calls) which are provided by the relevant BOP.
EntityProvider is one of the two main parts required to implement custom BOP. The other one is OperationProvider.
- Version:
- 17.1.1
- Source:
- See:
-
- BOP
- OperationProvider
- DataModelFactory to create Entity, Property and Relation instances.
Example
define([
'bop/js/api/entity/DataModelFactory',
'entity/js/api/PropertyType'
], function (
DataModelFactory,
PropertyType
) {
var CustomEntityProvider = function () {
var firstname = DataModelFactory.createProperty({
id: 'my.custom.bop.Employee.Firstname',
name: 'Firstname',
type: PropertyType.TEXT
});
var lastname = DataModelFactory.createProperty({
id: 'my.custom.bop.Employee.Lastname',
name: 'Lastname',
type: PropertyType.TEXT
});
var age = DataModelFactory.createProperty({
id: 'my.custom.bop.Employee.Age',
name: 'Age',
type: PropertyType.NUMBER
});
var employee = DataModelFactory.createEntity({
id: 'my.custom.bop.Employee',
singularName: 'Employee',
pluralName: 'Employees',
properties: [firstname, lastname, age]
});
this._entities = [employee];
};
CustomEntityProvider.prototype.getEntities = function() {
return this._entities;
};
return CustomEntityProvider;
});
Methods
getEntities() → {Array.<entity/js/api/Entity>}
stable API
Gets the array of Entities provided by this EntityProvider.
- Version:
- 17.1.1
- Source:
Returns:
- Type
- Array.<entity/js/api/Entity>