hunyadi-dev commented on a change in pull request #866:
URL: https://github.com/apache/nifi-minifi-cpp/pull/866#discussion_r468567898
##########
File path: extensions/libarchive/MergeContent.cpp
##########
@@ -342,6 +352,54 @@ std::shared_ptr<core::FlowFile>
ZipMerge::merge(core::ProcessContext *context, c
return flowFile;
}
+void AttributeMerger::mergeAttributes(core::ProcessSession *session,
std::shared_ptr<core::FlowFile> &mergeFlow) {
+ for (const auto& pair : getMergedAttributes()) {
+ session->putAttribute(mergeFlow, pair.first, pair.second);
+ }
+}
+
+std::map<std::string, std::string> AttributeMerger::getMergedAttributes() {
+ std::map<std::string, std::string> mergedAttributes;
+ bool isFirst = true;
+ for (const auto& flow : flows_) {
+ if (isFirst) {
+ mergedAttributes = flow->getAttributes();
+ isFirst = false;
+ } else {
+ processFlowFile(flow, mergedAttributes);
+ }
+ }
+ return mergedAttributes;
+}
+
+void KeepOnlymergedAttributesMerger::processFlowFile(const
std::shared_ptr<core::FlowFile> &flow, std::map<std::string, std::string>&
mergedAttributes) {
Review comment:
Minor, but the capitalization of `merged` looks off.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]