lordgamez commented on code in PR #1895:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1895#discussion_r1916989601


##########
libminifi/src/utils/StringUtils.cpp:
##########
@@ -602,4 +602,12 @@ std::string repeat(std::string_view str, size_t count) {
   return result;
 }
 
+std::optional<std::string> partAfterLastOccurrenceOf(std::string_view input, 
char delimiter) {
+  const size_t last_pos = input.find_last_of(delimiter);
+  if (last_pos == std::string::npos) {
+    return std::nullopt;
+  }
+  return std::string{input.substr(last_pos + 1)};
+}

Review Comment:
   Good point, I think in our use case it's a better approach, updated in 
https://github.com/apache/nifi-minifi-cpp/pull/1895/commits/efe1fd8a20027f98bc734747bfaa4c3376aaba5f



##########
libminifi/src/core/flow/StructuredConfiguration.cpp:
##########
@@ -191,23 +192,78 @@ void 
StructuredConfiguration::parseParameterContexts(const Node& parameter_conte
     uuid = id;
     auto parameter_context = std::make_unique<ParameterContext>(name, uuid);
     parameter_context->setDescription(getOptionalField(parameter_context_node, 
schema_.description, ""));
+    
parameter_context->setParameterProvider(getOptionalField(parameter_context_node,
 schema_.parameter_provider, ""));
     for (const auto& parameter_node : 
parameter_context_node[schema_.parameters]) {
       checkRequiredField(parameter_node, schema_.name);
       checkRequiredField(parameter_node, schema_.value);
       checkRequiredField(parameter_node, schema_.sensitive);
       auto parameter_name = parameter_node[schema_.name].getString().value();
       auto parameter_value = parameter_node[schema_.value].getString().value();
       auto sensitive = parameter_node[schema_.sensitive].getBool().value();
+      auto provided = 
parameter_node[schema_.provided].getBool().value_or(false);
       auto parameter_description = getOptionalField(parameter_node, 
schema_.description, "");
       if (sensitive) {
         parameter_value = 
utils::crypto::property_encryption::decrypt(parameter_value, 
sensitive_values_encryptor_);
       }
-      parameter_context->addParameter(Parameter{parameter_name, 
parameter_description, sensitive, parameter_value});
+      parameter_context->addParameter(Parameter{
+        .name = parameter_name,
+        .description = parameter_description,
+        .sensitive = sensitive,
+        .provided = provided,
+        .value = parameter_value});
     }
 
     parameter_contexts_.emplace(name, 
gsl::make_not_null(std::move(parameter_context)));
   }
+}
+
+void StructuredConfiguration::parseParameterProvidersNode(const Node& 
parameter_providers_node) {
+  if (!parameter_providers_node || !parameter_providers_node.isSequence()) {
+    return;
+  }
+  for (const auto& parameter_provider_node : parameter_providers_node) {
+    checkRequiredField(parameter_provider_node, schema_.name);
 
+    auto type = getRequiredField(parameter_provider_node, schema_.type);
+    logger_->log_debug("Using type {} for parameter provider node", type);
+
+    std::string fullType = type;
+    if (auto short_type = utils::string::partAfterLastOccurrenceOf(type, '.')) 
{
+      type = *short_type;
+    }

Review Comment:
   Updated in 
https://github.com/apache/nifi-minifi-cpp/pull/1895/commits/efe1fd8a20027f98bc734747bfaa4c3376aaba5f



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to