]>
git.wh0rd.org - tt-rss.git/blob - lib/dojo/data/api/Identity.js.uncompressed.js
1 define("dojo/data/api/Identity", ["../../_base/declare", "./Read"], function(declare
, Read
){
4 // dojo/data/api/Identity
6 return declare("dojo.data.api.Identity", Read
, {
8 // This is an abstract API that data provider implementations conform to.
9 // This file defines methods signatures and intentionally leaves all the
10 // methods unimplemented.
12 getFeatures: function(){
14 // See dojo/data/api/Read.getFeatures()
16 'dojo.data.api.Read': true,
17 'dojo.data.api.Identity': true
21 getIdentity: function(/* dojo/data/api/Item */ item){
23 // Returns a unique identifier for an item. The return value will be
24 // either a string or something that has a toString() method (such as,
25 // for example, a dojox/uuid object).
27 // The item from the store from which to obtain its identifier.
29 // Conforming implementations may throw an exception or return null if
30 // item is not an item.
32 // | var itemId = store.getIdentity(kermit);
33 // | assert(kermit === store.findByIdentity(store.getIdentity(kermit)));
34 throw new Error('Unimplemented API: dojo.data.api.Identity.getIdentity');
37 getIdentityAttributes: function(/* dojo/data/api/Item */ item){
39 // Returns an array of attribute names that are used to generate the identity.
40 // For most stores, this is a single attribute, but for some complex stores
41 // such as RDB backed stores that use compound (multi-attribute) identifiers
42 // it can be more than one. If the identity is not composed of attributes
43 // on the item, it will return null. This function is intended to identify
44 // the attributes that comprise the identity so that so that during a render
45 // of all attributes, the UI can hide the the identity information if it
48 // The item from the store from which to obtain the array of public attributes that
49 // compose the identifier, if any.
51 // | var itemId = store.getIdentity(kermit);
52 // | var identifiers = store.getIdentityAttributes(itemId);
53 // | assert(typeof identifiers === "array" || identifiers === null);
54 throw new Error('Unimplemented API: dojo.data.api.Identity.getIdentityAttributes');
58 fetchItemByIdentity: function(/* object */ keywordArgs
){
60 // Given the identity of an item, this method returns the item that has
61 // that identity through the onItem callback. Conforming implementations
62 // should return null if there is no item with the given identity.
63 // Implementations of fetchItemByIdentity() may sometimes return an item
64 // from a local cache and may sometimes fetch an item from a remote server,
66 // An anonymous object that defines the item to locate and callbacks to invoke when the
67 // item has been located and load has completed. The format of the object is as follows:
69 // | identity: string|object,
70 // | onItem: Function,
71 // | onError: Function,
75 // ####The *identity* parameter
77 // The identity parameter is the identity of the item you wish to locate and load
78 // This attribute is required. It should be a string or an object that toString()
81 // ####The *onItem* parameter
84 // The onItem parameter is the callback to invoke when the item has been loaded. It takes only one
85 // parameter, the item located, or null if none found.
87 // ####The *onError* parameter
90 // The onError parameter is the callback to invoke when the item load encountered an error. It takes only one
91 // parameter, the error object
93 // ####The *scope* parameter
95 // If a scope object is provided, all of the callback functions (onItem,
96 // onError, etc) will be invoked in the context of the scope object.
97 // In the body of the callback function, the value of the "this"
98 // keyword will be the scope object. If no scope object is provided,
99 // the callback functions will be called in the context of dojo.global.
100 // For example, onItem.call(scope, item, request) vs.
101 // onItem.call(dojo.global, item, request)
103 if(!this.isItemLoaded(keywordArgs
.item
)){
104 throw new Error('Unimplemented API: dojo.data.api.Identity.fetchItemByIdentity');