annotate app/model/Base.js @ 316:7de16725d251

Added docstring
author Torsten Irländer <torsten.irlaender@intevation.de>
date Tue, 13 Aug 2013 08:05:32 +0200
parents aeeb0f534411
children 7f5f74e62658
rev   line source
310
aeeb0f534411 Added Base model class
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
1 /**
aeeb0f534411 Added Base model class
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
2 * Base class for models
aeeb0f534411 Added Base model class
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
3 */
aeeb0f534411 Added Base model class
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
4 Ext.define('Lada.model.Base', {
aeeb0f534411 Added Base model class
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
5 extend: 'Ext.data.Model',
aeeb0f534411 Added Base model class
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
6 requires: ['Lada.lib.Helpers'],
aeeb0f534411 Added Base model class
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
7 /**
aeeb0f534411 Added Base model class
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
8 * Define fields in the model
aeeb0f534411 Added Base model class
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
9 */
aeeb0f534411 Added Base model class
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
10 fields: [],
aeeb0f534411 Added Base model class
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
11 /**
aeeb0f534411 Added Base model class
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
12 * Define the property which is used as unique attribute in the model.
aeeb0f534411 Added Base model class
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
13 * This might cause problems whith combined PK in the database. See
aeeb0f534411 Added Base model class
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
14 * https://roundup-intern.intevation.de/bfs/issue30
aeeb0f534411 Added Base model class
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
15 */
aeeb0f534411 Added Base model class
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
16 idProperty: null,
aeeb0f534411 Added Base model class
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
17 /**
aeeb0f534411 Added Base model class
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
18 * Define the URL of the (REST) ressource where to query for this model
aeeb0f534411 Added Base model class
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
19 */
aeeb0f534411 Added Base model class
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
20 proxyUrl: null,
aeeb0f534411 Added Base model class
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
21 /**
aeeb0f534411 Added Base model class
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
22 * The Proxy used for this model. Defaults to a REST proxy which returns
aeeb0f534411 Added Base model class
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
23 * JSON. The payload is expected to be in a "data" node. The url of the
aeeb0f534411 Added Base model class
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
24 * proxy is configured in the proxyUrl attribute.
aeeb0f534411 Added Base model class
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
25 */
aeeb0f534411 Added Base model class
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
26 proxy: {
aeeb0f534411 Added Base model class
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
27 type: 'rest',
aeeb0f534411 Added Base model class
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
28 appendId: true, //default
aeeb0f534411 Added Base model class
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
29 url: this.proxyUrl,
aeeb0f534411 Added Base model class
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
30 reader: {
aeeb0f534411 Added Base model class
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
31 type: 'json',
aeeb0f534411 Added Base model class
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
32 root: 'data'
aeeb0f534411 Added Base model class
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
33 }
aeeb0f534411 Added Base model class
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
34 },
aeeb0f534411 Added Base model class
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
35 /**
aeeb0f534411 Added Base model class
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
36 * Helper function to build an ID which is used in the proxy calls. This
aeeb0f534411 Added Base model class
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
37 * function is a workaround for
aeeb0f534411 Added Base model class
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
38 * https://roundup-intern.intevation.de/bfs/issue30
aeeb0f534411 Added Base model class
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
39 * as some items can not be identified with a singe id.
aeeb0f534411 Added Base model class
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
40 */
aeeb0f534411 Added Base model class
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
41 getEidi: function() {
aeeb0f534411 Added Base model class
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
42 var kid = this.get('kId');
aeeb0f534411 Added Base model class
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
43 var probeId = this.get('probeId');
aeeb0f534411 Added Base model class
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
44 return "/" + kid + "/" + probeId;
aeeb0f534411 Added Base model class
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
45 }
aeeb0f534411 Added Base model class
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
46 });

http://lada.wald.intevation.org