Blame view

src/Request/ParamsRequestImpl/Nodes/Requests/RequestOutputsNodeClass.php 2.08 KB
22521f1c   Benjamin Renard   First commit
1
<?php
966bd5f8   Benjamin Renard   Add request to ge...
2
3
4
5
6
7

require_once "RequestOutputDownloadNodeClass.php";
require_once "RequestOutputPlotNodeClass.php";
require_once "RequestOutputDataMiningNodeClass.php";
require_once "RequestOutputStatisticNodeClass.php";

22521f1c   Benjamin Renard   First commit
8
9
10
11
12
13
14
define ("REQUESTOUTPUTS_NAME", "outputs");

abstract class RequestOutputTypeEnum
{
	const DOWNLOAD   = "Download";
	const DATAMINING = "DataMining";
	const PLOT       = "Plot";
952dd7c7   elena   catalog integration
15
	const STATISTIC  = "Statistic";
22521f1c   Benjamin Renard   First commit
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
}

/**
 * @class RequestOutputsNodeClass
 * @brief Definition of a request outputs node for AMDA_Kernel
 * @details
 */
class RequestOutputsNodeClass extends NodeClass
{
	public function __construct()
	{
		parent::__construct(REQUESTOUTPUTS_NAME);
	}

	public function addNewOutput($type)
	{
		switch ($type)
		{
			case RequestOutputTypeEnum::DOWNLOAD :
				$output = new RequestOutputDownloadNodeClass();
				break;
			case RequestOutputTypeEnum::DATAMINING :
				$output = new RequestOutputDataMiningNodeClass();
				break;
			case RequestOutputTypeEnum::PLOT :
				$output = new RequestOutputPlotNodeClass();
				break;
952dd7c7   elena   catalog integration
43
44
45
			case RequestOutputTypeEnum::STATISTIC :			
				$output = new RequestOutputStatisticNodeClass();
				break;	
22521f1c   Benjamin Renard   First commit
46
47
48
49
50
51
52
53
54
			default :
				throw new Exception('Output node not implemented');
		}

		if (isset($output) && ($output != NULL))
			$this->addChild($output);

		return $output;
	}
966bd5f8   Benjamin Renard   Add request to ge...
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
	
	public function loadFromNode($xmlNode)
	{
		foreach ($this->getXmlNodeChildren($xmlNode) as $outputXmlNode) {
			switch ($this->getXmlNodeName($outputXmlNode)) {
				case REQUESTOUTPUTDOWNLOAD_NAME :
					$this->addNewOutput(RequestOutputTypeEnum::DOWNLOAD)->loadFromNode($outputXmlNode);
					break;
				case REQUESTOUTPUTDATAMINING_NAME :
					$this->addNewOutput(RequestOutputTypeEnum::DATAMINING)->loadFromNode($outputXmlNode);
					break;
				case REQUESTOUTPUTPLOT_NAME :
					$this->addNewOutput(RequestOutputTypeEnum::PLOT)->loadFromNode($outputXmlNode);
					break;
				case REQUESTOUTPUTSTATISTIC_NAME :
					$this->addNewOutput(RequestOutputTypeEnum::STATISTIC)->loadFromNode($outputXmlNode);
					break;
				default :
					throw new Exception('Output node not implemented');
			}
			
		}
	}
22521f1c   Benjamin Renard   First commit
78
79
80
}

?>