annotate app/model/Probe.js @ 958:5d57c6c53e20

Made the grids more robust against erroneous data
author Dustin Demuth <dustin@intevation.de>
date Tue, 10 Nov 2015 09:50:06 +0100
parents a1783726d43e
children f4eb53ba63fc
rev   line source
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
1 /* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
2 * Software engineering by Intevation GmbH
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
3 *
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
4 * This file is Free Software under the GNU GPL (v>=3)
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
5 * and comes with ABSOLUTELY NO WARRANTY! Check out
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
6 * the documentation coming with IMIS-Labordaten-Application for details.
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
7 */
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
8
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
9 /**
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
10 * A Probe.
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
11 * This class represents and defines the model of a 'Probe'
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
12 **/
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
13 Ext.define('Lada.model.Probe', {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
14 extend: 'Ext.data.Model',
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
15
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
16 fields: [{
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
17 name: 'id'
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
18 }, {
691
c5b8896768a2 Added Owner to Model
Dustin Demuth <dustin@intevation.de>
parents: 677
diff changeset
19 name: 'owner',
692
c31644b3d445 added owner-field
Dustin Demuth <dustin@intevation.de>
parents: 689
diff changeset
20 type: 'boolean',
c31644b3d445 added owner-field
Dustin Demuth <dustin@intevation.de>
parents: 689
diff changeset
21 persist: false
691
c5b8896768a2 Added Owner to Model
Dustin Demuth <dustin@intevation.de>
parents: 677
diff changeset
22 }, {
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
23 name: 'probeIdAlt'
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
24 }, {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
25 name: 'hauptprobenNr'
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
26 }, {
924
9265637fe6c0 changed layout of Probe form
Michael Stanko <mstanko@bfs.de>
parents: 711
diff changeset
27 name: 'test',
9265637fe6c0 changed layout of Probe form
Michael Stanko <mstanko@bfs.de>
parents: 711
diff changeset
28 type: 'boolean'
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
29 }, {
677
394c12b7bb21 Updated probe model to serialize empty strings to a null-value.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 548
diff changeset
30 name: 'netzbetreiberId',
394c12b7bb21 Updated probe model to serialize empty strings to a null-value.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 548
diff changeset
31 serialize: function(value) {
394c12b7bb21 Updated probe model to serialize empty strings to a null-value.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 548
diff changeset
32 if (value === '') {
394c12b7bb21 Updated probe model to serialize empty strings to a null-value.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 548
diff changeset
33 return null;
394c12b7bb21 Updated probe model to serialize empty strings to a null-value.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 548
diff changeset
34 }
394c12b7bb21 Updated probe model to serialize empty strings to a null-value.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 548
diff changeset
35 return value;
394c12b7bb21 Updated probe model to serialize empty strings to a null-value.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 548
diff changeset
36 }
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
37 }, {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
38 name: 'mstId'
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
39 }, {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
40 name: 'datenbasisId'
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
41 }, {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
42 name: 'baId'
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
43 }, {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
44 name: 'probenartId'
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
45 }, {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
46 name: 'mediaDesk'
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
47 }, {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
48 name: 'media'
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
49 }, {
677
394c12b7bb21 Updated probe model to serialize empty strings to a null-value.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 548
diff changeset
50 name: 'umwId',
394c12b7bb21 Updated probe model to serialize empty strings to a null-value.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 548
diff changeset
51 serialize: function(value) {
394c12b7bb21 Updated probe model to serialize empty strings to a null-value.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 548
diff changeset
52 if (value === '') {
394c12b7bb21 Updated probe model to serialize empty strings to a null-value.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 548
diff changeset
53 return null;
394c12b7bb21 Updated probe model to serialize empty strings to a null-value.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 548
diff changeset
54 }
394c12b7bb21 Updated probe model to serialize empty strings to a null-value.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 548
diff changeset
55 return value;
394c12b7bb21 Updated probe model to serialize empty strings to a null-value.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 548
diff changeset
56 }
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
57 }, {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
58 name: 'probeentnahmeBeginn',
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
59 type: 'date',
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
60 convert: function(v) {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
61 if (!v) {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
62 return v;
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
63 }
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
64 return new Date(v);
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
65 },
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
66 defaultValue: new Date()
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
67 }, {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
68 name: 'probeentnahmeEnde',
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
69 type: 'date',
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
70 convert: function(v) {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
71 if (!v) {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
72 return v;
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
73 }
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
74 return new Date(v);
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
75 },
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
76 defaultValue: new Date()
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
77 }, {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
78 name: 'mittelungsdauer'
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
79 }, {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
80 name: 'letzteAenderung',
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
81 type: 'date',
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
82 convert: function(v) {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
83 if (!v) {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
84 return v;
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
85 }
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
86 return new Date(v);
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
87 },
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
88 defaultValue: new Date()
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
89 }, {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
90 name: 'erzeugerId'
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
91 }, {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
92 name: 'probeNehmerId'
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
93 }, {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
94 name: 'mpKat'
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
95 }, {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
96 name: 'mplId'
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
97 }, {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
98 name: 'mprId'
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
99 }, {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
100 name: 'solldatumBeginn',
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
101 type: 'date',
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
102 convert: function(v) {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
103 if (!v) {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
104 return v;
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
105 }
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
106 return new Date(v);
927
a1783726d43e Serialize empty solldatum values to 'null'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 926
diff changeset
107 },
a1783726d43e Serialize empty solldatum values to 'null'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 926
diff changeset
108 serialize: function(value) {
a1783726d43e Serialize empty solldatum values to 'null'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 926
diff changeset
109 if (value === '') {
a1783726d43e Serialize empty solldatum values to 'null'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 926
diff changeset
110 return null;
a1783726d43e Serialize empty solldatum values to 'null'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 926
diff changeset
111 }
a1783726d43e Serialize empty solldatum values to 'null'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 926
diff changeset
112 return value;
926
c75f13578315 Changed 'Solldatum' fields to readonly fields without default value.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 924
diff changeset
113 }
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
114 }, {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
115 name: 'solldatumEnde',
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
116 type: 'date',
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
117 convert: function(v) {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
118 if (!v) {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
119 return v;
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
120 }
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
121 return new Date(v);
927
a1783726d43e Serialize empty solldatum values to 'null'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 926
diff changeset
122 },
a1783726d43e Serialize empty solldatum values to 'null'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 926
diff changeset
123 serialize: function(value) {
a1783726d43e Serialize empty solldatum values to 'null'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 926
diff changeset
124 if (value === '') {
a1783726d43e Serialize empty solldatum values to 'null'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 926
diff changeset
125 return null;
a1783726d43e Serialize empty solldatum values to 'null'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 926
diff changeset
126 }
a1783726d43e Serialize empty solldatum values to 'null'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 926
diff changeset
127 return value;
926
c75f13578315 Changed 'Solldatum' fields to readonly fields without default value.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 924
diff changeset
128 }
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
129 }, {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
130 name: 'readonly',
692
c31644b3d445 added owner-field
Dustin Demuth <dustin@intevation.de>
parents: 689
diff changeset
131 type: 'boolean',
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
132 persist: false
689
c07419f07a0c Added field treeModified to models.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 677
diff changeset
133 }, {
711
af16a257d5f6 Updated the model to have correct tree_modified value and parent_modified
Raimund Renkert <raimund.renkert@intevation.de>
parents: 698
diff changeset
134 name: 'treeModified',
af16a257d5f6 Updated the model to have correct tree_modified value and parent_modified
Raimund Renkert <raimund.renkert@intevation.de>
parents: 698
diff changeset
135 serialize: function(value) {
af16a257d5f6 Updated the model to have correct tree_modified value and parent_modified
Raimund Renkert <raimund.renkert@intevation.de>
parents: 698
diff changeset
136 if (value === '') {
af16a257d5f6 Updated the model to have correct tree_modified value and parent_modified
Raimund Renkert <raimund.renkert@intevation.de>
parents: 698
diff changeset
137 return null;
af16a257d5f6 Updated the model to have correct tree_modified value and parent_modified
Raimund Renkert <raimund.renkert@intevation.de>
parents: 698
diff changeset
138 }
af16a257d5f6 Updated the model to have correct tree_modified value and parent_modified
Raimund Renkert <raimund.renkert@intevation.de>
parents: 698
diff changeset
139 return value;
af16a257d5f6 Updated the model to have correct tree_modified value and parent_modified
Raimund Renkert <raimund.renkert@intevation.de>
parents: 698
diff changeset
140 }
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
141 }],
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
142
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
143 idProperty: 'id',
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
144
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
145 proxy: {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
146 type: 'rest',
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
147 url: 'lada-server/probe',
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
148 reader: {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
149 type: 'json',
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
150 root: 'data'
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
151 }
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
152 }
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
153 });

http://lada.wald.intevation.org