itopsoaptypes.class.inc.php 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  1. <?php
  2. // Copyright (C) 2010-2012 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. * Declarations required for the WSDL
  20. *
  21. * @copyright Copyright (C) 2010-2012 Combodo SARL
  22. * @license http://opensource.org/licenses/AGPL-3.0
  23. */
  24. // Note: the attributes must have the same names (case sensitive) as in the WSDL specification
  25. //
  26. class SOAPSearchCondition
  27. {
  28. public $attcode; // string
  29. public $value; // mixed
  30. public function __construct($sAttCode, $value)
  31. {
  32. $this->attcode = $sAttCode;
  33. $this->value = $value;
  34. }
  35. }
  36. class SOAPExternalKeySearch
  37. {
  38. public $conditions; // array of SOAPSearchCondition
  39. public function __construct($aConditions = null)
  40. {
  41. $this->conditions = $aConditions;
  42. }
  43. public function IsVoid()
  44. {
  45. if (is_null($this->conditions)) return true;
  46. if (count($this->conditions) == 0) return true;
  47. }
  48. }
  49. class SOAPAttributeValue
  50. {
  51. public $attcode; // string
  52. public $value; // mixed
  53. public function __construct($sAttCode, $value)
  54. {
  55. $this->attcode = $sAttCode;
  56. $this->value = $value;
  57. }
  58. }
  59. class SOAPLinkCreationSpec
  60. {
  61. public $class;
  62. public $conditions; // array of SOAPSearchCondition
  63. public $attributes; // array of SOAPAttributeValue
  64. public function __construct($sClass, $aConditions, $aAttributes)
  65. {
  66. $this->class = $sClass;
  67. $this->conditions = $aConditions;
  68. $this->attributes = $aAttributes;
  69. }
  70. }
  71. class SOAPLogMessage
  72. {
  73. public $text; // string
  74. public function __construct($sText)
  75. {
  76. $this->text = $sText;
  77. }
  78. }
  79. class SOAPResultLog
  80. {
  81. public $messages; // array of SOAPLogMessage
  82. public function __construct($aMessages)
  83. {
  84. $this->messages = $aMessages;
  85. }
  86. }
  87. class SOAPKeyValue
  88. {
  89. public $key; // string
  90. public $value; // string
  91. public function __construct($sKey, $sValue)
  92. {
  93. $this->key = $sKey;
  94. $this->value = $sValue;
  95. }
  96. }
  97. class SOAPResultMessage
  98. {
  99. public $label; // string
  100. public $values; // array of SOAPKeyValue
  101. public function __construct($sLabel, $aValues)
  102. {
  103. $this->label = $sLabel;
  104. $this->values = $aValues;
  105. }
  106. }
  107. class SOAPResult
  108. {
  109. public $status; // boolean
  110. public $result; // array of SOAPResultMessage
  111. public $errors; // array of SOAPResultLog
  112. public $warnings; // array of SOAPResultLog
  113. public $infos; // array of SOAPResultLog
  114. public function __construct($bStatus, $aResult, $aErrors, $aWarnings, $aInfos)
  115. {
  116. $this->status = $bStatus;
  117. $this->result = $aResult;
  118. $this->errors = $aErrors;
  119. $this->warnings = $aWarnings;
  120. $this->infos = $aInfos;
  121. }
  122. }
  123. class SOAPSimpleResult
  124. {
  125. public $status; // boolean
  126. public $message; // string
  127. public function __construct($bStatus, $sMessage)
  128. {
  129. $this->status = $bStatus;
  130. $this->message = $sMessage;
  131. }
  132. }
  133. class SOAPMapping
  134. {
  135. static function GetMapping()
  136. {
  137. $aSOAPMapping = array(
  138. 'SearchCondition' => 'SOAPSearchCondition',
  139. 'ExternalKeySearch' => 'SOAPExternalKeySearch',
  140. 'AttributeValue' => 'SOAPAttributeValue',
  141. 'LinkCreationSpec' => 'SOAPLinkCreationSpec',
  142. 'KeyValue' => 'SOAPKeyValue',
  143. 'LogMessage' => 'SOAPLogMessage',
  144. 'ResultLog' => 'SOAPResultLog',
  145. 'ResultData' => 'SOAPKeyValue',
  146. 'ResultMessage' => 'SOAPResultMessage',
  147. 'Result' => 'SOAPResult',
  148. 'SimpleResult' => 'SOAPSimpleResult',
  149. );
  150. return $aSOAPMapping;
  151. }
  152. }
  153. ?>