An API object representing expandable reference of an Entity.
ExpandableReference
gives client of Operations.read(..) an opportunity to automatically expand some of the references from the fetched
Entity.
- Version:
- 17.1.3
- Source:
- See:
-
- ExpandableReference.create(..) to see how to create instances of
ExpandableReference
s - Operations.read(..) to see where and how to use
ExpandableReference
- ExpandableReference.create(..) to see how to create instances of
Methods
(static) create(value, optionalParamsopt) → {operation/js/api/ExpandableReference}
stable API
Creates an instance of ExpandableReference
that could be passed into Operations.read(..) so that except for main data, it fetch
also embeded reference Entity record (otherwise there would be just the reference ID).
You have two options how to create an instance of ExpandableReference
:
Parameters:
Name | Type | Attributes | Description | ||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
value |
entity/js/api/Entity | entity/js/api/Property | Either an Entity that should be embedded or exact mapping Property that refers to the Entity that should be embedded. |
|||||||||
optionalParams |
Object |
<optional> |
Object literal with following possible parameters. Properties
|
- Version:
- 17.1.3
- Source:
- See:
-
- Operations.read(..) to see where and how to use
ExpandableReference
- Operations.read(..) to see where and how to use
Returns:
Examples
Creates an expandable reference that will expand all relations between Employee and Department entities.
require([
'operation/js/api/ExpandableReference'
], function(
ExpandableReference
) {
var department = Abcs.Entities().findById('my.custom.bop.Department');
var departmentRef = ExpandableReference.create(department);
});
Creates an expandable reference for just the specific mapping property.
require([
'operation/js/api/ExpandableReference'
], function(
ExpandableReference
) {
var employee = Abcs.Entities().findById('my.custom.bop.Employee');
var ref2Department = employee.getProperty('ref2Department');
var emp2DeptRef = ExpandableReference.create(ref2Department);
});
Creates an ExpandableReference
object to get an Employee data together with an embedded Department record that recursively contains embedded DepartmentType record.
require([
'operation/js/api/ExpandableReference'
], function(
ExpandableReference
) {
var employee = Abcs.Entities().findById('my.custom.bop.Employee');
var department = Abcs.Entities().findById('my.custom.bop.Department');
var departmentType = Abcs.Entities().findById('my.custom.bop.DepartmentType');
var expandableReference = ExpandableReference.create(department, {
expand: ExpandableReference.create(departmentType)
});
});