Blame view

src/Request/ParamsRequestImpl/ParamsRequestDataClass.php 6.28 KB
22521f1c   Benjamin Renard   First commit
1
2
3
<?php

/**
3493f196   Benjamin Renard   Add request to ge...
4
5
6
7
8
9
10
11
12
 * @class ParamsRequestTypeEnumClass
 * @brief Enumerate for request type
 * @details
 */
abstract class ParamsRequestTypeEnumClass
{
	const UNKNOWN = "";
	const XMLREQUEST = "XMLREQUEST";
	const PARAMGEN   = "PARAMGEN";
cd28a380   Benjamin Renard   Generate param in...
13
	const PARAMSINFOGEN   = "PARAMSINFOGEN";
3493f196   Benjamin Renard   Add request to ge...
14
15
16
}

/**
22521f1c   Benjamin Renard   First commit
17
18
19
20
21
22
 * @class ParamsRequestDataClass
 * @brief Data for a params request. Inherits from ProcessRequestDataClass
 * @details
 */
class ParamsRequestDataClass extends ProcessRequestDataClass
{
3493f196   Benjamin Renard   Add request to ge...
23
	private $requestType           = ParamsRequestTypeEnumClass::XMLREQUEST;
8c57155b   Benjamin Renard   Integration for t...
24
	private $requestNodes          = array();
22521f1c   Benjamin Renard   First commit
25
	private $compilationPath       = "";
944199fe   Benjamin Renard   Use table definit...
26
	private $localBasePath         = "";
22521f1c   Benjamin Renard   First commit
27
28
	private $waitingResults        = array();
	private $processParamsToCreate = array();
944199fe   Benjamin Renard   Use table definit...
29
	private $localParamsToCreate   = array();
ffc5cb81   Elena.Budnik   temporary commit
30
	private $localParamsToCreateAndCopy   = array();
22521f1c   Benjamin Renard   First commit
31
	private $paramsToCopy          = array();
3493f196   Benjamin Renard   Add request to ge...
32
	private $paramId               = "";
59eb1b9c   Elena.Budnik   new ama stat
33
	private $datasetId             = array();
92a8e6b0   Elena.Budnik   temporary commot
34
	private $task                  = "";
70e82c1f   Benjamin Renard   Fix doPlot
35
	private $requestIndex          = 0;
22521f1c   Benjamin Renard   First commit
36
37
38
39

	function __construct()
	{
		parent::__construct();
22521f1c   Benjamin Renard   First commit
40
41
42
43
44
45
46
47
48
49
50
	}

	public function getCompilationPath()
	{
		return $this->compilationPath;
	}

	public function setCompilationPath($compilationPath)
	{
		$this->compilationPath = $compilationPath;
	}
944199fe   Benjamin Renard   Use table definit...
51
52
53
54
55
56
57
58
59
60
	
	public function getLocalBasePath()
	{
		return $this->localBasePath;
	}
	
	public function setLocalBasePath($localBasePath)
	{
		$this->localBasePath = $localBasePath;
	}
22521f1c   Benjamin Renard   First commit
61

3493f196   Benjamin Renard   Add request to ge...
62
63
64
65
66
67
68
69
70
71
	public function getRequestType()
	{
		return $this->requestType;
	}
	
	public function setRequestType($requestType)
	{
		$this->requestType = $requestType;
	}
	
92a8e6b0   Elena.Budnik   temporary commot
72
73
74
75
76
77
78
79
	public function getTask()
	{
		return $this->task;
	}
	
	public function setTask($task)
	{
		$this->task = $task;
92a8e6b0   Elena.Budnik   temporary commot
80
	}
70e82c1f   Benjamin Renard   Fix doPlot
81
82
83
84
85
86
87
88
89
90

	public function getRequestIndex()
	{
		return $this->requestIndex;
	}

	public function setRequestIndex($requestIndex)
	{
		$this->requestIndex = $requestIndex;
	}
92a8e6b0   Elena.Budnik   temporary commot
91
	
8c57155b   Benjamin Renard   Integration for t...
92
	public function addRequestNode()
22521f1c   Benjamin Renard   First commit
93
	{
8c57155b   Benjamin Renard   Integration for t...
94
95
96
97
98
99
100
101
		$newRequestNode = new RequestNodeClass();
		$this->requestNodes[] = $newRequestNode;
		return $newRequestNode;
	}
	
	public function getRequestNodes()
	{
		return $this->requestNodes;
22521f1c   Benjamin Renard   First commit
102
103
	}

98881737   Benjamin Renard   Add post processi...
104
105
106
107
108
	public function getWaitingResults()
	{
		return $this->waitingResults;
	}
	
22521f1c   Benjamin Renard   First commit
109
110
111
112
113
114
115
116
117
118
	public function getWaitingResult($key)
	{
		return $this->waitingResults[$key];
	}

	public function addWaitingResult($key, $result)
	{
		$this->waitingResults[$key] = $result;
	}

3493f196   Benjamin Renard   Add request to ge...
119
120
121
122
123
124
125
126
127
128
	public function getParamId()
	{
		return $this->paramId;
	}
	
	public function setParamId($paramId)
	{
		$this->paramId = $paramId;
	}
	
22521f1c   Benjamin Renard   First commit
129
130
131
132
133
134
135
136
137
138
139
140
141
142
	public function getParamsToCopy()
	{
		return $this->paramsToCopy;
	}

	public function addParamToCopy($paramId,$paramFilePath)
	{
		$this->paramsToCopy[$paramId] = $paramFilePath;
	}

	public function getProcessParamsToCreate()
	{
		return $this->processParamsToCreate;
	}
59eb1b9c   Elena.Budnik   new ama stat
143
144
145
146
147
148
149
150
151
152
153
	
	public function getDatasetForStat()
	{
		return $this->datasetId;
	}
	
	public function addDatasetForStat($dsId)
	{
		$this->datasetId[] = $dsId;
	}
	
c0535e83   Benjamin Renard   Use units and yTi...
154
	public function addProcessParamToCreate($paramId, $expression, $expression_info, $getParams, $sampling, $gap, $dateModif, $units, $ytitle)
22521f1c   Benjamin Renard   First commit
155
156
157
	{
		$newParam = new ParamNodeClass();
		$newParam->setId($paramId);
c0535e83   Benjamin Renard   Use units and yTi...
158
159
160
161
162
163
164
165
166
		if (!empty($units)) {
			$newParam->getInfo()->setUnits($units);
		}
		if (!empty($ytitle)) {
			$newParam->getInfo()->setShortName($ytitle);
		}
		else {
			$newParam->getInfo()->setShortName($paramId);
		}
22521f1c   Benjamin Renard   First commit
167
168
169
170
171
172
		$newParam->setSampling($sampling);
		if (isset($gap) && ($gap > 0))
			$newParam->setGap($gap);
		foreach ($getParams as $getParam)
		{
			$amdaParamNode = $newParam->addParamGet(ParamGetTypeEnum::AMDAPARAM);
e4545ed5   Benjamin Renard   Implement templat...
173
174
175
176
			if (array_key_exists('template_args', $getParam))
				$amdaParamNode->setParamName($getParam['fullparamid']);
			else
				$amdaParamNode->setParamName($getParam['paramid']);
22521f1c   Benjamin Renard   First commit
177
		}
a04159d9   Benjamin Renard   Define common lib...
178
		$newParam->setProcess($expression, $expression_info, true);
22521f1c   Benjamin Renard   First commit
179
		$newParam->setOutput();
ffc5cb81   Elena.Budnik   temporary commit
180

286f7924   Benjamin Renard   Derived parameter...
181
		$this->processParamsToCreate[$paramId] = array('param' => $newParam, 'dateModif' => $dateModif);
52c1e291   Benjamin Renard   Generate TT and c...
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
	}

	public function addTTCatParamToCreate($paramId, $ttCatFilePath, $isShared, $dateModif, $units, $ytitle, $status, $flag = "")
	{
		$newParam = new ParamNodeClass();
		$newParam->setId($paramId);
		if (!empty($units)) {
			$newParam->getInfo()->setUnits($units);
		}
		if (!empty($ytitle)) {
			$newParam->getInfo()->setShortName($ytitle);
		}
		else {
			$newParam->getInfo()->setShortName($paramId);
		}
		if (!empty($status)) {
			foreach ($status as $def) {
				$newParam->getInfo()->addStatus($def["min"], $def["max"], $def["name"], $def["color"]);
			}
		}
		$constantGetNode = $newParam->addParamGet(ParamGetTypeEnum::CONSTANT);
		$constantParamNode = $constantGetNode->addConstant();
		$constantParamNode->setSampling(1);
		$process = "#ttcat_to_param(\$constant_1_".$constantParamNode->getType()."_";
		$process .= $constantParamNode->getConstValue()."_".$constantParamNode->getDim1()."_".$constantParamNode->getDim2().";".$ttCatFilePath;
		if (!empty($flag)) {
			$process .= ";".$flag;
		}
		$process .= ")";
		$newParam->setProcess($process, "Transform Time Table or Catalog to a parameter", !$isShared);
		$newParam->setOutput();

		$this->processParamsToCreate[$paramId] = array('param' => $newParam, 'dateModif' => $dateModif);
22521f1c   Benjamin Renard   First commit
215
	}
944199fe   Benjamin Renard   Use table definit...
216
217
218
219
220
221
	
	public function getLocalParamsToCreate()
	{
		return $this->localParamsToCreate;
	}
	
ffc5cb81   Elena.Budnik   temporary commit
222
223
224
225
226
227
	public function getLocalParamsToCreateAndCopy()
	{
		return $this->localParamsToCreateAndCopy;
	}	
	
	public function addLocalParamToCreate($paramId, $viId, $realVarId, $minSampling, $maxSampling, $type, $size, $dateModif, $isImpex = false)
944199fe   Benjamin Renard   Use table definit...
228
229
230
231
232
233
234
235
236
	{
		$newParam = new ParamNodeClass();
		$newParam->setId($paramId);
		
		$newParam->getInfo();
		
		$localParamNode = $newParam->addParamGet(ParamGetTypeEnum::LOCALBASE);
		$localParamNode->setVIId($viId);
		
e8ff4ba7   Elena.Budnik   integration of as...
237
		$localParamNode->addLocalParam($realVarId, $minSampling, $maxSampling, $type, $size);
944199fe   Benjamin Renard   Use table definit...
238
		
e9165342   Benjamin Renard   Write data mining...
239
		$newParam->setProcess("","");
944199fe   Benjamin Renard   Use table definit...
240
		$newParam->setOutput();
ffc5cb81   Elena.Budnik   temporary commit
241
242
243
244
245
246
247
248
249
		
		if ($isImpex) 
		{			
			$this->localParamsToCreateAndCopy[$paramId] = array('param' => $newParam, 'dateModif' => $dateModif);
		}
		else
		{
			$this->localParamsToCreate[$paramId] = array('param' => $newParam, 'dateModif' => $dateModif);
		}
944199fe   Benjamin Renard   Use table definit...
250
251
252
		
		return $newParam;
	}
22521f1c   Benjamin Renard   First commit
253
254
}

e9165342   Benjamin Renard   Write data mining...
255
?>