BranchSync.php 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865
  1. <?php
  2. namespace Entity;
  3. use Doctrine\ORM\Mapping as ORM;
  4. use Gedmo\Mapping\Annotation as Gedmo;
  5. use Doctrine\Common\Collections\ArrayCollection;
  6. /**
  7. * BranchSync
  8. *
  9. * @ORM\Table(name="branch_sync")
  10. * @ORM\Entity(repositoryClass="Entity\Repository\BranchSyncRepository")
  11. * @Gedmo\Tree(type="nested")
  12. */
  13. class BranchSync
  14. {
  15. /**
  16. * @var integer
  17. *
  18. * @ORM\Column(name="id", type="integer", precision=0, scale=0, nullable=false, unique=false)
  19. * @ORM\Id
  20. * @ORM\GeneratedValue(strategy="IDENTITY")
  21. */
  22. private $id;
  23. /**
  24. * @var integer
  25. *
  26. * @ORM\Column(name="access_url_id", type="integer", precision=0, scale=0, nullable=false, unique=false)
  27. */
  28. private $accessUrlId;
  29. /**
  30. * @var string
  31. *
  32. * @ORM\Column(name="branch_name", type="string", length=250, precision=0, scale=0, nullable=true, unique=false)
  33. */
  34. private $branchName;
  35. /**
  36. * @var string
  37. *
  38. * @ORM\Column(name="branch_ip", type="string", length=40, precision=0, scale=0, nullable=true, unique=false)
  39. */
  40. private $branchIp;
  41. /**
  42. * @var float
  43. *
  44. * @ORM\Column(name="latitude", type="decimal", precision=0, scale=0, nullable=true, unique=false)
  45. */
  46. private $latitude;
  47. /**
  48. * @var float
  49. *
  50. * @ORM\Column(name="longitude", type="decimal", precision=0, scale=0, nullable=true, unique=false)
  51. */
  52. private $longitude;
  53. /**
  54. * @var integer
  55. *
  56. * @ORM\Column(name="dwn_speed", type="integer", precision=0, scale=0, nullable=true, unique=false)
  57. */
  58. private $dwnSpeed;
  59. /**
  60. * @var integer
  61. *
  62. * @ORM\Column(name="up_speed", type="integer", precision=0, scale=0, nullable=true, unique=false)
  63. */
  64. private $upSpeed;
  65. /**
  66. * @var integer
  67. *
  68. * @ORM\Column(name="delay", type="integer", precision=0, scale=0, nullable=true, unique=false)
  69. */
  70. private $delay;
  71. /**
  72. * @var string
  73. *
  74. * @ORM\Column(name="admin_mail", type="string", length=250, precision=0, scale=0, nullable=true, unique=false)
  75. */
  76. private $adminMail;
  77. /**
  78. * @var string
  79. *
  80. * @ORM\Column(name="admin_name", type="string", length=250, precision=0, scale=0, nullable=true, unique=false)
  81. */
  82. private $adminName;
  83. /**
  84. * @var string
  85. *
  86. * @ORM\Column(name="admin_phone", type="string", length=250, precision=0, scale=0, nullable=true, unique=false)
  87. */
  88. private $adminPhone;
  89. /**
  90. * @var integer
  91. *
  92. * @ORM\Column(name="last_sync_trans_id", type="bigint", precision=0, scale=0, nullable=true, unique=false)
  93. */
  94. private $lastSyncTransId;
  95. /**
  96. * @var \DateTime
  97. *
  98. * @ORM\Column(name="last_sync_trans_date", type="datetime", precision=0, scale=0, nullable=true, unique=false)
  99. */
  100. private $lastSyncTransDate;
  101. /**
  102. * @var string
  103. *
  104. * @ORM\Column(name="last_sync_type", type="string", length=20, precision=0, scale=0, nullable=true, unique=false)
  105. */
  106. private $lastSyncType;
  107. /**
  108. * @var string
  109. *
  110. * @ORM\Column(name="branch_type", type="string", length=250, precision=0, scale=0, nullable=true, unique=false)
  111. */
  112. private $branchType;
  113. /**
  114. * @var integer
  115. * @Gedmo\TreeLeft
  116. * @ORM\Column(name="lft", type="integer", precision=0, scale=0, nullable=true, unique=false)
  117. */
  118. private $lft;
  119. /**
  120. * @var integer
  121. * @Gedmo\TreeRight
  122. * @ORM\Column(name="rgt", type="integer", precision=0, scale=0, nullable=true, unique=false)
  123. */
  124. private $rgt;
  125. /**
  126. * @var integer
  127. * @Gedmo\TreeLevel
  128. * @ORM\Column(name="lvl", type="integer", precision=0, scale=0, nullable=true, unique=false)
  129. */
  130. private $lvl;
  131. /**
  132. * @var integer
  133. * @Gedmo\TreeRoot
  134. * @ORM\Column(name="root", type="integer", precision=0, scale=0, nullable=true, unique=false)
  135. */
  136. private $root;
  137. /**
  138. * @var integer
  139. *
  140. * @ORM\Column(name="parent_id", type="integer", precision=0, scale=0, nullable=true, unique=false)
  141. */
  142. private $parentId;
  143. /**
  144. * @Gedmo\TreeParent
  145. * @ORM\ManyToOne(targetEntity="BranchSync", inversedBy="children")
  146. * @ORM\JoinColumn(name="parent_id", referencedColumnName="id", onDelete="SET NULL")
  147. */
  148. private $parent;
  149. /**
  150. * @ORM\OneToMany(targetEntity="BranchSync", mappedBy="parent")
  151. * @ORM\OrderBy({"lft" = "ASC"})
  152. */
  153. private $children;
  154. /**
  155. * @ORM\OneToMany(targetEntity="BranchUsers", mappedBy="branch")
  156. */
  157. private $users;
  158. /**
  159. * @ORM\OneToMany(targetEntity="Jury", mappedBy="branch")
  160. **/
  161. private $juries;
  162. /**
  163. * Machine name for the envelope plugin to use.
  164. *
  165. * @var string
  166. *
  167. * @ORM\Column(name="plugin_envelope", type="string", length=250, precision=0, scale=0, nullable=true, unique=false)
  168. */
  169. private $pluginEnvelope;
  170. /**
  171. * Machine name for the send plugin to use.
  172. *
  173. * @var string
  174. *
  175. * @ORM\Column(name="plugin_send", type="string", length=250, precision=0, scale=0, nullable=true, unique=false)
  176. */
  177. private $pluginSend;
  178. /**
  179. * Machine name for the receive plugin to use.
  180. *
  181. * @var string
  182. *
  183. * @ORM\Column(name="plugin_receive", type="string", length=250, precision=0, scale=0, nullable=true, unique=false)
  184. */
  185. private $pluginReceive;
  186. /**
  187. * Extra information about the branch.
  188. *
  189. * For now, mainly used by plugins to store extra information for them to be
  190. * instanciated.
  191. * An example status:
  192. * <code>
  193. * array(
  194. * 'plugins' => array(
  195. * 'receive' => array(
  196. * 'origin' => '/path/to/dir1',
  197. * 'processed' => '/path/to/dir2',
  198. * ),
  199. * ),
  200. * );
  201. * </code>
  202. *
  203. * @var array
  204. *
  205. * @ORM\Column(type="array", nullable=true, unique=false)
  206. */
  207. private $data;
  208. /**
  209. *
  210. */
  211. public function __construct()
  212. {
  213. // $this->lastSyncTransDate = new \DateTime();
  214. }
  215. /**
  216. * @return ArrayCollection
  217. */
  218. public function getJuries()
  219. {
  220. return $this->juries;
  221. }
  222. /**
  223. * @return ArrayCollection
  224. */
  225. public function getUsers()
  226. {
  227. return $this->users;
  228. }
  229. /**
  230. * Get id
  231. *
  232. * @return integer
  233. */
  234. public function getId()
  235. {
  236. return $this->id;
  237. }
  238. /**
  239. * Set accessUrlId
  240. *
  241. * @param integer $accessUrlId
  242. * @return BranchSync
  243. */
  244. public function setAccessUrlId($accessUrlId)
  245. {
  246. $this->accessUrlId = $accessUrlId;
  247. return $this;
  248. }
  249. /**
  250. * Get accessUrlId
  251. *
  252. * @return integer
  253. */
  254. public function getAccessUrlId()
  255. {
  256. return $this->accessUrlId;
  257. }
  258. /**
  259. * Set branchName
  260. *
  261. * @param string $branchName
  262. * @return BranchSync
  263. */
  264. public function setBranchName($branchName)
  265. {
  266. $this->branchName = $branchName;
  267. return $this;
  268. }
  269. /**
  270. * Get branchName
  271. *
  272. * @return string
  273. */
  274. public function getBranchName()
  275. {
  276. return $this->branchName;
  277. }
  278. /**
  279. * Set branchIp
  280. *
  281. * @param string $branchIp
  282. * @return BranchSync
  283. */
  284. public function setBranchIp($branchIp)
  285. {
  286. $this->branchIp = $branchIp;
  287. return $this;
  288. }
  289. /**
  290. * Get branchIp
  291. *
  292. * @return string
  293. */
  294. public function getBranchIp()
  295. {
  296. return $this->branchIp;
  297. }
  298. /**
  299. * Set latitude
  300. *
  301. * @param float $latitude
  302. * @return BranchSync
  303. */
  304. public function setLatitude($latitude)
  305. {
  306. $this->latitude = $latitude;
  307. return $this;
  308. }
  309. /**
  310. * Get latitude
  311. *
  312. * @return float
  313. */
  314. public function getLatitude()
  315. {
  316. return $this->latitude;
  317. }
  318. /**
  319. * Set longitude
  320. *
  321. * @param float $longitude
  322. * @return BranchSync
  323. */
  324. public function setLongitude($longitude)
  325. {
  326. $this->longitude = $longitude;
  327. return $this;
  328. }
  329. /**
  330. * Get longitude
  331. *
  332. * @return float
  333. */
  334. public function getLongitude()
  335. {
  336. return $this->longitude;
  337. }
  338. /**
  339. * Set dwnSpeed
  340. *
  341. * @param integer $dwnSpeed
  342. * @return BranchSync
  343. */
  344. public function setDwnSpeed($dwnSpeed)
  345. {
  346. $this->dwnSpeed = $dwnSpeed;
  347. return $this;
  348. }
  349. /**
  350. * Get dwnSpeed
  351. *
  352. * @return integer
  353. */
  354. public function getDwnSpeed()
  355. {
  356. return $this->dwnSpeed;
  357. }
  358. /**
  359. * Set upSpeed
  360. *
  361. * @param integer $upSpeed
  362. * @return BranchSync
  363. */
  364. public function setUpSpeed($upSpeed)
  365. {
  366. $this->upSpeed = $upSpeed;
  367. return $this;
  368. }
  369. /**
  370. * Get upSpeed
  371. *
  372. * @return integer
  373. */
  374. public function getUpSpeed()
  375. {
  376. return $this->upSpeed;
  377. }
  378. /**
  379. * Set delay
  380. *
  381. * @param integer $delay
  382. * @return BranchSync
  383. */
  384. public function setDelay($delay)
  385. {
  386. $this->delay = $delay;
  387. return $this;
  388. }
  389. /**
  390. * Get delay
  391. *
  392. * @return integer
  393. */
  394. public function getDelay()
  395. {
  396. return $this->delay;
  397. }
  398. /**
  399. * Set adminMail
  400. *
  401. * @param string $adminMail
  402. * @return BranchSync
  403. */
  404. public function setAdminMail($adminMail)
  405. {
  406. $this->adminMail = $adminMail;
  407. return $this;
  408. }
  409. /**
  410. * Get adminMail
  411. *
  412. * @return string
  413. */
  414. public function getAdminMail()
  415. {
  416. return $this->adminMail;
  417. }
  418. /**
  419. * Set adminName
  420. *
  421. * @param string $adminName
  422. * @return BranchSync
  423. */
  424. public function setAdminName($adminName)
  425. {
  426. $this->adminName = $adminName;
  427. return $this;
  428. }
  429. /**
  430. * Get adminName
  431. *
  432. * @return string
  433. */
  434. public function getAdminName()
  435. {
  436. return $this->adminName;
  437. }
  438. /**
  439. * Set adminPhone
  440. *
  441. * @param string $adminPhone
  442. * @return BranchSync
  443. */
  444. public function setAdminPhone($adminPhone)
  445. {
  446. $this->adminPhone = $adminPhone;
  447. return $this;
  448. }
  449. /**
  450. * Get adminPhone
  451. *
  452. * @return string
  453. */
  454. public function getAdminPhone()
  455. {
  456. return $this->adminPhone;
  457. }
  458. /**
  459. * Set lastSyncTransId
  460. *
  461. * @param integer $lastSyncTransId
  462. * @return BranchSync
  463. */
  464. public function setLastSyncTransId($lastSyncTransId)
  465. {
  466. $this->lastSyncTransId = $lastSyncTransId;
  467. return $this;
  468. }
  469. /**
  470. * Get lastSyncTransId
  471. *
  472. * @return integer
  473. */
  474. public function getLastSyncTransId()
  475. {
  476. return $this->lastSyncTransId;
  477. }
  478. /**
  479. * Set lastSyncTransDate
  480. *
  481. * @param \DateTime $lastSyncTransDate
  482. * @return BranchSync
  483. */
  484. public function setLastSyncTransDate($lastSyncTransDate)
  485. {
  486. $this->lastSyncTransDate = $lastSyncTransDate;
  487. return $this;
  488. }
  489. /**
  490. * Set branchType.
  491. *
  492. * @param string $branchType
  493. * @return BranchSync
  494. */
  495. public function setBranchType($branchType)
  496. {
  497. $this->branchType = $branchType;
  498. return $this;
  499. }
  500. /**
  501. * Get branchType.
  502. *
  503. * @return string
  504. */
  505. public function getBranchType()
  506. {
  507. return $this->branchType;
  508. }
  509. /**
  510. * Get lastSyncTransDate
  511. *
  512. * @return \DateTime
  513. */
  514. public function getLastSyncTransDate()
  515. {
  516. return $this->lastSyncTransDate;
  517. }
  518. /**
  519. * Set lastSyncType
  520. *
  521. * @param string $lastSyncType
  522. * @return BranchSync
  523. */
  524. public function setLastSyncType($lastSyncType)
  525. {
  526. $this->lastSyncType = $lastSyncType;
  527. return $this;
  528. }
  529. /**
  530. * Get lastSyncType
  531. *
  532. * @return string
  533. */
  534. public function getLastSyncType()
  535. {
  536. return $this->lastSyncType;
  537. }
  538. /**
  539. * Set lft
  540. *
  541. * @param integer $lft
  542. * @return BranchSync
  543. */
  544. public function setLft($lft)
  545. {
  546. $this->lft = $lft;
  547. return $this;
  548. }
  549. /**
  550. * Get lft
  551. *
  552. * @return integer
  553. */
  554. public function getLft()
  555. {
  556. return $this->lft;
  557. }
  558. /**
  559. * Set rgt
  560. *
  561. * @param integer $rgt
  562. * @return BranchSync
  563. */
  564. public function setRgt($rgt)
  565. {
  566. $this->rgt = $rgt;
  567. return $this;
  568. }
  569. /**
  570. * Get rgt
  571. *
  572. * @return integer
  573. */
  574. public function getRgt()
  575. {
  576. return $this->rgt;
  577. }
  578. /**
  579. * Set lvl
  580. *
  581. * @param integer $lvl
  582. * @return BranchSync
  583. */
  584. public function setLvl($lvl)
  585. {
  586. $this->lvl = $lvl;
  587. return $this;
  588. }
  589. /**
  590. * Get lvl
  591. *
  592. * @return integer
  593. */
  594. public function getLvl()
  595. {
  596. return $this->lvl;
  597. }
  598. /**
  599. * Set root
  600. *
  601. * @param integer $root
  602. * @return BranchSync
  603. */
  604. public function setRoot($root)
  605. {
  606. $this->root = $root;
  607. return $this;
  608. }
  609. /**
  610. * Get root
  611. *
  612. * @return integer
  613. */
  614. public function getRoot()
  615. {
  616. return $this->root;
  617. }
  618. /**
  619. * Set parentId
  620. *
  621. * @param integer $parentId
  622. * @return BranchSync
  623. */
  624. public function setParentId($parentId)
  625. {
  626. $this->parentId = $parentId;
  627. return $this;
  628. }
  629. /**
  630. * Get parentId
  631. *
  632. * @return integer
  633. */
  634. public function getParentId()
  635. {
  636. return $this->parentId;
  637. }
  638. /**
  639. * @param BranchSync $parent
  640. */
  641. public function setParent(BranchSync $parent = null)
  642. {
  643. $this->parent = $parent;
  644. }
  645. /**
  646. * @return mixed
  647. */
  648. public function getParent()
  649. {
  650. return $this->parent;
  651. }
  652. /**
  653. * Set pluginEnvelope.
  654. *
  655. * @param string $pluginEnvelope
  656. *
  657. * @return BranchSync
  658. */
  659. public function setPluginEnvelope($pluginEnvelope)
  660. {
  661. $this->pluginEnvelope = $pluginEnvelope;
  662. return $this;
  663. }
  664. /**
  665. * Get pluginEnvelope.
  666. *
  667. * @return string
  668. */
  669. public function getPluginEnvelope()
  670. {
  671. return $this->pluginEnvelope;
  672. }
  673. /**
  674. * Set pluginSend.
  675. *
  676. * @param string $pluginSend
  677. *
  678. * @return BranchSync
  679. */
  680. public function setPluginSend($pluginSend)
  681. {
  682. $this->pluginSend = $pluginSend;
  683. return $this;
  684. }
  685. /**
  686. * Get pluginSend.
  687. *
  688. * @return string
  689. */
  690. public function getPluginSend()
  691. {
  692. return $this->pluginSend;
  693. }
  694. /**
  695. * Set pluginReceive.
  696. *
  697. * @param string $pluginReceive
  698. *
  699. * @return BranchSync
  700. */
  701. public function setPluginReceive($pluginReceive)
  702. {
  703. $this->pluginReceive = $pluginReceive;
  704. return $this;
  705. }
  706. /**
  707. * Get pluginReceive.
  708. *
  709. * @return string
  710. */
  711. public function getPluginReceive()
  712. {
  713. return $this->pluginReceive;
  714. }
  715. /**
  716. * Set data.
  717. *
  718. * @param array $data
  719. *
  720. * @return BranchSync
  721. */
  722. public function setData($data)
  723. {
  724. $this->data = $data;
  725. return $this;
  726. }
  727. /**
  728. * Get data.
  729. *
  730. * @return array
  731. */
  732. public function getData()
  733. {
  734. return $this->data;
  735. }
  736. /**
  737. * Get plugin data.
  738. *
  739. * Helper to retrieve plugin information.
  740. *
  741. * @param string $plugin_type
  742. * The plugin type to search information for.
  743. *
  744. * @return array
  745. * The information or empty array.
  746. */
  747. public function getPluginData($plugin_type)
  748. {
  749. if (isset($this->data['plugins'][$plugin_type])) {
  750. return $this->data['plugins'][$plugin_type];
  751. }
  752. return array();
  753. }
  754. }