|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace AlgoWeb\ODataMetadata\MetadataV3\edmx; |
|
4
|
|
|
|
|
5
|
|
|
use AlgoWeb\ODataMetadata\IsOK; |
|
6
|
|
|
use AlgoWeb\ODataMetadata\MetadataV3\edm\Schema; |
|
7
|
|
|
|
|
8
|
|
|
/** |
|
9
|
|
|
* Class representing TEdmxType |
|
10
|
|
|
* |
|
11
|
|
|
* |
|
12
|
|
|
* XSD Type: TEdmx |
|
13
|
|
|
*/ |
|
14
|
|
|
class TEdmxType extends IsOK |
|
15
|
|
|
{ |
|
16
|
|
|
|
|
17
|
|
|
/** |
|
18
|
|
|
* @property string $version |
|
19
|
|
|
*/ |
|
20
|
|
|
private $version = null; |
|
21
|
|
|
|
|
22
|
|
|
/** |
|
23
|
|
|
* @property \AlgoWeb\ODataMetadata\MetadataV3\edmx\TDesignerType $designer |
|
24
|
|
|
*/ |
|
25
|
|
|
private $designer = null; |
|
26
|
|
|
|
|
27
|
|
|
/** |
|
28
|
|
|
* @property \AlgoWeb\ODataMetadata\MetadataV3\edmx\TRuntimeType $runtime |
|
29
|
|
|
*/ |
|
30
|
|
|
private $runtime = null; |
|
31
|
|
|
|
|
32
|
|
|
/** |
|
33
|
|
|
* @property \AlgoWeb\ODataMetadata\MetadataV3\edmx\TDataServicesType $dataServiceType |
|
34
|
|
|
*/ |
|
35
|
|
|
private $dataServiceType = null; |
|
36
|
|
|
|
|
37
|
|
|
/** |
|
38
|
|
|
* Gets as version |
|
39
|
|
|
* |
|
40
|
|
|
* @return string |
|
41
|
|
|
*/ |
|
42
|
|
|
public function getVersion() |
|
43
|
|
|
{ |
|
44
|
|
|
return $this->version; |
|
45
|
|
|
} |
|
46
|
|
|
|
|
47
|
|
|
/** |
|
48
|
|
|
* Sets a new version |
|
49
|
|
|
* |
|
50
|
|
|
* @param string $version |
|
51
|
|
|
* @return self |
|
52
|
|
|
*/ |
|
53
|
|
|
public function setVersion($version) |
|
54
|
|
|
{ |
|
55
|
|
|
if (!$this->isStringNotNullOrEmpty($version)) { |
|
56
|
|
|
$msg = "Version cannot be null or empty"; |
|
57
|
|
|
throw new \InvalidArgumentException($msg); |
|
58
|
|
|
} |
|
59
|
|
|
$this->version = $version; |
|
60
|
|
|
return $this; |
|
61
|
|
|
} |
|
62
|
|
|
|
|
63
|
|
|
/** |
|
64
|
|
|
* Gets data service type |
|
65
|
|
|
* |
|
66
|
|
|
* @return TDataServicesType |
|
67
|
|
|
*/ |
|
68
|
|
|
public function getDataServiceType() |
|
69
|
|
|
{ |
|
70
|
|
|
return $this->dataServiceType; |
|
71
|
|
|
} |
|
72
|
|
|
|
|
73
|
|
|
/** |
|
74
|
|
|
* Sets a new data service type |
|
75
|
|
|
* |
|
76
|
|
|
* @param TDataServicesType $dataServiceType |
|
77
|
|
|
* @return self |
|
78
|
|
|
*/ |
|
79
|
|
|
public function setDataServiceType(TDataServicesType $dataServiceType) |
|
80
|
|
|
{ |
|
81
|
|
|
$msg = null; |
|
82
|
|
|
if (!$dataServiceType->isOK($msg)) { |
|
83
|
|
|
throw new \InvalidArgumentException($msg); |
|
84
|
|
|
} |
|
85
|
|
|
$this->dataServiceType = $dataServiceType; |
|
86
|
|
|
return $this; |
|
87
|
|
|
} |
|
88
|
|
|
|
|
89
|
|
|
/** |
|
90
|
|
|
* Gets as designer |
|
91
|
|
|
* |
|
92
|
|
|
* @return \AlgoWeb\ODataMetadata\MetadataV3\edmx\TDesignerType |
|
93
|
|
|
*/ |
|
94
|
|
|
public function getDesigner() |
|
95
|
|
|
{ |
|
96
|
|
|
return $this->designer; |
|
97
|
|
|
} |
|
98
|
|
|
|
|
99
|
|
|
/** |
|
100
|
|
|
* Sets a new designer |
|
101
|
|
|
* |
|
102
|
|
|
* @param \AlgoWeb\ODataMetadata\MetadataV3\edmx\TDesignerType $designer |
|
103
|
|
|
* @return self |
|
104
|
|
|
*/ |
|
105
|
|
|
public function setDesigner(TDesignerType $designer) |
|
106
|
|
|
{ |
|
107
|
|
|
$msg = null; |
|
108
|
|
|
if (!$designer->isOK($msg)) { |
|
109
|
|
|
throw new \InvalidArgumentException($msg); |
|
110
|
|
|
} |
|
111
|
|
|
$this->designer = $designer; |
|
112
|
|
|
return $this; |
|
113
|
|
|
} |
|
114
|
|
|
|
|
115
|
|
|
/** |
|
116
|
|
|
* Gets as runtime |
|
117
|
|
|
* |
|
118
|
|
|
* @return \AlgoWeb\ODataMetadata\MetadataV3\edmx\TRuntimeType |
|
119
|
|
|
*/ |
|
120
|
|
|
public function getRuntime() |
|
121
|
|
|
{ |
|
122
|
|
|
return $this->runtime; |
|
123
|
|
|
} |
|
124
|
|
|
|
|
125
|
|
|
/** |
|
126
|
|
|
* Sets a new runtime |
|
127
|
|
|
* |
|
128
|
|
|
* @param \AlgoWeb\ODataMetadata\MetadataV3\edmx\TRuntimeType $runtime |
|
129
|
|
|
* @return self |
|
130
|
|
|
*/ |
|
131
|
|
|
public function setRuntime(TRuntimeType $runtime) |
|
132
|
|
|
{ |
|
133
|
|
|
$msg = null; |
|
134
|
|
|
if (!$runtime->isOK($msg)) { |
|
135
|
|
|
throw new \InvalidArgumentException($msg); |
|
136
|
|
|
} |
|
137
|
|
|
$this->runtime = $runtime; |
|
138
|
|
|
return $this; |
|
139
|
|
|
} |
|
140
|
|
|
|
|
141
|
|
|
public function isOK(&$msg = null) |
|
142
|
|
|
{ |
|
143
|
|
|
if (!$this->isStringNotNullOrEmpty($this->version)) { |
|
144
|
|
|
$msg = "Version cannot be null or empty"; |
|
145
|
|
|
return false; |
|
146
|
|
|
} |
|
147
|
|
|
if (null != $this->designer && !$this->designer->isOK($msg)) { |
|
148
|
|
|
return false; |
|
149
|
|
|
} |
|
150
|
|
|
if (null != $this->runtime && !$this->runtime->isOK($msg)) { |
|
151
|
|
|
return false; |
|
152
|
|
|
} |
|
153
|
|
|
if (!$this->dataServiceType->isOK($msg)) { |
|
154
|
|
|
return false; |
|
155
|
|
|
} |
|
156
|
|
|
|
|
157
|
|
|
if (null == $this->runtime && null == $this->dataServiceType) { |
|
158
|
|
|
$msg = "Either a runtime or a dataservice must be defined for Tedmx"; |
|
159
|
|
|
return false; |
|
160
|
|
|
} |
|
161
|
|
|
|
|
162
|
|
|
return true; |
|
163
|
|
|
} |
|
164
|
|
|
} |
|
165
|
|
|
|