SharedObjectsUpdaterInputOutputTTClass.php
1.72 KB
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
<?php
/**
* @class SharedObjectsUpdaterInputOutputTTClass
* @brief
* @details
*/
class SharedObjectsUpdaterInputOutputTTClass implements InputOutputInterface
{
private $processData = NULL;
/*
* @brief Constructor
*/
function __construct()
{
}
/*
* @brief translate input data from AMDA shared objects updater to AMDA_Integration module for a tt process request
*/
public function getInputData($input, $function, $requestId="")
{
if (isset($this->processData))
unset($this->processData);
$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');
}
$processData->setOutputDir($input['outputDir']);
$processData->setOutputFileFormat(TTRequestFileFormatEnum::INTERNAL);
$processData->setOutputFileName($input['outputFileName']);
$processData->setType($function);
$processData->setCmd("ttConversion");
$this->processData = $processData;
return $this->processData;
}
/*
* @brief translate output data from AMDA_Integration module to AMDA shared objects updater request
*/
public function getOutput($data)
{
$result = array('success' => $data->getSuccess());
if ($result['success']) {
$result['file'] = $data->getOutputDir()."/".$data->getOutputFileName();
}
return $result;
}
}
?>