Blame view

src/InputOutput/WSImpl/Process/WSInputOutputGetInfoProcessClass.php 1.93 KB
8b8f98e3   Elena.Budnik   getStatus fixed
1
2
3
4
5
6
7
8
9
10
<?php

/**
 * @class WSInputOutputGetInfoProcessClass
 * @brief Class that's implement an InputOutputInterface used to treat a get info process request
 * @details
 */
class WSInputOutputGetInfoProcessClass extends IHMInputOutputGetInfoProcessClass
{
	protected $jobsManager       = null;
8b8f98e3   Elena.Budnik   getStatus fixed
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

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

 
	/*
	 * @brief translate output data from AMDA_Integration module to IHM client for a get info process request
	*/
// ProcessRequestDataClass Object
// (
//     [managerfilePath:ProcessRequestDataClass:private] => /home/budnik/AMDA/AMDA_IHM/data/processManager.xml
//     [workingPath:ProcessRequestDataClass:private] => 
//     [cmd:ProcessRequestDataClass:private] => 
//     [envVars:ProcessRequestDataClass:private] => Array
//         (
//         )
// 
//     [postCmd:ProcessRequestDataClass:private] => 
//     [id:ProcessRequestDataClass:private] => process_t7ovpn_1520344095_13119
//     [type:ProcessRequestDataClass:private] => info
//     [batchEnable:ProcessRequestDataClass:private] => 1
//     [status:ProcessRequestDataClass:private] => done
//     [exitCode:ProcessRequestDataClass:private] => 0
//     [start:ProcessRequestDataClass:private] => 1520344095
//     [success:RequestDataClass:private] => 1
//     [lastErrorMessage:RequestDataClass:private] => Cannot run process request
// )
// 	
	
	public function getOutput($data)
	{
		if (!$data->getSuccess())
		{
			return array(
					'success' => false,
					'message' => $data->getLastErrorMessage());
		}

		$jobInfo = $this->jobsManager->updateJobStatus(
					$data->getId(),
					$data->getStatus() == ProcessStatusEnumClass::RUNNING,
					$data->getErrorCode());

		if (!$jobInfo['success'])
		{
			return array(
					'success' => false,
					'message' => $data->getLastErrorMessage());
		}	 
8b8f98e3   Elena.Budnik   getStatus fixed
65
66
67
		return $jobInfo;
	}
}
8b8f98e3   Elena.Budnik   getStatus fixed
68
?>