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


##########
libminifi/include/core/ProcessContext.h:
##########
@@ -135,6 +135,10 @@ class ProcessContext : public 
controller::ControllerServiceLookup, public core::
     return getProperty(property.name, value);
   }
 
+  virtual bool getProperty(bool /*supports_expression_language*/, 
std::string_view property_name, std::string& value, const 
std::shared_ptr<FlowFile>& /*flow_file*/) {
+    return getProperty(property_name, value);
+  }

Review Comment:
   We need an overload  with the `flow_file` parameter that only needs the 
`property_name` as that is the only one available and this version was already 
available as a private function. It is probably better to create a new 
`Property` constructor overload with these parameters, wrap these and pass it 
to the already available `getProperty` overload.



##########
libminifi/include/core/ConfigurableComponent.h:
##########
@@ -212,6 +212,8 @@ class ConfigurableComponent {
   // Dynamic properties
   std::map<std::string, Property> dynamic_properties_;
 
+  virtual Property* findProperty(const std::string& name) const;
+

Review Comment:
   In the python processors' properties are stored separately in the 
`python_properties_` vector. Because of this we need to override how to search 
for a property in getProperty and setProperty functions in the 
`ExecutePythonProcessor` class. Overriding this `findProperty` provides this, 
all other `getProperty` methods are either template functions or have an output 
reference parameter, which we cannot use for this.



##########
extensions/python/tests/PythonManifestTests.cpp:
##########
@@ -101,7 +101,7 @@ TEST_CASE("Python processor's description is part of the 
manifest") {
     REQUIRE(getNode(MyPyProc->children, "type").value == 
"org.apache.nifi.minifi.processors.MyPyProc");
 
     auto& rels = getNode(MyPyProc->children, 
"supportedRelationships").children;
-    REQUIRE(rels.size() == 2);
+    REQUIRE(rels.size() == 3);

Review Comment:
   I added the "original" default relationship to the python processors as the 
NiFi python processors have it.



##########
extensions/python/PythonProcessor.h:
##########
@@ -37,7 +38,7 @@ class PythonProcessor {
 
   void setDescription(const std::string& desc);
 
-  void addProperty(const std::string& name, const std::string& description, 
const std::string& defaultvalue, bool required, bool el);
+  void addProperty(const std::string& name, const std::string& description, 
const std::optional<std::string>& defaultvalue, bool required, bool el, const 
std::optional<int64_t>& validator_value);

Review Comment:
   I added a mapping of the NiFi validators to corresponding MiNiFi Property 
types and represented them with an int value, with the options listed in the 
PropertyTypeCode enum. On the python side it's called a validator, but maybe it 
would be better to change it property_type_code here and there as well.



-- 
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