Class sap.ui.model.odata.ODataAnnotationsModule: sap/ui/model/odata/ODataAnnotations
Implementation to access oData Annotations
Constructor Summary
new sap.ui.model.odata.ODataAnnotations(aAnnotationURI, oMetadata, mParams)
Method Summary
sap.ui.model.odata.ODataAnnotations.extend(sClassName, oClassInfo?, FNMetaImpl?)Creates a new subclass of class sap.ui.model.odata.ODataAnnotations with name
sClassName
and enriches it with the information contained in oClassInfo
.sap.ui.model.odata.ODataAnnotations.getMetadata()Returns a metadata object for class sap.ui.model.odata.ODataAnnotations.
attachFailed(oData?, fnFunction, oListener?)Attach event-handler
fnFunction
to the 'failed' event of this sap.ui.model.odata.ODataAnnotations
.attachLoaded(oData?, fnFunction, oListener?)Attach event-handler
fnFunction
to the 'loaded' event of this sap.ui.model.odata.ODataAnnotations
.detachFailed(fnFunction, oListener)Detach event-handler
fnFunction
from the 'failed' event of this sap.ui.model.odata.ODataAnnotations
.detachLoaded(fnFunction, oListener)Detach event-handler
fnFunction
from the 'loaded' event of this sap.ui.model.odata.ODataAnnotations
.Methods borrowed from class sap.ui.base.EventProvider
Methods borrowed from class sap.ui.base.Object
Constructor Detail
new sap.ui.model.odata.ODataAnnotations(aAnnotationURI, oMetadata, mParams)
Parameters:
{string|string[]} | aAnnotationURI | The annotation-URL or an array of URLS that should be parsed and merged |
{sap.ui.model.odata.ODataMetadata} | oMetadata | |
{object} | mParams |
Method Detail
sap.ui.model.odata.ODataAnnotations.extend(sClassName, oClassInfo?, FNMetaImpl?): function
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.
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.ODataAnnotations.getMetadata(): sap.ui.base.Metadata
Returns a metadata object for class sap.ui.model.odata.ODataAnnotations.
Returns:
{sap.ui.base.Metadata} | Metadata object describing this class |
addUrl(vUrl): Promise
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.
Parameters:
{string|sting[]} | vUrl | Either one URL as string or an array of URL strings |
Returns:
{Promise} | The Promise to load the given URL(s), resolved if all URLs have been loaded, rejected if at least one failed to load. The argument is an object containing the annotations object, success (an array of sucessfully loaded URLs), fail (an array ob of failed URLs). |
attachFailed(oData?, fnFunction, oListener?): sap.ui.model.odata.ODataAnnotations
Attach event-handler
fnFunction
to the 'failed' event of this sap.ui.model.odata.ODataAnnotations
. Parameters:
{object} | oData? | The object, that should be passed along with the event-object when firing the event. |
{function} | fnFunction | The function to call, when the event occurs. This function will be called on the oListener-instance (if present) or in a 'static way'. |
{object} | oListener? | Object on which to call the given function. If empty, the global context (window) is used. |
Returns:
{sap.ui.model.odata.ODataAnnotations} | this to allow method chaining |
attachLoaded(oData?, fnFunction, oListener?): sap.ui.model.odata.ODataAnnotations
Attach event-handler
fnFunction
to the 'loaded' event of this sap.ui.model.odata.ODataAnnotations
. Parameters:
{object} | oData? | The object, that should be passed along with the event-object when firing the event. |
{function} | fnFunction | The function to call, when the event occurs. This function will be called on the oListener-instance (if present) or in a 'static way'. |
{object} | oListener? | Object on which to call the given function. If empty, the global context (window) is used. |
Returns:
{sap.ui.model.odata.ODataAnnotations} | this to allow method chaining |
detachFailed(fnFunction, oListener): sap.ui.model.odata.ODataAnnotations
Detach event-handler
fnFunction
from the 'failed' event of this sap.ui.model.odata.ODataAnnotations
. The passed function and listener object must match the ones previously used for event registration.
Parameters:
{function} | fnFunction | The function to call, when the event occurs. |
{object} | oListener | Object on which the given function had to be called. |
Returns:
{sap.ui.model.odata.ODataAnnotations} | this to allow method chaining |
detachLoaded(fnFunction, oListener): sap.ui.model.odata.ODataAnnotations
Detach event-handler
fnFunction
from the 'loaded' event of this sap.ui.model.odata.ODataAnnotations
. The passed function and listener object must match the ones previously used for event registration.
Parameters:
{function} | fnFunction | The function to call, when the event occurs. |
{object} | oListener | Object on which the given function had to be called. |
Returns:
{sap.ui.model.odata.ODataAnnotations} | this to allow method chaining |
fireFailed(mArguments?): sap.ui.model.odata.ODataAnnotations
Fire event failed to attached listeners.
Parameters:
{object} | mArguments? | the arguments to pass along with the event. |
{string} | mArguments.message? | A text that describes the failure. |
{string} | mArguments.statusCode? | HTTP status code returned by the request (if available) |
{string} | mArguments.statusText? | The status as a text, details not specified, intended only for diagnosis output |
{string} | mArguments.responseText? | Response that has been received for the request ,as a text string |
Returns:
{sap.ui.model.odata.ODataAnnotations} | this to allow method chaining |
fireLoaded(mArguments?): sap.ui.model.odata.ODataAnnotations
Fire event loaded to attached listeners.
Parameters:
{map} | mArguments? | Map of arguments that will be given as parameters to teh event handler |
Returns:
{sap.ui.model.odata.ODataAnnotations} | this to allow method chaining |
getAnnotationsData(): object
returns the raw annotation data
Returns:
{object} | returns annotations data |
isFailed(): boolean
Checks whether annotations loading of at least one of the given URLs has already failed. Note: For asynchronous annotations attachFailed has to be used.
Returns:
{boolean} | whether annotations request has failed |
isLoaded(): boolean
Checks whether annotations from at least one source are available
Returns:
{boolean} | returns whether annotations is already loaded |
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. |
setXML(oXMLDocument, sXMLContent, mOptions?): boolean
Sets an XML document
Parameters:
{object} | oXMLDocument | The XML document to parse for annotations |
{string} | sXMLContent | The XML content as string to parse for annotations |
{map} | mOptions? | Additional options |
{fuction} | mOptions.success? | 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. |
{fuction} | mOptions.error? | 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. |
{boolean} | mOptions.fireEvents? | If this option is set to true, events are fired as if the annotations were loaded from a URL |
Returns:
{boolean} | Whether or not parsing was successful |