modelreflection.class.inc.php 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. <?php
  2. // Copyright (C) 2013 Combodo SARL
  3. //
  4. // This file is part of iTop.
  5. //
  6. // iTop is free software; you can redistribute it and/or modify
  7. // it under the terms of the GNU Affero General Public License as published by
  8. // the Free Software Foundation, either version 3 of the License, or
  9. // (at your option) any later version.
  10. //
  11. // iTop is distributed in the hope that it will be useful,
  12. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. // GNU Affero General Public License for more details.
  15. //
  16. // You should have received a copy of the GNU Affero General Public License
  17. // along with iTop. If not, see <http://www.gnu.org/licenses/>
  18. /**
  19. * Reflection API for the MetaModel (partial)
  20. *
  21. * @copyright Copyright (C) 2013 Combodo SARL
  22. * @license http://opensource.org/licenses/AGPL-3.0
  23. */
  24. interface ModelReflection
  25. {
  26. public function GetClassIcon($sClass, $bImgTag = true);
  27. public function IsValidAttCode($sClass, $sAttCode);
  28. public function GetName($sClass);
  29. public function GetLabel($sClass, $sAttCodeEx);
  30. public function ListAttributeDefs($sClass);
  31. public function GetAllowedValues_att($sClass, $sAttCode);
  32. public function HasChildrenClasses($sClass);
  33. public function GetClasses($sCategories = '');
  34. public function IsValidClass($sClass);
  35. public function GetExternalKeys($sClass);
  36. public function GetAttributeDef($sClass, $sAttCode);
  37. public function IsSameFamilyBranch($sClassA, $sClassB);
  38. public function GetFiltersList($sClass);
  39. public function IsValidFilterCode($sClass, $sFilterCode);
  40. }
  41. class ModelReflectionRuntime implements ModelReflection
  42. {
  43. public function __construct()
  44. {
  45. }
  46. public function GetClassIcon($sClass, $bImgTag = true)
  47. {
  48. return MetaModel::GetClassIcon($sClass, $bImgTag);
  49. }
  50. public function IsValidAttCode($sClass, $sAttCode)
  51. {
  52. return MetaModel::IsValidAttCode($sClass, $sAttCode);
  53. }
  54. public function GetName($sClass)
  55. {
  56. return MetaModel::GetName($sClass);
  57. }
  58. public function GetLabel($sClass, $sAttCodeEx)
  59. {
  60. return MetaModel::GetLabel($sClass, $sAttCodeEx);
  61. }
  62. public function ListAttributeDefs($sClass)
  63. {
  64. return MetaModel::ListAttributeDefs($sClass);
  65. }
  66. public function GetAllowedValues_att($sClass, $sAttCode)
  67. {
  68. return MetaModel::GetAllowedValues_att($sClass, $sAttCode);
  69. }
  70. public function HasChildrenClasses($sClass)
  71. {
  72. return MetaModel::HasChildrenClasses($sClass);
  73. }
  74. public function GetClasses($sCategories = '')
  75. {
  76. return MetaModel::GetClasses($sCategories);
  77. }
  78. public function IsValidClass($sClass)
  79. {
  80. return MetaModel::IsValidClass($sClass);
  81. }
  82. public function GetExternalKeys($sClass)
  83. {
  84. return MetaModel::GetExternalKeys($sClass);
  85. }
  86. public function GetAttributeDef($sClass, $sAttCode)
  87. {
  88. return MetaModel::GetAttributeDef($sClass, $sAttCode);
  89. }
  90. public function IsSameFamilyBranch($sClassA, $sClassB)
  91. {
  92. return MetaModel::IsSameFamilyBranch($sClassA, $sClassB);
  93. }
  94. public function GetFiltersList($sClass)
  95. {
  96. return MetaModel::GetFiltersList($sClass);
  97. }
  98. public function IsValidFilterCode($sClass, $sFilterCode)
  99. {
  100. return MetaModel::IsValidFilterCode($sClass, $sFilterCode);
  101. }
  102. }