RequestParamObject.js
2.4 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
/**
* Project : AMDA-NG
* Name : RequestParamObject.js
* Description : Request Param Business Object Definition
* @class amdaModel.RequestParamObject
* @extends amdaModel.AmdaObject
*
* @author benjamin
* @version $Id: $
******************************************************************************
* FT Id : Date : Name - Description
******************************************************************************
* : :13/06/2016: benjamin – creation
*/
Ext.define('amdaModel.RequestParamObject', {
extend: 'amdaModel.AmdaObject',
idProperty: 'id',
fields : [
{name: 'type', type: 'int'},
{name: 'paramid', type: 'string'},
{name: 'dim1', type: 'string'},
{name: 'dim2', type: 'string'},
{name: 'template_args', type: 'auto', defaultValue: null}
],
getParamFullName : function() {
var paramIndexes = '';
switch (this.get('type')) {
case 0:
//scalar - nothing to do
break;
case 1:
//Tab1D
if ((this.get('dim1') != '') && (this.get('dim1') != '*'))
paramIndexes = '('+this.get('dim1')+')';
else if ((this.get('dim2') != '') && (this.get('dim2') != '*'))
paramIndexes = '('+this.get('dim2')+')';
break;
case 2:
//Tab2D
var dim1 = this.get('dim1') != '' ? this.get('dim1') : "*";
var dim2 = this.get('dim2') != '' ? this.get('dim2') : "*";
if ((dim1 != '*') || (dim2 != '*'))
paramIndexes = '('+dim1+','+dim2+')';
}
var template_args = "";
if (this.get('template_args')) {
Ext.Object.each(this.get('template_args'), function (argKey, argValue) {
template_args += "_";
template_args += argValue;
});
}
return this.get('paramid')+template_args+paramIndexes;
},
getJsonValues : function()
{
var paramValues = new Object();
paramValues['id'] = this.get('id');
paramValues['paramid'] = this.get('paramid');
paramValues['name'] = this.get('name');
paramValues['dim1'] = this.get('dim1');
paramValues['dim2'] = this.get('dim2');
paramValues['type'] = this.get('type');
if (this.get('template_args') != null) {
paramValues['template_args'] = new Object();
Ext.Object.each(this.get('template_args'), function (argKey, argValue) {
paramValues['template_args'][argKey] = argValue;
});
}
return paramValues;
}
});