Search in sources :

Example 1 with Table

use of org.apache.nifi.toolkit.cli.impl.result.writer.Table in project nifi by apache.

the class BucketsResult method writeSimpleResult.

@Override
protected void writeSimpleResult(final PrintStream output) {
    if (buckets.isEmpty()) {
        return;
    }
    final Table table = new Table.Builder().column("#", 3, 3, false).column("Name", 20, 36, true).column("Id", 36, 36, false).column("Description", 11, 40, true).build();
    for (int i = 0; i < buckets.size(); ++i) {
        final Bucket bucket = buckets.get(i);
        table.addRow(String.valueOf(i + 1), bucket.getName(), bucket.getIdentifier(), bucket.getDescription());
    }
    final TableWriter tableWriter = new DynamicTableWriter();
    tableWriter.write(table, output);
}
Also used : Table(org.apache.nifi.toolkit.cli.impl.result.writer.Table) DynamicTableWriter(org.apache.nifi.toolkit.cli.impl.result.writer.DynamicTableWriter) TableWriter(org.apache.nifi.toolkit.cli.impl.result.writer.TableWriter) Bucket(org.apache.nifi.registry.bucket.Bucket) DynamicTableWriter(org.apache.nifi.toolkit.cli.impl.result.writer.DynamicTableWriter)

Example 2 with Table

use of org.apache.nifi.toolkit.cli.impl.result.writer.Table in project nifi by apache.

the class VersionControlInfoResult method writeSimpleResult.

@Override
protected void writeSimpleResult(final PrintStream output) {
    final VersionControlInformationDTO dto = versionControlInformationEntity.getVersionControlInformation();
    if (dto == null) {
        return;
    }
    final Table table = new Table.Builder().column("Registry", 20, 30, true).column("Bucket", 20, 30, true).column("Flow", 20, 30, true).column("Ver", 3, 3, false).build();
    table.addRow(dto.getRegistryName(), dto.getBucketName(), dto.getFlowName(), String.valueOf(dto.getVersion()));
    final TableWriter tableWriter = new DynamicTableWriter();
    tableWriter.write(table, output);
}
Also used : Table(org.apache.nifi.toolkit.cli.impl.result.writer.Table) DynamicTableWriter(org.apache.nifi.toolkit.cli.impl.result.writer.DynamicTableWriter) TableWriter(org.apache.nifi.toolkit.cli.impl.result.writer.TableWriter) DynamicTableWriter(org.apache.nifi.toolkit.cli.impl.result.writer.DynamicTableWriter) VersionControlInformationDTO(org.apache.nifi.web.api.dto.VersionControlInformationDTO)

Example 3 with Table

use of org.apache.nifi.toolkit.cli.impl.result.writer.Table in project nifi by apache.

the class VersionedFlowsResult method writeSimpleResult.

@Override
protected void writeSimpleResult(PrintStream output) {
    if (versionedFlows.isEmpty()) {
        return;
    }
    final Table table = new Table.Builder().column("#", 3, 3, false).column("Name", 20, 36, true).column("Id", 36, 36, false).column("Description", 11, 40, true).build();
    for (int i = 0; i < versionedFlows.size(); ++i) {
        final VersionedFlow flow = versionedFlows.get(i);
        table.addRow(String.valueOf(i + 1), flow.getName(), flow.getIdentifier(), flow.getDescription());
    }
    final TableWriter tableWriter = new DynamicTableWriter();
    tableWriter.write(table, output);
}
Also used : Table(org.apache.nifi.toolkit.cli.impl.result.writer.Table) DynamicTableWriter(org.apache.nifi.toolkit.cli.impl.result.writer.DynamicTableWriter) TableWriter(org.apache.nifi.toolkit.cli.impl.result.writer.TableWriter) VersionedFlow(org.apache.nifi.registry.flow.VersionedFlow) DynamicTableWriter(org.apache.nifi.toolkit.cli.impl.result.writer.DynamicTableWriter)

Example 4 with Table

use of org.apache.nifi.toolkit.cli.impl.result.writer.Table in project nifi by apache.

the class ProcessGroupsResult method writeSimpleResult.

@Override
protected void writeSimpleResult(final PrintStream output) {
    final Table table = new Table.Builder().column("#", 3, 3, false).column("Name", 20, 36, true).column("Id", 36, 36, false).column("Running", 7, 7, false).column("Stopped", 7, 7, false).column("Disabled", 8, 8, false).column("Invalid", 7, 7, false).build();
    for (int i = 0; i < processGroups.size(); i++) {
        final ProcessGroupDTO dto = processGroups.get(i);
        table.addRow(String.valueOf(i + 1), dto.getName(), dto.getId(), String.valueOf(dto.getRunningCount()), String.valueOf(dto.getStoppedCount()), String.valueOf(dto.getDisabledCount()), String.valueOf(dto.getInvalidCount()));
    }
    final TableWriter tableWriter = new DynamicTableWriter();
    tableWriter.write(table, output);
}
Also used : Table(org.apache.nifi.toolkit.cli.impl.result.writer.Table) DynamicTableWriter(org.apache.nifi.toolkit.cli.impl.result.writer.DynamicTableWriter) TableWriter(org.apache.nifi.toolkit.cli.impl.result.writer.TableWriter) ProcessGroupDTO(org.apache.nifi.web.api.dto.ProcessGroupDTO) DynamicTableWriter(org.apache.nifi.toolkit.cli.impl.result.writer.DynamicTableWriter)

Example 5 with Table

use of org.apache.nifi.toolkit.cli.impl.result.writer.Table in project nifi by apache.

the class RegistryClientsResult method writeSimpleResult.

@Override
protected void writeSimpleResult(final PrintStream output) {
    final Set<RegistryClientEntity> clients = registryClients.getRegistries();
    if (clients == null || clients.isEmpty()) {
        return;
    }
    final List<RegistryDTO> registries = clients.stream().map(RegistryClientEntity::getComponent).sorted(Comparator.comparing(RegistryDTO::getName)).collect(Collectors.toList());
    final Table table = new Table.Builder().column("#", 3, 3, false).column("Name", 20, 36, true).column("Id", 36, 36, false).column("Uri", 3, Integer.MAX_VALUE, false).build();
    for (int i = 0; i < registries.size(); i++) {
        RegistryDTO r = registries.get(i);
        table.addRow("" + (i + 1), r.getName(), r.getId(), r.getUri());
    }
    final TableWriter tableWriter = new DynamicTableWriter();
    tableWriter.write(table, output);
}
Also used : Table(org.apache.nifi.toolkit.cli.impl.result.writer.Table) DynamicTableWriter(org.apache.nifi.toolkit.cli.impl.result.writer.DynamicTableWriter) TableWriter(org.apache.nifi.toolkit.cli.impl.result.writer.TableWriter) RegistryClientEntity(org.apache.nifi.web.api.entity.RegistryClientEntity) RegistryDTO(org.apache.nifi.web.api.dto.RegistryDTO) DynamicTableWriter(org.apache.nifi.toolkit.cli.impl.result.writer.DynamicTableWriter)

Aggregations

DynamicTableWriter (org.apache.nifi.toolkit.cli.impl.result.writer.DynamicTableWriter)7 Table (org.apache.nifi.toolkit.cli.impl.result.writer.Table)7 TableWriter (org.apache.nifi.toolkit.cli.impl.result.writer.TableWriter)7 PrintStream (java.io.PrintStream)1 Collections (java.util.Collections)1 Comparator (java.util.Comparator)1 Date (java.util.Date)1 List (java.util.List)1 Collectors (java.util.stream.Collectors)1 Validate (org.apache.commons.lang3.Validate)1 Bucket (org.apache.nifi.registry.bucket.Bucket)1 VersionedFlow (org.apache.nifi.registry.flow.VersionedFlow)1 ResultType (org.apache.nifi.toolkit.cli.api.ResultType)1 ProcessGroupDTO (org.apache.nifi.web.api.dto.ProcessGroupDTO)1 RegistryDTO (org.apache.nifi.web.api.dto.RegistryDTO)1 VariableDTO (org.apache.nifi.web.api.dto.VariableDTO)1 VariableRegistryDTO (org.apache.nifi.web.api.dto.VariableRegistryDTO)1 VersionControlInformationDTO (org.apache.nifi.web.api.dto.VersionControlInformationDTO)1 RegistryClientEntity (org.apache.nifi.web.api.entity.RegistryClientEntity)1 VariableRegistryEntity (org.apache.nifi.web.api.entity.VariableRegistryEntity)1