adamdebreceni commented on a change in pull request #870:
URL: https://github.com/apache/nifi-minifi-cpp/pull/870#discussion_r469822537
##########
File path: extensions/libarchive/MergeContent.h
##########
@@ -259,20 +259,56 @@ class ZipMerge: public ArchiveMerge, public MergeBin {
}
};
+class AttributeMerger {
+public:
+ explicit
AttributeMerger(std::deque<std::shared_ptr<org::apache::nifi::minifi::core::FlowFile>>
&flows)
+ : flows_(flows) {}
+ void mergeAttributes(core::ProcessSession *session,
std::shared_ptr<core::FlowFile> &merge_flow);
+ virtual ~AttributeMerger() = default;
+protected:
+ std::map<std::string, std::string> getMergedAttributes();
+ virtual void processFlowFile(const std::shared_ptr<core::FlowFile>
&flow_file, std::map<std::string, std::string>& merged_attributes) = 0;
+
+ const std::deque<std::shared_ptr<core::FlowFile>> &flows_;
+};
+
+class KeepOnlyCommonAttributesMerger: public AttributeMerger {
+public:
+ explicit
KeepOnlyCommonAttributesMerger(std::deque<std::shared_ptr<org::apache::nifi::minifi::core::FlowFile>>
&flows)
+ : AttributeMerger(flows) {}
+protected:
+ void processFlowFile(const std::shared_ptr<core::FlowFile> &flow_file,
std::map<std::string, std::string>& merged_attributes) override;
+};
+
+class KeepAllUniqueAttributesMerger: public AttributeMerger {
+public:
+ explicit
KeepAllUniqueAttributesMerger(std::deque<std::shared_ptr<org::apache::nifi::minifi::core::FlowFile>>
&flows)
+ : AttributeMerger(flows) {}
+protected:
+ void processFlowFile(const std::shared_ptr<core::FlowFile> &flow_file,
std::map<std::string, std::string>& merged_attributes) override;
+
+private:
+ std::vector<std::string> removed_attributes_;
+};
+
// MergeContent Class
class MergeContent : public processors::BinFiles {
- public:
+public:
+ static constexpr const char *ATTRIBUTE_STRATEGY_KEEP_COMMON = "Keep Only
Common Attributes";
Review comment:
I'm all for using static members to store the attribute name, but then
we should make all of them static members not just the new ones, if moving the
others seems problematic, we should reassess leaving them be for now
----------------------------------------------------------------
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]