MCPcopy Create free account
hub / github.com/apache/nifi-minifi-cpp / create

Method create

libminifi/src/core/ProcessSession.cpp:77–106  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

75}
76
77std::shared_ptr<core::FlowFile> ProcessSession::create(const std::shared_ptr<core::FlowFile> &parent) {
78 auto record = std::make_shared<FlowFileRecord>();
79 auto flow_version = process_context_->getProcessorNode()->getFlowIdentifier();
80 if (flow_version != nullptr) {
81 record->setAttribute(SpecialFlowAttribute::FLOW_ID, flow_version->getFlowId());
82 }
83
84 if (parent) {
85 // Copy attributes
86 for (const auto& attribute : parent->getAttributes()) {
87 if (attribute.first == SpecialFlowAttribute::ALTERNATE_IDENTIFIER || attribute.first == SpecialFlowAttribute::DISCARD_REASON || attribute.first == SpecialFlowAttribute::UUID) {
88 // Do not copy special attributes from parent
89 continue;
90 }
91 record->setAttribute(attribute.first, attribute.second);
92 }
93 record->setLineageStartDate(parent->getlineageStartDate());
94 record->setLineageIdentifiers(parent->getlineageIdentifiers());
95 parent->getlineageIdentifiers().push_back(parent->getUUID());
96 }
97
98 utils::Identifier uuid = record->getUUID();
99 _addedFlowFiles[uuid] = record;
100 logger_->log_debug("Create FlowFile with UUID %s", record->getUUIDStr());
101 std::stringstream details;
102 details << process_context_->getProcessorNode()->getName() << " creates flow record " << record->getUUIDStr();
103 provenance_report_->create(record, details.str());
104
105 return record;
106}
107
108std::shared_ptr<core::FlowFile> ProcessSession::clone(const std::shared_ptr<core::FlowFile> &parent) {
109 std::shared_ptr<core::FlowFile> record = this->create(parent);

Callers 4

cloneMethod · 0.95
writeMethod · 0.45
importFromMethod · 0.45
importMethod · 0.45

Calls 12

getProcessorNodeMethod · 0.80
setLineageStartDateMethod · 0.80
setLineageIdentifiersMethod · 0.80
log_debugMethod · 0.80
getFlowIdentifierMethod · 0.45
setAttributeMethod · 0.45
getFlowIdMethod · 0.45
getAttributesMethod · 0.45
getlineageStartDateMethod · 0.45
getUUIDMethod · 0.45
getUUIDStrMethod · 0.45
getNameMethod · 0.45

Tested by

no test coverage detected