Class sap.ui.model.odata.v2.ODataAnnotationsModule: sap/ui/model/odata/v2/ODataAnnotations


Annotation loader for OData V2 services


Since: 1.37.0.
Constructor Summary
new sap.ui.model.odata.v2.ODataAnnotations(oMetadata, mOptions)Creates a new instance of the ODataAnnotations annotation loader.
Method Summary
sap.ui.model.odata.v2.ODataAnnotations.extend(sClassName, oClassInfo?, FNMetaImpl?)Creates a new subclass of class sap.ui.model.odata.v2.ODataAnnotations with name sClassName and enriches it with the information contained in oClassInfo.
sap.ui.model.odata.v2.ODataAnnotations.getMetadata()Returns a metadata object for class sap.ui.model.odata.v2.ODataAnnotations.
attachAllFailed(oData?, fnFunction, oListener?)This event exists for compatibility with the old Annotation loader Attaches the given callback to the allFailed event.
attachError(oData?, fnFunction, oListener?)Attaches the given callback to the error event, which is fired whenever a source cannot be loaded, parsed or merged into the annotation data.
attachFailed(oData?, fnFunction, oListener?)Attaches the given callback to the failed event.
attachLoaded(oData?, fnFunction, oListener?)Attaches the given callback to the loaded event.
attachSomeLoaded(oData?, fnFunction, oListener?)This event exists for compatibility with the old Annotation loader Attaches the given callback to the someLoaded event.
attachSuccess(oData?, fnFunction, oListener?)Attaches the given callback to the success event, which is fired whenever a source has been successfully (loaded,) parsed and merged into the annotation data.
detachAllFailed(fnFunction, oListener?)Detaches the given callback from the allFailed event.
detachError(fnFunction, oListener?)Detaches the given callback from the error event.
detachFailed(fnFunction, oListener?)Detaches the given callback from the failed event.
detachLoaded(fnFunction, oListener?)Detaches the given callback from the loaded event.
detachSomeLoaded(fnFunction, oListener?)Detaches the given callback from the someLoaded event.
detachSuccess(fnFunction, oListener?)Detaches the given callback from the success event.
getData()Returns the parsed and merged annotation data object
loaded()Returns a promise that resolves when the annotation sources that were added up to this point were successfully (loaded,) parsed and merged
setHeaders(mHeaders)Set custom headers which are provided in a key/value map.
getAnnotationsData()V1 API Compatibility method.
Methods borrowed from class sap.ui.base.Object
Constructor Detail
new sap.ui.model.odata.v2.ODataAnnotations(oMetadata, mOptions)
Creates a new instance of the ODataAnnotations annotation loader.
Parameters:
{sap.ui.model.odata.ODataMetadata}oMetadata Metadata object with the metadata information needed to parse the annotations
{map}mOptions Obligatory options
{string|map|string[]|map[]}mOptions.source One or several annotation sources. See sap.ui.model.odata.v2.ODataAnnotations#addSource for more details
{map}mOptions.headers A map of headers to be sent with every request. See sap.ui.model.odata.v2.ODataAnnotations#setHeaders for more details
{boolean}mOptions.skipMetadata If set to true, the metadata document will not be parsed for annotations;
Method Detail
sap.ui.model.odata.v2.ODataAnnotations.extend(sClassName, oClassInfo?, FNMetaImpl?): function
Creates a new subclass of class sap.ui.model.odata.v2.ODataAnnotations 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.EventProvider.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.model.odata.v2.ODataAnnotations.getMetadata(): sap.ui.base.Metadata
Returns a metadata object for class sap.ui.model.odata.v2.ODataAnnotations.
Returns:
{sap.ui.base.Metadata} Metadata object describing this class
attachAllFailed(oData?, fnFunction, oListener?): sap.ui.model.odata.v2.ODataAnnotations
This event exists for compatibility with the old Annotation loader Attaches the given callback to the allFailed event. This event is fired when no annotation from a group of sources was successfully (loaded,) parsed and merged. The parameter result will be set on the event argument and contains an array of Errors in the order in which the sources had been added.
Parameters:
{object}oData? The object, that should be passed along with the event-object when firing the event.
{function}fnFunction The event callback. This function will be called in the context of the oListener object if given as the next argument.
{object}oListener? Object to use as context of the callback. If empty, the global context is used.
Returns:
{sap.ui.model.odata.v2.ODataAnnotations}this-reference to allow method chaining
attachError(oData?, fnFunction, oListener?): sap.ui.model.odata.v2.ODataAnnotations
Attaches the given callback to the error event, which is fired whenever a source cannot be loaded, parsed or merged into the annotation data. The following parameters will be set on the event object that is given to the callback function: source - A map containing the properties type - containing either "url" or "xml" - and data containing the data given as source, either an URL or an XML string depending on how the source was added. error - An Error object describing the problem that occurred
Parameters:
{object}oData? The object, that should be passed along with the event-object when firing the event.
{function}fnFunction The event callback. This function will be called in the context of the oListener object if given as the next argument.
{object}oListener? Object to use as context of the callback. If empty, the global context is used.
Returns:
{sap.ui.model.odata.v2.ODataAnnotations}this-reference to allow method chaining
attachFailed(oData?, fnFunction, oListener?): sap.ui.model.odata.v2.ODataAnnotations
Attaches the given callback to the failed event. This event is fired when at least one annotation from a group of sources was not successfully (loaded,) parsed or merged. The parameter result will be set on the event argument and contains an array of Errors in the order in which the sources had been added.
Parameters:
{object}oData? The object, that should be passed along with the event-object when firing the event.
{function}fnFunction The event callback. This function will be called in the context of the oListener object if given as the next argument.
{object}oListener? Object to use as context of the callback. If empty, the global context is used.
Returns:
{sap.ui.model.odata.v2.ODataAnnotations}this-reference to allow method chaining
attachLoaded(oData?, fnFunction, oListener?): sap.ui.model.odata.v2.ODataAnnotations
Attaches the given callback to the loaded event. This event is fired when all annotations from a group of sources was successfully (loaded,) parsed and merged. The parameter result will be set on the event argument and contains an array of all loaded sources as well as Errors in the order in which they had been added.
Parameters:
{object}oData? The object, that should be passed along with the event-object when firing the event.
{function}fnFunction The event callback. This function will be called in the context of the oListener object if given as the next argument.
{object}oListener? Object to use as context of the callback. If empty, the global context is used.
Returns:
{sap.ui.model.odata.v2.ODataAnnotations}this-reference to allow method chaining
attachSomeLoaded(oData?, fnFunction, oListener?): sap.ui.model.odata.v2.ODataAnnotations
This event exists for compatibility with the old Annotation loader Attaches the given callback to the someLoaded event. This event is fired when at least one annotation from a group of sources was successfully (loaded,) parsed and merged. The parameter result will be set on the event argument and contains an array of all loaded sources as well as Errors in the order in which they had been added.
Parameters:
{object}oData? The object, that should be passed along with the event-object when firing the event.
{function}fnFunction The event callback. This function will be called in the context of the oListener object if given as the next argument.
{object}oListener? Object to use as context of the callback. If empty, the global context is used.
Returns:
{sap.ui.model.odata.v2.ODataAnnotations}this-reference to allow method chaining
attachSuccess(oData?, fnFunction, oListener?): sap.ui.model.odata.v2.ODataAnnotations
Attaches the given callback to the success event, which is fired whenever a source has been successfully (loaded,) parsed and merged into the annotation data. The following parameters will be set on the event object that is given to the callback function: source - A map containing the properties type - containing either "url" or "xml" - and data containing the data given as source, either an URL or an XML string depending on how the source was added.
Parameters:
{object}oData? The object, that should be passed along with the event-object when firing the event.
{function}fnFunction The event callback. This function will be called in the context of the oListener object if given as the next argument.
{object}oListener? Object to use as context of the callback. If empty, the global context is used.
Returns:
{sap.ui.model.odata.v2.ODataAnnotations}this-reference to allow method chaining.
detachAllFailed(fnFunction, oListener?): sap.ui.model.odata.v2.ODataAnnotations
Detaches the given callback from the allFailed event. The passed function and listener object must match the ones previously used for attaching to the event.
Parameters:
{function}fnFunction The event callback previously used with sap.ui.model.odata.v2.ODataAnnotations#attachFailed.
{object}oListener? The same (if any) context object that was used when attaching to the error event.
Returns:
{sap.ui.model.odata.v2.ODataAnnotations}this-reference to allow method chaining.
detachError(fnFunction, oListener?): sap.ui.model.odata.v2.ODataAnnotations
Detaches the given callback from the error event. The passed function and listener object must match the ones previously used for attaching to the event.
Parameters:
{function}fnFunction The event callback previously used with sap.ui.model.odata.v2.ODataAnnotations#attachError.
{object}oListener? The same (if any) context object that was used when attaching to the error event.
Returns:
{sap.ui.model.odata.v2.ODataAnnotations}this-reference to allow method chaining.
detachFailed(fnFunction, oListener?): sap.ui.model.odata.v2.ODataAnnotations
Detaches the given callback from the failed event. The passed function and listener object must match the ones previously used for attaching to the event.
Parameters:
{function}fnFunction The event callback previously used with sap.ui.model.odata.v2.ODataAnnotations#attachFailed.
{object}oListener? The same (if any) context object that was used when attaching to the error event.
Returns:
{sap.ui.model.odata.v2.ODataAnnotations}this-reference to allow method chaining.
detachLoaded(fnFunction, oListener?): sap.ui.model.odata.v2.ODataAnnotations
Detaches the given callback from the loaded event. The passed function and listener object must match the ones previously used for attaching to the event.
Parameters:
{function}fnFunction The event callback previously used with sap.ui.model.odata.v2.ODataAnnotations#attachLoaded.
{object}oListener? The same (if any) context object that was used when attaching to the error event.
Returns:
{sap.ui.model.odata.v2.ODataAnnotations}this-reference to allow method chaining.
detachSomeLoaded(fnFunction, oListener?): sap.ui.model.odata.v2.ODataAnnotations
Detaches the given callback from the someLoaded event. The passed function and listener object must match the ones previously used for attaching to the event.
Parameters:
{function}fnFunction The event callback previously used with sap.ui.model.odata.v2.ODataAnnotations#attachSomeLoaded.
{object}oListener? The same (if any) context object that was used when attaching to the error event.
Returns:
{sap.ui.model.odata.v2.ODataAnnotations}this-reference to allow method chaining.
detachSuccess(fnFunction, oListener?): sap.ui.model.odata.v2.ODataAnnotations
Detaches the given callback from the success event. The passed function and listener object must match the ones previously used for attaching to the event.
Parameters:
{function}fnFunction The event callback previously used with sap.ui.model.odata.v2.ODataAnnotations#attachSuccess.
{object}oListener? The same (if any) context object that was used when attaching to the success event.
Returns:
{sap.ui.model.odata.v2.ODataAnnotations}this-reference to allow method chaining.
getData(): object
Returns the parsed and merged annotation data object
Returns:
{object} returns annotations data
loaded(): Promise
Returns a promise that resolves when the annotation sources that were added up to this point were successfully (loaded,) parsed and merged
Returns:
{Promise} The Promise that resolves/rejects after the last added sources have been processed
setHeaders(mHeaders)
Set custom headers which are provided in a key/value map. These headers are used for all requests. The "Accept-Language" header cannot be modified and is set using the core's language setting.

To remove these headers, simply set the mHeaders parameter to {}. Please also note that when calling this method again all previous custom headers are removed unless they are specified again in the mCustomHeaders parameter.

Parameters:
{map}mHeaders the header name/value map.
getAnnotationsData(): object
V1 API Compatibility method. @see sap.ui.model.odata.v2.ODataAnnotations#getData Returns the parsed and merged annotation data object
Deprecated:
true
Returns:
{object} returns annotations data