@Test public void fetchJudgmentIndexingItems() { Judgment judgment1 = createCcJudgment(SourceCode.COMMON_COURT, "AA1", "ABC1"); Judgment judgment2 = createCcJudgment(SourceCode.COMMON_COURT, "AA2", "ABC"); Judgment judgment3 = createCcJudgment(SourceCode.COMMON_COURT, "AA3", "ABC"); Judgment judgment4 = createCcJudgment(SourceCode.COMMON_COURT, "AA4", "ABC4"); Judgment judgment5 = createCcJudgment(SourceCode.COMMON_COURT, "AA5", "ABC5"); judgmentRepository.markAsIndexed(judgment3.getId()); EnrichmentTag tag1 = TestInMemoryEnrichmentTagFactory.createEnrichmentTag(judgment1.getId(), EnrichmentTagTypes.REFERENCED_COURT_CASES, JsonNormalizer.normalizeJson("[{'caseNumber':'ABC','judgmentIds':[" + judgment2.getId() + "," + judgment3.getId() + "]}," + "{'caseNumber':'ABC4','judgmentIds':[" + judgment4.getId() + "]}]")); EnrichmentTag tag2 = TestInMemoryEnrichmentTagFactory.createEnrichmentTag(judgment2.getId(), EnrichmentTagTypes.REFERENCED_COURT_CASES, JsonNormalizer.normalizeJson("[{'caseNumber':'ABC','judgmentIds':[" + judgment3.getId() + "]}," + "{'caseNumber':'ABC4','judgmentIds':[" + judgment4.getId() + "]}]")); enrichmentTagRepository.save(Lists.newArrayList(tag1, tag2)); List<JudgmentIndexingItem> retJudgmentIndexingItems = judgmentIndexingItemFetcher.fetchJudgmentIndexingItems(); JudgmentIndexingItem expectedIndexingItem1 = new JudgmentIndexingItem(judgment1.getId(), 0L); JudgmentIndexingItem expectedIndexingItem2 = new JudgmentIndexingItem(judgment2.getId(), 1L); JudgmentIndexingItem expectedIndexingItem4 = new JudgmentIndexingItem(judgment4.getId(), 2L); JudgmentIndexingItem expectedIndexingItem5 = new JudgmentIndexingItem(judgment5.getId(), 0L); assertThat(retJudgmentIndexingItems, containsInAnyOrder( expectedIndexingItem1, expectedIndexingItem2, expectedIndexingItem4, expectedIndexingItem5)); }
@Transactional public List<JudgmentIndexingItem> fetchJudgmentIndexingItems() { List<Long> notIndexedIds = judgmentRepository.findAllNotIndexedIds(); Map<Long, Long> referencingJudgmentsCountInfo = countReferencingJudgments(); List<JudgmentIndexingItem> judgmentsIndexingItems = Lists.newLinkedList(); for (Long notIndexedId : notIndexedIds) { long referencingCount = (referencingJudgmentsCountInfo.containsKey(notIndexedId)) ? referencingJudgmentsCountInfo.get(notIndexedId) : 0; judgmentsIndexingItems.add(new JudgmentIndexingItem(notIndexedId, referencingCount)); } return judgmentsIndexingItems; }
JudgmentIndexingItemFetcher { @Transactional public List<JudgmentIndexingItem> fetchJudgmentIndexingItems() { List<Long> notIndexedIds = judgmentRepository.findAllNotIndexedIds(); Map<Long, Long> referencingJudgmentsCountInfo = countReferencingJudgments(); List<JudgmentIndexingItem> judgmentsIndexingItems = Lists.newLinkedList(); for (Long notIndexedId : notIndexedIds) { long referencingCount = (referencingJudgmentsCountInfo.containsKey(notIndexedId)) ? referencingJudgmentsCountInfo.get(notIndexedId) : 0; judgmentsIndexingItems.add(new JudgmentIndexingItem(notIndexedId, referencingCount)); } return judgmentsIndexingItems; } }
JudgmentIndexingItemFetcher { @Transactional public List<JudgmentIndexingItem> fetchJudgmentIndexingItems() { List<Long> notIndexedIds = judgmentRepository.findAllNotIndexedIds(); Map<Long, Long> referencingJudgmentsCountInfo = countReferencingJudgments(); List<JudgmentIndexingItem> judgmentsIndexingItems = Lists.newLinkedList(); for (Long notIndexedId : notIndexedIds) { long referencingCount = (referencingJudgmentsCountInfo.containsKey(notIndexedId)) ? referencingJudgmentsCountInfo.get(notIndexedId) : 0; judgmentsIndexingItems.add(new JudgmentIndexingItem(notIndexedId, referencingCount)); } return judgmentsIndexingItems; }  }
JudgmentIndexingItemFetcher { @Transactional public List<JudgmentIndexingItem> fetchJudgmentIndexingItems() { List<Long> notIndexedIds = judgmentRepository.findAllNotIndexedIds(); Map<Long, Long> referencingJudgmentsCountInfo = countReferencingJudgments(); List<JudgmentIndexingItem> judgmentsIndexingItems = Lists.newLinkedList(); for (Long notIndexedId : notIndexedIds) { long referencingCount = (referencingJudgmentsCountInfo.containsKey(notIndexedId)) ? referencingJudgmentsCountInfo.get(notIndexedId) : 0; judgmentsIndexingItems.add(new JudgmentIndexingItem(notIndexedId, referencingCount)); } return judgmentsIndexingItems; }  @Transactional List<JudgmentIndexingItem> fetchJudgmentIndexingItems(); }
JudgmentIndexingItemFetcher { @Transactional public List<JudgmentIndexingItem> fetchJudgmentIndexingItems() { List<Long> notIndexedIds = judgmentRepository.findAllNotIndexedIds(); Map<Long, Long> referencingJudgmentsCountInfo = countReferencingJudgments(); List<JudgmentIndexingItem> judgmentsIndexingItems = Lists.newLinkedList(); for (Long notIndexedId : notIndexedIds) { long referencingCount = (referencingJudgmentsCountInfo.containsKey(notIndexedId)) ? referencingJudgmentsCountInfo.get(notIndexedId) : 0; judgmentsIndexingItems.add(new JudgmentIndexingItem(notIndexedId, referencingCount)); } return judgmentsIndexingItems; }  @Transactional List<JudgmentIndexingItem> fetchJudgmentIndexingItems();  }