martinzink commented on code in PR #2186:
URL: https://github.com/apache/nifi-minifi-cpp/pull/2186#discussion_r3621125218
##########
minifi_rust/minifi_native/src/api/processor_wrappers/utils/context_session_flowfile_bundle.rs:
##########
@@ -0,0 +1,85 @@
+use crate::api::attribute::GetAttribute;
+use crate::api::flow_file::GetId;
+use crate::api::property::{GetControllerService, GetProperty};
+use crate::{
+ ComponentIdentifier, EnableControllerService, MinifiError, ProcessContext,
ProcessSession,
+ Property,
+};
+
+pub struct ContextSessionFlowFileBundle<'a, PC, PS>
+where
+ PC: ProcessContext,
+ PS: ProcessSession<FlowFile = PC::FlowFile>,
+{
+ context: &'a PC,
+ session: &'a PS,
+ flow_file: Option<&'a PC::FlowFile>,
+}
+
+impl<'a, PC, PS> ContextSessionFlowFileBundle<'a, PC, PS>
+where
+ PC: ProcessContext,
+ PS: ProcessSession<FlowFile = PC::FlowFile>,
+{
+ pub(crate) fn new(
+ context: &'a PC,
+ session: &'a PS,
+ flow_file: Option<&'a PC::FlowFile>,
+ ) -> Self {
+ Self {
+ context,
+ session,
+ flow_file,
+ }
+ }
+}
+impl<'a, PC, PS> GetProperty for ContextSessionFlowFileBundle<'a, PC, PS>
+where
+ PC: ProcessContext,
+ PS: ProcessSession<FlowFile = PC::FlowFile>,
+{
+ fn get_property(&self, property: &Property) -> Result<Option<String>,
MinifiError> {
+ self.context.get_property(property, self.flow_file)
+ }
+}
+
+impl<'a, PC, PS> GetControllerService for ContextSessionFlowFileBundle<'a, PC,
PS>
+where
+ PC: ProcessContext,
+ PS: ProcessSession<FlowFile = PC::FlowFile>,
+{
+ fn get_controller_service<Cs>(&self, property: &Property) ->
Result<Option<&Cs>, MinifiError>
+ where
+ Cs: EnableControllerService + ComponentIdentifier + 'static,
+ {
+ self.context.get_controller_service(property)
+ }
+}
+
+impl<'a, PC, PS> GetAttribute for ContextSessionFlowFileBundle<'a, PC, PS>
+where
+ PC: ProcessContext,
+ PS: ProcessSession<FlowFile = PC::FlowFile>,
+{
+ fn get_attribute(&self, name: &str) -> Result<Option<String>, MinifiError>
{
+ if let Some(ff) = &self.flow_file {
Review Comment:
👍 [lordgamez review
changes](https://github.com/apache/nifi-minifi-cpp/pull/2186/commits/b09fd16d24d1ee006e3ea46bca0535f2be40bf9d)
##########
minifi_rust/generate_docs/Dockerfile.generate_docs:
##########
Review Comment:
👍 [lordgamez review
changes](https://github.com/apache/nifi-minifi-cpp/pull/2186/commits/b09fd16d24d1ee006e3ea46bca0535f2be40bf9d)
--
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]