IHMInputOutputInfoProcessAbstractClass.php 1.57 KB
<?php

/**
 * @class IHMInputOutputParamsAbstractClass
 * @brief Abstract class that's implement an InputOutputInterface used to treat a request to get the status of a list of process
 * @details
 */
abstract class IHMInputOutputInfoProcessAbstractClass implements InputOutputInterface
{
	protected $jobsManager       = null;
	protected $processDatas      = array();

	/*
	 * @brief Constructor
	*/
	function __construct()
	{
		$this->jobsManager      = new IHMJobsManagerClass();
	}

	/*
	 * @brief translate input data from IHM client to AMDA_Integration module
	*/
	public function getInputData($input,$function,$requestId="")
	{
		$res = $this->getJobIds($input);

		if (!$res['success'])
			throw new Exception($res['message']);
			
		foreach($res['jobs'] as $jobid)
		{
			$processData = new ProcessRequestDataClass();
				
			$processData->setManagerFilePath(IHMConfigClass::getProcessManagerFilePath());
			$processData->setType(ProcessTypeEnumClass::INFO);
			$processData->setId($jobid);
			$processData->setUser(IHMConfigClass::getUserName());
				
			$this->processDatas[] = $processData;
		}

		return $this->processDatas;
	}

	/*
	 * @brief translate output data from AMDA_Integration module to IHM client
	*/
	public function getOutput($data)
	{
		return $this->marshallResult($data);
	}

	/*
	 * @brief Abstract method used to get the list of concerning jobs
	*/
	abstract protected function getJobIds($input);

	/*
	 * @brief Abstract method to marshall the result
	*/
	abstract protected function marshallResult($data);
}

?>