ListTaskFlowsByPageResult.cc 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  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/dms-enterprise/model/ListTaskFlowsByPageResult.h>
  17. #include <json/json.h>
  18. using namespace AlibabaCloud::Dms_enterprise;
  19. using namespace AlibabaCloud::Dms_enterprise::Model;
  20. ListTaskFlowsByPageResult::ListTaskFlowsByPageResult() :
  21. ServiceResult()
  22. {}
  23. ListTaskFlowsByPageResult::ListTaskFlowsByPageResult(const std::string &payload) :
  24. ServiceResult()
  25. {
  26. parse(payload);
  27. }
  28. ListTaskFlowsByPageResult::~ListTaskFlowsByPageResult()
  29. {}
  30. void ListTaskFlowsByPageResult::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 allTaskFlowListNode = value["TaskFlowList"]["TaskFlow"];
  37. for (auto valueTaskFlowListTaskFlow : allTaskFlowListNode)
  38. {
  39. TaskFlow taskFlowListObject;
  40. if(!valueTaskFlowListTaskFlow["Id"].isNull())
  41. taskFlowListObject.id = std::stol(valueTaskFlowListTaskFlow["Id"].asString());
  42. if(!valueTaskFlowListTaskFlow["DagName"].isNull())
  43. taskFlowListObject.dagName = valueTaskFlowListTaskFlow["DagName"].asString();
  44. if(!valueTaskFlowListTaskFlow["Description"].isNull())
  45. taskFlowListObject.description = valueTaskFlowListTaskFlow["Description"].asString();
  46. if(!valueTaskFlowListTaskFlow["CreatorId"].isNull())
  47. taskFlowListObject.creatorId = valueTaskFlowListTaskFlow["CreatorId"].asString();
  48. if(!valueTaskFlowListTaskFlow["CreatorNickName"].isNull())
  49. taskFlowListObject.creatorNickName = valueTaskFlowListTaskFlow["CreatorNickName"].asString();
  50. if(!valueTaskFlowListTaskFlow["DagOwnerNickName"].isNull())
  51. taskFlowListObject.dagOwnerNickName = valueTaskFlowListTaskFlow["DagOwnerNickName"].asString();
  52. if(!valueTaskFlowListTaskFlow["DeployId"].isNull())
  53. taskFlowListObject.deployId = std::stol(valueTaskFlowListTaskFlow["DeployId"].asString());
  54. if(!valueTaskFlowListTaskFlow["Status"].isNull())
  55. taskFlowListObject.status = std::stoi(valueTaskFlowListTaskFlow["Status"].asString());
  56. if(!valueTaskFlowListTaskFlow["LatestInstanceStatus"].isNull())
  57. taskFlowListObject.latestInstanceStatus = std::stoi(valueTaskFlowListTaskFlow["LatestInstanceStatus"].asString());
  58. if(!valueTaskFlowListTaskFlow["LatestInstanceTime"].isNull())
  59. taskFlowListObject.latestInstanceTime = valueTaskFlowListTaskFlow["LatestInstanceTime"].asString();
  60. if(!valueTaskFlowListTaskFlow["ScenarioId"].isNull())
  61. taskFlowListObject.scenarioId = valueTaskFlowListTaskFlow["ScenarioId"].asString();
  62. if(!valueTaskFlowListTaskFlow["CronSwitch"].isNull())
  63. taskFlowListObject.cronSwitch = valueTaskFlowListTaskFlow["CronSwitch"].asString() == "true";
  64. if(!valueTaskFlowListTaskFlow["CronStr"].isNull())
  65. taskFlowListObject.cronStr = valueTaskFlowListTaskFlow["CronStr"].asString();
  66. if(!valueTaskFlowListTaskFlow["CronParam"].isNull())
  67. taskFlowListObject.cronParam = valueTaskFlowListTaskFlow["CronParam"].asString();
  68. if(!valueTaskFlowListTaskFlow["TriggerType"].isNull())
  69. taskFlowListObject.triggerType = std::stoi(valueTaskFlowListTaskFlow["TriggerType"].asString());
  70. if(!valueTaskFlowListTaskFlow["CronType"].isNull())
  71. taskFlowListObject.cronType = std::stoi(valueTaskFlowListTaskFlow["CronType"].asString());
  72. if(!valueTaskFlowListTaskFlow["TimeZoneId"].isNull())
  73. taskFlowListObject.timeZoneId = valueTaskFlowListTaskFlow["TimeZoneId"].asString();
  74. taskFlowList_.push_back(taskFlowListObject);
  75. }
  76. if(!value["ErrorCode"].isNull())
  77. errorCode_ = value["ErrorCode"].asString();
  78. if(!value["ErrorMessage"].isNull())
  79. errorMessage_ = value["ErrorMessage"].asString();
  80. if(!value["Success"].isNull())
  81. success_ = value["Success"].asString() == "true";
  82. if(!value["TotalCount"].isNull())
  83. totalCount_ = std::stoi(value["TotalCount"].asString());
  84. }
  85. int ListTaskFlowsByPageResult::getTotalCount()const
  86. {
  87. return totalCount_;
  88. }
  89. std::vector<ListTaskFlowsByPageResult::TaskFlow> ListTaskFlowsByPageResult::getTaskFlowList()const
  90. {
  91. return taskFlowList_;
  92. }
  93. std::string ListTaskFlowsByPageResult::getErrorCode()const
  94. {
  95. return errorCode_;
  96. }
  97. std::string ListTaskFlowsByPageResult::getErrorMessage()const
  98. {
  99. return errorMessage_;
  100. }
  101. bool ListTaskFlowsByPageResult::getSuccess()const
  102. {
  103. return success_;
  104. }