Annotation loader for OData V2 services
Creates a new instance of the ODataAnnotations annotation loader.
new sap.ui.model.odata.v2.ODataAnnotations(oMetadata, mOptions)
Param | Type | Default Value | Description |
---|---|---|---|
oMetadata | sap.ui.model.odata.ODataMetadata | Metadata object with the metadata information needed to parse the annotations |
|
mOptions | object | Obligatory options |
|
source | string Object<string,any> string[] Array<Object<string,any>> | One or several annotation sources; see #addSource for more details |
|
headers | Object<string,string> | A map of headers to be sent with every request; see #setHeaders for more details |
|
skipMetadata | boolean | Whether the metadata document will not be parsed for annotations |
|
cacheKey? | string | A valid cache key |
Method | Description |
---|---|
addSource |
Adds one or several sources to the annotation loader. Sources will be loaded instantly but merged only after the previously added source has either been successfully merged or failed. |
attachAllFailed |
Attaches the given callback to the This event exists for compatibility with the old Annotation loader. It is fired when no annotation from a group of sources was successfully (loaded,) parsed and merged. The parameter When called, the context of the event handler (its |
attachError |
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: When called, the context of the event handler (its |
attachFailed |
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 When called, the context of the event handler (its |
attachLoaded |
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 When called, the context of the event handler (its |
attachSomeLoaded |
Attaches the given callback to the This event exists for compatibility with the old annotation loader. It is fired when at least one annotation from a group of sources was successfully (loaded,) parsed and merged. The parameter When called, the context of the event handler (its |
attachSuccess |
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 are set on the event object that is given to the callback function: When called, the context of the event handler (its |
detachAllFailed |
Detaches the given callback from the The passed function and listener object must match the ones used for event registration. |
detachError |
Detaches the given callback from the The passed function and listener object must match the ones used for event registration. |
detachFailed |
Detaches the given callback from the The passed function and listener object must match the ones used for event registration. |
detachLoaded |
Detaches the given callback from the The passed function and listener object must match the ones used for event registration. |
detachSomeLoaded |
Detaches the given callback from the The passed function and listener object must match the ones used for event registration. |
detachSuccess |
Detaches the given callback from the The passed function and listener object must match the ones used for event registration. |
sap.ui.model.odata.v2.ODataAnnotations.extend |
Creates a new subclass of class sap.ui.model.odata.v2.ODataAnnotations with name
|
getAnnotationsData |
Returns the parsed and merged annotation data object.
Since 1.37.0 only kept for compatibility with V1 API, use {@link #getData} instead.
|
getData |
Returns the parsed and merged annotation data object. |
getHeaders |
Returns a map of custom headers that are sent with every request to an annotation URL. |
sap.ui.model.odata.v2.ODataAnnotations.getMetadata |
Returns a metadata object for class sap.ui.model.odata.v2.ODataAnnotations. |
loaded |
Returns a promise that resolves when the added annotation sources were successfully processed. |
setHeaders |
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 |
Adds one or several sources to the annotation loader. Sources will be loaded instantly but merged only after the previously added source has either been successfully merged or failed.
Param | Type | DefaultValue | Description |
---|---|---|---|
vSource | string string[] sap.ui.model.odata.v2.ODataAnnotations.Source sap.ui.model.odata.v2.ODataAnnotations.Source[] |
One or several Annotation source or array of annotation sources; an annotation source is either a string containing a URL or an object of type sap.ui.model.odata.v2.ODataAnnotations.Source. |
Attaches the given callback to the allFailed
event.
This event exists for compatibility with the old Annotation loader. It 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.
When called, the context of the event handler (its this
) will be bound to oListener
if specified, otherwise it will be bound to this sap.ui.model.odata.v2.ODataAnnotations
itself.
Param | Type | DefaultValue | Description |
---|---|---|---|
oData | object |
An application-specific payload object that will be passed to the event handler along with the event object when firing the event |
|
fnFunction | function |
The function to be called, when the event occurs |
|
oListener | object |
Context object to call the event handler with, defaults to this |
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 a URL or an XML string depending on how the source was added. error
- An Error object describing the problem that occurred
When called, the context of the event handler (its this
) will be bound to oListener
if specified, otherwise it will be bound to this sap.ui.model.odata.v2.ODataAnnotations
itself.
Param | Type | DefaultValue | Description |
---|---|---|---|
oData | object |
An application-specific payload object that will be passed to the event handler along with the event object when firing the event |
|
fnFunction | function |
The function to be called, when the event occurs |
|
oListener | object |
Context object to call the event handler with, defaults to this |
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.
When called, the context of the event handler (its this
) will be bound to oListener
if specified, otherwise it will be bound to this sap.ui.model.odata.v2.ODataAnnotations
itself.
Param | Type | DefaultValue | Description |
---|---|---|---|
oData | object |
An application-specific payload object that will be passed to the event handler along with the event object when firing the event |
|
fnFunction | function |
The function to be called, when the event occurs |
|
oListener | object |
Context object to call the event handler with, defaults to this |
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.
When called, the context of the event handler (its this
) will be bound to oListener
if specified, otherwise it will be bound to this sap.ui.model.odata.v2.ODataAnnotations
itself.
Param | Type | DefaultValue | Description |
---|---|---|---|
oData | object |
An application-specific payload object that will be passed to the event handler along with the event object when firing the event |
|
fnFunction | function |
The function to be called, when the event occurs |
|
oListener | object |
Context object to call the event handler with, defaults to this |
Attaches the given callback to the someLoaded
event.
This event exists for compatibility with the old annotation loader. It 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.
When called, the context of the event handler (its this
) will be bound to oListener
if specified, otherwise it will be bound to this sap.ui.model.odata.v2.ODataAnnotations
itself.
Param | Type | DefaultValue | Description |
---|---|---|---|
oData | object |
An application-specific payload object that will be passed to the event handler along with the event object when firing the event |
|
fnFunction | function |
The function to be called, when the event occurs |
|
oListener | object |
Context object to call the event handler with, defaults to this |
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 are 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 a URL or an XML string depending on how the source was added.
When called, the context of the event handler (its this
) will be bound to oListener
if specified, otherwise it will be bound to this sap.ui.model.odata.v2.ODataAnnotations
itself.
Param | Type | DefaultValue | Description |
---|---|---|---|
oData | object |
An application-specific payload object that will be passed to the event handler along with the event object when firing the event |
|
fnFunction | function |
The function to be called, when the event occurs |
|
oListener | object |
Context object to call the event handler with, defaults to this |
Detaches the given callback from the allFailed
event.
The passed function and listener object must match the ones used for event registration.
Param | Type | DefaultValue | Description |
---|---|---|---|
fnFunction | function |
The function to be called, when the event occurs |
|
oListener | object |
Context object on which the given function had to be called |
Detaches the given callback from the error
event.
The passed function and listener object must match the ones used for event registration.
Param | Type | DefaultValue | Description |
---|---|---|---|
fnFunction | function |
The function to be called, when the event occurs |
|
oListener | object |
Context object on which the given function had to be called |
Detaches the given callback from the failed
event.
The passed function and listener object must match the ones used for event registration.
Param | Type | DefaultValue | Description |
---|---|---|---|
fnFunction | function |
The function to be called, when the event occurs |
|
oListener | object |
Context object on which the given function had to be called |
Detaches the given callback from the loaded
event.
The passed function and listener object must match the ones used for event registration.
Param | Type | DefaultValue | Description |
---|---|---|---|
fnFunction | function |
The function to be called, when the event occurs |
|
oListener | object |
Context object on which the given function had to be called |
Detaches the given callback from the someLoaded
event.
The passed function and listener object must match the ones used for event registration.
Param | Type | DefaultValue | Description |
---|---|---|---|
fnFunction | function |
The function to be called, when the event occurs |
|
oListener | object |
Context object on which the given function had to be called |
Detaches the given callback from the success
event.
The passed function and listener object must match the ones used for event registration.
Param | Type | DefaultValue | Description |
---|---|---|---|
fnFunction | function |
The function to be called, when the event occurs |
|
oListener | object |
Context object on which the given function had to be called |
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.
Param | Type | DefaultValue | Description |
---|---|---|---|
sClassName | string |
Name of the class being created |
|
oClassInfo | object |
Object literal with information about the class |
|
FNMetaImpl | function |
Constructor function for the metadata object; if not given, it defaults to the metadata implementation used by this class |
Returns the parsed and merged annotation data object.
Returns a metadata object for class sap.ui.model.odata.v2.ODataAnnotations.
Returns a promise that resolves when the added annotation sources were successfully processed.
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 {}
. Note that when calling this method again, all previous custom headers are removed, unless they are specified again in the mCustomHeaders
parameter.
Param | Type | DefaultValue | Description |
---|---|---|---|
mHeaders | Object<string,string> |
the header name/value map. |