Package org.apache.nifi.provenance
Interface ProvenanceEventBuilder
public interface ProvenanceEventBuilder
-
Method Summary
Modifier and TypeMethodDescriptionaddChildFlowFile
(String childId) Adds the given FlowFile identifier as a child for Events of typeProvenanceEventType.FORK
andProvenanceEventType.CLONE
addChildFlowFile
(FlowFile child) Adds the given FlowFile as a child for Events of typeProvenanceEventType.FORK
,ProvenanceEventType.JOIN
, andProvenanceEventType.CLONE
This is valid only forProvenanceEventType.FORK
,ProvenanceEventType.JOIN
, andProvenanceEventType.CLONE
events and will be ignored for any other event types.addParentFlowFile
(FlowFile parent) Adds the given FlowFile as a parent for Events of type,ProvenanceEventType.FORK
,ProvenanceEventType.JOIN
, andProvenanceEventType.CLONE
This is valid only forProvenanceEventType.FORK
,ProvenanceEventType.JOIN
, andProvenanceEventType.CLONE
events and will be ignored for any other event types.build()
Builds the Provenance Event.copy()
fromEvent
(ProvenanceEventRecord event) Populates the values of the Event being built from the values in the given eventfromFlowFile
(FlowFile flowFile) Populates the builder with as much information as it can from the given FlowFileremoveChildFlowFile
(FlowFile child) Removes the given FlowFile as a child for Events of typeProvenanceEventType.FORK
,ProvenanceEventType.JOIN
, andProvenanceEventType.CLONE
This is valid only forProvenanceEventType.FORK
,ProvenanceEventType.JOIN
, andProvenanceEventType.CLONE
events and will be ignored for any other event types.removeParentFlowFile
(FlowFile parent) Removes the given FlowFile as a parent for Events of type,ProvenanceEventType.FORK
,ProvenanceEventType.JOIN
, andProvenanceEventType.CLONE
This is valid only forProvenanceEventType.FORK
,ProvenanceEventType.JOIN
, andProvenanceEventType.CLONE
events and will be ignored for any other event types.setAlternateIdentifierUri
(String alternateIdentifierUri) Associates the given identifier with the FlowFile for which this Event is created.Sets the attributes that existed on the FlowFile before this event occurred and any attributes that were added or updated as a result of this event.setComponentId
(String componentId) Sets the unique identifier of the NiFi Component (such as aProcessor
) that is generating the EventsetComponentType
(String componentType) Sets the type of the Component that is generating the Event.setCurrentContentClaim
(String container, String section, String identifier, Long offset, long size) Sets the Content Claim that the FlowFile is associated with as a result of this eventsetDetails
(String details) Sets the details for this event.setEventDuration
(long millis) Sets the amount of time that was required in order to perform the function referred to by this eventsetEventTime
(long eventTime) Sets the time at which the Provenance Event took placesetEventType
(ProvenanceEventType eventType) Sets the type ofProvenanceEventRecord
setFlowFileEntryDate
(long entryDate) Sets the date and time at which the FlowFile entered the flowsetFlowFileUUID
(String uuid) Sets the UUID to associate with the FlowFilesetLineageStartDate
(long startDate) Sets the time at which the FlowFile's lineage begansetPreviousContentClaim
(String container, String section, String identifier, Long offset, long size) Sets the Content Claim that the FlowFile was previously associated with before this event occurred.setRelationship
(Relationship relationship) Sets the to which the FlowFile was routed forProvenanceEventType.ROUTE
events.setSourceQueueIdentifier
(String identifier) Sets the identifier of the FlowFile Queue from which the FlowFile was pulledsetSourceSystemFlowFileIdentifier
(String sourceSystemFlowFileIdentifier) Sets the identifier that is used by the remote system to refer to the FlowFile for which this Event is being created.setTransitUri
(String transitUri) Sets the Transit URI that is used for the Event.
-
Method Details
-
setEventType
Sets the type ofProvenanceEventRecord
- Parameters:
eventType
- of the event- Returns:
- the builder
-
fromEvent
Populates the values of the Event being built from the values in the given event- Parameters:
event
- the event from which to populate the Builders values- Returns:
- the builder
-
setFlowFileEntryDate
Sets the date and time at which the FlowFile entered the flow- Parameters:
entryDate
- of the flow file- Returns:
- the builder
-
setPreviousContentClaim
ProvenanceEventBuilder setPreviousContentClaim(String container, String section, String identifier, Long offset, long size) Sets the Content Claim that the FlowFile was previously associated with before this event occurred.- Parameters:
container
- for previous contentsection
- for previous contentidentifier
- for previous contentoffset
- for previous contentsize
- for previous content- Returns:
- the builder
-
setCurrentContentClaim
ProvenanceEventBuilder setCurrentContentClaim(String container, String section, String identifier, Long offset, long size) Sets the Content Claim that the FlowFile is associated with as a result of this event- Parameters:
container
- for resulting contentsection
- for resulting contentidentifier
- for resulting contentoffset
- for resulting contentsize
- for resulting content- Returns:
- the builder
-
setSourceQueueIdentifier
Sets the identifier of the FlowFile Queue from which the FlowFile was pulled- Parameters:
identifier
- of the source queue- Returns:
- the builder
-
setAttributes
ProvenanceEventBuilder setAttributes(Map<String, String> previousAttributes, Map<String, String> updatedAttributes) Sets the attributes that existed on the FlowFile before this event occurred and any attributes that were added or updated as a result of this event.- Parameters:
previousAttributes
- Map of all attributes before the event occurredupdatedAttributes
- Map containing all attributes that were added or updated. If any entry has a value ofnull
, that attribute is considered removed- Returns:
- the builder
-
setFlowFileUUID
Sets the UUID to associate with the FlowFile- Parameters:
uuid
- of the flowfile- Returns:
- the builder
-
setEventTime
Sets the time at which the Provenance Event took place- Parameters:
eventTime
- time of the event- Returns:
- the builder
-
setEventDuration
Sets the amount of time that was required in order to perform the function referred to by this event- Parameters:
millis
- of the event- Returns:
- the builder
-
setLineageStartDate
Sets the time at which the FlowFile's lineage began- Parameters:
startDate
- start date of the event- Returns:
- the builder
-
setComponentId
Sets the unique identifier of the NiFi Component (such as aProcessor
) that is generating the Event- Parameters:
componentId
- that produced the event- Returns:
- the builder
-
setComponentType
Sets the type of the Component that is generating the Event. ForProcessor
s, this is the Simple Class Name of the Processor.- Parameters:
componentType
- of the component that made the event- Returns:
- the builder
-
setSourceSystemFlowFileIdentifier
Sets the identifier that is used by the remote system to refer to the FlowFile for which this Event is being created. This is valid only for Event TypesProvenanceEventType.RECEIVE
andProvenanceEventType.SEND
and will be ignored for any other event types.- Parameters:
sourceSystemFlowFileIdentifier
- identifier the remote system used- Returns:
- the builder
-
setTransitUri
Sets the Transit URI that is used for the Event. This is a URI that provides information about the System and Protocol information over which the transfer occurred. The intent of this field is such that both the sender and the receiver can publish the events to an external Enterprise-wide system that is then able to correlate the SEND and RECEIVE events. This is valid only for Event TypesProvenanceEventType.RECEIVE
andProvenanceEventType.SEND
and will be ignored for any other event types.- Parameters:
transitUri
- of the event- Returns:
- the builder
-
addParentFlowFile
Adds the given FlowFile as a parent for Events of type,ProvenanceEventType.FORK
,ProvenanceEventType.JOIN
, andProvenanceEventType.CLONE
This is valid only forProvenanceEventType.FORK
,ProvenanceEventType.JOIN
, andProvenanceEventType.CLONE
events and will be ignored for any other event types.- Parameters:
parent
- flowfile that this event is derived from- Returns:
- the builder
-
removeParentFlowFile
Removes the given FlowFile as a parent for Events of type,ProvenanceEventType.FORK
,ProvenanceEventType.JOIN
, andProvenanceEventType.CLONE
This is valid only forProvenanceEventType.FORK
,ProvenanceEventType.JOIN
, andProvenanceEventType.CLONE
events and will be ignored for any other event types.- Parameters:
parent
- previous parent of this event- Returns:
- the builder
-
addChildFlowFile
Adds the given FlowFile as a child for Events of typeProvenanceEventType.FORK
,ProvenanceEventType.JOIN
, andProvenanceEventType.CLONE
This is valid only forProvenanceEventType.FORK
,ProvenanceEventType.JOIN
, andProvenanceEventType.CLONE
events and will be ignored for any other event types.- Parameters:
child
- the child to add- Returns:
- the builder
-
addChildFlowFile
Adds the given FlowFile identifier as a child for Events of typeProvenanceEventType.FORK
andProvenanceEventType.CLONE
- Parameters:
childId
- the ID of the FlowFile that is a child- Returns:
- the builder
-
removeChildFlowFile
Removes the given FlowFile as a child for Events of typeProvenanceEventType.FORK
,ProvenanceEventType.JOIN
, andProvenanceEventType.CLONE
This is valid only forProvenanceEventType.FORK
,ProvenanceEventType.JOIN
, andProvenanceEventType.CLONE
events and will be ignored for any other event types.- Parameters:
child
- to remove- Returns:
- the builder
-
setAlternateIdentifierUri
Associates the given identifier with the FlowFile for which this Event is created. This provides a linkage between the given FlowFile and alternate identifier. This information can be useful if published to an external, enterprise-wide Provenance tracking system that is able to associate the data between different processes or services. This is valid only forProvenanceEventType.ADDINFO
events and will be ignored for any other event types.- Parameters:
alternateIdentifierUri
- another identifier of the flowfile this event is for- Returns:
- the builder
-
setDetails
Sets the details for this event. This is a free-form String that can contain any information that is relevant to this event.- Parameters:
details
- a description of the event- Returns:
- the builder
-
setRelationship
Sets the to which the FlowFile was routed forProvenanceEventType.ROUTE
events. This is valid only forProvenanceEventType.ROUTE
events and will be ignored for any other event types.- Parameters:
relationship
- to which flowfiles in this event were routed- Returns:
- the builder
-
fromFlowFile
Populates the builder with as much information as it can from the given FlowFile- Parameters:
flowFile
- to source attributes for this event from- Returns:
- the builder
-
build
ProvenanceEventRecord build()Builds the Provenance Event. It is possible that callingProvenanceEventRecord.getEventId()
on theProvenanceEventRecord
that is returned will yield-1
. This is because the implementation of the Event may depend on theinvalid reference
ProvevenanceEventRepository
- Returns:
- the event
-
getChildFlowFileIds
- Returns:
- the ids of all FlowFiles that have been added as children via
addChildFlowFile(FlowFile)
-
getParentFlowFileIds
- Returns:
- the ids of all FlowFiles that have been added as parents via
addParentFlowFile(FlowFile)
-
getFlowFileId
String getFlowFileId()- Returns:
- the id of the FlowFile for which the event is being built
-
copy
ProvenanceEventBuilder copy()- Returns:
- a new Provenance Event Builder that is identical to this one (a deep copy)
-