class sap.ui.model.odata.ODataMetadata

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

Implementation to access OData metadata


Constructor

Constructor for a new ODataMetadata.

new sap.ui.model.odata.ODataMetadata(sMetadataURI, mParams?)
Param Type Default Value Description
sMetadataURI string

needs the correct metadata uri including $metadata

mParams? object

optional map of parameters.

async? boolean true

request is per default async

user? string

Deprecated for security reasons. Use strong server side authentication instead. UserID for the service.

password? string

Deprecated for security reasons. Use strong server side authentication instead. Password for the service.

headers? object

(optional) map of custom headers which should be set with the request.

cacheKey? string

(optional) A valid cache key


Events Overview

Event Description
failed

The failed event is fired when loading or parsing metadata failed.

loaded

The loaded event is fired after metadata has been loaded and parsed.

failed

The failed event is fired when loading or parsing metadata failed.

Param Type Description
oEvent sap.ui.base.Event

loaded

The loaded event is fired after metadata has been loaded and parsed.

Param Type Description
oEvent sap.ui.base.Event

Methods Overview

Method Description
attachFailed

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

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

attachLoaded

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

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

detachFailed

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

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

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

sap.ui.model.odata.ODataMetadata.extend

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

sap.ui.model.odata.ODataMetadata.getMetadata

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

getServiceMetadata

Return the metadata object.

getUseBatch

Get the use-batch extension value if any

isFailed

Checks whether metadata loading has already failed.

isLoaded

Checks whether metadata is available.

loaded

Returns a promise for the loaded state of the metadata.

refresh

Refreshes the metadata creating a new request to the server.

Returns a new promise which can be resolved or rejected depending on the metadata loading state.

attachFailed

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

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

attachLoaded

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

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

detachFailed

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

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

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

Creates a new subclass of class sap.ui.model.odata.ODataMetadata 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 to pass along with the event

sap.ui.model.odata.ODataMetadata.getMetadata

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

getServiceMetadata

Return the metadata object.

getUseBatch

Get the use-batch extension value if any

isFailed

Checks whether metadata loading has already failed.

isLoaded

Checks whether metadata is available.

loaded

Returns a promise for the loaded state of the metadata.

Param Type DefaultValue Description
bRejectOnFailure boolean false

With bRejectOnFailure=false the returned promise is not rejected. In case of failure this promise stays pending. Since 1.79 with bRejectOnFailure=true the returned promise is rejected when the initial loading of the metadata fails.

refresh

Refreshes the metadata creating a new request to the server.

Returns a new promise which can be resolved or rejected depending on the metadata loading state.