Search in sources :

Example 1 with FlowFileSummary

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;
}
Also used : ArrayList(java.util.ArrayList) FlowFileSummary(org.apache.nifi.controller.queue.FlowFileSummary) Date(java.util.Date)

Aggregations

ArrayList (java.util.ArrayList)1 Date (java.util.Date)1 FlowFileSummary (org.apache.nifi.controller.queue.FlowFileSummary)1