Blame view

src/InputOutput/WSImpl/TimeTables/WSInputOutputTTClass.php 1.85 KB
738745d3   Elena.Budnik   draft for Web Ser...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
<?php

/**
 * @class WSInputOutputTTClass
 * @brief 
 * @details
*/
//TODO not finished and not used for the moment 
class WSInputOutputTTClass extends IHMInputOutputTTClass
{
 
/*
	* @brief Constructor
*/
	function __construct()
	{
		 
	}

/*
	* @brief translate input data from IHM client to AMDA_Integration module for a tt process request
*/
	public function getInputData($input, $function, $requestId="")
	{
6a8aef7f   Benjamin Renard   Add APIs getCatal...
25
26
		if (isset($this->processData))
			unset($this->processData);
738745d3   Elena.Budnik   draft for Web Ser...
27

6a8aef7f   Benjamin Renard   Add APIs getCatal...
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
		$processData = new TTRequestDataClass();
		$processData->setInputFileName($input['inputFile']);
		$processData->setInputFileFormat(TTRequestFileFormatEnum::INTERNAL);
		$processData->setOutputDir(WSConfigClass::getWsResultDir());
		$processData->setOutputFileName($input['outputFileName']);
		$outputFormat = empty($input['outputFormat']) ? 'VOTABLE' : $input['outputFormat'];
		switch ($outputFormat) {
			case 'ASCII':
				$processData->setOutputFileFormat(TTRequestFileFormatEnum::ASCII);
				break;
			case 'VOTABLE':
				$processData->setOutputFileFormat(TTRequestFileFormatEnum::VOTABLE);
				break;
			case 'INTERNAL':
				$processData->setOutputFileFormat(TTRequestFileFormatEnum::INTERNAL);
				break;
			case 'HPEVENT':
				$processData->setOutputFileFormat(TTRequestFileFormatEnum::SPASE);
				break;
			default:
				throw new Exception('Unknown output format');
738745d3   Elena.Budnik   draft for Web Ser...
49
		}
6a8aef7f   Benjamin Renard   Add APIs getCatal...
50
51
52
53
		$processData->setType($function);
		$processData->setCmd("ttConversion");

		$this->processData = $processData;
738745d3   Elena.Budnik   draft for Web Ser...
54

6a8aef7f   Benjamin Renard   Add APIs getCatal...
55
		return $this->processData;
738745d3   Elena.Budnik   draft for Web Ser...
56
57
58
59
60
61
62
	}

/*
	* @brief translate output data from AMDA_Integration module to IHM client  request
*/
	public function getOutput($data)
	{
6a8aef7f   Benjamin Renard   Add APIs getCatal...
63
64
65
66
		$result  = array('success' => $data->getSuccess());
		if ($result['success']) {
			$result['file'] = $data->getOutputDir()."/".$data->getOutputFileName();
		}
738745d3   Elena.Budnik   draft for Web Ser...
67
68
69
70
71
		return $result;
	}
} 

?>