@Test public void extractJudgmentType_REGULATION_REASON() { sJudgment.setTypes(Lists.newArrayList("regulation","reasons")); JudgmentType judgmentType = sourceCcJudgmentExtractor.extractJudgmentType(sJudgment, correctionList); assertEquals(JudgmentType.REGULATION, judgmentType); }
@Override public JudgmentType extractJudgmentType(SourceCcJudgment sourceJudgment, ImportCorrectionList correctionList) { List<String> sjTypes = Lists.newArrayList(sourceJudgment.getTypes()); sjTypes.replaceAll(sType->sType.toUpperCase().trim()); JudgmentType judgmentType = null; if (sjTypes.contains("SENTENCE")) { judgmentType = JudgmentType.SENTENCE; } else if (sjTypes.contains("DECISION")) { judgmentType = JudgmentType.DECISION; } else if (sjTypes.contains("REGULATION")) { judgmentType = JudgmentType.REGULATION; } else if (sjTypes.contains("REASON")) { judgmentType = JudgmentType.REASONS; } if (sjTypes.size() > 1 || judgmentType == null) { String oldValue = sjTypes.stream().reduce((t, u) -> t + ", " + u).get(); judgmentType = judgmentType==null? JudgmentType.SENTENCE: judgmentType; correctionList.addCorrection(createUpdate(null).ofProperty(JUDGMENT_TYPE).oldValue(oldValue).newValue(judgmentType.name()).build()); } return judgmentType; }
SourceCcJudgmentExtractor implements JudgmentDataExtractor<CommonCourtJudgment, SourceCcJudgment> { @Override public JudgmentType extractJudgmentType(SourceCcJudgment sourceJudgment, ImportCorrectionList correctionList) { List<String> sjTypes = Lists.newArrayList(sourceJudgment.getTypes()); sjTypes.replaceAll(sType->sType.toUpperCase().trim()); JudgmentType judgmentType = null; if (sjTypes.contains("SENTENCE")) { judgmentType = JudgmentType.SENTENCE; } else if (sjTypes.contains("DECISION")) { judgmentType = JudgmentType.DECISION; } else if (sjTypes.contains("REGULATION")) { judgmentType = JudgmentType.REGULATION; } else if (sjTypes.contains("REASON")) { judgmentType = JudgmentType.REASONS; } if (sjTypes.size() > 1 || judgmentType == null) { String oldValue = sjTypes.stream().reduce((t, u) -> t + ", " + u).get(); judgmentType = judgmentType==null? JudgmentType.SENTENCE: judgmentType; correctionList.addCorrection(createUpdate(null).ofProperty(JUDGMENT_TYPE).oldValue(oldValue).newValue(judgmentType.name()).build()); } return judgmentType; } }
SourceCcJudgmentExtractor implements JudgmentDataExtractor<CommonCourtJudgment, SourceCcJudgment> { @Override public JudgmentType extractJudgmentType(SourceCcJudgment sourceJudgment, ImportCorrectionList correctionList) { List<String> sjTypes = Lists.newArrayList(sourceJudgment.getTypes()); sjTypes.replaceAll(sType->sType.toUpperCase().trim()); JudgmentType judgmentType = null; if (sjTypes.contains("SENTENCE")) { judgmentType = JudgmentType.SENTENCE; } else if (sjTypes.contains("DECISION")) { judgmentType = JudgmentType.DECISION; } else if (sjTypes.contains("REGULATION")) { judgmentType = JudgmentType.REGULATION; } else if (sjTypes.contains("REASON")) { judgmentType = JudgmentType.REASONS; } if (sjTypes.size() > 1 || judgmentType == null) { String oldValue = sjTypes.stream().reduce((t, u) -> t + ", " + u).get(); judgmentType = judgmentType==null? JudgmentType.SENTENCE: judgmentType; correctionList.addCorrection(createUpdate(null).ofProperty(JUDGMENT_TYPE).oldValue(oldValue).newValue(judgmentType.name()).build()); } return judgmentType; }  }
SourceCcJudgmentExtractor implements JudgmentDataExtractor<CommonCourtJudgment, SourceCcJudgment> { @Override public JudgmentType extractJudgmentType(SourceCcJudgment sourceJudgment, ImportCorrectionList correctionList) { List<String> sjTypes = Lists.newArrayList(sourceJudgment.getTypes()); sjTypes.replaceAll(sType->sType.toUpperCase().trim()); JudgmentType judgmentType = null; if (sjTypes.contains("SENTENCE")) { judgmentType = JudgmentType.SENTENCE; } else if (sjTypes.contains("DECISION")) { judgmentType = JudgmentType.DECISION; } else if (sjTypes.contains("REGULATION")) { judgmentType = JudgmentType.REGULATION; } else if (sjTypes.contains("REASON")) { judgmentType = JudgmentType.REASONS; } if (sjTypes.size() > 1 || judgmentType == null) { String oldValue = sjTypes.stream().reduce((t, u) -> t + ", " + u).get(); judgmentType = judgmentType==null? JudgmentType.SENTENCE: judgmentType; correctionList.addCorrection(createUpdate(null).ofProperty(JUDGMENT_TYPE).oldValue(oldValue).newValue(judgmentType.name()).build()); } return judgmentType; }  @Override void convertSpecific(CommonCourtJudgment ccJudgment, SourceCcJudgment sourceJudgment, ImportCorrectionList correctionList); @Override CommonCourtJudgment createNewJudgment(); @Override ArrayList<String> extractLegalBases(SourceCcJudgment sourceJudgment, ImportCorrectionList correctionList); @Override String extractSummary(SourceCcJudgment sourceJudgment, ImportCorrectionList correctionList); @Override String extractDecision(SourceCcJudgment sourceJudgment, ImportCorrectionList correctionList); @Override ArrayList<String> extractCourtReporters(SourceCcJudgment sourceJudgment, ImportCorrectionList correctionList); @Override LocalDate extractJudgmentDate(SourceCcJudgment sourceJudgment, ImportCorrectionList correctionList); @Override List<CourtCase> extractCourtCases(SourceCcJudgment sourceJudgment, ImportCorrectionList correctionList); @Override JudgmentTextContent extractTextContent(SourceCcJudgment sourceJudgment, ImportCorrectionList correctionList); @Override List<JudgmentReferencedRegulation> extractReferencedRegulations(SourceCcJudgment sourceJudgment, ImportCorrectionList correctionList); @Override SourceCode getSourceCode(); @Override String extractSourceJudgmentId(SourceCcJudgment sourceJudgment, ImportCorrectionList correctionList); @Override String extractSourceJudgmentUrl(SourceCcJudgment sourceJudgment, ImportCorrectionList correctionList); @Override String extractPublisher(SourceCcJudgment sourceJudgment, ImportCorrectionList correctionList); @Override String extractReviser(SourceCcJudgment sourceJudgment, ImportCorrectionList correctionList); @Override DateTime extractPublicationDate(SourceCcJudgment sourceJudgment, ImportCorrectionList correctionList); @Override LocalDate extractReceiptDate(SourceCcJudgment sourceJudgment, ImportCorrectionList correctionList); @Override List<String> extractLowerCourtJudgments(SourceCcJudgment sourceJudgment, ImportCorrectionList correctionList); @Override MeansOfAppeal extractMeansOfAppeal(SourceCcJudgment sourceJudgment, ImportCorrectionList correctionList); @Override JudgmentResult extractJudgmentResult(SourceCcJudgment sourceJudgment, ImportCorrectionList correctionList); @Override List<Judge> extractJudges(SourceCcJudgment sourceJudgment, ImportCorrectionList correctionList); @Override JudgmentType extractJudgmentType(SourceCcJudgment sourceJudgment, ImportCorrectionList correctionList); @Autowired void setCommonCourtRepository(CommonCourtRepository commonCourtRepository); @Autowired void setCcDivisionRepository(CcDivisionRepository ccDivisionRepository); @Autowired void setCcJudgmentKeywordCreator(JudgmentKeywordCreator ccJudgmentKeywordCreator); @Autowired void setLawJournalEntryCreator(LawJournalEntryCreator lawJournalEntryCreator); @Autowired void setLawJournalEntryExtractor(LawJournalEntryExtractor lawJournalEntryExtractor); @Autowired void setJudgeConverter(JudgeConverter judgeConverter); }
SourceCcJudgmentExtractor implements JudgmentDataExtractor<CommonCourtJudgment, SourceCcJudgment> { @Override public JudgmentType extractJudgmentType(SourceCcJudgment sourceJudgment, ImportCorrectionList correctionList) { List<String> sjTypes = Lists.newArrayList(sourceJudgment.getTypes()); sjTypes.replaceAll(sType->sType.toUpperCase().trim()); JudgmentType judgmentType = null; if (sjTypes.contains("SENTENCE")) { judgmentType = JudgmentType.SENTENCE; } else if (sjTypes.contains("DECISION")) { judgmentType = JudgmentType.DECISION; } else if (sjTypes.contains("REGULATION")) { judgmentType = JudgmentType.REGULATION; } else if (sjTypes.contains("REASON")) { judgmentType = JudgmentType.REASONS; } if (sjTypes.size() > 1 || judgmentType == null) { String oldValue = sjTypes.stream().reduce((t, u) -> t + ", " + u).get(); judgmentType = judgmentType==null? JudgmentType.SENTENCE: judgmentType; correctionList.addCorrection(createUpdate(null).ofProperty(JUDGMENT_TYPE).oldValue(oldValue).newValue(judgmentType.name()).build()); } return judgmentType; }  @Override void convertSpecific(CommonCourtJudgment ccJudgment, SourceCcJudgment sourceJudgment, ImportCorrectionList correctionList); @Override CommonCourtJudgment createNewJudgment(); @Override ArrayList<String> extractLegalBases(SourceCcJudgment sourceJudgment, ImportCorrectionList correctionList); @Override String extractSummary(SourceCcJudgment sourceJudgment, ImportCorrectionList correctionList); @Override String extractDecision(SourceCcJudgment sourceJudgment, ImportCorrectionList correctionList); @Override ArrayList<String> extractCourtReporters(SourceCcJudgment sourceJudgment, ImportCorrectionList correctionList); @Override LocalDate extractJudgmentDate(SourceCcJudgment sourceJudgment, ImportCorrectionList correctionList); @Override List<CourtCase> extractCourtCases(SourceCcJudgment sourceJudgment, ImportCorrectionList correctionList); @Override JudgmentTextContent extractTextContent(SourceCcJudgment sourceJudgment, ImportCorrectionList correctionList); @Override List<JudgmentReferencedRegulation> extractReferencedRegulations(SourceCcJudgment sourceJudgment, ImportCorrectionList correctionList); @Override SourceCode getSourceCode(); @Override String extractSourceJudgmentId(SourceCcJudgment sourceJudgment, ImportCorrectionList correctionList); @Override String extractSourceJudgmentUrl(SourceCcJudgment sourceJudgment, ImportCorrectionList correctionList); @Override String extractPublisher(SourceCcJudgment sourceJudgment, ImportCorrectionList correctionList); @Override String extractReviser(SourceCcJudgment sourceJudgment, ImportCorrectionList correctionList); @Override DateTime extractPublicationDate(SourceCcJudgment sourceJudgment, ImportCorrectionList correctionList); @Override LocalDate extractReceiptDate(SourceCcJudgment sourceJudgment, ImportCorrectionList correctionList); @Override List<String> extractLowerCourtJudgments(SourceCcJudgment sourceJudgment, ImportCorrectionList correctionList); @Override MeansOfAppeal extractMeansOfAppeal(SourceCcJudgment sourceJudgment, ImportCorrectionList correctionList); @Override JudgmentResult extractJudgmentResult(SourceCcJudgment sourceJudgment, ImportCorrectionList correctionList); @Override List<Judge> extractJudges(SourceCcJudgment sourceJudgment, ImportCorrectionList correctionList); @Override JudgmentType extractJudgmentType(SourceCcJudgment sourceJudgment, ImportCorrectionList correctionList); @Autowired void setCommonCourtRepository(CommonCourtRepository commonCourtRepository); @Autowired void setCcDivisionRepository(CcDivisionRepository ccDivisionRepository); @Autowired void setCcJudgmentKeywordCreator(JudgmentKeywordCreator ccJudgmentKeywordCreator); @Autowired void setLawJournalEntryCreator(LawJournalEntryCreator lawJournalEntryCreator); @Autowired void setLawJournalEntryExtractor(LawJournalEntryExtractor lawJournalEntryExtractor); @Autowired void setJudgeConverter(JudgeConverter judgeConverter);  }