1: <?php
2: namespace Mapbender\MonitoringBundle\Entity;
3: use Doctrine\ORM\Mapping as ORM;
4: use Doctrine\Common\Collections\ArrayCollection;
5: use Symfony\Component\Validator\Constraints as Assert;
6:
7: /**
8: * Description of MonitoringDefinition
9: *
10: * @author apour
11: * @ORM\Entity
12: */
13: class MonitoringDefinition {
14: /**
15: *
16: * @ORM\Id
17: * @ORM\Column(type="integer")
18: * @ORM\GeneratedValue(strategy="AUTO")
19: */
20: protected $id;
21:
22: /**
23: *
24: * @ORM\Column(type="string", nullable=true)
25: */
26: protected $type;
27:
28: /**
29: *
30: * @ORM\Column(type="string", nullable=true)
31: */
32: protected $typeId;
33:
34: /**
35: *
36: * @ORM\Column(type="string", nullable=true)
37: */
38: protected $name;
39:
40: /**
41: *
42: * @ORM\Column(type="string", nullable=true)
43: */
44: protected $title;
45:
46: /**
47: *
48: * @ORM\Column(type="string", nullable=true)
49: */
50: protected $alias;
51:
52: /**
53: *
54: * @ORM\Column(type="text", nullable=true)
55: */
56: protected $url;
57:
58: /**
59: * @Assert\NotNull
60: * @ORM\Column(type="text")
61: */
62: protected $requestUrl;
63:
64: /**
65: *
66: * @ORM\Column(type="text", nullable=true)
67: */
68: protected $response;
69:
70: /**
71: *
72: * @ORM\Column(type="text", nullable=true)
73: */
74: protected $lastResponse;
75:
76: /**
77: *
78: * @ORM\Column(type="string", nullable=true)
79: */
80: protected $contactEmail;
81:
82: /**
83: *
84: * @ORM\Column(type="string", nullable=true)
85: */
86: protected $contact;
87:
88: /**
89: *
90: * @ORM\Column(type="datetime", nullable=true)
91: */
92: protected $lastNotificationTime;
93:
94: /**
95: * @ORM\OneToMany(targetEntity="MonitoringJob",mappedBy="monitoringDefinition", cascade={"persist","remove"})
96: * @ORM\OrderBy({"timestamp" = "DESC"});
97: */
98: protected $monitoringJobs;
99:
100: /**
101: *
102: * @ORM\Column(type="time", nullable=true)
103: */
104: protected $ruleStart;
105:
106: /**
107: *
108: * @ORM\Column(type="time", nullable=true)
109: */
110: protected $ruleEnd;
111:
112: /**
113: *
114: * @ORM\Column(type="boolean", nullable=false)
115: */
116: protected $ruleMonitor;
117:
118: /**
119: *
120: * @ORM\Column(type="string", nullable=false)
121: */
122: protected $enabled;
123:
124: public function __construct()
125: {
126: $this->ruleMonitor = false;
127: $this->enabled = true;
128: $this->monitoringJobs = new \Doctrine\Common\Collections\ArrayCollection();
129: }
130:
131: /**
132: * Get id
133: *
134: * @return integer
135: */
136: public function getId()
137: {
138: return $this->id;
139: }
140:
141: /**
142: * Set type
143: *
144: * @param string $type
145: */
146: public function setType($type)
147: {
148: $this->type = $type;
149: }
150:
151: /**
152: * Get type
153: *
154: * @return string
155: */
156: public function getType()
157: {
158: return $this->type;
159: }
160:
161: /**
162: * Set typeId
163: *
164: * @param string $typeId
165: */
166: public function setTypeId($typeId)
167: {
168: $this->typeId = $typeId;
169: }
170:
171: /**
172: * Get typeId
173: *
174: * @return string
175: */
176: public function getTypeId()
177: {
178: return $this->typeId;
179: }
180:
181: /**
182: * Set name
183: *
184: * @param string $name
185: */
186: public function setName($name)
187: {
188: $this->name = $name;
189: }
190:
191: /**
192: * Get name
193: *
194: * @return string
195: */
196: public function getName()
197: {
198: return $this->name;
199: }
200:
201: /**
202: * Set title
203: *
204: * @param string $title
205: */
206: public function setTitle($title)
207: {
208: $this->title = $title;
209: }
210:
211: /**
212: * Get title
213: *
214: * @return string
215: */
216: public function getTitle()
217: {
218: return $this->title;
219: }
220:
221: /**
222: * Set alias
223: *
224: * @param string $alias
225: */
226: public function setAlias($alias)
227: {
228: $this->alias = $alias;
229: }
230:
231: /**
232: * Get alias
233: *
234: * @return string
235: */
236: public function getAlias()
237: {
238: return $this->alias;
239: }
240:
241: /**
242: * Set url
243: *
244: * @param string $url
245: */
246: public function setUrl($url)
247: {
248: $this->url = $url;
249: }
250:
251: /**
252: * Get url
253: *
254: * @return string
255: */
256: public function getUrl()
257: {
258: return $this->url;
259: }
260:
261: /**
262: * Set requestUrl
263: *
264: * @param string $requestUrl
265: */
266: public function setRequestUrl($requestUrl)
267: {
268: $this->requestUrl = $requestUrl;
269: }
270:
271: /**
272: * Get requestUrl
273: *
274: * @return string
275: */
276: public function getRequestUrl()
277: {
278: return $this->requestUrl;
279: }
280:
281: /**
282: * Set response
283: *
284: * @param text $response
285: */
286: public function setResponse($response)
287: {
288: $this->response = $response;
289: }
290:
291: /**
292: * Get response
293: *
294: * @return text
295: */
296: public function getResponse()
297: {
298: return $this->response;
299: }
300:
301: /**
302: * Set lastResponse
303: *
304: * @param text $lastResponse
305: */
306: public function setLastResponse($lastResponse)
307: {
308: $this->lastResponse = $lastResponse;
309: }
310:
311: /**
312: * Get lastResponse
313: *
314: * @return text
315: */
316: public function getLastResponse()
317: {
318: return $this->lastResponse;
319: }
320:
321: /**
322: * Set contactEmail
323: *
324: * @param string $contactEmail
325: */
326: public function setContactEmail($contactEmail)
327: {
328: $this->contactEmail = $contactEmail;
329: }
330:
331: /**
332: * Get contactEmail
333: *
334: * @return string
335: */
336: public function getContactEmail()
337: {
338: return $this->contactEmail;
339: }
340:
341: /**
342: * Set contact
343: *
344: * @param string $contact
345: */
346: public function setContact($contact)
347: {
348: $this->contact = $contact;
349: }
350:
351: /**
352: * Get contact
353: *
354: * @return string
355: */
356: public function getContact()
357: {
358: return $this->contact;
359: }
360:
361: /**
362: * Set lastNotificationTime
363: *
364: * @param datetime $lastNotificationTime
365: */
366: public function setLastNotificationTime($lastNotificationTime)
367: {
368: $this->lastNotificationTime = $lastNotificationTime;
369: }
370:
371: /**
372: * Get lastNotificationTime
373: *
374: * @return datetime
375: */
376: public function getLastNotificationTime()
377: {
378: return $this->lastNotificationTime;
379: }
380:
381: /**
382: * Set ruleStart
383: *
384: * @param datetime $ruleStart
385: */
386: public function setRuleStart($ruleStart)
387: {
388: $this->ruleStart = $ruleStart;
389: }
390:
391: /**
392: * Get ruleStart
393: *
394: * @return datetime
395: */
396: public function getRuleStart()
397: {
398: return $this->ruleStart;
399: }
400:
401: /**
402: * Set ruleEnd
403: *
404: * @param datetime $ruleEnd
405: */
406: public function setRuleEnd($ruleEnd)
407: {
408: $this->ruleEnd = $ruleEnd;
409: }
410:
411: /**
412: * Get ruleEnd
413: *
414: * @return datetime
415: */
416: public function getRuleEnd()
417: {
418: return $this->ruleEnd;
419: }
420:
421: /**
422: * Set ruleMonitor
423: *
424: * @param boolean $ruleMonitor
425: */
426: public function setRuleMonitor($ruleMonitor)
427: {
428: $this->ruleMonitor = $ruleMonitor;
429: }
430:
431: /**
432: * Get ruleMonitor
433: *
434: * @return boolean
435: */
436: public function getRuleMonitor()
437: {
438: return $this->ruleMonitor;
439: }
440:
441: /**
442: * Set enabled
443: *
444: * @param string $enabled
445: */
446: public function setEnabled($enabled)
447: {
448: $this->enabled = $enabled;
449: }
450:
451: /**
452: * Get enabled
453: *
454: * @return string
455: */
456: public function getEnabled()
457: {
458: return $this->enabled;
459: }
460:
461: /**
462: * Add monitoringJobs
463: *
464: * @param Mapbender\MonitoringBundle\Entity\MonitoringJob $monitoringJobs
465: */
466: public function addMonitoringJob(\Mapbender\MonitoringBundle\Entity\MonitoringJob $monitoringJob)
467: {
468: $this->monitoringJobs[] = $monitoringJob;
469: }
470:
471: /**
472: * Get monitoringJobs
473: *
474: * @return Doctrine\Common\Collections\Collection
475: */
476: public function getMonitoringJobs()
477: {
478: return $this->monitoringJobs;
479: }
480:
481: /**
482: * Get the latest MonitoringJob
483: */
484: public function getLastMonitoringJob(){
485: return $this->monitoringJobs[0];
486: }
487: }
488: