ListTableThemeResult.cc 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  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/ListTableThemeResult.h>
  17. #include <json/json.h>
  18. using namespace AlibabaCloud::Dataworks_public;
  19. using namespace AlibabaCloud::Dataworks_public::Model;
  20. ListTableThemeResult::ListTableThemeResult() :
  21. ServiceResult()
  22. {}
  23. ListTableThemeResult::ListTableThemeResult(const std::string &payload) :
  24. ServiceResult()
  25. {
  26. parse(payload);
  27. }
  28. ListTableThemeResult::~ListTableThemeResult()
  29. {}
  30. void ListTableThemeResult::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["TotalCount"].isNull())
  38. data_.totalCount = std::stol(dataNode["TotalCount"].asString());
  39. auto allThemeListNode = dataNode["ThemeList"]["ThemeListItem"];
  40. for (auto dataNodeThemeListThemeListItem : allThemeListNode)
  41. {
  42. Data::ThemeListItem themeListItemObject;
  43. if(!dataNodeThemeListThemeListItem["CreateTimeStamp"].isNull())
  44. themeListItemObject.createTimeStamp = std::stol(dataNodeThemeListThemeListItem["CreateTimeStamp"].asString());
  45. if(!dataNodeThemeListThemeListItem["ParentId"].isNull())
  46. themeListItemObject.parentId = std::stol(dataNodeThemeListThemeListItem["ParentId"].asString());
  47. if(!dataNodeThemeListThemeListItem["ThemeId"].isNull())
  48. themeListItemObject.themeId = std::stol(dataNodeThemeListThemeListItem["ThemeId"].asString());
  49. if(!dataNodeThemeListThemeListItem["ProjectId"].isNull())
  50. themeListItemObject.projectId = std::stol(dataNodeThemeListThemeListItem["ProjectId"].asString());
  51. if(!dataNodeThemeListThemeListItem["Name"].isNull())
  52. themeListItemObject.name = dataNodeThemeListThemeListItem["Name"].asString();
  53. if(!dataNodeThemeListThemeListItem["Level"].isNull())
  54. themeListItemObject.level = std::stoi(dataNodeThemeListThemeListItem["Level"].asString());
  55. if(!dataNodeThemeListThemeListItem["Creator"].isNull())
  56. themeListItemObject.creator = dataNodeThemeListThemeListItem["Creator"].asString();
  57. data_.themeList.push_back(themeListItemObject);
  58. }
  59. if(!value["HttpStatusCode"].isNull())
  60. httpStatusCode_ = std::stoi(value["HttpStatusCode"].asString());
  61. if(!value["ErrorMessage"].isNull())
  62. errorMessage_ = value["ErrorMessage"].asString();
  63. if(!value["Success"].isNull())
  64. success_ = value["Success"].asString() == "true";
  65. if(!value["ErrorCode"].isNull())
  66. errorCode_ = value["ErrorCode"].asString();
  67. }
  68. int ListTableThemeResult::getHttpStatusCode()const
  69. {
  70. return httpStatusCode_;
  71. }
  72. ListTableThemeResult::Data ListTableThemeResult::getData()const
  73. {
  74. return data_;
  75. }
  76. std::string ListTableThemeResult::getErrorCode()const
  77. {
  78. return errorCode_;
  79. }
  80. std::string ListTableThemeResult::getErrorMessage()const
  81. {
  82. return errorMessage_;
  83. }
  84. bool ListTableThemeResult::getSuccess()const
  85. {
  86. return success_;
  87. }