Search in sources :

Example 6 with ProvenanceEventDTO

use of org.apache.nifi.web.api.dto.provenance.ProvenanceEventDTO in project nifi by apache.

the class ControllerFacade method setComponentDetails.

private void setComponentDetails(final ProvenanceEventDTO dto) {
    final ProcessGroup root = flowController.getGroup(flowController.getRootGroupId());
    final Connectable connectable = root.findLocalConnectable(dto.getComponentId());
    if (connectable != null) {
        dto.setGroupId(connectable.getProcessGroup().getIdentifier());
        dto.setComponentName(connectable.getName());
        return;
    }
    final RemoteGroupPort remoteGroupPort = root.findRemoteGroupPort(dto.getComponentId());
    if (remoteGroupPort != null) {
        dto.setGroupId(remoteGroupPort.getProcessGroupIdentifier());
        dto.setComponentName(remoteGroupPort.getName());
        return;
    }
    final Connection connection = root.findConnection(dto.getComponentId());
    if (connection != null) {
        dto.setGroupId(connection.getProcessGroup().getIdentifier());
        String name = connection.getName();
        final Collection<Relationship> relationships = connection.getRelationships();
        if (StringUtils.isBlank(name) && CollectionUtils.isNotEmpty(relationships)) {
            name = StringUtils.join(relationships.stream().map(relationship -> relationship.getName()).collect(Collectors.toSet()), ", ");
        }
        dto.setComponentName(name);
        return;
    }
}
Also used : Bundle(org.apache.nifi.bundle.Bundle) Arrays(java.util.Arrays) SearchableFields(org.apache.nifi.provenance.SearchableFields) StringUtils(org.apache.commons.lang3.StringUtils) QueueSize(org.apache.nifi.controller.queue.QueueSize) ClassUtils(org.apache.commons.lang3.ClassUtils) ROOT_GROUP_ID_ALIAS(org.apache.nifi.controller.FlowController.ROOT_GROUP_ID_ALIAS) AuthorizationResult(org.apache.nifi.authorization.AuthorizationResult) VersionedProcessGroup(org.apache.nifi.registry.flow.VersionedProcessGroup) Map(java.util.Map) ResourceNotFoundException(org.apache.nifi.web.ResourceNotFoundException) ProvenanceRepository(org.apache.nifi.provenance.ProvenanceRepository) RootGroupPort(org.apache.nifi.remote.RootGroupPort) Connectable(org.apache.nifi.connectable.Connectable) Connection(org.apache.nifi.connectable.Connection) ProcessorStatus(org.apache.nifi.controller.status.ProcessorStatus) FlowFilePrioritizer(org.apache.nifi.flowfile.FlowFilePrioritizer) ProcessGroupStatus(org.apache.nifi.controller.status.ProcessGroupStatus) Set(java.util.Set) FlowController(org.apache.nifi.controller.FlowController) VariableRegistry(org.apache.nifi.registry.VariableRegistry) AttributeDTO(org.apache.nifi.web.api.dto.provenance.AttributeDTO) ControllerService(org.apache.nifi.controller.ControllerService) RemoteProcessGroup(org.apache.nifi.groups.RemoteProcessGroup) WebApplicationException(javax.ws.rs.WebApplicationException) ExtensionManager(org.apache.nifi.nar.ExtensionManager) ConnectionStatus(org.apache.nifi.controller.status.ConnectionStatus) ComponentStatusRepository(org.apache.nifi.controller.status.history.ComponentStatusRepository) LineageRequestDTO(org.apache.nifi.web.api.dto.provenance.lineage.LineageRequestDTO) ProvenanceRequestDTO(org.apache.nifi.web.api.dto.provenance.ProvenanceRequestDTO) DtoFactory(org.apache.nifi.web.api.dto.DtoFactory) Resource(org.apache.nifi.authorization.Resource) Counter(org.apache.nifi.controller.Counter) ProvenanceEventDTO(org.apache.nifi.web.api.dto.provenance.ProvenanceEventDTO) AccessDeniedException(org.apache.nifi.authorization.AccessDeniedException) ControllerServiceEntity(org.apache.nifi.web.api.entity.ControllerServiceEntity) ConfigurableComponent(org.apache.nifi.components.ConfigurableComponent) CollectionUtils(org.apache.commons.collections4.CollectionUtils) TreeSet(java.util.TreeSet) LineageDTO(org.apache.nifi.web.api.dto.provenance.lineage.LineageDTO) ArrayList(java.util.ArrayList) ContentAvailability(org.apache.nifi.controller.ContentAvailability) NiFiUser(org.apache.nifi.authorization.user.NiFiUser) Relationship(org.apache.nifi.processor.Relationship) ProvenanceEventRecord(org.apache.nifi.provenance.ProvenanceEventRecord) ControllerServiceProvider(org.apache.nifi.controller.service.ControllerServiceProvider) ProcessGroupCounts(org.apache.nifi.groups.ProcessGroupCounts) ProvenanceDTO(org.apache.nifi.web.api.dto.provenance.ProvenanceDTO) Collator(java.text.Collator) DocumentedTypeDTO(org.apache.nifi.web.api.dto.DocumentedTypeDTO) ContentDirection(org.apache.nifi.controller.repository.claim.ContentDirection) RequestAction(org.apache.nifi.authorization.RequestAction) ProvenanceOptionsDTO(org.apache.nifi.web.api.dto.provenance.ProvenanceOptionsDTO) IOException(java.io.IOException) Authorizer(org.apache.nifi.authorization.Authorizer) NiFiProperties(org.apache.nifi.util.NiFiProperties) ReportingTask(org.apache.nifi.reporting.ReportingTask) CoreAttributes(org.apache.nifi.flowfile.attributes.CoreAttributes) NodeIdentifier(org.apache.nifi.cluster.protocol.NodeIdentifier) ProcessGroup(org.apache.nifi.groups.ProcessGroup) SortedSet(java.util.SortedSet) BundleCoordinate(org.apache.nifi.bundle.BundleCoordinate) Query(org.apache.nifi.provenance.search.Query) Date(java.util.Date) LoggerFactory(org.slf4j.LoggerFactory) Port(org.apache.nifi.connectable.Port) FlowService(org.apache.nifi.services.FlowService) BundleDTO(org.apache.nifi.web.api.dto.BundleDTO) ControllerStatusDTO(org.apache.nifi.web.api.dto.status.ControllerStatusDTO) Locale(java.util.Locale) SearchableField(org.apache.nifi.provenance.search.SearchableField) Template(org.apache.nifi.controller.Template) Label(org.apache.nifi.controller.label.Label) ProvenanceSearchableFieldDTO(org.apache.nifi.web.api.dto.provenance.ProvenanceSearchableFieldDTO) Authorizable(org.apache.nifi.authorization.resource.Authorizable) RequiredPermission(org.apache.nifi.components.RequiredPermission) TimeZone(java.util.TimeZone) Collection(java.util.Collection) BundleUtils(org.apache.nifi.util.BundleUtils) Collectors(java.util.stream.Collectors) ResourceFactory(org.apache.nifi.authorization.resource.ResourceFactory) Processor(org.apache.nifi.processor.Processor) SystemDiagnostics(org.apache.nifi.diagnostics.SystemDiagnostics) List(java.util.List) Result(org.apache.nifi.authorization.AuthorizationResult.Result) StatusHistoryDTO(org.apache.nifi.web.api.dto.status.StatusHistoryDTO) ProvenanceResultsDTO(org.apache.nifi.web.api.dto.provenance.ProvenanceResultsDTO) SearchTerms(org.apache.nifi.provenance.search.SearchTerms) ProcessorNode(org.apache.nifi.controller.ProcessorNode) ControllerServiceNode(org.apache.nifi.controller.service.ControllerServiceNode) HashMap(java.util.HashMap) Function(java.util.function.Function) HashSet(java.util.HashSet) QueryResult(org.apache.nifi.provenance.search.QueryResult) ReportingTaskNode(org.apache.nifi.controller.ReportingTaskNode) SearchTerm(org.apache.nifi.provenance.search.SearchTerm) QuerySubmission(org.apache.nifi.provenance.search.QuerySubmission) ContentNotFoundException(org.apache.nifi.controller.repository.ContentNotFoundException) Logger(org.slf4j.Logger) RemoteGroupPort(org.apache.nifi.remote.RemoteGroupPort) ProcessorDiagnosticsDTO(org.apache.nifi.web.api.dto.diagnostics.ProcessorDiagnosticsDTO) TimeUnit(java.util.concurrent.TimeUnit) Consumer(java.util.function.Consumer) RemoteProcessGroupStatus(org.apache.nifi.controller.status.RemoteProcessGroupStatus) NiFiCoreException(org.apache.nifi.web.NiFiCoreException) ComputeLineageSubmission(org.apache.nifi.provenance.lineage.ComputeLineageSubmission) FormatUtils(org.apache.nifi.util.FormatUtils) NiFiUserUtils(org.apache.nifi.authorization.user.NiFiUserUtils) PortStatus(org.apache.nifi.controller.status.PortStatus) SearchResultsDTO(org.apache.nifi.web.api.dto.search.SearchResultsDTO) BulletinRepository(org.apache.nifi.reporting.BulletinRepository) DownloadableContent(org.apache.nifi.web.DownloadableContent) LineageRequestType(org.apache.nifi.web.api.dto.provenance.lineage.LineageRequestDTO.LineageRequestType) Comparator(java.util.Comparator) Collections(java.util.Collections) InputStream(java.io.InputStream) Connectable(org.apache.nifi.connectable.Connectable) RemoteGroupPort(org.apache.nifi.remote.RemoteGroupPort) Relationship(org.apache.nifi.processor.Relationship) VersionedProcessGroup(org.apache.nifi.registry.flow.VersionedProcessGroup) RemoteProcessGroup(org.apache.nifi.groups.RemoteProcessGroup) ProcessGroup(org.apache.nifi.groups.ProcessGroup) Connection(org.apache.nifi.connectable.Connection)

Aggregations

ProvenanceEventDTO (org.apache.nifi.web.api.dto.provenance.ProvenanceEventDTO)6 ArrayList (java.util.ArrayList)4 Date (java.util.Date)4 HashMap (java.util.HashMap)4 NodeIdentifier (org.apache.nifi.cluster.protocol.NodeIdentifier)4 HashSet (java.util.HashSet)3 Map (java.util.Map)3 ProvenanceDTO (org.apache.nifi.web.api.dto.provenance.ProvenanceDTO)3 ProvenanceRequestDTO (org.apache.nifi.web.api.dto.provenance.ProvenanceRequestDTO)3 ProvenanceResultsDTO (org.apache.nifi.web.api.dto.provenance.ProvenanceResultsDTO)3 ApiOperation (io.swagger.annotations.ApiOperation)2 ApiResponses (io.swagger.annotations.ApiResponses)2 IOException (java.io.IOException)2 Comparator (java.util.Comparator)2 TreeSet (java.util.TreeSet)2 Consumes (javax.ws.rs.Consumes)2 Path (javax.ws.rs.Path)2 Produces (javax.ws.rs.Produces)2 AuthorizationResult (org.apache.nifi.authorization.AuthorizationResult)2 InputStream (java.io.InputStream)1