@Test public void transformCriteria_TWO_CRITERIA() { JudgmentCriteria criteria = new JudgmentCriteria(); criteria.setCcCourtName("word1"); criteria.setJudgeName("word2"); String solrQuery = queryFactory.transformCriteria(criteria); assertEquals("+ccCourtName:word1 +judgeName:word2", solrQuery); }
@Override public String transformCriteria(JudgmentCriteria criteria) { List<String> list = Lists.newLinkedList(); list.add(criterionTransformer.transformToEqualsCriterionWithParsing(JudgmentIndexField.ALL, criteria.getAll())); list.addAll(transformCommonCourtCriteria(criteria)); list.addAll(transformSupremeCourtCriteria(criteria)); list.addAll(transformConstitutionalTribunalCriteria(criteria)); list.add(criterionTransformer.transformToEqualsCriterion(JudgmentIndexField.COURT_TYPE, criteria.getCourtType())); list.add(criterionTransformer.transformToDateRangeCriterion( JudgmentIndexField.JUDGMENT_DATE, criteria.getJudgmentDateFrom(), criteria.getJudgmentDateTo())); list.add(criterionTransformer.transformToEqualsEnumCriteria(JudgmentIndexField.JUDGMENT_TYPE, criteria.getJudgmentTypes(), Operator.OR)); list.add(criterionTransformer.transformToEqualsCriterionWithParsing(JudgmentIndexField.JUDGE_NAME, criteria.getJudgeName())); list.add(criterionTransformer.transformToEqualsCriteria(JudgmentIndexField.KEYWORD, criteria.getKeywords(), Operator.AND)); list.add(criterionTransformer.transformToEqualsCriterionWithParsing(JudgmentIndexField.LEGAL_BASE, criteria.getLegalBase())); list.add(criterionTransformer.transformToEqualsCriterionWithParsing(JudgmentIndexField.REFERENCED_REGULATION, criteria.getReferencedRegulation())); list.add(criterionTransformer.transformToEqualsCriterion(JudgmentIndexField.LAW_JOURNAL_ENTRY_ID, criteria.getLawJournalEntryId())); list.add(criterionTransformer.transformToEqualsCriterion(JudgmentIndexField.LAW_JOURNAL_ENTRY_CODE, criteria.getLawJournalEntryCode())); list.add(criterionTransformer.transformToEqualsCriterion(JudgmentIndexField.REFERENCED_COURT_CASE_ID, criteria.getReferencedCourtCaseId())); list.add(criterionTransformer.transformToEqualsCriterion(JudgmentIndexField.CASE_NUMBER, criteria.getCaseNumber())); String criteriaString = list.stream() .filter(x -> StringUtils.isNotEmpty(x)) .collect(Collectors.joining(" ")); return StringUtils.isNotEmpty(criteriaString) ? criteriaString : SolrConstants.DEFAULT_QUERY; }
JudgmentCriteriaTransformer implements CriteriaTransformer<JudgmentCriteria> { @Override public String transformCriteria(JudgmentCriteria criteria) { List<String> list = Lists.newLinkedList(); list.add(criterionTransformer.transformToEqualsCriterionWithParsing(JudgmentIndexField.ALL, criteria.getAll())); list.addAll(transformCommonCourtCriteria(criteria)); list.addAll(transformSupremeCourtCriteria(criteria)); list.addAll(transformConstitutionalTribunalCriteria(criteria)); list.add(criterionTransformer.transformToEqualsCriterion(JudgmentIndexField.COURT_TYPE, criteria.getCourtType())); list.add(criterionTransformer.transformToDateRangeCriterion( JudgmentIndexField.JUDGMENT_DATE, criteria.getJudgmentDateFrom(), criteria.getJudgmentDateTo())); list.add(criterionTransformer.transformToEqualsEnumCriteria(JudgmentIndexField.JUDGMENT_TYPE, criteria.getJudgmentTypes(), Operator.OR)); list.add(criterionTransformer.transformToEqualsCriterionWithParsing(JudgmentIndexField.JUDGE_NAME, criteria.getJudgeName())); list.add(criterionTransformer.transformToEqualsCriteria(JudgmentIndexField.KEYWORD, criteria.getKeywords(), Operator.AND)); list.add(criterionTransformer.transformToEqualsCriterionWithParsing(JudgmentIndexField.LEGAL_BASE, criteria.getLegalBase())); list.add(criterionTransformer.transformToEqualsCriterionWithParsing(JudgmentIndexField.REFERENCED_REGULATION, criteria.getReferencedRegulation())); list.add(criterionTransformer.transformToEqualsCriterion(JudgmentIndexField.LAW_JOURNAL_ENTRY_ID, criteria.getLawJournalEntryId())); list.add(criterionTransformer.transformToEqualsCriterion(JudgmentIndexField.LAW_JOURNAL_ENTRY_CODE, criteria.getLawJournalEntryCode())); list.add(criterionTransformer.transformToEqualsCriterion(JudgmentIndexField.REFERENCED_COURT_CASE_ID, criteria.getReferencedCourtCaseId())); list.add(criterionTransformer.transformToEqualsCriterion(JudgmentIndexField.CASE_NUMBER, criteria.getCaseNumber())); String criteriaString = list.stream() .filter(x -> StringUtils.isNotEmpty(x)) .collect(Collectors.joining(" ")); return StringUtils.isNotEmpty(criteriaString) ? criteriaString : SolrConstants.DEFAULT_QUERY; } }
JudgmentCriteriaTransformer implements CriteriaTransformer<JudgmentCriteria> { @Override public String transformCriteria(JudgmentCriteria criteria) { List<String> list = Lists.newLinkedList(); list.add(criterionTransformer.transformToEqualsCriterionWithParsing(JudgmentIndexField.ALL, criteria.getAll())); list.addAll(transformCommonCourtCriteria(criteria)); list.addAll(transformSupremeCourtCriteria(criteria)); list.addAll(transformConstitutionalTribunalCriteria(criteria)); list.add(criterionTransformer.transformToEqualsCriterion(JudgmentIndexField.COURT_TYPE, criteria.getCourtType())); list.add(criterionTransformer.transformToDateRangeCriterion( JudgmentIndexField.JUDGMENT_DATE, criteria.getJudgmentDateFrom(), criteria.getJudgmentDateTo())); list.add(criterionTransformer.transformToEqualsEnumCriteria(JudgmentIndexField.JUDGMENT_TYPE, criteria.getJudgmentTypes(), Operator.OR)); list.add(criterionTransformer.transformToEqualsCriterionWithParsing(JudgmentIndexField.JUDGE_NAME, criteria.getJudgeName())); list.add(criterionTransformer.transformToEqualsCriteria(JudgmentIndexField.KEYWORD, criteria.getKeywords(), Operator.AND)); list.add(criterionTransformer.transformToEqualsCriterionWithParsing(JudgmentIndexField.LEGAL_BASE, criteria.getLegalBase())); list.add(criterionTransformer.transformToEqualsCriterionWithParsing(JudgmentIndexField.REFERENCED_REGULATION, criteria.getReferencedRegulation())); list.add(criterionTransformer.transformToEqualsCriterion(JudgmentIndexField.LAW_JOURNAL_ENTRY_ID, criteria.getLawJournalEntryId())); list.add(criterionTransformer.transformToEqualsCriterion(JudgmentIndexField.LAW_JOURNAL_ENTRY_CODE, criteria.getLawJournalEntryCode())); list.add(criterionTransformer.transformToEqualsCriterion(JudgmentIndexField.REFERENCED_COURT_CASE_ID, criteria.getReferencedCourtCaseId())); list.add(criterionTransformer.transformToEqualsCriterion(JudgmentIndexField.CASE_NUMBER, criteria.getCaseNumber())); String criteriaString = list.stream() .filter(x -> StringUtils.isNotEmpty(x)) .collect(Collectors.joining(" ")); return StringUtils.isNotEmpty(criteriaString) ? criteriaString : SolrConstants.DEFAULT_QUERY; }  }
JudgmentCriteriaTransformer implements CriteriaTransformer<JudgmentCriteria> { @Override public String transformCriteria(JudgmentCriteria criteria) { List<String> list = Lists.newLinkedList(); list.add(criterionTransformer.transformToEqualsCriterionWithParsing(JudgmentIndexField.ALL, criteria.getAll())); list.addAll(transformCommonCourtCriteria(criteria)); list.addAll(transformSupremeCourtCriteria(criteria)); list.addAll(transformConstitutionalTribunalCriteria(criteria)); list.add(criterionTransformer.transformToEqualsCriterion(JudgmentIndexField.COURT_TYPE, criteria.getCourtType())); list.add(criterionTransformer.transformToDateRangeCriterion( JudgmentIndexField.JUDGMENT_DATE, criteria.getJudgmentDateFrom(), criteria.getJudgmentDateTo())); list.add(criterionTransformer.transformToEqualsEnumCriteria(JudgmentIndexField.JUDGMENT_TYPE, criteria.getJudgmentTypes(), Operator.OR)); list.add(criterionTransformer.transformToEqualsCriterionWithParsing(JudgmentIndexField.JUDGE_NAME, criteria.getJudgeName())); list.add(criterionTransformer.transformToEqualsCriteria(JudgmentIndexField.KEYWORD, criteria.getKeywords(), Operator.AND)); list.add(criterionTransformer.transformToEqualsCriterionWithParsing(JudgmentIndexField.LEGAL_BASE, criteria.getLegalBase())); list.add(criterionTransformer.transformToEqualsCriterionWithParsing(JudgmentIndexField.REFERENCED_REGULATION, criteria.getReferencedRegulation())); list.add(criterionTransformer.transformToEqualsCriterion(JudgmentIndexField.LAW_JOURNAL_ENTRY_ID, criteria.getLawJournalEntryId())); list.add(criterionTransformer.transformToEqualsCriterion(JudgmentIndexField.LAW_JOURNAL_ENTRY_CODE, criteria.getLawJournalEntryCode())); list.add(criterionTransformer.transformToEqualsCriterion(JudgmentIndexField.REFERENCED_COURT_CASE_ID, criteria.getReferencedCourtCaseId())); list.add(criterionTransformer.transformToEqualsCriterion(JudgmentIndexField.CASE_NUMBER, criteria.getCaseNumber())); String criteriaString = list.stream() .filter(x -> StringUtils.isNotEmpty(x)) .collect(Collectors.joining(" ")); return StringUtils.isNotEmpty(criteriaString) ? criteriaString : SolrConstants.DEFAULT_QUERY; }  @Override String transformCriteria(JudgmentCriteria criteria); @Autowired void setCriterionTransformer(
            SolrCriterionTransformer<JudgmentIndexField> criterionTransformer); }
JudgmentCriteriaTransformer implements CriteriaTransformer<JudgmentCriteria> { @Override public String transformCriteria(JudgmentCriteria criteria) { List<String> list = Lists.newLinkedList(); list.add(criterionTransformer.transformToEqualsCriterionWithParsing(JudgmentIndexField.ALL, criteria.getAll())); list.addAll(transformCommonCourtCriteria(criteria)); list.addAll(transformSupremeCourtCriteria(criteria)); list.addAll(transformConstitutionalTribunalCriteria(criteria)); list.add(criterionTransformer.transformToEqualsCriterion(JudgmentIndexField.COURT_TYPE, criteria.getCourtType())); list.add(criterionTransformer.transformToDateRangeCriterion( JudgmentIndexField.JUDGMENT_DATE, criteria.getJudgmentDateFrom(), criteria.getJudgmentDateTo())); list.add(criterionTransformer.transformToEqualsEnumCriteria(JudgmentIndexField.JUDGMENT_TYPE, criteria.getJudgmentTypes(), Operator.OR)); list.add(criterionTransformer.transformToEqualsCriterionWithParsing(JudgmentIndexField.JUDGE_NAME, criteria.getJudgeName())); list.add(criterionTransformer.transformToEqualsCriteria(JudgmentIndexField.KEYWORD, criteria.getKeywords(), Operator.AND)); list.add(criterionTransformer.transformToEqualsCriterionWithParsing(JudgmentIndexField.LEGAL_BASE, criteria.getLegalBase())); list.add(criterionTransformer.transformToEqualsCriterionWithParsing(JudgmentIndexField.REFERENCED_REGULATION, criteria.getReferencedRegulation())); list.add(criterionTransformer.transformToEqualsCriterion(JudgmentIndexField.LAW_JOURNAL_ENTRY_ID, criteria.getLawJournalEntryId())); list.add(criterionTransformer.transformToEqualsCriterion(JudgmentIndexField.LAW_JOURNAL_ENTRY_CODE, criteria.getLawJournalEntryCode())); list.add(criterionTransformer.transformToEqualsCriterion(JudgmentIndexField.REFERENCED_COURT_CASE_ID, criteria.getReferencedCourtCaseId())); list.add(criterionTransformer.transformToEqualsCriterion(JudgmentIndexField.CASE_NUMBER, criteria.getCaseNumber())); String criteriaString = list.stream() .filter(x -> StringUtils.isNotEmpty(x)) .collect(Collectors.joining(" ")); return StringUtils.isNotEmpty(criteriaString) ? criteriaString : SolrConstants.DEFAULT_QUERY; }  @Override String transformCriteria(JudgmentCriteria criteria); @Autowired void setCriterionTransformer(
            SolrCriterionTransformer<JudgmentIndexField> criterionTransformer);  }