@Test public void doesNotAddFrameNumbersToAudioError() { addError(_AUDIO_1_ID, 0, 0, "ec1", "em1"); addError(_AUDIO_1_ID, 0, 0, "ec1", "em1"); var mergedErrors = DetectionErrorUtil.getMergedDetectionErrors(_testJob); assertEquals(1, mergedErrors.size()); JsonIssueDetails issue = mergedErrors.get(_AUDIO_1_ID).iterator().next(); assertEquals("ec1", issue.getCode()); assertEquals(_TEST_ALGO1_NAME, issue.getSource()); assertEquals("em1", issue.getMessage()); }
public static Multimap<Long, JsonIssueDetails> getMergedDetectionErrors(BatchJob job) { Multimap<Long, DetectionProcessingError> errorsIndexedByMedia = Multimaps.index(job.getDetectionProcessingErrors(), DetectionProcessingError::getMediaId); SetMultimap<Long, JsonIssueDetails> results = MultimapBuilder.hashKeys().hashSetValues().build(); for (var entry : errorsIndexedByMedia.asMap().entrySet()) { Media media = job.getMedia(entry.getKey()); Collection<DetectionProcessingError> mediaErrors = entry.getValue(); if (media.getMediaType() == MediaType.VIDEO) { results.putAll(media.getId(), mergeErrors(job, mediaErrors)); } else { List<JsonIssueDetails> issues = mediaErrors .stream() .map(d -> convertDetectionErrorToIssue(job, d)) .collect(toList()); results.putAll(media.getId(), issues); } } return results; }
DetectionErrorUtil { public static Multimap<Long, JsonIssueDetails> getMergedDetectionErrors(BatchJob job) { Multimap<Long, DetectionProcessingError> errorsIndexedByMedia = Multimaps.index(job.getDetectionProcessingErrors(), DetectionProcessingError::getMediaId); SetMultimap<Long, JsonIssueDetails> results = MultimapBuilder.hashKeys().hashSetValues().build(); for (var entry : errorsIndexedByMedia.asMap().entrySet()) { Media media = job.getMedia(entry.getKey()); Collection<DetectionProcessingError> mediaErrors = entry.getValue(); if (media.getMediaType() == MediaType.VIDEO) { results.putAll(media.getId(), mergeErrors(job, mediaErrors)); } else { List<JsonIssueDetails> issues = mediaErrors .stream() .map(d -> convertDetectionErrorToIssue(job, d)) .collect(toList()); results.putAll(media.getId(), issues); } } return results; } }
DetectionErrorUtil { public static Multimap<Long, JsonIssueDetails> getMergedDetectionErrors(BatchJob job) { Multimap<Long, DetectionProcessingError> errorsIndexedByMedia = Multimaps.index(job.getDetectionProcessingErrors(), DetectionProcessingError::getMediaId); SetMultimap<Long, JsonIssueDetails> results = MultimapBuilder.hashKeys().hashSetValues().build(); for (var entry : errorsIndexedByMedia.asMap().entrySet()) { Media media = job.getMedia(entry.getKey()); Collection<DetectionProcessingError> mediaErrors = entry.getValue(); if (media.getMediaType() == MediaType.VIDEO) { results.putAll(media.getId(), mergeErrors(job, mediaErrors)); } else { List<JsonIssueDetails> issues = mediaErrors .stream() .map(d -> convertDetectionErrorToIssue(job, d)) .collect(toList()); results.putAll(media.getId(), issues); } } return results; } private  DetectionErrorUtil(); }
DetectionErrorUtil { public static Multimap<Long, JsonIssueDetails> getMergedDetectionErrors(BatchJob job) { Multimap<Long, DetectionProcessingError> errorsIndexedByMedia = Multimaps.index(job.getDetectionProcessingErrors(), DetectionProcessingError::getMediaId); SetMultimap<Long, JsonIssueDetails> results = MultimapBuilder.hashKeys().hashSetValues().build(); for (var entry : errorsIndexedByMedia.asMap().entrySet()) { Media media = job.getMedia(entry.getKey()); Collection<DetectionProcessingError> mediaErrors = entry.getValue(); if (media.getMediaType() == MediaType.VIDEO) { results.putAll(media.getId(), mergeErrors(job, mediaErrors)); } else { List<JsonIssueDetails> issues = mediaErrors .stream() .map(d -> convertDetectionErrorToIssue(job, d)) .collect(toList()); results.putAll(media.getId(), issues); } } return results; } private  DetectionErrorUtil(); static Multimap<Long, JsonIssueDetails> getMergedDetectionErrors(BatchJob job); static Collector<Integer, ?, Optional<String>> toFrameRangesString(); }
DetectionErrorUtil { public static Multimap<Long, JsonIssueDetails> getMergedDetectionErrors(BatchJob job) { Multimap<Long, DetectionProcessingError> errorsIndexedByMedia = Multimaps.index(job.getDetectionProcessingErrors(), DetectionProcessingError::getMediaId); SetMultimap<Long, JsonIssueDetails> results = MultimapBuilder.hashKeys().hashSetValues().build(); for (var entry : errorsIndexedByMedia.asMap().entrySet()) { Media media = job.getMedia(entry.getKey()); Collection<DetectionProcessingError> mediaErrors = entry.getValue(); if (media.getMediaType() == MediaType.VIDEO) { results.putAll(media.getId(), mergeErrors(job, mediaErrors)); } else { List<JsonIssueDetails> issues = mediaErrors .stream() .map(d -> convertDetectionErrorToIssue(job, d)) .collect(toList()); results.putAll(media.getId(), issues); } } return results; } private  DetectionErrorUtil(); static Multimap<Long, JsonIssueDetails> getMergedDetectionErrors(BatchJob job); static Collector<Integer, ?, Optional<String>> toFrameRangesString();  }