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

Class: bop/js/api/operation/OperationInput

new bop/js/api/operation/OperationInput(params)

stable API

Builds operation input instances..

What's being build here needs to be passed into OperationBuilder.takes(..) 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
Name Type Description
entity String

Entity whose Properties the build operation accepts on it's input.

Version:
  • 17.1.1
Source:
See:
Examples

Creates minimalistic instance of OperationInput with only input Entity specified.

var employee = Abcs.Entities().findById('my.custom.bop.Employee');
var input = new OperationInput({
    entity: employee
});

Creates an instance of OperationInput with two explicit parameters specified.

var employee = Abcs.Entities().findById('my.custom.bop.Employee');
var firstname = employee.getProperty('Firstname');
var lastname = employee.getProperty('Lastname');
var input = new OperationInput({
    entity: employee
}).parameter(firstname).
    parameter(lastname);

Creates an instance of OperationInput accepting parameters for all properties defined inside of the passed entity.

// Assuming three properties: "Firstname", "Lastname" and "Age"
var employee = Abcs.Entities().findById('my.custom.bop.Employee');
var input = new OperationInput({
    entity: employee
}).parametersAll();

Members

Methods

operators(operators) → {bop/js/api/operation/OperationInput}

stable API

Sets default set of Operators applied to every Property of all PropertyTypes.

This will be used if neither explicit configuration nor PropertyType-sensitive operators configuration had been set to override these defaults.

Abcs UI is automatically adapted with respect to the available operators. For example if only Equals and Contains operators are available, only those are going to be shown to the end-user in Advanced Search UI.

Parameters:
Name Type Description
operators Array.<module:operation/js/api/Operator>
Version:
  • 17.1.1
Source:
See:
Returns:

a reference to this object to allow method chaining

Type
bop/js/api/operation/OperationInput
Examples

Creates an instance of OperationInput accepting all properties defined inside of the passed entity.
All parameters are capable to process the same set of operators (Equals, Contains, Starts-with, Ends-with) with no difference based on actual PropertyType.

// Assuming three properties: Firstname (PropertyType.TEXT), Lastname (PropertyType.TEXT) and Age (PropertyType.NUMBER)
var employee = Abcs.Entities().findById('my.custom.bop.Employee');
var operators = [Operator.EQUALS, Operator.NOT_EQUALS];
var input = new OperationInput({
    entity: employee
}).parametersAll().
    operators(operators);

Creates an instance of OperationInput accepting all properties defined inside of the passed entity.
This time all parameters of PropertyType.TEXT are capable to process extended set of operators than the default one which is used for all other PropertyType.

// Assuming three properties: Firstname (PropertyType.TEXT), Lastname (PropertyType.TEXT) and Age (PropertyType.NUMBER)
var employee = Abcs.Entities().findById('my.custom.bop.Employee');
var operators = [Operator.EQUALS, Operator.NOT_EQUALS];
var textOperators = [
    Operator.EQUALS,
    Operator.NOT_EQUALS,
    Operator.CONTAINS,
    Operator.NOT_CONTAINS
];
var input = new OperationInput({
    entity: employee
}).parametersAll().
    operators(operators).                                // General operators are used for "Age" property as it had no closer specification
    operatorsForType(PropertyType.TEXT, textOperators);  // TEXT-based operators are used for "Firstname" and "Lastname" properties

Creates an instance of OperationInput accepting all properties defined inside of the passed entity.
This time all parameters of PropertyType.TEXT are capable to process extended set of operators than the default one. Plus "Firstname" Property supports completely customized Operator set.

// Assuming three properties: Firstname (PropertyType.TEXT), Lastname (PropertyType.TEXT) and Age (PropertyType.NUMBER)
var employee = Abcs.Entities().findById('my.custom.bop.Employee');
var firstname = employee.getProperty('Firstname');
var operators = [Operator.EQUALS, Operator.NOT_EQUALS];
var textOperators = [
    Operator.EQUALS,
    Operator.NOT_EQUALS,
    Operator.CONTAINS,
    Operator.NOT_CONTAINS
];
var firstnameOperators = [
    Operator.EQUALS,
    Operator.NOT_EQUALS,
    Operator.CONTAINS,
    Operator.NOT_CONTAINS,
    Operator.STARTS_WITH,
    Operator.ENDS_WITH
];
var input = new OperationInput({
    entity: employee
}).parametersAll().
    parameter({
        property: firstname,
        operators: firstnameOperators                    // Concrete operator set is used for "Firstname" property
    })
    operators(operators).                                // General operator set is used for "Age" property as it had no closer specification
    operatorsForType(PropertyType.TEXT, textOperators);  // TEXT-based operator set is used for "Lastname" property as it's most specifc configuration

operatorsForType(propertyType, operators) → {bop/js/api/operation/OperationInput}

stable API

Sets default set of operators applied to every property of the given property type if no explicit configuration had been set to override these defaults.

Abcs UI is automatically adapted with respect to the available operators. For example if only Equals and Contains operators are available, only those are going to be shows to the end-user in Advanced Search UI.

Parameters:
Name Type Description
propertyType module:entity/js/api/PropertyType
operators Array.<module:operation/js/api/Operator>
Version:
  • 17.1.1
Source:
See:
Returns:

a reference to this object to allow method chaining

Type
bop/js/api/operation/OperationInput
Examples

Creates an instance of OperationInput accepting all properties defined inside of the passed entity.
Both parameters are capable to process the same set of TEXT-based operators (Equals, Contains, Starts-with, Ends-with).

// Assuming three properties: Firstname (PropertyType.TEXT), Lastname (PropertyType.TEXT) and Age (PropertyType.NUMBER)
var employee = Abcs.Entities().findById('my.custom.bop.Employee');
var textOperators = [
    Operator.EQUALS,
    Operator.NOT_EQUALS,
    Operator.CONTAINS,
    Operator.NOT_CONTAINS
];
var input = new OperationInput({
    entity: employee
}).parametersAll().
    operatorsForType(PropertyType.TEXT, textOperators);  // Sets textOperators only for "Firstname" and "Lastname" properties

Creates an instance of OperationInput with two explicit parameters specified.
One parameter is inheriting default set of operators, the other one override this configuration with custom set.

// Assuming three properties: Firstname (PropertyType.TEXT), Lastname (PropertyType.TEXT) and Age (PropertyType.NUMBER)
var employee = Abcs.Entities().findById('my.custom.bop.Employee');
var firstname = employee.getProperty('Firstname');
var lastname = employee.getProperty('Lastname');
var textOperators = [
    Operator.EQUALS,
    Operator.NOT_EQUALS,
    Operator.CONTAINS,
    Operator.NOT_CONTAINS
];
var firstnameOperators = [
    Operator.EQUALS,
    Operator.NOT_EQUALS,
    Operator.CONTAINS,
    Operator.NOT_CONTAINS,
    Operator.STARTS_WITH,
    Operator.ENDS_WITH
];
var input = new OperationInput({
    entity: employee
}).parameter(lastname).                                      // Default operators (textOperators) are used
    parameter({
        property: firstname,
        operators: [Operator.EQUALS, Operator.NOT_EQUALS]    // Overriding default TEXT-based operators set with custom configuration
    })
    operatorsForType(PropertyType.TEXT, textOperators);      // Sets operators for all TEXT-based properties with no explicit configuration

parameter(params) → {bop/js/api/operation/OperationInput}

stable API

Includes single parameter into the OperationInput configuration.

You can either pass Property instance directly or object literal which allows you to customize parameter description more precisely. Few examples:

  • If your parameter can handle different set of Operators, you can include "operators" parameter into your object literal listing all available values.
  • If your parameter is required, you can specify that by passing "required" attribute with value true.
  • If you want to mark your parameter with "PATH" or "QUERY" constant which allow you later to process them easily in your ConditionVisitor implementation, you can use "additionalInfo" parameter and place all custom values there.

Parameters:
Name Type Description
params Property | Object

Either Property instance directly or an Object literal with customized parameters.

Properties
Name Type Attributes Description
property entity/js/api/Property

Property this parameter is working with.

required Boolean <optional>

true if this parameter is required, false otherwise.

operators Array.<module:operation/js/api/Operator> <optional>

Array of Operators supported by this parameter.

additionalInfo Object <optional>

Additional information required for processing this parameter further.

Version:
  • 17.1.1
Source:
See:
Returns:

a reference to this object to allow method chaining

Type
bop/js/api/operation/OperationInput
Examples

Creates an instance of OperationInput with two explicit parameters specified.

var employee = Abcs.Entities().findById('my.custom.bop.Employee');
var firstname = employee.getProperty('Firstname');
var lastname = employee.getProperty('Lastname');
var input = new OperationInput({
    entity: employee
}).parameter(firstname).
    parameter(lastname);

Creates an instance of OperationInput with two parameters and their supported operators explicitly specified. Also includes additional information which marks this parameters with 'PATH' constant. That allows us to process such parameter correctly in ConditionVisitor implementation.

var employee = Abcs.Entities().findById('my.custom.bop.Employee');
var firstname = employee.getProperty('Firstname');
var lastname = employee.getProperty('Lastname');
var input = new OperationInput({
    entity: employee
}).parameter({
    property: firstname,
    operators: [Operator.EQUALS, Operator.NOT_EQUALS],
    additionalInfo: {
        type: 'PATH'
    }
}).parameter({
    property: lastname,
    operators: [Operator.EQUALS, Operator.NOT_EQUALS],
    additionalInfo: {
        type: 'PATH'
    }
});

parametersAll() → {bop/js/api/operation/OperationInput}

stable API

Configure this OperationInput so it accepts all entity properties on the resulted operation input.

Same effect can be accomplised by calling OperationInput.parameter(..) multiple times for each Property. But if your entity is more complex and your operation accepts all of it's properties on input, this method might be handy.

Version:
  • 17.1.1
Source:
See:
Returns:

a reference to this object to allow method chaining

Type
bop/js/api/operation/OperationInput
Examples

Creates an instance of OperationInput accepting all properties defined inside of the passed entity.

// Assuming Employee entity contains several different properties: Firstname, lastname, age, ..
var employee = Abcs.Entities().findById('my.custom.bop.Employee');
var input = new OperationInput({
    entity: employee
}).parametersAll();

Creates an instance of OperationInput accepting all properties defined inside of the passed entity. Setting different sets of operators with respect to the actual PropertyTypes.

// Assuming Employee entity contains several different properties: Firstname, lastname, age, ..
var employee = Abcs.Entities().findById('my.custom.bop.Employee');
var textOperators = [
    Operator.EQUALS,
    Operator.NOT_EQUALS,
    Operator.CONTAINS,
    Operator.NOT_CONTAINS,
    Operator.STARTS_WITH,
    Operator.ENDS_WITH
];
var numberOperators = [
    Operator.EQUALS,
    Operator.NOT_EQUALS,
    Operator.LESS,
    Operator.LESS_OR_EQUAL,
    Operator.MORE,
    Operator.MORE_OR_EQUAL
];
var input = new OperationInput({
    entity: employee
}).parametersAll().
    operatorsForType(PropertyType.TEXT, textOperators).     // Setting Operators set for all TEXT-based properties
    operatorsForType(PropertyType.NUMBER, numberOperators); // Setting Operators set for all NUMBER-based properties