@Override public boolean select(final ProvenanceEventRecord value) { if (!isAuthorized(value, user)) { return false; } return value.getEventId() >= firstRecordId; } }, maxRecords);
public static StandardProvenanceEventRecord copy(StandardProvenanceEventRecord other) { Builder builder = new Builder().fromEvent(other); return new StandardProvenanceEventRecord(builder); }
@Override protected String getRawProtocolPortId(ProvenanceEventRecord event) { return event.getComponentId(); } }
public PlaceholderProvenanceEvent(final ProvenanceEventRecord original) { this.componentId = original.getComponentId(); this.eventId = original.getEventId(); this.eventTime = original.getEventTime(); this.flowFileUuid = original.getFlowFileUuid(); }
@Override public ComputeLineageSubmission submitLineageComputation(final long eventId, final NiFiUser user) { final ProvenanceEventRecord event = getEvent(eventId); if (event == null) { final String userId = user == null ? null : user.getIdentity(); final AsyncLineageSubmission result = new AsyncLineageSubmission(LineageComputationType.FLOWFILE_LINEAGE, eventId, Collections.emptySet(), 1, userId); result.getResult().setError("Could not find event with ID " + eventId); lineageSubmissionMap.put(result.getLineageIdentifier(), result); return result; } return submitLineageComputation(Collections.singleton(event.getFlowFileUuid()), user, LineageComputationType.FLOWFILE_LINEAGE, eventId); }
@Override public void authorize(final ProvenanceEventRecord event) { if (authorizer == null) { return; } final Authorizable eventAuthorizable = resourceFactory.createProvenanceDataAuthorizable(event.getComponentId()); eventAuthorizable.authorize(authorizer, RequestAction.READ, user); } }
@Override public ProvenanceEventRecord getEvent(final long id) throws IOException { final List<ProvenanceEventRecord> records = getEvents(id, 1); if (records.isEmpty()) { return null; } final ProvenanceEventRecord record = records.get(0); if (record.getEventId() != id) { return null; } return record; }
ProvenanceEventBuilder build(final FlowFile flowFile, final ProvenanceEventType eventType) { final ProvenanceEventBuilder builder = repository.eventBuilder(); builder.setEventType(eventType); builder.fromFlowFile(flowFile); builder.setLineageStartDate(flowFile.getLineageStartDate()); builder.setComponentId(processorId); builder.setComponentType(processorType); return builder; } }
private byte[] encrypt(byte[] serialized, String eventId) throws IOException, EncryptionException { String keyId = getKeyId(); try { return provenanceEventEncryptor.encrypt(serialized, eventId, keyId); } catch (Exception e) { logger.error("Encountered an error: ", e); throw new EncryptionException(e); } }
public EventIdFirstSchemaRecordWriter(final File file, final AtomicLong idGenerator, final TocWriter writer, final boolean compressed, final int uncompressedBlockSize, final IdentifierLookup idLookup) throws IOException { super(file, idGenerator, writer, compressed, uncompressedBlockSize); this.idLookup = idLookup; componentIdMap = idLookup.invertComponentIdentifiers(); componentTypeMap = idLookup.invertComponentTypes(); queueIdMap = idLookup.invertQueueIdentifiers(); }
@Override public String toString() { return "EncryptionException " + getLocalizedMessage(); } }
public AsyncLineageSubmission(final LineageComputationType computationType, final Long eventId, final Collection<String> lineageFlowFileUuids, final int numSteps, final String submitterId) { this.computationType = computationType; this.eventId = eventId; this.lineageFlowFileUuids = lineageFlowFileUuids; this.submitterId = submitterId; this.result = new StandardLineageResult(numSteps, lineageFlowFileUuids); }
@Override public Set<ProvenanceEventRecord> replaceUnauthorizedWithPlaceholders(Set<ProvenanceEventRecord> events) { return repository.replaceUnauthorizedWithPlaceholders(events, user); } };
@Override public void registerEvents(final Iterable<ProvenanceEventRecord> events) { for (final ProvenanceEventRecord event : events) { registerEvent(event); } }
@Override public void registerEvents(final Iterable<ProvenanceEventRecord> events) { for (final ProvenanceEventRecord event : events) { registerEvent(event); } }
public void authorize(final ProvenanceEventRecord event, final NiFiUser user) { if (authorizer == null || user == null) { return; } final Authorizable eventAuthorizable = resourceFactory.createProvenanceDataAuthorizable(event.getComponentId()); eventAuthorizable.authorize(authorizer, RequestAction.READ, user); }
public EventIdFirstSchemaRecordWriter(final OutputStream out, final String storageLocation, final AtomicLong idGenerator, final TocWriter tocWriter, final boolean compressed, final int uncompressedBlockSize, final IdentifierLookup idLookup) throws IOException { super(out, storageLocation, idGenerator, tocWriter, compressed, uncompressedBlockSize); this.idLookup = idLookup; componentIdMap = idLookup.invertComponentIdentifiers(); componentTypeMap = idLookup.invertComponentTypes(); queueIdMap = idLookup.invertQueueIdentifiers(); }