DownloadNode.js
3.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
/**
* Project : AMDA-NG4
* Name : DownloadNode.js
* @class amdaModel.DownloadNode
* @extends amdaModel.ExecutableNode
* @brief Basic Model of Node corresponding to a download request
* @author Myriam
* @version $Id: DownloadNode.js 2949 2015-06-23 10:25:59Z elena $
*/
Ext.define('amdaModel.DownloadNode', {
extend: 'amdaModel.ExecutableNode',
statics: {
nodeType: 'download',
objectName: 'Download'
},
constructor : function(config) {
this.callParent(arguments);
this.set('moduleId',myDesktopApp.dynamicModules.download.id);
this.set('objectDataModel',amdaModel.Download.$className);
},
decodeObject: function(obj) {
var myValues = new Object();
myValues.list=[];
obj.panels().each(function (panel) {
panel.params().each(function (param) {
var myParam = new Object();
myParam.paramid = param.get('paramid');
myParam.type = param.get('type');
myParam['dim1-index'] = param.get('dim1-index');
myParam['dim1-sum-type'] = param.get('dim1-sum-type');
myParam['dim1-min-value'] = param.get('dim1-min-value');
myParam['dim1-max-value'] = param.get('dim1-max-value');
myParam['dim1-min-index'] = param.get('dim1-min-index');
myParam['dim1-max-index'] = param.get('dim1-max-index');
myParam['dim2-index'] = param.get('dim2-index');
myParam['dim2-sum-type'] = param.get('dim2-sum-type');
myParam['dim2-min-value'] = param.get('dim2-min-value');
myParam['dim2-max-value'] = param.get('dim2-max-value');
myParam['dim2-min-index'] = param.get('dim2-min-index');
myParam['dim2-max-index'] = param.get('dim2-max-index');
myParam.template_args = param.get('template_args');
if (!param.get('plotonly')) {
myValues.list.push(myParam);
}
else
alert('Parameter '+ myParam.paramid + ' is PlotOnly');
});
});
myValues.timesrc = obj.get('timesrc');
// if there's at least one timeTable name into 'timeTables' collection
if (myValues.timesrc == amdaModel.AmdaTimeObject.inputTimeSrc[0]
&& obj.get('timeTables')
&& obj.get('timeTables').length){
// get complete timeTables collection
var timeTables = obj.get('timeTables');
// init an empty array for timeTables
myValues.timeTables=[];
// for each interval record
Ext.Array.each(timeTables, function(item, index, all){
if (!item.$className) {
myValues.timeTables[index] = {timeTableName : item.timeTableName, id : item.id};
}
// get Json simplified value
else {
myValues.timeTables[index] = item.getJsonValues();
}
});
}
else {
myValues.startDate = Ext.Date.format(obj.get('startDate'), 'Y-m-d\\TH:i:s.u');
myValues.stopDate = Ext.Date.format(obj.get('startDate'), 'Y-m-d\\TH:i:s.u');
myValues.durationDay = obj.get('durationDay');
myValues.durationHour = obj.get('durationHour');
myValues.durationMin = obj.get('durationMin');
myValues.durationSec = obj.get('durationSec');
myValues.durationMs = obj.get('durationMs');
}
myValues.name = obj.get('name');
return myValues;
}
});