new bop/js/api/operation/OperationOutput(params)
stable API
Builds the operation output.
The operation output description drives some Application Builder UI features. For example if table is configured to use Operation with only two output Properties selected, these will be available for Business User to select in Table Creation Wizard - Data section.
Most typical use case is when Operation of type Operation.Type.READ_ONE returns all available Entity properties (resp. detailed information about Entity), but related Operation of type Operation.Type.READ_MANY returns only certain sub-set of them (e.g. the most important ones which user want to see in some Collection component). In such case, you need to create two OperationOutput instances and configure output for each Operation separately.
What's being build here needs to be passed into OperationBuilder.returns(..) method creating the final Operation instance which is the base building block for creating custom BOP.
Parameters:
Name | Type | Description | ||||||
---|---|---|---|---|---|---|---|---|
params |
Object | Object literal with all possible parameters. Properties
|
- Version:
- 17.1.1
- Source:
- See:
Methods
propertiesFrom(outputs) → {bop/js/api/operation/OperationOutput}
stable API
Extends all Properties from either single OperationOutput instance or array of OperationOutputs.
Parameters:
Name | Type | Description |
---|---|---|
outputs |
bop/js/api/operation/OperationOutput | Array.<bop/js/api/operation/OperationOutput> | OperationOutput(s) from which you want to extend all it's (resp. their's) Properties. |
- Version:
- 17.1.1
- Source:
Returns:
a reference to this object to allow method chaining
Examples
// Assuming Employee has properties: "Firstname", "Lastname", "Age", "Salary" and some others
var employee = Abcs.Entities().findById('my.custom.bop.Employee');
var firstname = employee.getProperty('firstname');
var lastname = employee.getProperty('lastname');
var age = employee.getProperty('age');
var salary = employee.getProperty('salary');
// If some operation returns only basic Name information about Employee, this OperationOutput can be used
var nameOutput = new OperationOutput({
entity: employee
}).property(firstname).
property(lastname);
// If on the other hand some other operation returns more information about Employee, full-OperationOutput can be used
var fullOutput = new OperationOutput({
entity: employee
}).propertiesFrom(nameOutput). // Inheriting all properties defined inside nameOutput ("Firstname", "Lastname")
property(age). // Explicitly including "Age" property
property(salary); // Explicitly including "Salary" property
// Assuming Employee has properties: "Firstname", "Lastname", "Age", "Salary" and some others
var employee = Abcs.Entities().findById('my.custom.bop.Employee');
var firstname = employee.getProperty('firstname');
var lastname = employee.getProperty('lastname');
var age = employee.getProperty('age');
var salary = employee.getProperty('salary');
var firstOutput = new OperationOutput({
entity: employee
}).property(firstname).
property(lastname);
var secondOutput = new OperationOutput({
entity: employee
}).property(age).
property(salary);
// If on the other hand some other operation returns more information about Employee, full-OperationOutput can be used
var fullOutput = new OperationOutput({
entity: employee
}).propertiesFrom(firstOutput). // Inheriting all properties defined inside firstOutput ("Firstname", "Lastname")
propertiesFrom(secondOutput); // Inheriting all properties defined inside secondOutput ("Age", "Salary")
property(property) → {bop/js/api/operation/OperationOutput}
stable API
Explicitly including additional Properties into the resulted OperationOutput.
Parameters:
Name | Type | Description |
---|---|---|
property |
entity/js/api/Property | Property you want to include into the OperationOutput. |
- Version:
- 17.1.1
- Source:
Returns:
a reference to this object to allow method chaining
Example
// Assuming Employee has properties: "Firstname", "Lastname", "Age", "Salary" and some others
var employee = Abcs.Entities().findById('my.custom.bop.Employee');
var firstname = employee.getProperty('firstname');
var lastname = employee.getProperty('lastname');
var output = new OperationOutput({
entity: employee
}).property(firstname).
property(lastname);