AlipayDataZbdmLineageQueryModel.py 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. import json
  4. from alipay.aop.api.constant.ParamConstants import *
  5. class AlipayDataZbdmLineageQueryModel(object):
  6. def __init__(self):
  7. self._direction = None
  8. self._edge_type = None
  9. self._max_depth = None
  10. self._start_ids = None
  11. @property
  12. def direction(self):
  13. return self._direction
  14. @direction.setter
  15. def direction(self, value):
  16. self._direction = value
  17. @property
  18. def edge_type(self):
  19. return self._edge_type
  20. @edge_type.setter
  21. def edge_type(self, value):
  22. if isinstance(value, list):
  23. self._edge_type = list()
  24. for i in value:
  25. self._edge_type.append(i)
  26. @property
  27. def max_depth(self):
  28. return self._max_depth
  29. @max_depth.setter
  30. def max_depth(self, value):
  31. self._max_depth = value
  32. @property
  33. def start_ids(self):
  34. return self._start_ids
  35. @start_ids.setter
  36. def start_ids(self, value):
  37. if isinstance(value, list):
  38. self._start_ids = list()
  39. for i in value:
  40. self._start_ids.append(i)
  41. def to_alipay_dict(self):
  42. params = dict()
  43. if self.direction:
  44. if hasattr(self.direction, 'to_alipay_dict'):
  45. params['direction'] = self.direction.to_alipay_dict()
  46. else:
  47. params['direction'] = self.direction
  48. if self.edge_type:
  49. if isinstance(self.edge_type, list):
  50. for i in range(0, len(self.edge_type)):
  51. element = self.edge_type[i]
  52. if hasattr(element, 'to_alipay_dict'):
  53. self.edge_type[i] = element.to_alipay_dict()
  54. if hasattr(self.edge_type, 'to_alipay_dict'):
  55. params['edge_type'] = self.edge_type.to_alipay_dict()
  56. else:
  57. params['edge_type'] = self.edge_type
  58. if self.max_depth:
  59. if hasattr(self.max_depth, 'to_alipay_dict'):
  60. params['max_depth'] = self.max_depth.to_alipay_dict()
  61. else:
  62. params['max_depth'] = self.max_depth
  63. if self.start_ids:
  64. if isinstance(self.start_ids, list):
  65. for i in range(0, len(self.start_ids)):
  66. element = self.start_ids[i]
  67. if hasattr(element, 'to_alipay_dict'):
  68. self.start_ids[i] = element.to_alipay_dict()
  69. if hasattr(self.start_ids, 'to_alipay_dict'):
  70. params['start_ids'] = self.start_ids.to_alipay_dict()
  71. else:
  72. params['start_ids'] = self.start_ids
  73. return params
  74. @staticmethod
  75. def from_alipay_dict(d):
  76. if not d:
  77. return None
  78. o = AlipayDataZbdmLineageQueryModel()
  79. if 'direction' in d:
  80. o.direction = d['direction']
  81. if 'edge_type' in d:
  82. o.edge_type = d['edge_type']
  83. if 'max_depth' in d:
  84. o.max_depth = d['max_depth']
  85. if 'start_ids' in d:
  86. o.start_ids = d['start_ids']
  87. return o