1: <?php
2:
3: namespace Mapbender\WmcBundle\Entity;
4:
5: use Doctrine\ORM\Mapping as ORM;
6: use Mapbender\CoreBundle\Entity\State;
7: use Mapbender\WmsBundle\Component\OnlineResource;
8: use Mapbender\WmsBundle\Component\LegendUrl;
9: use Symfony\Component\Validator\Constraints as Assert;
10:
11: /**
12: * A Wmc entity presents an OGC WMC.
13: * @ORM\Entity
14: * @ORM\Table(name="mb_wmc_wmc")
15: * ORM\DiscriminatorMap({"mb_wmc" = "Wmc"})
16: */
17: class Wmc
18: {
19:
20: /**
21: * @ORM\Id
22: * @ORM\Column(type="integer")
23: * @ORM\GeneratedValue(strategy="AUTO")
24: */
25: protected $id;
26:
27: /**
28: * @var string $version The wmc version
29: * @ORM\Column(type="string", length=10, nullable=true)
30: */
31: protected $version = "1.1.0";
32:
33: /**
34: * @var string $wmcid a wmc id
35: * @ORM\Column(type="string", length=255, nullable=true)
36: */
37: protected $wmcid;
38:
39: /**
40: * @ORM\OneToOne(targetEntity="Mapbender\CoreBundle\Entity\State", cascade={"persist","remove"})
41: * @ORM\JoinColumn(name="state", referencedColumnName="id")
42: * */
43: protected $state;
44:
45: /**
46: * @var array $keywords The keywords of the wmc
47: * @ORM\Column(type="array",nullable=true)
48: * */
49: protected $keywords = array();
50:
51: /**
52: * @var string $abstract The wmc description
53: * @ORM\Column(type="text", nullable=true)
54: */
55: protected $abstract;
56:
57: /**
58: * @var string A description url
59: * @ORM\Column(type="object", nullable=true)
60: */
61: public $logourl;
62:
63: /**
64: * @var string A description url
65: * @ORM\Column(type="object", nullable=true)
66: */
67: public $descriptionurl;
68:
69: /**
70: * @var string $screenshotPath The wmc description
71: * @ORM\Column(type="string", length=255, nullable=true)
72: */
73: private $screenshotPath;
74:
75: /**
76: * @var screenshot
77: * @Assert\File(maxSize="6000000")
78: */
79: private $screenshot;
80:
81: /**
82: * @var Contact A contact.
83: * @ORM\OneToOne(targetEntity="Mapbender\CoreBundle\Entity\Contact", cascade={"persist","remove"})
84: */
85: protected $contact;
86:
87: /**
88: * @var wmc document
89: * @Assert\File(maxSize="6000000")
90: */
91: private $xml;
92:
93:
94: /**
95: * Set id
96: *
97: * @param integer $id
98: * @return State
99: */
100: public function setId($id)
101: {
102: $this->id = $id;
103: return $this;
104: }
105:
106: /**
107: * Get id
108: *
109: * @return integer $id
110: */
111: public function getId()
112: {
113: return $this->id;
114: }
115:
116: public function setState($state)
117: {
118: $this->state = $state;
119: return $this;
120: }
121:
122: public function getState()
123: {
124: return $this->state;
125: }
126:
127: public function setKeywords($keywords)
128: {
129: $this->keywords = $keywords;
130: return $this;
131: }
132:
133: public function getKeywords()
134: {
135: return $this->keywords;
136: }
137:
138: /**
139: * Set abstract
140: *
141: * @param string $abstract
142: * @return Source
143: */
144: public function setAbstract($abstract)
145: {
146: $this->abstract = $abstract;
147: return $this;
148: }
149:
150: /**
151: * Get abstract
152: *
153: * @return string
154: */
155: public function getAbstract()
156: {
157: return $this->abstract;
158: }
159:
160: /**
161: * Set logourl
162: *
163: * @param LegendUrl $logourl
164: * @return Wmc
165: */
166: public function setLogourl(LegendUrl $logourl)
167: {
168: $this->logourl = $logourl;
169: return $this;
170: }
171:
172: /**
173: * Get logourl
174: *
175: * @return LegendUrl
176: */
177: public function getLogourl()
178: {
179: return $this->logourl;
180: }
181:
182: /**
183: * Set descriptionurl
184: *
185: * @param OnlineResource $descriptionurl
186: * @return Wmc
187: */
188: public function setDescriptionurl(OnlineResource $descriptionurl)
189: {
190: $this->descriptionurl = $descriptionurl;
191: return $this;
192: }
193:
194: /**
195: * Get descriptionurl
196: *
197: * @return OnlineResource
198: */
199: public function getDescriptionurl()
200: {
201: return $this->descriptionurl;
202: }
203:
204: /**
205: * Set screenshotPath
206: *
207: * @param string $screenshotPath
208: * @return Source
209: */
210: public function setScreenshotPath($screenshotPath)
211: {
212: $this->screenshotPath = $screenshotPath;
213: return $this;
214: }
215:
216: /**
217: * Get screenshotPath
218: *
219: * @return string
220: */
221: public function getScreenshotPath()
222: {
223: return $this->screenshotPath;
224: }
225:
226: /**
227: * @param string $screenshot
228: */
229: public function setScreenshot($screenshot) {
230: $this->screenshot = $screenshot;
231: }
232:
233: /**
234: * Get version
235: *
236: * @return string
237: */
238: public function getVersion() {
239: return $this->version;
240: }
241:
242: /**
243: * @param string $version
244: */
245: public function setVersion($version) {
246: $this->version = $version;
247: return $this;
248: }
249:
250: /**
251: * Get version
252: *
253: * @return string
254: */
255: public function getWmcid() {
256: return $this->wmcid;
257: }
258:
259: /**
260: * @param string $wmcid
261: */
262: public function setWmcid($wmcid) {
263: $this->wmcid = $wmcid;
264: return $this;
265: }
266:
267:
268:
269: /**
270: * Set contact
271: *
272: * @param string $contact
273: * @return WmsSource
274: */
275: public function setContact($contact)
276: {
277: $this->contact = $contact;
278: return $this;
279: }
280:
281: /**
282: * Get contact
283: *
284: * @return string
285: */
286: public function getContact()
287: {
288: return $this->contact;
289: }
290:
291: /**
292: * @param string $xml
293: */
294: public function setXml($xml) {
295: $this->xml = $xml;
296: }
297:
298: /**
299: * Get xml
300: *
301: * @return string
302: */
303: public function getXml() {
304: return $this->xml;
305: }
306:
307: /**
308: * Get screenshot
309: *
310: * @return string
311: */
312: public function getScreenshot() {
313: return $this->screenshot;
314: }
315:
316:
317: public static function create($state = null, $logoUrl = null,
318: $descriptionUrl = null)
319: {
320: $state = $state === null ? new State() : $state;
321: $wmc = new Wmc();
322: $wmc->setState($state);
323: $logoUrl = $logoUrl === null ? LegendUrl::create() : logoUrl;
324: if($logoUrl !== null)
325: {
326: $wmc->setLogourl($logoUrl);
327: }
328: $descriptionUrl = $descriptionUrl === null ? OnlineResource::create() : $descriptionUrl;
329: if($descriptionUrl !== null)
330: {
331: $wmc->setDescriptionurl($descriptionUrl);
332: }
333: return $wmc;
334: }
335:
336: }
337:
338: