Blame view

src/Request/ParamsRequestImpl/Nodes/Requests/RequestOutputDataMiningNodeClass.php 4.47 KB
22521f1c   Benjamin Renard   First commit
1
2
<?php

966bd5f8   Benjamin Renard   Add request to ge...
3
4
require_once "RequestOutputPostProcessingNodeClass.php";

22521f1c   Benjamin Renard   First commit
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
define ("REQUESTOUTPUTDATAMINING_NAME", "dataMining");
define ("REQUESTOUTPUTDATAMINING_TIMEFORMAT", "timeFormat");
define ("REQUESTOUTPUTDATAMINING_FILEFORMAT", "fileFormat");
define ("REQUESTOUTPUTDATAMINING_STRUCTURE", "outputStructure");
define ("REQUESTOUTPUTDATAMINING_FILENAME", "fileName");

define ("REQUESTOUTPUTDATAMININGPARAM_NAME",  "param");
define ("REQUESTOUTPUTDATAMININGPARAM_ID", "id");

abstract class RequestOutputDataMiningTimeFormatEnum
{
	const UNKNOWN = "";
	const ISO   = "ISO";
}

abstract class RequestOutputDataMiningFileFormatEnum
{
	const UNKNOWN = "";
	const ASCII   = "ASCII";
	const XML     = "XML";
	const VOT     = "VOT";
}

abstract class RequestOutputDataMiningStructureEnum
{
	const UNKNOWN                             = "";
	const ONE_FILE                            = "one-file";
	const ONE_FILE_PER_INTERVAL               = "one-file-per-interval";
}

class RequestOutputDataMiningParamNodeClass extends NodeClass
{
	public function __construct()
	{
		parent::__construct(REQUESTOUTPUTDATAMININGPARAM_NAME);
	}

	public function setId($id)
	{
		$this->setAttribute(REQUESTOUTPUTDATAMININGPARAM_ID, $id);
	}

	public function getId()
	{
		return $this->getAttribute(REQUESTOUTPUTDATAMININGPARAM_ID);
	}
966bd5f8   Benjamin Renard   Add request to ge...
51
52
53
54
55
	
	public function loadFromNode($xmlNode)
	{
		$this->setId($this->getXmlNodeAttribute($xmlNode, REQUESTOUTPUTDATAMININGPARAM_ID));
	}
22521f1c   Benjamin Renard   First commit
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
}

/**
 * @class RequestOutputDataMiningNodeClass
 * @brief Definition of a request data mining output node for AMDA_Kernel
 * @details
 */
class RequestOutputDataMiningNodeClass extends NodeClass
{
	public function __construct()
	{
		parent::__construct(REQUESTOUTPUTDATAMINING_NAME);
	}

	public function setTimeFormat($timeFormat)
	{
		$node = $this->getChildInstanceByName(REQUESTOUTPUTDATAMINING_TIMEFORMAT, true);
		$node->setValue($timeFormat);
	}

	public function setFileFormat($fileFormat)
	{
		$node = $this->getChildInstanceByName(REQUESTOUTPUTDATAMINING_FILEFORMAT, true);
		$node->setValue($fileFormat);
	}

	public function setStructure($structure)
	{
		$node = $this->getChildInstanceByName(REQUESTOUTPUTDATAMINING_STRUCTURE, true);
		$node->setValue($structure);
	}

	public function setFileName($fileName)
	{
		$node = $this->getChildInstanceByName(REQUESTOUTPUTDATAMINING_FILENAME, true);
		$node->setValue($fileName);
	}

966bd5f8   Benjamin Renard   Add request to ge...
94
	public function setParam($id = "")
22521f1c   Benjamin Renard   First commit
95
96
97
98
99
100
101
102
	{
		$node = $this->getFirstChildByName(REQUESTOUTPUTDATAMININGPARAM_NAME);
		if (!$node)
		{
			$node = new RequestOutputDataMiningParamNodeClass();
			$this->addChild($node);
		}
		$node->setId($id);
966bd5f8   Benjamin Renard   Add request to ge...
103
		return $node;
22521f1c   Benjamin Renard   First commit
104
105
	}

966bd5f8   Benjamin Renard   Add request to ge...
106
	public function addPostProcessing($process = "")
22521f1c   Benjamin Renard   First commit
107
108
109
110
111
112
113
114
	{
		$node = $this->getChildInstanceByName(REQUESTOUTPUTPOSTPROCESSING_NAME);
		if ($node == NULL)
		{
			$node = new RequestOutputPostProcessingNodeClass();
			$this->addChild($node);
		}

966bd5f8   Benjamin Renard   Add request to ge...
115
116
117
		if ($process != "")
			$node->addPostProcessing($process);
		return $node;
22521f1c   Benjamin Renard   First commit
118
119
120
121
122
123
124
125
126
127
128
	}

	public function isPostProcessing($process)
	{
		$node = $this->getChildInstanceByName(REQUESTOUTPUTPOSTPROCESSING_NAME);

		if ($node == NULL)
			return false;
			
		return $node->isPostProcessing($process);
	}
966bd5f8   Benjamin Renard   Add request to ge...
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
	
	public function loadFromNode($xmlNode)
	{
		$timeformatXmlNode = $this->getXmlNodeChildByTagName($xmlNode, REQUESTOUTPUTDATAMINING_TIMEFORMAT);
		if (isset($timeformatXmlNode))
			$this->setTimeFormat($this->getXmlNodeValue($timeformatXmlNode));
		
		$fileformatXmlNode = $this->getXmlNodeChildByTagName($xmlNode, REQUESTOUTPUTDATAMINING_FILEFORMAT);
		if (isset($fileformatXmlNode))
			$this->setFileFormat($this->getXmlNodeValue($fileformatXmlNode));
		
		$structureXmlNode = $this->getXmlNodeChildByTagName($xmlNode, REQUESTOUTPUTDATAMINING_STRUCTURE);
		if (isset($structureXmlNode))
			$this->setStructure($this->getXmlNodeValue($structureXmlNode));
		
		$filenameXmlNode = $this->getXmlNodeChildByTagName($xmlNode, REQUESTOUTPUTDATAMINING_FILENAME);
		if (isset($filenameXmlNode))
			$this->setFileName($this->getXmlNodeValue($filenameXmlNode));
		
		foreach ($this->getXmlNodeChildrenByTagName($xmlNode, REQUESTOUTPUTDATAMININGPARAM_NAME) as $paramXmlNode) {
			$this->setParam()->loadFromNode($paramXmlNode);
		}
		
		$postProcessingXmlNode = $this->getXmlNodeChildByTagName($xmlNode, REQUESTOUTPUTPOSTPROCESSING_NAME);
		if (isset($postProcessingXmlNode))
			$this->addPostProcessing()->loadFromNode($postProcessingXmlNode);
	}
22521f1c   Benjamin Renard   First commit
156
157
158
}

?>