Show:

Serializer class for OData.

Methods

_appendIdToURL

(
  • id
  • url
)
private

Appends id to URL according to the OData specification.

Parameters:

_buildURL

(
  • modelName
  • id
)
String private

Overloaded method from build-url-mixin (Ember Data), taht builds URL to OData feed. Appends id as (id) (OData specification) instead of /id.

Parameters:

Returns:

_generateFunctionQueryString

(
  • queryParams
  • store
)
String private

A method to generate url part from queryParams.

Parameters:

Returns:

_getODataArgs

(
  • params
  • isEmber
  • isAction
)
Object private

A method to make args object function/action call method's.

Parameters:

Returns:

_normalizeBatchGetResponses

(
  • store
  • getResponses
  • errors
)
Object private

A method to normalize batch get responses.

Parameters:

Returns:

Object:

Normalized responses by record id.

_normalizeEmbeddedRelationship

() private

Fixes error with hasMany polymorphic relationships. Delete this after ember-data 3.5.0 update.

_sendRecord

() private

Makes HTTP request for creating, updating or deleting the record.

ajaxOptions

(
  • url
  • type
  • options
)
Object

Overloaded method from RESTAdapter (Ember Data). Customizes ajax options for the requests.

Parameters:

Returns:

batchSelect

(
  • store
  • queries
)
Promise

A method to get array of models with batch request.

Parameters:

  • store DS.Store

    The store.

  • queries Array

    Array of Flexberry Query objects.

Returns:

Promise:

A promise that fulfilled with an array of query responses.

batchUpdate

(
  • store
  • models
  • getProjections
)
Promise

A method to send batch update, create or delete models in single transaction.

All models saving using this method must have identifiers.

The array which fulfilled the promise may contain the following values:

  • same model object - for created, updated or unaltered records.
  • null - for deleted records.

Parameters:

  • store DS.Store

    The store.

  • models DS.Model[] | DS.Model

    Is array of models or single model for batch update.

  • getProjections Object

    Optional projections for updated models.

Returns:

Promise:

A promise that fulfilled with an array of models in the new state.

callAction

(
  • args
)
Promise

A method to call OData actions using ajax request.

Parameters:

  • args Object

    Method arguments.

    • actionName Object

      OData action name (required).

    • data Object

      OData action data.

    • url String

      Backend url.

    • fields Object

      Request's xhrFields.

    • store Object

      Ember's store, needed when results are ember models.

    • modelName String

      Model name, needed when results are ember models.

    • successCallback Function

      Success callback.

    • failCallback Function

      Fail callback.

    • alwaysCallback Function

      Always callback.

Returns:

callEmberOdataAction

(
  • args
)
Promise

A method to call OData actions that returns model records using ajax request.

Parameters:

  • args Object

    Method arguments.

    • actionName Object

      OData action name (required).

    • data Object

      OData action data.

    • url String

      Backend url.

    • fields Object

      Request's xhrFields.

    • store Object

      Ember's store.

    • modelName String

      Model name.

    • successCallback Function

      Success callback.

    • failCallback Function

      Fail callback.

    • alwaysCallback Function

      Always callback.

Returns:

callEmberOdataFunction

(
  • args
)
Promise

A method to call OData functions that returns model records using ajax request.

Parameters:

  • args Object

    Method arguments.

    • functionName Object

      OData functioin name (required).

    • params Object

      OData function parameters.

    • url String

      Backend url.

    • fields Object

      Request's xhrFields.

    • store Object

      Ember's store.

    • modelName String

      Model name.

    • modelProjection String

      Model projection.

    • successCallback Function

      Success callback.

    • failCallback Function

      Fail callback.

    • alwaysCallback Function

      Always callback.

Returns:

callFunction

(
  • args
)
Promise

A method to call OData functions using ajax request.

Parameters:

  • args Object

    Method arguments.

    • functionName Object

      OData functioin name (required).

    • params Object

      OData function parameters.

    • url String

      Backend url.

    • fields Object

      Request's xhrFields.

    • store Object

      Ember's store, needed when results are ember models.

    • modelName String

      Model name, needed when results are ember models.

    • modelProjection String

      Model projection, needed when results are ember models.

    • successCallback Function

      Success callback.

    • failCallback Function

      Fail callback.

    • alwaysCallback Function

      Always callback.

Returns:

findAll

(
  • store
  • type
  • sinceToken
  • snapshotRecordArray
)
Promise

Overloaded method from RESTAdapter (Ember Data). Called by the sore in order to fetch all records from the server.

Parameters:

Returns:

Promise:

promise

findRecord

(
  • store
  • type
  • id
  • snapshot
)
Promise

Overloaded method from RESTAdapter (Ember Data). Called by the sore in order to fetch single record by ID from the server.

Parameters:

Returns:

Promise:

promise

generateActionUrl

(
  • actionName
  • data
  • url
)
String

A method to generate url for ajax request to odata action.

Parameters:

Returns:

getModelNameFromOdataContext

(
  • context
)
String

A method to get model name from odata context.

Parameters:

  • context String

    OData context from get response.

Returns:

String:

Model name.

handleResponse

(
  • status
  • headers
  • payload
)

Takes an ajax response, and returns the json payload or an error.

Parameters:

makeRequest

(
  • params
)
public

A method to make ajax requests.

Parameters:

pathForType

(
  • modelName
)
String

Overloaded method from build-url-mixin (Ember Data), that determines the pathname for a given type. Additionally capitalizes the type name (requirement of Flexberry OData Server).

Parameters:

Returns:

String:

The path for a given type.

query

(
  • store
  • type
  • query
)
Promise

Overloaded method from RESTAdapter (Ember Data). Called by the sore in order to fetch data from the server.

Parameters:

Returns:

queryRecord

(
  • store
  • type
  • query
)
Promise

Overloaded method from RESTAdapter (Ember Data). Called by the sore in order to fetch single record from the server.

Parameters:

Returns:

Promise:

promise

serializeBelongsTo

(
  • snapshot
  • json
  • relationship
)

serializeBelongsTo can be used to customize how DS.belongsTo properties are serialized. If there is set option odata-id at serializer and DS.belongsTo property is not null, then property will be serialized like:

RelationName@odata.bind': RelationType(RelatedObjectId)
                    

Parameters:

Properties

timeout

Number

Timeout for AJAX-requests.

Default: 0