JavaScript Extension Development API for Oracle Visual Builder Cloud Service - Classic Applications

Class: operation/js/api/ExpandableReference

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:

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:

  • Pass an instance of Entity in which case all references between the main and the given Entity will be expanded.
  • Pass an instance of Property which represents one particular mapping property between two entities.
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
Name Type Attributes Description
expand operation/js/api/ExpandableReference | Array.<operation/js/api/ExpandableReference> <optional>

Either a single instance of ExpandableReference or an array of ExpandableReferences for deeper children expansion.

Version:
  • 17.1.3
Source:
See:
Returns:
Type
operation/js/api/ExpandableReference
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)
    });
});