annotate app/model/Probe.js @ 1234:390dabbf27ed

Empty string for media descriptor is disallowed. This follows server Rev 1ef08710aaeb.
author Tom Gottfried <tom@intevation.de>
date Fri, 28 Oct 2016 21:23:31 +0200
parents eeed1b92341f
children aaab7ca3c040
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 }, {
1217
4270da0f7d3b Merged branch schema-update into default.
Tom Gottfried <tom@intevation.de>
parents: 1066
diff changeset
23 name: 'idAlt'
548
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 }, {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
30 name: 'mstId'
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
31 }, {
1066
d198946e5540 Introduced laborMstId as new probe field.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 999
diff changeset
32 name: 'laborMstId'
d198946e5540 Introduced laborMstId as new probe field.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 999
diff changeset
33 }, {
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
34 name: 'datenbasisId'
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
35 }, {
1217
4270da0f7d3b Merged branch schema-update into default.
Tom Gottfried <tom@intevation.de>
parents: 1066
diff changeset
36 name: 'baId',
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: 'probenartId'
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
39 }, {
1234
390dabbf27ed Empty string for media descriptor is disallowed.
Tom Gottfried <tom@intevation.de>
parents: 1229
diff changeset
40 name: 'mediaDesk',
390dabbf27ed Empty string for media descriptor is disallowed.
Tom Gottfried <tom@intevation.de>
parents: 1229
diff changeset
41 serialize: function(value) {
390dabbf27ed Empty string for media descriptor is disallowed.
Tom Gottfried <tom@intevation.de>
parents: 1229
diff changeset
42 if (value === '') {
390dabbf27ed Empty string for media descriptor is disallowed.
Tom Gottfried <tom@intevation.de>
parents: 1229
diff changeset
43 return null;
390dabbf27ed Empty string for media descriptor is disallowed.
Tom Gottfried <tom@intevation.de>
parents: 1229
diff changeset
44 }
390dabbf27ed Empty string for media descriptor is disallowed.
Tom Gottfried <tom@intevation.de>
parents: 1229
diff changeset
45 return value;
390dabbf27ed Empty string for media descriptor is disallowed.
Tom Gottfried <tom@intevation.de>
parents: 1229
diff changeset
46 }
548
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);
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
65 }
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
66 }, {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
67 name: 'probeentnahmeEnde',
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
68 type: 'date',
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
69 convert: function(v) {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
70 if (!v) {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
71 return v;
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 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
74 }
548
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 name: 'mittelungsdauer'
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: 'letzteAenderung',
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
79 type: 'date',
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
80 convert: function(v) {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
81 if (!v) {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
82 return v;
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 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
85 }
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
86 }, {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
87 name: 'erzeugerId'
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
88 }, {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
89 name: 'probeNehmerId'
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
90 }, {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
91 name: 'mplId'
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: 'mprId'
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: 'solldatumBeginn',
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
96 type: 'date',
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
97 convert: function(v) {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
98 if (!v) {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
99 return v;
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 return new Date(v);
927
a1783726d43e Serialize empty solldatum values to 'null'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 926
diff changeset
102 },
a1783726d43e Serialize empty solldatum values to 'null'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 926
diff changeset
103 serialize: function(value) {
a1783726d43e Serialize empty solldatum values to 'null'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 926
diff changeset
104 if (value === '') {
a1783726d43e Serialize empty solldatum values to 'null'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 926
diff changeset
105 return null;
a1783726d43e Serialize empty solldatum values to 'null'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 926
diff changeset
106 }
a1783726d43e Serialize empty solldatum values to 'null'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 926
diff changeset
107 return value;
926
c75f13578315 Changed 'Solldatum' fields to readonly fields without default value.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 924
diff changeset
108 }
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
109 }, {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
110 name: 'solldatumEnde',
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
111 type: 'date',
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
112 convert: function(v) {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
113 if (!v) {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
114 return v;
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 return new Date(v);
927
a1783726d43e Serialize empty solldatum values to 'null'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 926
diff changeset
117 },
a1783726d43e Serialize empty solldatum values to 'null'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 926
diff changeset
118 serialize: function(value) {
a1783726d43e Serialize empty solldatum values to 'null'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 926
diff changeset
119 if (value === '') {
a1783726d43e Serialize empty solldatum values to 'null'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 926
diff changeset
120 return null;
a1783726d43e Serialize empty solldatum values to 'null'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 926
diff changeset
121 }
a1783726d43e Serialize empty solldatum values to 'null'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 926
diff changeset
122 return value;
926
c75f13578315 Changed 'Solldatum' fields to readonly fields without default value.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 924
diff changeset
123 }
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
124 }, {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
125 name: 'readonly',
692
c31644b3d445 added owner-field
Dustin Demuth <dustin@intevation.de>
parents: 689
diff changeset
126 type: 'boolean',
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
127 persist: false
689
c07419f07a0c Added field treeModified to models.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 677
diff changeset
128 }, {
711
af16a257d5f6 Updated the model to have correct tree_modified value and parent_modified
Raimund Renkert <raimund.renkert@intevation.de>
parents: 698
diff changeset
129 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
130 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
131 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
132 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
133 }
af16a257d5f6 Updated the model to have correct tree_modified value and parent_modified
Raimund Renkert <raimund.renkert@intevation.de>
parents: 698
diff changeset
134 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
135 }
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
136 }],
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
137
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
138 idProperty: 'id',
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
139
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
140 proxy: {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
141 type: 'rest',
999
f73ca04d73a7 Refactored Server URL
Dustin Demuth <dustin@intevation.de>
parents: 970
diff changeset
142 url: 'lada-server/rest/probe',
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
143 reader: {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
144 type: 'json',
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
145 root: 'data'
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
146 }
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
147 }
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
148 });

http://lada.wald.intevation.org