OData Class
addon/serializers/odata.js:8
Serializer class for OData.
Item Index
Methods
- _appendIdToURL
- _buildURL
- _generateFunctionQueryString
- _getODataArgs
- _normalizeBatchGetResponses
- _normalizeEmbeddedRelationship
- _sendRecord
- ajaxOptions
- batchSelect
- batchUpdate
- callAction
- callEmberOdataAction
- callEmberOdataFunction
- callFunction
- findAll
- findRecord
- generateActionUrl
- getModelNameFromOdataContext
- handleResponse
- makeRequest
- pathForType
- query
- queryRecord
- serializeBelongsTo
Properties
Methods
_appendIdToURL
-
id
-
url
Appends id to URL according to the OData specification.
_buildURL
-
modelName
-
id
Overloaded method from build-url-mixin
(Ember Data), taht builds URL to OData feed.
Appends id as (id)
(OData specification) instead of /id
.
Returns:
_generateFunctionQueryString
-
queryParams
-
store
A method to generate url part from queryParams.
Returns:
_getODataArgs
-
params
-
isEmber
-
isAction
A method to make args object function/action call method's.
Returns:
_normalizeBatchGetResponses
-
store
-
getResponses
-
errors
A method to normalize batch get responses.
Returns:
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
Overloaded method from RESTAdapter
(Ember Data).
Customizes ajax options for the requests.
Returns:
batchSelect
-
store
-
queries
A method to get array of models with batch request.
Returns:
A promise that fulfilled with an array of query responses.
batchUpdate
-
store
-
models
-
getProjections
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.StoreThe store.
-
models
DS.Model[] | DS.ModelIs array of models or single model for batch update.
-
getProjections
ObjectOptional projections for updated models.
Returns:
A promise that fulfilled with an array of models in the new state.
callAction
-
args
A method to call OData actions using ajax request.
Parameters:
-
args
ObjectMethod arguments.
-
actionName
ObjectOData action name (required).
-
data
ObjectOData action data.
-
url
StringBackend url.
-
fields
ObjectRequest's xhrFields.
-
store
ObjectEmber's store, needed when results are ember models.
-
modelName
StringModel name, needed when results are ember models.
-
successCallback
FunctionSuccess callback.
-
failCallback
FunctionFail callback.
-
alwaysCallback
FunctionAlways callback.
-
Returns:
callEmberOdataAction
-
args
A method to call OData actions that returns model records using ajax request.
Parameters:
-
args
ObjectMethod arguments.
-
actionName
ObjectOData action name (required).
-
data
ObjectOData action data.
-
url
StringBackend url.
-
fields
ObjectRequest's xhrFields.
-
store
ObjectEmber's store.
-
modelName
StringModel name.
-
successCallback
FunctionSuccess callback.
-
failCallback
FunctionFail callback.
-
alwaysCallback
FunctionAlways callback.
-
Returns:
callEmberOdataFunction
-
args
A method to call OData functions that returns model records using ajax request.
Parameters:
-
args
ObjectMethod arguments.
-
functionName
ObjectOData functioin name (required).
-
params
ObjectOData function parameters.
-
url
StringBackend url.
-
fields
ObjectRequest's xhrFields.
-
store
ObjectEmber's store.
-
modelName
StringModel name.
-
modelProjection
StringModel projection.
-
successCallback
FunctionSuccess callback.
-
failCallback
FunctionFail callback.
-
alwaysCallback
FunctionAlways callback.
-
Returns:
callFunction
-
args
A method to call OData functions using ajax request.
Parameters:
-
args
ObjectMethod arguments.
-
functionName
ObjectOData functioin name (required).
-
params
ObjectOData function parameters.
-
url
StringBackend url.
-
fields
ObjectRequest's xhrFields.
-
store
ObjectEmber's store, needed when results are ember models.
-
modelName
StringModel name, needed when results are ember models.
-
modelProjection
StringModel projection, needed when results are ember models.
-
successCallback
FunctionSuccess callback.
-
failCallback
FunctionFail callback.
-
alwaysCallback
FunctionAlways callback.
-
Returns:
findAll
-
store
-
type
-
sinceToken
-
snapshotRecordArray
Overloaded method from RESTAdapter
(Ember Data).
Called by the sore in order to fetch all records from the server.
Parameters:
-
store
DS.Store -
type
DS.Model -
sinceToken
String -
snapshotRecordArray
DS.SnapshotRecordArray
Returns:
promise
findRecord
-
store
-
type
-
id
-
snapshot
Overloaded method from RESTAdapter
(Ember Data).
Called by the sore in order to fetch single record by ID from the server.
Parameters:
-
store
DS.Store -
type
DS.Model -
id
String -
snapshot
DS.Snapshot
Returns:
promise
generateActionUrl
-
actionName
-
data
-
url
A method to generate url for ajax request to odata action.
Returns:
getModelNameFromOdataContext
-
context
A method to get model name from odata context.
Parameters:
-
context
StringOData context from get response.
Returns:
Model name.
handleResponse
-
status
-
headers
-
payload
Takes an ajax response, and returns the json payload or an error.
pathForType
-
modelName
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:
-
modelName
String
Returns:
The path for a given type.
query
-
store
-
type
-
query
Overloaded method from RESTAdapter
(Ember Data).
Called by the sore in order to fetch data from the server.
Returns:
queryRecord
-
store
-
type
-
query
Overloaded method from RESTAdapter
(Ember Data).
Called by the sore in order to fetch single record from the server.
Returns:
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:
-
snapshot
DS.Snapshot -
json
Object -
relationship
Object