You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by GitBox <gi...@apache.org> on 2020/08/13 09:31:29 UTC
[GitHub] [nifi-minifi-cpp] adamdebreceni commented on a change in pull request #870: MINIFICPP-1321 Support attribute strategies in MergeContent processor
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:
users@infra.apache.org