IHMInputOutputParamsGeneratorClass.php 1.13 KB
<?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
		);
	}
}
?>