@Test(expected = NullPointerException.class) public void generateXSettings_NULL() { xsettingsGenerator.generateXSettings(null); }
@Override public XSettings generateXSettings(JudgmentGlobalFilter judgmentGlobalFilter) { Preconditions.checkArgument(canGenerateXSettings(judgmentGlobalFilter)); XSettings xsettings = new XSettings(); CourtCriteria courtCriteria = judgmentGlobalFilter.getCourtCriteria(); if (courtCriteria.getCcCourtId() == null) { xsettings.setField(XField.CC_APPEAL); return xsettings; } CommonCourt commonCourt = commonCourtRepository.findOne(courtCriteria.getCcCourtId()); if (CommonCourtType.APPEAL == commonCourt.getType()) { xsettings.setField(XField.CC_REGION); xsettings.setFieldValuePrefix(""+commonCourt.getId()); return xsettings; } if (CommonCourtType.REGIONAL == commonCourt.getType()) { xsettings.setField(XField.CC_DISTRICT); xsettings.setFieldValuePrefix(""+commonCourt.getId()); return xsettings; } throw new IllegalStateException("may not generate xsettings"); }
CcCourtChartXSettingsGenerator implements XSettingsGenerator { @Override public XSettings generateXSettings(JudgmentGlobalFilter judgmentGlobalFilter) { Preconditions.checkArgument(canGenerateXSettings(judgmentGlobalFilter)); XSettings xsettings = new XSettings(); CourtCriteria courtCriteria = judgmentGlobalFilter.getCourtCriteria(); if (courtCriteria.getCcCourtId() == null) { xsettings.setField(XField.CC_APPEAL); return xsettings; } CommonCourt commonCourt = commonCourtRepository.findOne(courtCriteria.getCcCourtId()); if (CommonCourtType.APPEAL == commonCourt.getType()) { xsettings.setField(XField.CC_REGION); xsettings.setFieldValuePrefix(""+commonCourt.getId()); return xsettings; } if (CommonCourtType.REGIONAL == commonCourt.getType()) { xsettings.setField(XField.CC_DISTRICT); xsettings.setFieldValuePrefix(""+commonCourt.getId()); return xsettings; } throw new IllegalStateException("may not generate xsettings"); } }
CcCourtChartXSettingsGenerator implements XSettingsGenerator { @Override public XSettings generateXSettings(JudgmentGlobalFilter judgmentGlobalFilter) { Preconditions.checkArgument(canGenerateXSettings(judgmentGlobalFilter)); XSettings xsettings = new XSettings(); CourtCriteria courtCriteria = judgmentGlobalFilter.getCourtCriteria(); if (courtCriteria.getCcCourtId() == null) { xsettings.setField(XField.CC_APPEAL); return xsettings; } CommonCourt commonCourt = commonCourtRepository.findOne(courtCriteria.getCcCourtId()); if (CommonCourtType.APPEAL == commonCourt.getType()) { xsettings.setField(XField.CC_REGION); xsettings.setFieldValuePrefix(""+commonCourt.getId()); return xsettings; } if (CommonCourtType.REGIONAL == commonCourt.getType()) { xsettings.setField(XField.CC_DISTRICT); xsettings.setFieldValuePrefix(""+commonCourt.getId()); return xsettings; } throw new IllegalStateException("may not generate xsettings"); }  }
CcCourtChartXSettingsGenerator implements XSettingsGenerator { @Override public XSettings generateXSettings(JudgmentGlobalFilter judgmentGlobalFilter) { Preconditions.checkArgument(canGenerateXSettings(judgmentGlobalFilter)); XSettings xsettings = new XSettings(); CourtCriteria courtCriteria = judgmentGlobalFilter.getCourtCriteria(); if (courtCriteria.getCcCourtId() == null) { xsettings.setField(XField.CC_APPEAL); return xsettings; } CommonCourt commonCourt = commonCourtRepository.findOne(courtCriteria.getCcCourtId()); if (CommonCourtType.APPEAL == commonCourt.getType()) { xsettings.setField(XField.CC_REGION); xsettings.setFieldValuePrefix(""+commonCourt.getId()); return xsettings; } if (CommonCourtType.REGIONAL == commonCourt.getType()) { xsettings.setField(XField.CC_DISTRICT); xsettings.setFieldValuePrefix(""+commonCourt.getId()); return xsettings; } throw new IllegalStateException("may not generate xsettings"); }  @Override XSettings generateXSettings(JudgmentGlobalFilter judgmentGlobalFilter); @Override boolean canGenerateXSettings(JudgmentGlobalFilter judgmentGlobalFilter); @Override boolean handles(ChartCode chartCode); @Autowired void setCommonCourtRepository(CommonCourtRepository commonCourtRepository); }
CcCourtChartXSettingsGenerator implements XSettingsGenerator { @Override public XSettings generateXSettings(JudgmentGlobalFilter judgmentGlobalFilter) { Preconditions.checkArgument(canGenerateXSettings(judgmentGlobalFilter)); XSettings xsettings = new XSettings(); CourtCriteria courtCriteria = judgmentGlobalFilter.getCourtCriteria(); if (courtCriteria.getCcCourtId() == null) { xsettings.setField(XField.CC_APPEAL); return xsettings; } CommonCourt commonCourt = commonCourtRepository.findOne(courtCriteria.getCcCourtId()); if (CommonCourtType.APPEAL == commonCourt.getType()) { xsettings.setField(XField.CC_REGION); xsettings.setFieldValuePrefix(""+commonCourt.getId()); return xsettings; } if (CommonCourtType.REGIONAL == commonCourt.getType()) { xsettings.setField(XField.CC_DISTRICT); xsettings.setFieldValuePrefix(""+commonCourt.getId()); return xsettings; } throw new IllegalStateException("may not generate xsettings"); }  @Override XSettings generateXSettings(JudgmentGlobalFilter judgmentGlobalFilter); @Override boolean canGenerateXSettings(JudgmentGlobalFilter judgmentGlobalFilter); @Override boolean handles(ChartCode chartCode); @Autowired void setCommonCourtRepository(CommonCourtRepository commonCourtRepository);  }