Blame view

src/InputOutput/IHMImpl/TimeTables/IHMInputOutputConvertTTClass.php 1.66 KB
0b6b2080   Elena.Budnik   TT download
1
2
3
<?php

/**
a0d6e953   Benjamin Renard   Update TT/Catalog...
4
 * @class IHMInputOutputConvertTTClass
0b6b2080   Elena.Budnik   TT download
5
6
7
 * @brief 
 * @details
*/
a0d6e953   Benjamin Renard   Update TT/Catalog...
8
class IHMInputOutputConvertTTClass implements InputOutputInterface
0b6b2080   Elena.Budnik   TT download
9
{
a0d6e953   Benjamin Renard   Update TT/Catalog...
10
11
12
	private $processData = NULL;

 
0b6b2080   Elena.Budnik   TT download
13
14
	/*
	 * @brief Constructor
a0d6e953   Benjamin Renard   Update TT/Catalog...
15
	 */
0b6b2080   Elena.Budnik   TT download
16
17
	function __construct()
	{
a0d6e953   Benjamin Renard   Update TT/Catalog...
18
		 
0b6b2080   Elena.Budnik   TT download
19
20
21
	}

	/*
a0d6e953   Benjamin Renard   Update TT/Catalog...
22
23
	 * @brief translate input data from AMDA IHM to AMDA_Integration module for a tt process request
	 */
0b6b2080   Elena.Budnik   TT download
24
25
	public function getInputData($input, $function, $requestId="")
	{
a0d6e953   Benjamin Renard   Update TT/Catalog...
26
27
		if (isset($this->processData))
			unset($this->processData);
0b6b2080   Elena.Budnik   TT download
28

a0d6e953   Benjamin Renard   Update TT/Catalog...
29
30
31
32
33
34
35
36
37
38
39
40
41
42
		$processData = new TTRequestDataClass();
		$processData->setInputFileName($input['inputFile']);
		switch ($input['inputFormat']) {
			case 'ASCII':
				$processData->setInputFileFormat(TTRequestFileFormatEnum::ASCII);
				break;
			case 'VOTABLE':
				$processData->setInputFileFormat(TTRequestFileFormatEnum::VOTABLE);
				break;
			case 'INTERNAL':
				$processData->setInputFileFormat(TTRequestFileFormatEnum::INTERNAL);
				break;
			default:
				throw new Exception('Unknown input format');
0b6b2080   Elena.Budnik   TT download
43
		}
a0d6e953   Benjamin Renard   Update TT/Catalog...
44
45
46
47
48
		$processData->setOutputDir($input['outputDir']);
		$processData->setOutputFileFormat(TTRequestFileFormatEnum::INTERNAL);
		$processData->setOutputFileName($input['outputFileName']);
		$processData->setType($function);
		$processData->setCmd("ttConversion");
0b6b2080   Elena.Budnik   TT download
49

a0d6e953   Benjamin Renard   Update TT/Catalog...
50
51
52
		$this->processData = $processData;
	
		return $this->processData;
0b6b2080   Elena.Budnik   TT download
53
54
55
	}

	/*
a0d6e953   Benjamin Renard   Update TT/Catalog...
56
57
	 * @brief translate output data from AMDA_Integration module to AMDA IHM request
	 */
0b6b2080   Elena.Budnik   TT download
58
59
	public function getOutput($data)
	{
a0d6e953   Benjamin Renard   Update TT/Catalog...
60
61
62
		$result  = array('success' => $data->getSuccess());
		if ($result['success']) {
			$result['file'] = $data->getOutputDir()."/".$data->getOutputFileName();
0b6b2080   Elena.Budnik   TT download
63
		}
0b6b2080   Elena.Budnik   TT download
64
65
66
		return $result;
	}
} 
a0d6e953   Benjamin Renard   Update TT/Catalog...
67

0b6b2080   Elena.Budnik   TT download
68
?>