Blame view

src/InputOutput/IHMImpl/Params/DataMiningImpl/IHMInputOutputParamsDataMiningClass.php 2.59 KB
22521f1c   Benjamin Renard   First commit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
<?php

define ("DATAMINING_RESULT_FILE_KEY","datamining");

/**
 * @class IHMInputOutputParamsDataMiningClass
 * @brief Implementation of IHMInputOutputParamsAbstractClass to treat data mining request
 * @details
*/
class IHMInputOutputParamsDataMiningClass extends IHMInputOutputParamsAbstractClass
{
	/*
	 * @brief method to unmarshall a data mining request
	*/
	protected function unmarshallRequest($input)
	{
74fd500a   Hacene SI HADJ MOHAND   us #9874 ms zoo...
17
		/*	'{"id":"cond_2","name":"us44_test1","sampling":600,"gap":5,"description":"","expression":"dst>0","timesrc":"Interval","startDate":"2008-01-31T00:00:00","stopDate":"2008-02-01T00:00:00","durationDay":"0001","durationHour":"00","durationMin":"00","durationSec":"00","durationMs":"000","leaf":true,"nodeType":"condition"}'
22521f1c   Benjamin Renard   First commit
18
19
		 */

7d14181a   Benjamin Renard   Fix multi-request...
20
		$requestNode = $this->paramsData->addRequestNode(0);
8c57155b   Benjamin Renard   Integration for t...
21
		$paramsNode = $requestNode->getParamsNode();
22521f1c   Benjamin Renard   First commit
22
23

		//unmarshall time definition
8c57155b   Benjamin Renard   Integration for t...
24
		$this->unmarshallTimeDefinition($input, 0);
22521f1c   Benjamin Renard   First commit
25
26

		//unmarshall data mining output definition
8c57155b   Benjamin Renard   Integration for t...
27
		$outputsNode = $requestNode->getOutputsNode();
22521f1c   Benjamin Renard   First commit
28
29
30
31
32
33
34
		$dataMiningNode = $outputsNode->addNewOutput(RequestOutputTypeEnum::DATAMINING);

		$dataMiningNode->setTimeFormat(RequestOutputDataMiningTimeFormatEnum::ISO);

		$dataMiningNode->setFileFormat(RequestOutputDataMiningFileFormatEnum::XML);

		//parse expression
a928f9d3   Benjamin Renard   New parser integr...
35
36
37
38
39
		$expressionInfo = $this->paramManager->parseExpression($input->expression, $this->paramsData->getWorkingPath());
		if (!$expressionInfo['success']) {
			throw new Exception($expressionInfo['message']);
		}

22521f1c   Benjamin Renard   First commit
40
41
42
		$paramId = "datamining_".md5($expressionInfo["expression"]);

		//create a derived param for the expression
e9165342   Benjamin Renard   Write data mining...
43
		$this->paramManager->addProcessParam($paramId, $expressionInfo["expression"], $input->expression,
8a233e84   Benjamin Renard   Add modif. time f...
44
				$expressionInfo['params'], $input->sampling_mode, $input->sampling, $input->reference_param,
91e7647e   Erdogan Furkan   Integration is no...
45
46
47
48
49
50
51
			$input->gap,
			time(),
			"",
			"",
			"",
			$this->paramsData
		);
22521f1c   Benjamin Renard   First commit
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
			
		//add derived param to output
		$paramsNode->addParam($paramId);
		$dataMiningNode->setParam($paramId);

		$resultFile = "result_".$this->requestID;
		$this->paramsData->addWaitingResult(DATAMINING_RESULT_FILE_KEY, $resultFile);

		$postProcessCmd  = "mv timeTable_datamining_*.xml ".$resultFile.".xml";
		$postProcessCmd .= " && ";
		$postProcessCmd .= "mv Gaps_timeTable_datamining_*.xml Gaps_".$resultFile.".xml";

		$this->paramsData->setPostCmd($postProcessCmd);

		return $this->paramsData;
	}

	/*
	 * @brief method to marshall the result of a data mining request
	*/
	protected function marshallResult($data)
	{
		return $this->commonMarshallResult($data,DATAMINING_RESULT_FILE_KEY);
	}
}
e9165342   Benjamin Renard   Write data mining...
77
?>