Class sap.ui.generic.app.navigation.service.SelectionVariantModule: sap/ui/generic/app/navigation/service/SelectionVariant

extends Object

Creates a new instance of a SelectionVariant class. If no parameter is passed, an new empty instance is created whose ID has been set to "". Passing a JSON-serialized string complying to the Selection Variant Specification will parse it, and the newly created instance will contain the same information.

Constructor Summary
Method Summary
sap.ui.generic.app.navigation.service.SelectionVariant.addParameter(sName, sValue)Sets the value of a parameter called sName to the new value sValue.
sap.ui.generic.app.navigation.service.SelectionVariant.addSelectOption(sPropertyName, sSign, sOption, sLow, sHigh?)Adds a new range to the list of select options for a given parameter.
sap.ui.generic.app.navigation.service.SelectionVariant.extend(sClassName, oClassInfo?, FNMetaImpl?)Creates a new subclass of class sap.ui.generic.app.navigation.service.SelectionVariant with name sClassName and enriches it with the information contained in oClassInfo.
sap.ui.generic.app.navigation.service.SelectionVariant.getFilterContextUrl()Gets the current context URL intended for the filters.
sap.ui.generic.app.navigation.service.SelectionVariant.getID()Returns the identification of the selection variant.
sap.ui.generic.app.navigation.service.SelectionVariant.getMetadata()Returns a metadata object for class sap.ui.generic.app.navigation.service.SelectionVariant.
sap.ui.generic.app.navigation.service.SelectionVariant.getParameter(sName)Returns the value of the parameter called sName if it has been set.
sap.ui.generic.app.navigation.service.SelectionVariant.getParameterContextUrl()Gets the current context URL intended for the parameters.
sap.ui.generic.app.navigation.service.SelectionVariant.getParameterNames()Returns the set of parameter names available in this selection variant
sap.ui.generic.app.navigation.service.SelectionVariant.getSelectOption(sPropertyName)Returns the set of select options/ranges available for a given property name.
sap.ui.generic.app.navigation.service.SelectionVariant.getSelectOptionsPropertyNames()Returns the names of the properties available for this instance.
sap.ui.generic.app.navigation.service.SelectionVariant.getText()Returns the current text / description of this selection variant.
sap.ui.generic.app.navigation.service.SelectionVariant.getValue(sName)First tries to retrieve the set of select options/ranges available for sName as property name.
sap.ui.generic.app.navigation.service.SelectionVariant.isEmpty()Returns true if the selection variant does neither contain parameters nor ranges.
sap.ui.generic.app.navigation.service.SelectionVariant.massAddSelectOption(sPropertyName, aSelectOptions)Adds a set of select options to the list of select options for a given parameter.
sap.ui.generic.app.navigation.service.SelectionVariant.removeParameter(sName)Removes a parameter called sName from the selection variant.
sap.ui.generic.app.navigation.service.SelectionVariant.removeSelectOption(sName)Removes a select option called sName from the selection variant.
sap.ui.generic.app.navigation.service.SelectionVariant.renameParameter(sNameOld, sNameNew)Renames a parameter called sNameOld to sNameNew.
sap.ui.generic.app.navigation.service.SelectionVariant.renameSelectOption(sNameOld, sNameNew)Renames a select option called sNameOld to sNameNew.
sap.ui.generic.app.navigation.service.SelectionVariant.setFilterContextUrl(sURL)Sets the context URL intended for the filters.
sap.ui.generic.app.navigation.service.SelectionVariant.setID(sId)Sets the identification of the selection variant.
sap.ui.generic.app.navigation.service.SelectionVariant.setParameterContextUrl(sURL)Sets the context URL intended for the parameters.
sap.ui.generic.app.navigation.service.SelectionVariant.setText(sNewText)Sets the text / description of the selection variant.
sap.ui.generic.app.navigation.service.SelectionVariant.toJSONObject()Returns the external representation of the selection variant as JSON object.
sap.ui.generic.app.navigation.service.SelectionVariant.toJSONString()Serializes this instance into a JSON-formatted string.
Methods borrowed from class sap.ui.base.Object
Constructor Detail
new sap.ui.generic.app.navigation.service.SelectionVariant(vSelectionVariant?)
Parameters:
{string|object}vSelectionVariant? If of type string, the selection variant is JSON-formatted; if of type object, the object represents a selection variant
Exceptions:
An instance of sap.ui.generic.app.navigation.service.NavError in case of input errors. Valid error codes are:
Error codeDescription
SelectionVariant.INVALID_INPUT_TYPEIndicates that the data format of the selection variant provided is inconsistent
SelectionVariant.UNABLE_TO_PARSE_INPUTIndicates that the provided string is not a JSON-formatted string
SelectionVariant.INPUT_DOES_NOT_CONTAIN_SELECTIONVARIANT_IDIndicates that the SelectionVariantID cannot be retrieved
SelectionVariant.PARAMETER_WITHOUT_VALUEIndicates that there was an attempt to specify a parameter, but without providing any value (not even an empty value)
SelectionVariant.SELECT_OPTION_WITHOUT_PROPERTY_NAMEIndicates that a selection option has been defined, but the Ranges definition is missing
SelectionVariant.SELECT_OPTION_RANGES_NOT_ARRAYIndicates that the Ranges definition is not an array
These exceptions can only be thrown if the parameter vSelectionVariant has been provided.
Method Detail
sap.ui.generic.app.navigation.service.SelectionVariant.addParameter(sName, sValue): object
Sets the value of a parameter called sName to the new value sValue. If the parameter has already been set before, its value is overwritten.
Parameters:
{string}sName The name of the parameter to be set; the null value is not allowed
{string}sValue The value of the parameter to be set
Exceptions:
An instance of sap.ui.generic.app.navigation.service.NavError in case of input errors. Valid error codes are:
Error codeDescription
SelectionVariant.PARAMETER_WITHOUT_NAMEIndicates that the name of the parameter has not been specified
SelectionVariant.INVALID_INPUT_TYPEIndicates that an input parameter has an invalid type or the value is set to null
SelectionVariant.PARAMETER_SELOPT_COLLISIONIndicates that another SelectOption with the same name as the parameter already exists
Returns:
{object} This instance to allow method chaining
sap.ui.generic.app.navigation.service.SelectionVariant.addSelectOption(sPropertyName, sSign, sOption, sLow, sHigh?): object
Adds a new range to the list of select options for a given parameter.
Parameters:
{string}sPropertyName The name of the property for which the selection range is added
{string}sSign The sign of the range (Include or Exclude)
{string}sOption The option of the range (EQ for "equals", NE for "not equals", LE for "less or equals", GE for "greater or equals", LT for "less than" (and not equals), GT for "greater than" (and not equals), BT for "between", or CP for "contains pattern" (ABAP-styled pattern matching with the asterisk as wildcard)
{string}sLow The single value or the lower boundary of the interval; the null value is not allowed
{string}sHigh? Set only if sOption is BT: the upper boundary of the interval; must be undefined or null in all other cases
Exceptions:
An instance of sap.ui.generic.app.navigation.service.NavError in case of input errors. Valid error codes are:
Error codeDescription
SelectionVariant.INVALID_SIGNIndicates that the sign is an invalid expression
SelectionVariant.INVALID_OPTIONIndicates that the option is an invalid expression
SelectionVariant.HIGH_PROVIDED_THOUGH_NOT_ALLOWEDIndicates that the upper boundary has been specified, even though the option is not 'BT'
SelectionVariant.INVALID_INPUT_TYPEIndicates that an input parameter has an invalid type or the value is set to null
SelectionVariant.INVALID_PROPERTY_NAMEIndicates that the property name is invalid, for example, it has not been specified
SelectionVariant.PARAMETER_SELOPT_COLLISIONIndicates that another parameter with the same name as the property name already exists
Returns:
{object} This instance to allow method chaining.
sap.ui.generic.app.navigation.service.SelectionVariant.extend(sClassName, oClassInfo?, FNMetaImpl?): function
Creates a new subclass of class sap.ui.generic.app.navigation.service.SelectionVariant with name sClassName and enriches it with the information contained in oClassInfo.

oClassInfo might contain the same kind of information as described in sap.ui.base.Object.extend.

Parameters:
{string}sClassName Name of the class being created
{object}oClassInfo? Object literal with information about the class
{function}FNMetaImpl? Constructor function for the metadata object; if not given, it defaults to sap.ui.core.ElementMetadata
Returns:
{function} Created class / constructor function
sap.ui.generic.app.navigation.service.SelectionVariant.getFilterContextUrl(): string
Gets the current context URL intended for the filters.
Returns:
{string} The current context URL for the filters
sap.ui.generic.app.navigation.service.SelectionVariant.getID(): string
Returns the identification of the selection variant.
Returns:
{string} The identification of the selection variant as made available during construction
sap.ui.generic.app.navigation.service.SelectionVariant.getMetadata(): sap.ui.base.Metadata
Returns a metadata object for class sap.ui.generic.app.navigation.service.SelectionVariant.
Returns:
{sap.ui.base.Metadata} Metadata object describing this class
sap.ui.generic.app.navigation.service.SelectionVariant.getParameter(sName): string
Returns the value of the parameter called sName if it has been set. If the parameter has never been set or has been removed, undefined is returned.
Parameters:
{string}sName The name of the parameter to be returned
Exceptions:
An instance of sap.ui.generic.app.navigation.service.NavError in case of input errors. Valid error codes are:
Error codeDescription
SelectionVariant.INVALID_INPUT_TYPEIndicates that an input parameter has an invalid type
Returns:
{string} The value of parameter sName; returning the value null not possible
sap.ui.generic.app.navigation.service.SelectionVariant.getParameterContextUrl(): string
Gets the current context URL intended for the parameters.
Returns:
{string} The current context URL for the parameters
sap.ui.generic.app.navigation.service.SelectionVariant.getParameterNames(): array
Returns the set of parameter names available in this selection variant
Returns:
{array} the list of parameter names which are valid
sap.ui.generic.app.navigation.service.SelectionVariant.getSelectOption(sPropertyName): array
Returns the set of select options/ranges available for a given property name.
Parameters:
{string}sPropertyName The name of the property for which the set of select options/ranges is returned
Exceptions:
An instance of sap.ui.generic.app.navigation.service.NavError in case of input errors. Valid error codes are:
Error codeDescription
SelectionVariant.INVALID_INPUT_TYPEIndicates that an input parameter has an invalid type
SelectionVariant.INVALID_PROPERTY_NAMEIndicates that the property name is invalid, for example, it has not been specified
Returns:
{array} If sPropertyName is an invalid name of a property or no range exists, undefined is returned; otherwise, an immutable array of ranges is returned. Each entry of the array is an object with the following properties:
  • Sign: The sign of the range
  • Option: The option of the range
  • Low: The low value of the range; returning value null is not possible
  • High: The high value of the range; if this value is not necessary, null is used
For further information about the meaning of the attributes, refer to method addSelectOption.
sap.ui.generic.app.navigation.service.SelectionVariant.getSelectOptionsPropertyNames(): array
Returns the names of the properties available for this instance.
Returns:
{array} The list of property names available for this instance
sap.ui.generic.app.navigation.service.SelectionVariant.getText(): string
Returns the current text / description of this selection variant.
Returns:
{string} the current description of this selection variant.
sap.ui.generic.app.navigation.service.SelectionVariant.getValue(sName): array
First tries to retrieve the set of select options/ranges available for sName as property name. If successful, this array of selections is being returned. If it fails, an attempt to find a parameter, whose name is sName, is made. If the latter succeeds, the single value is converted to fit into an array of selections to make it type compatible with ranges. This array is then returned.
If neither a select option nor a parameter could be found, undefined is returned.
Parameters:
{string}sName The name of the attribute for which the value is retrieved
Exceptions:
An instance of sap.ui.generic.app.navigation.service.NavError in case of input errors. Valid error codes are:
Error codeDescription
SelectionVariant.INVALID_INPUT_TYPEIndicates that an input parameter has an invalid type
SelectionVariant.INVALID_PROPERTY_NAMEIndicates that the property name is invalid, for example, it has not been specified
Returns:
{array} The ranges in the select options for the specified property or a range-converted representation of a parameter is returned. If both lookups fail, undefined is returned.
The returned ranges have the format:
  • Sign: The sign of the range
  • Option: The option of the range
  • Low: The low value of the range; returning the value null is not possible
  • High: The high value of the range; if this value is not necessary, null (but does exist)
For further information on the meaning of the attributes, refer to method addSelectOption.
sap.ui.generic.app.navigation.service.SelectionVariant.isEmpty(): boolean
Returns true if the selection variant does neither contain parameters nor ranges.
Returns:
{boolean} If set to true there are no parameters and no select options available in the selection variant; false otherwise.
sap.ui.generic.app.navigation.service.SelectionVariant.massAddSelectOption(sPropertyName, aSelectOptions): object
Adds a set of select options to the list of select options for a given parameter.
Parameters:
{string}sPropertyName The name of the property for which the set of select options is added
{array}aSelectOptions Set of select options to be added
Exceptions:
An instance of sap.ui.generic.app.navigation.service.NavError in case of input errors. Valid error codes are:
Error codeDescription
SelectionVariant.INVALID_INPUT_TYPEIndicates that an input parameter has an invalid type
Returns:
{object} This instance to allow method chaining
sap.ui.generic.app.navigation.service.SelectionVariant.removeParameter(sName): object
Removes a parameter called sName from the selection variant.
Parameters:
{string}sName The name of the parameter to be removed
Exceptions:
An instance of sap.ui.generic.app.navigation.service.NavError in case of input errors. Valid error codes are:
Error codeDescription
SelectionVariant.PARAMETER_WITHOUT_NAMEIndicates that name of the parameter has not been specified
SelectionVariant.INVALID_INPUT_TYPEIndicates that an input parameter has an invalid type
Returns:
{object} This instance to allow method chaining
sap.ui.generic.app.navigation.service.SelectionVariant.removeSelectOption(sName): object
Removes a select option called sName from the selection variant.
Parameters:
{string}sName The name of the select option to be removed
Exceptions:
An instance of sap.ui.generic.app.navigation.service.NavError in case of input errors. Valid error codes are:
Error codeDescription
SelectionVariant.SELOPT_WITHOUT_NAMEIndicates that name of the select option has not been specified
SelectionVariant.SELOPT_WRONG_TYPEIndicates that the name of the parameter sName has an invalid type
Returns:
{object} This instance to allow method chaining.
sap.ui.generic.app.navigation.service.SelectionVariant.renameParameter(sNameOld, sNameNew): object
Renames a parameter called sNameOld to sNameNew. If a parameter or a select option with the name sNameNew already exist, an error is thrown. If a parameter with the name sNameOld does not exist, nothing is changed.
Parameters:
{string}sNameOld The current name of the parameter to be renamed
{string}sNameNew The new name of the parameter
Exceptions:
An instance of sap.ui.generic.app.navigation.service.NavError in case of input errors. Valid error codes are:
Error codeDescription
SelectionVariant.PARAMETER_WITHOUT_NAMEIndicates that the name of a parameter has not been specified
SelectionVariant.INVALID_INPUT_TYPEIndicates that an input parameter has an invalid type
SelectionVariant.PARAMETER_SELOPT_COLLISIONIndicates that another select option with the same new name already exists
SelectionVariant.PARAMETER_COLLISIONIndicates that another parameter with the same new name already exists
Returns:
{object} This instance to allow method chaining
sap.ui.generic.app.navigation.service.SelectionVariant.renameSelectOption(sNameOld, sNameNew): object
Renames a select option called sNameOld to sNameNew. If a select option or a parameter with the name sNameNew already exist, an error is thrown. If a select option with the name sNameOld does not exist, nothing is changed.
Parameters:
{string}sNameOld The current name of the select option property to be renamed
{string}sNameNew The new name of the select option property
Exceptions:
An instance of sap.ui.generic.app.navigation.service.NavError in case of input errors. Valid error codes are:
Error codeDescription
SelectionVariant.SELOPT_WITHOUT_NAMEIndicates that the name of a select option has not been specified
SelectionVariant.SELOPT_WRONG_TYPEIndicates that a select option has an invalid type
SelectionVariant.PARAMETER_SELOPT_COLLISIONIndicates that another parameter with the same new name already exists
SelectionVariant.SELOPT_COLLISIONIndicates that another select option with the same new name already exists
Returns:
{object} This instance to allow method chaining
sap.ui.generic.app.navigation.service.SelectionVariant.setFilterContextUrl(sURL)
Sets the context URL intended for the filters.
Parameters:
{string}sURL The URL of the filters
Exceptions:
An instance of sap.ui.generic.app.navigation.service.NavError in case of input errors. Valid error codes are:
Error codeDescription
SelectionVariant.INVALID_INPUT_TYPEIndicates that an input parameter has an invalid type
sap.ui.generic.app.navigation.service.SelectionVariant.setID(sId)
Sets the identification of the selection variant.
Parameters:
{string}sId The new identification of the selection variant
sap.ui.generic.app.navigation.service.SelectionVariant.setParameterContextUrl(sURL)
Sets the context URL intended for the parameters.
Parameters:
{string}sURL The URL of the parameter context
Exceptions:
An instance of sap.ui.generic.app.navigation.service.NavError in case of input errors. Valid error codes are:
Error codeDescription
SelectionVariant.INVALID_INPUT_TYPEIndicates that an input parameter has an invalid type
sap.ui.generic.app.navigation.service.SelectionVariant.setText(sNewText)
Sets the text / description of the selection variant.
Parameters:
{string}sNewText The new description to be used
Exceptions:
An instance of sap.ui.generic.app.navigation.service.NavError in case of input errors. Valid error codes are:
Error codeDescription
SelectionVariant.INVALID_INPUT_TYPEIndicates that an input parameter has an invalid type
sap.ui.generic.app.navigation.service.SelectionVariant.toJSONObject(): object
Returns the external representation of the selection variant as JSON object.
Returns:
{object} The external representation of this instance as a JSON object
sap.ui.generic.app.navigation.service.SelectionVariant.toJSONString(): string
Serializes this instance into a JSON-formatted string.
Returns:
{string} The JSON-formatted representation of this instance in stringified format