lordgamez commented on a change in pull request #870:
URL: https://github.com/apache/nifi-minifi-cpp/pull/870#discussion_r470070629
##########
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 left them as ::processor namespace level constants as both tests and
different classes use these constants currently.
----------------------------------------------------------------
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]