class sap.ui.model.odata.ODataAnnotations

Visiblity: public
UX Guidelines:
Implements:
Available since: N/A
Module: sap/ui/model/odata/ODataAnnotations
Application Component: CA-UI5-COR

Implementation to access OData Annotations


Constructor

new sap.ui.model.odata.ODataAnnotations(aAnnotationURI, oMetadata, mParams)
Param Type Default Value Description
aAnnotationURI string string[]

The annotation-URL or an array of URLs that should be parsed and merged

oMetadata sap.ui.model.odata.ODataMetadata
mParams object

Events Overview

Event Description
failed

The failed event is fired when loading, parsing or merging new annotations failed.

loaded

The loaded event is fired after new annotations have been added to this object.

failed

The failed event is fired when loading, parsing or merging new annotations failed.

Param Type Description
oEvent sap.ui.base.Event

loaded

The loaded event is fired after new annotations have been added to this object.

Param Type Description
oEvent sap.ui.base.Event

Methods Overview

Method Description
addUrl

Adds either one URL or an array of URLs to be loaded and parsed. The result will be merged into the annotations data which can be retrieved using the getAnnotations-method.

attachFailed

Attaches event handler fnFunction to the failed event of this sap.ui.model.odata.ODataAnnotations.

attachLoaded

Attaches event handler fnFunction to the loaded event of this sap.ui.model.odata.ODataAnnotations.

detachFailed

Detaches event handler fnFunction from the failed event of this sap.ui.model.odata.ODataAnnotations.

The passed function and listener object must match the ones used for event registration.

detachLoaded

Detaches event handler fnFunction from the loaded event of this sap.ui.model.odata.ODataAnnotations.

The passed function and listener object must match the ones used for event registration.

sap.ui.model.odata.ODataAnnotations.extend

Creates a new subclass of class sap.ui.model.odata.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.

fireFailed

Fires event failed to attached listeners.

fireLoaded

Fires event loaded to attached listeners.

getAnnotationsData

returns the raw annotation data

sap.ui.model.odata.ODataAnnotations.getMetadata

Returns a metadata object for class sap.ui.model.odata.ODataAnnotations.

isFailed

Checks whether annotations loading of at least one of the given URLs has already failed. Note: For asynchronous annotations #attachFailed has to be used.

isLoaded

Checks whether annotations from at least one source are available

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 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.

setXML

Sets an XML document.

addUrl

Adds either one URL or an array of URLs to be loaded and parsed. The result will be merged into the annotations data which can be retrieved using the getAnnotations-method.

Param Type DefaultValue Description
vUrl string string[]

Either one URL as string or an array of URL strings

attachFailed

Attaches event handler fnFunction to the failed event of this sap.ui.model.odata.ODataAnnotations.

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 sap.ui.model.odata.ODataAnnotations itself

attachLoaded

Attaches event handler fnFunction to the loaded event of this sap.ui.model.odata.ODataAnnotations.

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 sap.ui.model.odata.ODataAnnotations itself

detachFailed

Detaches event handler fnFunction from the failed event of this sap.ui.model.odata.ODataAnnotations.

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

detachLoaded

Detaches event handler fnFunction from the loaded event of this sap.ui.model.odata.ODataAnnotations.

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

sap.ui.model.odata.ODataAnnotations.extend

Creates a new subclass of class sap.ui.model.odata.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

fireFailed

Fires event failed to attached listeners.

Param Type DefaultValue Description
oParameters object

Parameters to pass along with the event

message string

A text that describes the failure.

statusCode string

HTTP status code returned by the request (if available)

statusText string

The status as a text, details not specified, intended only for diagnosis output

responseText string

Response that has been received for the request ,as a text string

fireLoaded

Fires event loaded to attached listeners.

Param Type DefaultValue Description
oParameters object

Parameters that will be given as parameters to the event handler

getAnnotationsData

returns the raw annotation data

sap.ui.model.odata.ODataAnnotations.getMetadata

Returns a metadata object for class sap.ui.model.odata.ODataAnnotations.

isFailed

Checks whether annotations loading of at least one of the given URLs has already failed. Note: For asynchronous annotations #attachFailed has to be used.

isLoaded

Checks whether annotations from at least one source are available

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 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.

Param Type DefaultValue Description
mHeaders Object<string,string>

the header name/value map.

setXML

Sets an XML document.

Param Type DefaultValue Description
oXMLDocument object

The XML document to parse for annotations

sXMLContent string

The XML content as string to parse for annotations

mOptions object

Additional options

success function

Success callback gets an objec as argument with the properties "annotations" containing the parsed annotations and "xmlDoc" containing the XML-Document that was returned by the request.

error function

Error callback gets an objec as argument with the property "xmlDoc" containing the XML-Document that was returned by the request and could not be correctly parsed.

fireEvents boolean

If this option is set to true, events are fired as if the annotations were loaded from a URL