use of org.apache.nifi.controller.queue.FlowFileSummary in project nifi by apache.
the class DtoFactory method createListingRequestDTO.
/**
* Creates a ListingRequestDTO from the specified ListFlowFileStatus.
*
* @param listingRequest listingRequest
* @return dto
*/
public ListingRequestDTO createListingRequestDTO(final ListFlowFileStatus listingRequest) {
final ListingRequestDTO dto = new ListingRequestDTO();
dto.setId(listingRequest.getRequestIdentifier());
dto.setSubmissionTime(new Date(listingRequest.getRequestSubmissionTime()));
dto.setLastUpdated(new Date(listingRequest.getLastUpdated()));
dto.setState(listingRequest.getState().toString());
dto.setFailureReason(listingRequest.getFailureReason());
dto.setFinished(isListingRequestComplete(listingRequest.getState()));
dto.setMaxResults(listingRequest.getMaxResults());
dto.setPercentCompleted(listingRequest.getCompletionPercentage());
dto.setQueueSize(createQueueSizeDTO(listingRequest.getQueueSize()));
if (isListingRequestComplete(listingRequest.getState())) {
final List<FlowFileSummary> flowFileSummaries = listingRequest.getFlowFileSummaries();
if (flowFileSummaries != null) {
final Date now = new Date();
final List<FlowFileSummaryDTO> summaryDtos = new ArrayList<>(flowFileSummaries.size());
for (final FlowFileSummary summary : flowFileSummaries) {
summaryDtos.add(createFlowFileSummaryDTO(summary, now));
}
dto.setFlowFileSummaries(summaryDtos);
}
}
return dto;
}
Aggregations