GetMetaTableBasicInfoResult.cc 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. /*
  2. * Copyright 2009-2017 Alibaba Cloud All rights reserved.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. #include <alibabacloud/dataworks-public/model/GetMetaTableBasicInfoResult.h>
  17. #include <json/json.h>
  18. using namespace AlibabaCloud::Dataworks_public;
  19. using namespace AlibabaCloud::Dataworks_public::Model;
  20. GetMetaTableBasicInfoResult::GetMetaTableBasicInfoResult() :
  21. ServiceResult()
  22. {}
  23. GetMetaTableBasicInfoResult::GetMetaTableBasicInfoResult(const std::string &payload) :
  24. ServiceResult()
  25. {
  26. parse(payload);
  27. }
  28. GetMetaTableBasicInfoResult::~GetMetaTableBasicInfoResult()
  29. {}
  30. void GetMetaTableBasicInfoResult::parse(const std::string &payload)
  31. {
  32. Json::Reader reader;
  33. Json::Value value;
  34. reader.parse(payload, value);
  35. setRequestId(value["RequestId"].asString());
  36. auto dataNode = value["Data"];
  37. if(!dataNode["TableName"].isNull())
  38. data_.tableName = dataNode["TableName"].asString();
  39. if(!dataNode["TableGuid"].isNull())
  40. data_.tableGuid = dataNode["TableGuid"].asString();
  41. if(!dataNode["OwnerId"].isNull())
  42. data_.ownerId = dataNode["OwnerId"].asString();
  43. if(!dataNode["TenantId"].isNull())
  44. data_.tenantId = std::stol(dataNode["TenantId"].asString());
  45. if(!dataNode["ProjectId"].isNull())
  46. data_.projectId = std::stol(dataNode["ProjectId"].asString());
  47. if(!dataNode["CreateTime"].isNull())
  48. data_.createTime = std::stol(dataNode["CreateTime"].asString());
  49. if(!dataNode["LastModifyTime"].isNull())
  50. data_.lastModifyTime = std::stol(dataNode["LastModifyTime"].asString());
  51. if(!dataNode["LifeCycle"].isNull())
  52. data_.lifeCycle = std::stoi(dataNode["LifeCycle"].asString());
  53. if(!dataNode["IsVisible"].isNull())
  54. data_.isVisible = std::stoi(dataNode["IsVisible"].asString());
  55. if(!dataNode["LastDdlTime"].isNull())
  56. data_.lastDdlTime = std::stol(dataNode["LastDdlTime"].asString());
  57. if(!dataNode["LastAccessTime"].isNull())
  58. data_.lastAccessTime = std::stol(dataNode["LastAccessTime"].asString());
  59. if(!dataNode["EnvType"].isNull())
  60. data_.envType = std::stoi(dataNode["EnvType"].asString());
  61. if(!dataNode["DataSize"].isNull())
  62. data_.dataSize = std::stol(dataNode["DataSize"].asString());
  63. if(!dataNode["Comment"].isNull())
  64. data_.comment = dataNode["Comment"].asString();
  65. if(!dataNode["ProjectName"].isNull())
  66. data_.projectName = dataNode["ProjectName"].asString();
  67. if(!dataNode["DatabaseName"].isNull())
  68. data_.databaseName = dataNode["DatabaseName"].asString();
  69. if(!dataNode["PartitionKeys"].isNull())
  70. data_.partitionKeys = dataNode["PartitionKeys"].asString();
  71. if(!dataNode["Location"].isNull())
  72. data_.location = dataNode["Location"].asString();
  73. if(!dataNode["ClusterId"].isNull())
  74. data_.clusterId = dataNode["ClusterId"].asString();
  75. if(!dataNode["Caption"].isNull())
  76. data_.caption = dataNode["Caption"].asString();
  77. if(!dataNode["IsPartitionTable"].isNull())
  78. data_.isPartitionTable = dataNode["IsPartitionTable"].asString() == "true";
  79. if(!dataNode["ReadCount"].isNull())
  80. data_.readCount = std::stol(dataNode["ReadCount"].asString());
  81. if(!dataNode["ViewCount"].isNull())
  82. data_.viewCount = std::stol(dataNode["ViewCount"].asString());
  83. if(!dataNode["FavoriteCount"].isNull())
  84. data_.favoriteCount = std::stol(dataNode["FavoriteCount"].asString());
  85. if(!dataNode["IsView"].isNull())
  86. data_.isView = dataNode["IsView"].asString() == "true";
  87. if(!value["ErrorCode"].isNull())
  88. errorCode_ = value["ErrorCode"].asString();
  89. if(!value["ErrorMessage"].isNull())
  90. errorMessage_ = value["ErrorMessage"].asString();
  91. if(!value["HttpStatusCode"].isNull())
  92. httpStatusCode_ = std::stoi(value["HttpStatusCode"].asString());
  93. if(!value["Success"].isNull())
  94. success_ = value["Success"].asString() == "true";
  95. }
  96. int GetMetaTableBasicInfoResult::getHttpStatusCode()const
  97. {
  98. return httpStatusCode_;
  99. }
  100. GetMetaTableBasicInfoResult::Data GetMetaTableBasicInfoResult::getData()const
  101. {
  102. return data_;
  103. }
  104. std::string GetMetaTableBasicInfoResult::getErrorCode()const
  105. {
  106. return errorCode_;
  107. }
  108. std::string GetMetaTableBasicInfoResult::getErrorMessage()const
  109. {
  110. return errorMessage_;
  111. }
  112. bool GetMetaTableBasicInfoResult::getSuccess()const
  113. {
  114. return success_;
  115. }