Search in sources :

Example 1 with ProcessGroupStatusSnapshotDTO

use of org.apache.nifi.web.api.dto.status.ProcessGroupStatusSnapshotDTO in project nifi by apache.

the class StandardNiFiServiceFacade method pruneChildGroups.

private void pruneChildGroups(final ProcessGroupStatusSnapshotDTO snapshot) {
    for (final ProcessGroupStatusSnapshotEntity childProcessGroupStatusEntity : snapshot.getProcessGroupStatusSnapshots()) {
        final ProcessGroupStatusSnapshotDTO childProcessGroupStatus = childProcessGroupStatusEntity.getProcessGroupStatusSnapshot();
        childProcessGroupStatus.setConnectionStatusSnapshots(null);
        childProcessGroupStatus.setProcessGroupStatusSnapshots(null);
        childProcessGroupStatus.setInputPortStatusSnapshots(null);
        childProcessGroupStatus.setOutputPortStatusSnapshots(null);
        childProcessGroupStatus.setProcessorStatusSnapshots(null);
        childProcessGroupStatus.setRemoteProcessGroupStatusSnapshots(null);
    }
}
Also used : ProcessGroupStatusSnapshotEntity(org.apache.nifi.web.api.entity.ProcessGroupStatusSnapshotEntity) ProcessGroupStatusSnapshotDTO(org.apache.nifi.web.api.dto.status.ProcessGroupStatusSnapshotDTO) NodeProcessGroupStatusSnapshotDTO(org.apache.nifi.web.api.dto.status.NodeProcessGroupStatusSnapshotDTO)

Example 2 with ProcessGroupStatusSnapshotDTO

use of org.apache.nifi.web.api.dto.status.ProcessGroupStatusSnapshotDTO in project nifi by apache.

the class DtoFactory method createConciseProcessGroupStatusDto.

public ProcessGroupStatusDTO createConciseProcessGroupStatusDto(final ProcessGroupStatus processGroupStatus) {
    final ProcessGroupStatusDTO processGroupStatusDto = new ProcessGroupStatusDTO();
    processGroupStatusDto.setId(processGroupStatus.getId());
    processGroupStatusDto.setName(processGroupStatus.getName());
    processGroupStatusDto.setStatsLastRefreshed(new Date());
    final ProcessGroupStatusSnapshotDTO snapshot = new ProcessGroupStatusSnapshotDTO();
    processGroupStatusDto.setAggregateSnapshot(snapshot);
    snapshot.setId(processGroupStatus.getId());
    snapshot.setName(processGroupStatus.getName());
    if (processGroupStatus.getVersionedFlowState() != null) {
        snapshot.setVersionedFlowState(processGroupStatus.getVersionedFlowState().name());
    }
    snapshot.setFlowFilesQueued(processGroupStatus.getQueuedCount());
    snapshot.setBytesQueued(processGroupStatus.getQueuedContentSize());
    snapshot.setBytesRead(processGroupStatus.getBytesRead());
    snapshot.setBytesWritten(processGroupStatus.getBytesWritten());
    snapshot.setFlowFilesIn(processGroupStatus.getInputCount());
    snapshot.setBytesIn(processGroupStatus.getInputContentSize());
    snapshot.setFlowFilesOut(processGroupStatus.getOutputCount());
    snapshot.setBytesOut(processGroupStatus.getOutputContentSize());
    snapshot.setFlowFilesTransferred(processGroupStatus.getFlowFilesTransferred());
    snapshot.setBytesTransferred(processGroupStatus.getBytesTransferred());
    snapshot.setFlowFilesSent(processGroupStatus.getFlowFilesSent());
    snapshot.setBytesSent(processGroupStatus.getBytesSent());
    snapshot.setFlowFilesReceived(processGroupStatus.getFlowFilesReceived());
    snapshot.setBytesReceived(processGroupStatus.getBytesReceived());
    snapshot.setActiveThreadCount(processGroupStatus.getActiveThreadCount());
    StatusMerger.updatePrettyPrintedFields(snapshot);
    return processGroupStatusDto;
}
Also used : ProcessGroupStatusDTO(org.apache.nifi.web.api.dto.status.ProcessGroupStatusDTO) RemoteProcessGroupStatusDTO(org.apache.nifi.web.api.dto.status.RemoteProcessGroupStatusDTO) RemoteProcessGroupStatusSnapshotDTO(org.apache.nifi.web.api.dto.status.RemoteProcessGroupStatusSnapshotDTO) ProcessGroupStatusSnapshotDTO(org.apache.nifi.web.api.dto.status.ProcessGroupStatusSnapshotDTO) Date(java.util.Date)

Example 3 with ProcessGroupStatusSnapshotDTO

use of org.apache.nifi.web.api.dto.status.ProcessGroupStatusSnapshotDTO in project nifi by apache.

the class DtoFactory method createProcessGroupStatusDto.

public ProcessGroupStatusDTO createProcessGroupStatusDto(final ProcessGroup processGroup, final ProcessGroupStatus processGroupStatus) {
    final ProcessGroupStatusDTO processGroupStatusDto = createConciseProcessGroupStatusDto(processGroupStatus);
    final ProcessGroupStatusSnapshotDTO snapshot = processGroupStatusDto.getAggregateSnapshot();
    // processor status
    final Collection<ProcessorStatusSnapshotEntity> processorStatusSnapshotEntities = new ArrayList<>();
    snapshot.setProcessorStatusSnapshots(processorStatusSnapshotEntities);
    final Collection<ProcessorStatus> processorStatusCollection = processGroupStatus.getProcessorStatus();
    if (processorStatusCollection != null) {
        for (final ProcessorStatus processorStatus : processorStatusCollection) {
            final ProcessorStatusDTO processorStatusDto = createProcessorStatusDto(processorStatus);
            final ProcessorNode processor = processGroup.findProcessor(processorStatusDto.getId());
            final PermissionsDTO processorPermissions = createPermissionsDto(processor);
            processorStatusSnapshotEntities.add(entityFactory.createProcessorStatusSnapshotEntity(processorStatusDto.getAggregateSnapshot(), processorPermissions));
        }
    }
    // connection status
    final Collection<ConnectionStatusSnapshotEntity> connectionStatusDtoCollection = new ArrayList<>();
    snapshot.setConnectionStatusSnapshots(connectionStatusDtoCollection);
    final Collection<ConnectionStatus> connectionStatusCollection = processGroupStatus.getConnectionStatus();
    if (connectionStatusCollection != null) {
        for (final ConnectionStatus connectionStatus : connectionStatusCollection) {
            final ConnectionStatusDTO connectionStatusDto = createConnectionStatusDto(connectionStatus);
            final Connection connection = processGroup.findConnection(connectionStatusDto.getId());
            final PermissionsDTO connectionPermissions = createPermissionsDto(connection);
            connectionStatusDtoCollection.add(entityFactory.createConnectionStatusSnapshotEntity(connectionStatusDto.getAggregateSnapshot(), connectionPermissions));
        }
    }
    // local child process groups
    final Collection<ProcessGroupStatusSnapshotEntity> childProcessGroupStatusDtoCollection = new ArrayList<>();
    snapshot.setProcessGroupStatusSnapshots(childProcessGroupStatusDtoCollection);
    final Collection<ProcessGroupStatus> childProcessGroupStatusCollection = processGroupStatus.getProcessGroupStatus();
    if (childProcessGroupStatusCollection != null) {
        for (final ProcessGroupStatus childProcessGroupStatus : childProcessGroupStatusCollection) {
            final ProcessGroupStatusDTO childProcessGroupStatusDto = createProcessGroupStatusDto(processGroup, childProcessGroupStatus);
            final ProcessGroup childProcessGroup = processGroup.findProcessGroup(childProcessGroupStatusDto.getId());
            final PermissionsDTO childProcessGroupPermissions = createPermissionsDto(childProcessGroup);
            childProcessGroupStatusDtoCollection.add(entityFactory.createProcessGroupStatusSnapshotEntity(childProcessGroupStatusDto.getAggregateSnapshot(), childProcessGroupPermissions));
        }
    }
    // remote child process groups
    final Collection<RemoteProcessGroupStatusSnapshotEntity> childRemoteProcessGroupStatusDtoCollection = new ArrayList<>();
    snapshot.setRemoteProcessGroupStatusSnapshots(childRemoteProcessGroupStatusDtoCollection);
    final Collection<RemoteProcessGroupStatus> childRemoteProcessGroupStatusCollection = processGroupStatus.getRemoteProcessGroupStatus();
    if (childRemoteProcessGroupStatusCollection != null) {
        for (final RemoteProcessGroupStatus childRemoteProcessGroupStatus : childRemoteProcessGroupStatusCollection) {
            final RemoteProcessGroupStatusDTO childRemoteProcessGroupStatusDto = createRemoteProcessGroupStatusDto(childRemoteProcessGroupStatus);
            final RemoteProcessGroup remoteProcessGroup = processGroup.findRemoteProcessGroup(childRemoteProcessGroupStatusDto.getId());
            final PermissionsDTO remoteProcessGroupPermissions = createPermissionsDto(remoteProcessGroup);
            childRemoteProcessGroupStatusDtoCollection.add(entityFactory.createRemoteProcessGroupStatusSnapshotEntity(childRemoteProcessGroupStatusDto.getAggregateSnapshot(), remoteProcessGroupPermissions));
        }
    }
    // input ports
    final Collection<PortStatusSnapshotEntity> inputPortStatusDtoCollection = new ArrayList<>();
    snapshot.setInputPortStatusSnapshots(inputPortStatusDtoCollection);
    final Collection<PortStatus> inputPortStatusCollection = processGroupStatus.getInputPortStatus();
    if (inputPortStatusCollection != null) {
        for (final PortStatus portStatus : inputPortStatusCollection) {
            final PortStatusDTO portStatusDto = createPortStatusDto(portStatus);
            final Port inputPort = processGroup.findInputPort(portStatus.getId());
            final PermissionsDTO inputPortPermissions = createPermissionsDto(inputPort);
            inputPortStatusDtoCollection.add(entityFactory.createPortStatusSnapshotEntity(portStatusDto.getAggregateSnapshot(), inputPortPermissions));
        }
    }
    // output ports
    final Collection<PortStatusSnapshotEntity> outputPortStatusDtoCollection = new ArrayList<>();
    snapshot.setOutputPortStatusSnapshots(outputPortStatusDtoCollection);
    final Collection<PortStatus> outputPortStatusCollection = processGroupStatus.getOutputPortStatus();
    if (outputPortStatusCollection != null) {
        for (final PortStatus portStatus : outputPortStatusCollection) {
            final PortStatusDTO portStatusDto = createPortStatusDto(portStatus);
            final Port outputPort = processGroup.findOutputPort(portStatus.getId());
            final PermissionsDTO outputPortPermissions = createPermissionsDto(outputPort);
            outputPortStatusDtoCollection.add(entityFactory.createPortStatusSnapshotEntity(portStatusDto.getAggregateSnapshot(), outputPortPermissions));
        }
    }
    return processGroupStatusDto;
}
Also used : InstantiatedVersionedRemoteGroupPort(org.apache.nifi.registry.flow.mapping.InstantiatedVersionedRemoteGroupPort) RemoteGroupPort(org.apache.nifi.remote.RemoteGroupPort) RootGroupPort(org.apache.nifi.remote.RootGroupPort) Port(org.apache.nifi.connectable.Port) InstantiatedVersionedPort(org.apache.nifi.registry.flow.mapping.InstantiatedVersionedPort) ArrayList(java.util.ArrayList) PortStatusDTO(org.apache.nifi.web.api.dto.status.PortStatusDTO) RemoteProcessGroupStatusSnapshotEntity(org.apache.nifi.web.api.entity.RemoteProcessGroupStatusSnapshotEntity) ProcessGroupStatusSnapshotEntity(org.apache.nifi.web.api.entity.ProcessGroupStatusSnapshotEntity) PortStatusSnapshotEntity(org.apache.nifi.web.api.entity.PortStatusSnapshotEntity) ConnectionStatusSnapshotEntity(org.apache.nifi.web.api.entity.ConnectionStatusSnapshotEntity) ProcessorStatusDTO(org.apache.nifi.web.api.dto.status.ProcessorStatusDTO) ProcessorNode(org.apache.nifi.controller.ProcessorNode) PortStatus(org.apache.nifi.controller.status.PortStatus) ConnectionStatus(org.apache.nifi.controller.status.ConnectionStatus) NodeConnectionStatus(org.apache.nifi.cluster.coordination.node.NodeConnectionStatus) RemoteProcessGroupStatusDTO(org.apache.nifi.web.api.dto.status.RemoteProcessGroupStatusDTO) ProcessGroupStatus(org.apache.nifi.controller.status.ProcessGroupStatus) RemoteProcessGroupStatus(org.apache.nifi.controller.status.RemoteProcessGroupStatus) RemoteProcessGroup(org.apache.nifi.groups.RemoteProcessGroup) InstantiatedVersionedRemoteProcessGroup(org.apache.nifi.registry.flow.mapping.InstantiatedVersionedRemoteProcessGroup) ProcessGroupStatusDTO(org.apache.nifi.web.api.dto.status.ProcessGroupStatusDTO) RemoteProcessGroupStatusDTO(org.apache.nifi.web.api.dto.status.RemoteProcessGroupStatusDTO) Connection(org.apache.nifi.connectable.Connection) InstantiatedVersionedConnection(org.apache.nifi.registry.flow.mapping.InstantiatedVersionedConnection) RemoteProcessGroupStatusSnapshotDTO(org.apache.nifi.web.api.dto.status.RemoteProcessGroupStatusSnapshotDTO) ProcessGroupStatusSnapshotDTO(org.apache.nifi.web.api.dto.status.ProcessGroupStatusSnapshotDTO) RemoteProcessGroupStatus(org.apache.nifi.controller.status.RemoteProcessGroupStatus) ProcessorStatus(org.apache.nifi.controller.status.ProcessorStatus) ProcessorStatusSnapshotEntity(org.apache.nifi.web.api.entity.ProcessorStatusSnapshotEntity) ConnectionStatusDTO(org.apache.nifi.web.api.dto.status.ConnectionStatusDTO) RemoteProcessGroup(org.apache.nifi.groups.RemoteProcessGroup) ProcessGroup(org.apache.nifi.groups.ProcessGroup) InstantiatedVersionedProcessGroup(org.apache.nifi.registry.flow.mapping.InstantiatedVersionedProcessGroup) InstantiatedVersionedRemoteProcessGroup(org.apache.nifi.registry.flow.mapping.InstantiatedVersionedRemoteProcessGroup) RemoteProcessGroupStatusSnapshotEntity(org.apache.nifi.web.api.entity.RemoteProcessGroupStatusSnapshotEntity)

Aggregations

ProcessGroupStatusSnapshotDTO (org.apache.nifi.web.api.dto.status.ProcessGroupStatusSnapshotDTO)3 ProcessGroupStatusDTO (org.apache.nifi.web.api.dto.status.ProcessGroupStatusDTO)2 RemoteProcessGroupStatusDTO (org.apache.nifi.web.api.dto.status.RemoteProcessGroupStatusDTO)2 RemoteProcessGroupStatusSnapshotDTO (org.apache.nifi.web.api.dto.status.RemoteProcessGroupStatusSnapshotDTO)2 ProcessGroupStatusSnapshotEntity (org.apache.nifi.web.api.entity.ProcessGroupStatusSnapshotEntity)2 ArrayList (java.util.ArrayList)1 Date (java.util.Date)1 NodeConnectionStatus (org.apache.nifi.cluster.coordination.node.NodeConnectionStatus)1 Connection (org.apache.nifi.connectable.Connection)1 Port (org.apache.nifi.connectable.Port)1 ProcessorNode (org.apache.nifi.controller.ProcessorNode)1 ConnectionStatus (org.apache.nifi.controller.status.ConnectionStatus)1 PortStatus (org.apache.nifi.controller.status.PortStatus)1 ProcessGroupStatus (org.apache.nifi.controller.status.ProcessGroupStatus)1 ProcessorStatus (org.apache.nifi.controller.status.ProcessorStatus)1 RemoteProcessGroupStatus (org.apache.nifi.controller.status.RemoteProcessGroupStatus)1 ProcessGroup (org.apache.nifi.groups.ProcessGroup)1 RemoteProcessGroup (org.apache.nifi.groups.RemoteProcessGroup)1 InstantiatedVersionedConnection (org.apache.nifi.registry.flow.mapping.InstantiatedVersionedConnection)1 InstantiatedVersionedPort (org.apache.nifi.registry.flow.mapping.InstantiatedVersionedPort)1