use of org.apache.nifi.web.api.dto.status.ProcessorStatusSnapshotDTO in project nifi by apache.
the class DtoFactory method createProcessorStatusDto.
public ProcessorStatusDTO createProcessorStatusDto(final ProcessorStatus procStatus) {
final ProcessorStatusDTO dto = new ProcessorStatusDTO();
dto.setId(procStatus.getId());
dto.setGroupId(procStatus.getGroupId());
dto.setName(procStatus.getName());
dto.setStatsLastRefreshed(new Date());
dto.setRunStatus(procStatus.getRunStatus().toString());
final ProcessorStatusSnapshotDTO snapshot = new ProcessorStatusSnapshotDTO();
dto.setAggregateSnapshot(snapshot);
snapshot.setId(procStatus.getId());
snapshot.setGroupId(procStatus.getGroupId());
snapshot.setName(procStatus.getName());
snapshot.setFlowFilesOut(procStatus.getOutputCount());
snapshot.setBytesOut(procStatus.getOutputBytes());
snapshot.setFlowFilesIn(procStatus.getInputCount());
snapshot.setBytesIn(procStatus.getInputBytes());
snapshot.setBytesRead(procStatus.getBytesRead());
snapshot.setBytesWritten(procStatus.getBytesWritten());
snapshot.setTaskCount(procStatus.getInvocations());
snapshot.setTasksDurationNanos(procStatus.getProcessingNanos());
snapshot.setTasksDuration(FormatUtils.formatHoursMinutesSeconds(procStatus.getProcessingNanos(), TimeUnit.NANOSECONDS));
// determine the run status
snapshot.setRunStatus(procStatus.getRunStatus().toString());
snapshot.setExecutionNode(procStatus.getExecutionNode().toString());
snapshot.setActiveThreadCount(procStatus.getActiveThreadCount());
snapshot.setType(procStatus.getType());
StatusMerger.updatePrettyPrintedFields(snapshot);
return dto;
}
Aggregations