Search.js
2.95 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
/**
* Project : AMDA-NG
* Name : Search.js
* Description : Condition Business Object Definition
* @class amdaModel.Search
* @extends amdaModel.AmdaObject
*
* @author myriam
* @version $Id: Search.js 2068 2014-02-06 11:27:38Z elena $
******************************************************************************
* FT Id : Date : Name - Description
******************************************************************************
* : :23/06/2011: myriam – creation
* : :04/07/2011: elena – event Execute
* : :06/07/2011: elena – date fields
*/
Ext.define('amdaModel.Search', {
extend: 'amdaModel.AmdaTimeObject',
fields : [
// {name: 'name', type: 'string', defaultValue: 'Search'},
{name: 'sampling', type: 'int', defaultValue: '600'},
{name: 'gap', type: 'int', defaultValue: '5'},
{name: 'description', type: 'string'},
{name: 'expression', type: 'string'}
],
propertiesToCopy : 'id,name,sampling,gap,description,expression',
getJsonValues : function(hasId){
var myValues = new Object();
if (hasId) {
myValues.id = this.get('id');
}
myValues.name = this.get('name');
myValues.sampling = this.get('sampling');
myValues.gap = this.get('gap');
myValues.description = this.get('description');
myValues.expression = this.get('expression').replace(/\n/g," ");;
myValues.timesrc = this.get('timesrc');
// if there's at least one timeTable name into 'timeTables' collection
if (this.get('timesrc') == amdaModel.AmdaTimeObject.inputTimeSrc[0] && this.get('timeTables') && this.get('timeTables').length){
// myValues.timeTables = this.get('timeTables').items;
// get complete timeTables collection
var timeTables = this.get('timeTables');
// init an empty array for timeTables
myValues.timeTables=[];
// for each interval record
Ext.Array.each(timeTables, function(item, index, all){
// get Json simplified value
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 = this.get('startDate');
myValues.stopDate = this.get('stopDate');
myValues.durationDay = this.get('durationDay');
myValues.durationHour = this.get('durationHour');
myValues.durationMin = this.get('durationMin');
myValues.durationSec = this.get('durationSec');
}
myValues.leaf = true;
myValues.nodeType = amdaModel.SearchNode.nodeType;
return myValues;
}
});