Blame view

src/InputOutput/IHMImpl/Params/GeneratorImpl/IHMInputOutputParamsGeneratorClass.php 1.13 KB
3493f196   Benjamin Renard   Add request to ge...
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
<?php

/**
 * @class IHMInputOutputParamsGeneratorClass
 * @brief Implementation of IHMInputOutputParamsAbstractClass to treat params generation request
 * @details
*/
class IHMInputOutputParamsGeneratorClass extends IHMInputOutputParamsAbstractClass
{
	/*
	 * @brief method to unmarshall a params generation request
	*/
	protected function unmarshallRequest($input)
	{
		$this->paramsData->setRequestType(ParamsRequestTypeEnumClass::PARAMGEN);
		
		$this->paramsData->setParamId($input->paramId);
		
		$paramInfo = $this->paramManager->addExistingParam($input->paramId,$this->paramsData);

		return $this->paramsData;
	}

	/*
	 * @brief method to marshall the result of a download request
	*/
	protected function marshallResult($data)
	{
		if (!$data->getSuccess())
			return array(
					'success' => false,
					'message' => $data->getParamId() . " : " . $data->getLastErrorMessage());
		
		if ($data->getErrorCode() != 0)
			return array(
					'success' => false,
					'message' => $data->getParamId() . " : " . 'Error detected during parameter compilation');
		
		return array(
			'success' => true
		);
	}
}
?>