adarmiento commented on a change in pull request #3700: NIFI-6638: Empty 
multiple queues at once at different flow levels
URL: https://github.com/apache/nifi/pull/3700#discussion_r333202099
 
 

 ##########
 File path: 
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/dto/DtoFactory.java
 ##########
 @@ -556,6 +556,77 @@ public DropRequestDTO createDropRequestDTO(final 
DropFlowFileStatus dropRequest)
         return dto;
     }
 
+    /**
+     * Creates a DropRequestDTO from the specified flow file statuses.
+     *
+     * @param dropRequestId the dropRequest id
+     * @param dropRequests dropRequests
+     * @return dto
+     */
+    public DropRequestDTO createDropRequestDTO(final String dropRequestId, 
final Set<? extends DropFlowFileStatus> dropRequests) {
+        final DropRequestDTO dto = new DropRequestDTO();
+        dto.setId(dropRequestId);
+        dto.setSubmissionTime(new Date(dropRequests.stream()
+                .mapToLong(DropFlowFileStatus::getRequestSubmissionTime)
+                .min()
+                .orElseGet(() -> new Date().getTime()))
+        );
+        dto.setLastUpdated(new Date(dropRequests.stream()
+                .mapToLong(DropFlowFileStatus::getLastUpdated)
+                .max()
+                .orElseGet(() -> dto.getSubmissionTime().getTime()))
+        );
+        //dto.setState(dropRequest.getState().toString());
+        dto.setFailureReasons(dropRequests.stream()
+                .filter(dropRequest -> dropRequest.getFailureReason() != null)
+                .map(dropRequest -> {
+                    return new 
DropRequestDTO.FailureReason(dropRequest.getConnectionIdentifier(),dropRequest.getFailureReason());
 })
+                .collect(Collectors.toList())
+        );
+        dto.setFinished(isDropRequestComplete(
+                dropRequests.stream()
+                    .map(DropFlowFileStatus::getState)
+                    .reduce(DropFlowFileState.COMPLETE,(a,b) -> {
 
 Review comment:
   ```suggestion
                       .reduce(DropFlowFileState.COMPLETE, (a,b) -> {
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to