GetQualityEntityResult.cc 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  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/GetQualityEntityResult.h>
  17. #include <json/json.h>
  18. using namespace AlibabaCloud::Dataworks_public;
  19. using namespace AlibabaCloud::Dataworks_public::Model;
  20. GetQualityEntityResult::GetQualityEntityResult() :
  21. ServiceResult()
  22. {}
  23. GetQualityEntityResult::GetQualityEntityResult(const std::string &payload) :
  24. ServiceResult()
  25. {
  26. parse(payload);
  27. }
  28. GetQualityEntityResult::~GetQualityEntityResult()
  29. {}
  30. void GetQualityEntityResult::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 allDataNode = value["Data"]["EntityDto"];
  37. for (auto valueDataEntityDto : allDataNode)
  38. {
  39. EntityDto dataObject;
  40. if(!valueDataEntityDto["RelativeNode"].isNull())
  41. dataObject.relativeNode = valueDataEntityDto["RelativeNode"].asString();
  42. if(!valueDataEntityDto["OnDutyAccountName"].isNull())
  43. dataObject.onDutyAccountName = valueDataEntityDto["OnDutyAccountName"].asString();
  44. if(!valueDataEntityDto["Task"].isNull())
  45. dataObject.task = std::stoi(valueDataEntityDto["Task"].asString());
  46. if(!valueDataEntityDto["TableName"].isNull())
  47. dataObject.tableName = valueDataEntityDto["TableName"].asString();
  48. if(!valueDataEntityDto["Followers"].isNull())
  49. dataObject.followers = valueDataEntityDto["Followers"].asString();
  50. if(!valueDataEntityDto["OnDuty"].isNull())
  51. dataObject.onDuty = valueDataEntityDto["OnDuty"].asString();
  52. if(!valueDataEntityDto["MatchExpression"].isNull())
  53. dataObject.matchExpression = valueDataEntityDto["MatchExpression"].asString();
  54. if(!valueDataEntityDto["CreateTime"].isNull())
  55. dataObject.createTime = std::stol(valueDataEntityDto["CreateTime"].asString());
  56. if(!valueDataEntityDto["ProjectName"].isNull())
  57. dataObject.projectName = valueDataEntityDto["ProjectName"].asString();
  58. if(!valueDataEntityDto["HasRelativeNode"].isNull())
  59. dataObject.hasRelativeNode = valueDataEntityDto["HasRelativeNode"].asString() == "true";
  60. if(!valueDataEntityDto["EnvType"].isNull())
  61. dataObject.envType = valueDataEntityDto["EnvType"].asString();
  62. if(!valueDataEntityDto["EntityLevel"].isNull())
  63. dataObject.entityLevel = std::stoi(valueDataEntityDto["EntityLevel"].asString());
  64. if(!valueDataEntityDto["ModifyUser"].isNull())
  65. dataObject.modifyUser = valueDataEntityDto["ModifyUser"].asString();
  66. if(!valueDataEntityDto["Sql"].isNull())
  67. dataObject.sql = std::stoi(valueDataEntityDto["Sql"].asString());
  68. if(!valueDataEntityDto["Id"].isNull())
  69. dataObject.id = std::stol(valueDataEntityDto["Id"].asString());
  70. if(!valueDataEntityDto["ModifyTime"].isNull())
  71. dataObject.modifyTime = std::stol(valueDataEntityDto["ModifyTime"].asString());
  72. data_.push_back(dataObject);
  73. }
  74. if(!value["HttpStatusCode"].isNull())
  75. httpStatusCode_ = std::stoi(value["HttpStatusCode"].asString());
  76. if(!value["ErrorMessage"].isNull())
  77. errorMessage_ = value["ErrorMessage"].asString();
  78. if(!value["ErrorCode"].isNull())
  79. errorCode_ = value["ErrorCode"].asString();
  80. if(!value["Success"].isNull())
  81. success_ = value["Success"].asString() == "true";
  82. }
  83. int GetQualityEntityResult::getHttpStatusCode()const
  84. {
  85. return httpStatusCode_;
  86. }
  87. std::vector<GetQualityEntityResult::EntityDto> GetQualityEntityResult::getData()const
  88. {
  89. return data_;
  90. }
  91. std::string GetQualityEntityResult::getErrorCode()const
  92. {
  93. return errorCode_;
  94. }
  95. std::string GetQualityEntityResult::getErrorMessage()const
  96. {
  97. return errorMessage_;
  98. }
  99. bool GetQualityEntityResult::getSuccess()const
  100. {
  101. return success_;
  102. }