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
|
- Version:
- 17.1.1
- Source:
- See:
Examples
var employee = Abcs.Entities().findById('my.custom.bop.Employee');
var input = new OperationInput({
entity: employee
});
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);
// 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
Examples
// 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);
// 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
// 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
Examples
// 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
// 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
|
- Version:
- 17.1.1
- Source:
- See:
Returns:
a reference to this object to allow method chaining
Examples
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);
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
Examples
// 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();
// 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