annotate app/model/Probe.js @ 1403:0026b509a746

Backed out changeset b92aef19cff9. This change completely prevents creating a new Messung.
author Tom Gottfried <tom@intevation.de>
date Mon, 20 Mar 2017 13:21:22 +0100
parents 3b4dcc83a21b
children
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 }, {
1238
aaab7ca3c040 An empty string is only one time a valid idAlt.
Tom Gottfried <tom@intevation.de>
parents: 1234
diff changeset
23 name: 'idAlt',
aaab7ca3c040 An empty string is only one time a valid idAlt.
Tom Gottfried <tom@intevation.de>
parents: 1234
diff changeset
24 serialize: function(value) {
aaab7ca3c040 An empty string is only one time a valid idAlt.
Tom Gottfried <tom@intevation.de>
parents: 1234
diff changeset
25 if (value === '') {
aaab7ca3c040 An empty string is only one time a valid idAlt.
Tom Gottfried <tom@intevation.de>
parents: 1234
diff changeset
26 return null;
aaab7ca3c040 An empty string is only one time a valid idAlt.
Tom Gottfried <tom@intevation.de>
parents: 1234
diff changeset
27 }
aaab7ca3c040 An empty string is only one time a valid idAlt.
Tom Gottfried <tom@intevation.de>
parents: 1234
diff changeset
28 return value;
aaab7ca3c040 An empty string is only one time a valid idAlt.
Tom Gottfried <tom@intevation.de>
parents: 1234
diff changeset
29 }
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
30 }, {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
31 name: 'hauptprobenNr'
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
32 }, {
924
9265637fe6c0 changed layout of Probe form
Michael Stanko <mstanko@bfs.de>
parents: 711
diff changeset
33 name: 'test',
9265637fe6c0 changed layout of Probe form
Michael Stanko <mstanko@bfs.de>
parents: 711
diff changeset
34 type: 'boolean'
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
35 }, {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
36 name: 'mstId'
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
37 }, {
1066
d198946e5540 Introduced laborMstId as new probe field.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 999
diff changeset
38 name: 'laborMstId'
d198946e5540 Introduced laborMstId as new probe field.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 999
diff changeset
39 }, {
548
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 }, {
1280
3b4dcc83a21b fix sencha compile warnings
Michael Stanko <mstanko@bfs.de>
parents: 1238
diff changeset
42 name: 'baId'
548
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 }, {
1234
390dabbf27ed Empty string for media descriptor is disallowed.
Tom Gottfried <tom@intevation.de>
parents: 1229
diff changeset
46 name: 'mediaDesk',
390dabbf27ed Empty string for media descriptor is disallowed.
Tom Gottfried <tom@intevation.de>
parents: 1229
diff changeset
47 serialize: function(value) {
390dabbf27ed Empty string for media descriptor is disallowed.
Tom Gottfried <tom@intevation.de>
parents: 1229
diff changeset
48 if (value === '') {
390dabbf27ed Empty string for media descriptor is disallowed.
Tom Gottfried <tom@intevation.de>
parents: 1229
diff changeset
49 return null;
390dabbf27ed Empty string for media descriptor is disallowed.
Tom Gottfried <tom@intevation.de>
parents: 1229
diff changeset
50 }
390dabbf27ed Empty string for media descriptor is disallowed.
Tom Gottfried <tom@intevation.de>
parents: 1229
diff changeset
51 return value;
390dabbf27ed Empty string for media descriptor is disallowed.
Tom Gottfried <tom@intevation.de>
parents: 1229
diff changeset
52 }
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
53 }, {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
54 name: 'media'
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
55 }, {
677
394c12b7bb21 Updated probe model to serialize empty strings to a null-value.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 548
diff changeset
56 name: 'umwId',
394c12b7bb21 Updated probe model to serialize empty strings to a null-value.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 548
diff changeset
57 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
58 if (value === '') {
394c12b7bb21 Updated probe model to serialize empty strings to a null-value.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 548
diff changeset
59 return null;
394c12b7bb21 Updated probe model to serialize empty strings to a null-value.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 548
diff changeset
60 }
394c12b7bb21 Updated probe model to serialize empty strings to a null-value.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 548
diff changeset
61 return value;
394c12b7bb21 Updated probe model to serialize empty strings to a null-value.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 548
diff changeset
62 }
548
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 name: 'probeentnahmeBeginn',
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
65 type: 'date',
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
66 convert: function(v) {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
67 if (!v) {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
68 return v;
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
69 }
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
70 return new Date(v);
970
f4eb53ba63fc Setting Timestamps the correct way. Before this commit the times of the instatiation of the model were used as default values, which led to wrong dates.
Dustin Demuth <dustin@intevation.de>
parents: 927
diff changeset
71 }
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
72 }, {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
73 name: 'probeentnahmeEnde',
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
74 type: 'date',
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
75 convert: function(v) {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
76 if (!v) {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
77 return v;
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
78 }
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
79 return new Date(v);
970
f4eb53ba63fc Setting Timestamps the correct way. Before this commit the times of the instatiation of the model were used as default values, which led to wrong dates.
Dustin Demuth <dustin@intevation.de>
parents: 927
diff changeset
80 }
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
81 }, {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
82 name: 'mittelungsdauer'
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
83 }, {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
84 name: 'letzteAenderung',
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
85 type: 'date',
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
86 convert: function(v) {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
87 if (!v) {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
88 return v;
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 return new Date(v);
970
f4eb53ba63fc Setting Timestamps the correct way. Before this commit the times of the instatiation of the model were used as default values, which led to wrong dates.
Dustin Demuth <dustin@intevation.de>
parents: 927
diff changeset
91 }
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
92 }, {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
93 name: 'erzeugerId'
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
94 }, {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
95 name: 'probeNehmerId'
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
96 }, {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
97 name: 'mplId'
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
98 }, {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
99 name: 'mprId'
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
100 }, {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
101 name: 'solldatumBeginn',
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
102 type: 'date',
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
103 convert: function(v) {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
104 if (!v) {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
105 return v;
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
106 }
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
107 return new Date(v);
927
a1783726d43e Serialize empty solldatum values to 'null'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 926
diff changeset
108 },
a1783726d43e Serialize empty solldatum values to 'null'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 926
diff changeset
109 serialize: function(value) {
a1783726d43e Serialize empty solldatum values to 'null'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 926
diff changeset
110 if (value === '') {
a1783726d43e Serialize empty solldatum values to 'null'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 926
diff changeset
111 return null;
a1783726d43e Serialize empty solldatum values to 'null'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 926
diff changeset
112 }
a1783726d43e Serialize empty solldatum values to 'null'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 926
diff changeset
113 return value;
926
c75f13578315 Changed 'Solldatum' fields to readonly fields without default value.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 924
diff changeset
114 }
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
115 }, {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
116 name: 'solldatumEnde',
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
117 type: 'date',
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
118 convert: function(v) {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
119 if (!v) {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
120 return v;
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
121 }
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
122 return new Date(v);
927
a1783726d43e Serialize empty solldatum values to 'null'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 926
diff changeset
123 },
a1783726d43e Serialize empty solldatum values to 'null'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 926
diff changeset
124 serialize: function(value) {
a1783726d43e Serialize empty solldatum values to 'null'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 926
diff changeset
125 if (value === '') {
a1783726d43e Serialize empty solldatum values to 'null'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 926
diff changeset
126 return null;
a1783726d43e Serialize empty solldatum values to 'null'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 926
diff changeset
127 }
a1783726d43e Serialize empty solldatum values to 'null'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 926
diff changeset
128 return value;
926
c75f13578315 Changed 'Solldatum' fields to readonly fields without default value.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 924
diff changeset
129 }
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
130 }, {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
131 name: 'readonly',
692
c31644b3d445 added owner-field
Dustin Demuth <dustin@intevation.de>
parents: 689
diff changeset
132 type: 'boolean',
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
133 persist: false
689
c07419f07a0c Added field treeModified to models.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 677
diff changeset
134 }, {
711
af16a257d5f6 Updated the model to have correct tree_modified value and parent_modified
Raimund Renkert <raimund.renkert@intevation.de>
parents: 698
diff changeset
135 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
136 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
137 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
138 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
139 }
af16a257d5f6 Updated the model to have correct tree_modified value and parent_modified
Raimund Renkert <raimund.renkert@intevation.de>
parents: 698
diff changeset
140 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
141 }
548
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
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
144 idProperty: 'id',
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
145
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
146 proxy: {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
147 type: 'rest',
999
f73ca04d73a7 Refactored Server URL
Dustin Demuth <dustin@intevation.de>
parents: 970
diff changeset
148 url: 'lada-server/rest/probe',
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
149 reader: {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
150 type: 'json',
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
151 root: 'data'
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 }
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
154 });

http://lada.wald.intevation.org