| 75 | } |
| 76 | |
| 77 | std::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 | |
| 108 | std::shared_ptr<core::FlowFile> ProcessSession::clone(const std::shared_ptr<core::FlowFile> &parent) { |
| 109 | std::shared_ptr<core::FlowFile> record = this->create(parent); |
no test coverage detected