Blame view

js/app/models/DownloadNode.js 3.65 KB
16035364   Benjamin Renard   First commit
1
2
3
4
/** 
 * Project  : AMDA-NG4
 * Name     : DownloadNode.js
 * @class   amdaModel.DownloadNode
915d6711   Benjamin Renard   DownloadNode now ...
5
 * @extends amdaModel.ExecutableNode
16035364   Benjamin Renard   First commit
6
7
 * @brief   Basic Model of Node corresponding to a download request
 * @author  Myriam
aa94fd24   elena   Merge with last svn
8
 * @version $Id: DownloadNode.js 2949 2015-06-23 10:25:59Z elena $
16035364   Benjamin Renard   First commit
9
 */
fdf1413b   Elena.Budnik   TT download
10

16035364   Benjamin Renard   First commit
11
12
Ext.define('amdaModel.DownloadNode', {

915d6711   Benjamin Renard   DownloadNode now ...
13
14
15
    extend: 'amdaModel.ExecutableNode',	

    statics: {
fb23b7fe   Benjamin Renard   Save 'used first ...
16
17
        nodeType: 'download',
        objectName: 'Download'
915d6711   Benjamin Renard   DownloadNode now ...
18
    },
16035364   Benjamin Renard   First commit
19
        
915d6711   Benjamin Renard   DownloadNode now ...
20
21
22
23
24
    constructor : function(config) {
        this.callParent(arguments);
        this.set('moduleId',myDesktopApp.dynamicModules.download.id);
        this.set('objectDataModel',amdaModel.Download.$className);
    },
16035364   Benjamin Renard   First commit
25
    
acafe456   Benjamin Renard   Fix Get Data
26
27
28
29
    decodeObject: function(obj) {
        var myValues  = new Object(); 		
        myValues.list=[];

915d6711   Benjamin Renard   DownloadNode now ...
30
        obj.panels().each(function (panel) {
acafe456   Benjamin Renard   Fix Get Data
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
            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');						
            });
        });				
915d6711   Benjamin Renard   DownloadNode now ...
55
        myValues.timesrc = obj.get('timesrc');
acafe456   Benjamin Renard   Fix Get Data
56
57
        // if there's at least one timeTable name into 'timeTables' collection
        if (myValues.timesrc == amdaModel.AmdaTimeObject.inputTimeSrc[0]
915d6711   Benjamin Renard   DownloadNode now ...
58
59
            && obj.get('timeTables')
            && obj.get('timeTables').length){
acafe456   Benjamin Renard   Fix Get Data
60
            // get complete timeTables collection
915d6711   Benjamin Renard   DownloadNode now ...
61
            var timeTables =  obj.get('timeTables');	    
acafe456   Benjamin Renard   Fix Get Data
62
63
64
65
66
67
68
69
70
71
72
73
74
75
            // 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 {
79a60955   Hacene SI HADJ MOHAND   ms ok affichage ko
76
77
            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');
915d6711   Benjamin Renard   DownloadNode now ...
78
79
80
81
            myValues.durationDay = obj.get('durationDay');
            myValues.durationHour = obj.get('durationHour');
            myValues.durationMin = obj.get('durationMin');
            myValues.durationSec = obj.get('durationSec');
b852834a   Hacene SI HADJ MOHAND   progress
82
            myValues.durationMs = obj.get('durationMs');
acafe456   Benjamin Renard   Fix Get Data
83
84
        }

915d6711   Benjamin Renard   DownloadNode now ...
85
        myValues.name = obj.get('name');
acafe456   Benjamin Renard   Fix Get Data
86
        return myValues;
915d6711   Benjamin Renard   DownloadNode now ...
87
    }
16035364   Benjamin Renard   First commit
88
});