MCPcopy Create free account
hub / github.com/apache/nifi-minifi-cpp / updateFromPayload

Method updateFromPayload

libminifi/src/core/FlowConfiguration.cpp:70–95  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

68}
69
70std::unique_ptr<core::ProcessGroup> FlowConfiguration::updateFromPayload(const std::string& url, const std::string& yamlConfigPayload) {
71 auto old_services = controller_services_;
72 auto old_provider = service_provider_;
73 controller_services_ = std::make_shared<core::controller::ControllerServiceMap>();
74 service_provider_ = std::make_shared<core::controller::StandardControllerServiceProvider>(controller_services_, nullptr, configuration_);
75 auto payload = getRootFromPayload(yamlConfigPayload);
76 if (!url.empty() && payload != nullptr) {
77 std::string flow_id, bucket_id;
78 auto path_split = utils::StringUtils::split(url, "/");
79 // Registry API docs: nifi.apache.org/docs/nifi-registry-docs/rest-api/index.html
80 // GET /buckets/{bucketId}/flows/{flowId}: Gets a flow
81 const auto bucket_token_found = std::find(path_split.cbegin(), path_split.cend(), "buckets");
82 if (bucket_token_found != path_split.cend() && std::next(bucket_token_found) != path_split.cend()) {
83 bucket_id = *std::next(bucket_token_found);
84 const auto flows_token_found = std::find(std::next(bucket_token_found, 2), path_split.cend(), "flows");
85 if (flows_token_found != path_split.cend() && std::next(flows_token_found) != path_split.cend()) {
86 flow_id = *std::next(flows_token_found);
87 }
88 }
89 flow_version_->setFlowVersion(url, bucket_id, flow_id);
90 } else {
91 controller_services_ = old_services;
92 service_provider_ = old_provider;
93 }
94 return payload;
95}
96
97bool FlowConfiguration::persist(const std::string &configuration) {
98 if (!config_path_) {

Callers 2

applyConfigurationMethod · 0.80
loadInitialFlowMethod · 0.80

Calls 4

cbeginMethod · 0.80
cendMethod · 0.80
emptyMethod · 0.45
setFlowVersionMethod · 0.45

Tested by

no test coverage detected