@Test public void shouldGetById() throws Exception { VaccineReport report = make(a(VaccineReportBuilder.defaultVaccineReport)); ProcessingPeriod period = make(a(ProcessingPeriodBuilder.defaultProcessingPeriod)); report.setPeriod(period); when(repository.getByIdWithFullDetails(2L)).thenReturn(report); when(settingService.getVisibilityForProgram(report.getProgramId())).thenReturn(new ArrayList<VaccineIvdTabVisibility>()); when(annualFacilityDemographicEstimateService.getEstimateValuesForFacility(report.getFacilityId(), report.getProgramId(), report.getPeriod().getStartDate().getYear())).thenReturn(null); VaccineReport result = service.getById(2L); verify(repository).getByIdWithFullDetails(2L); assertThat(result.getStatus(), is(report.getStatus())); }
public VaccineReport getById(Long id) { VaccineReport report = repository.getByIdWithFullDetails(id); report.setTabVisibilitySettings(tabVisibilityService.getVisibilityForProgram(report.getProgramId())); DateTime periodStartDate = new DateTime(report.getPeriod().getStartDate()); report.setFacilityDemographicEstimates(annualFacilityDemographicEstimateService.getEstimateValuesForFacility(report.getFacilityId(), report.getProgramId(), periodStartDate.getYear())); return report; }
VaccineReportService { public VaccineReport getById(Long id) { VaccineReport report = repository.getByIdWithFullDetails(id); report.setTabVisibilitySettings(tabVisibilityService.getVisibilityForProgram(report.getProgramId())); DateTime periodStartDate = new DateTime(report.getPeriod().getStartDate()); report.setFacilityDemographicEstimates(annualFacilityDemographicEstimateService.getEstimateValuesForFacility(report.getFacilityId(), report.getProgramId(), periodStartDate.getYear())); return report; } }
VaccineReportService { public VaccineReport getById(Long id) { VaccineReport report = repository.getByIdWithFullDetails(id); report.setTabVisibilitySettings(tabVisibilityService.getVisibilityForProgram(report.getProgramId())); DateTime periodStartDate = new DateTime(report.getPeriod().getStartDate()); report.setFacilityDemographicEstimates(annualFacilityDemographicEstimateService.getEstimateValuesForFacility(report.getFacilityId(), report.getProgramId(), periodStartDate.getYear())); return report; }  }
VaccineReportService { public VaccineReport getById(Long id) { VaccineReport report = repository.getByIdWithFullDetails(id); report.setTabVisibilitySettings(tabVisibilityService.getVisibilityForProgram(report.getProgramId())); DateTime periodStartDate = new DateTime(report.getPeriod().getStartDate()); report.setFacilityDemographicEstimates(annualFacilityDemographicEstimateService.getEstimateValuesForFacility(report.getFacilityId(), report.getProgramId(), periodStartDate.getYear())); return report; }  @Transactional VaccineReport initialize(Long facilityId, Long programId, Long periodId, Long userId); @Transactional void save(VaccineReport report, Long userId); @Transactional void submit(VaccineReport report, Long userId); List<ReportStatusDTO> getReportedPeriodsFor(Long facilityId, Long programId); List<ReportStatusDTO> getPeriodsFor(Long facilityId, Long programId, Date endDate); VaccineReport getById(Long id); Long getReportIdForFacilityAndPeriod(Long facilityId, Long periodId); List<HashMap<String, Object>> vaccineUsageTrend(String facilityCode, String productCode, Long periodId, Long zoneId); Map<String, Object> getMonthlyVaccineReport(Long facilityId, Long periodId, Long zoneId); }
VaccineReportService { public VaccineReport getById(Long id) { VaccineReport report = repository.getByIdWithFullDetails(id); report.setTabVisibilitySettings(tabVisibilityService.getVisibilityForProgram(report.getProgramId())); DateTime periodStartDate = new DateTime(report.getPeriod().getStartDate()); report.setFacilityDemographicEstimates(annualFacilityDemographicEstimateService.getEstimateValuesForFacility(report.getFacilityId(), report.getProgramId(), periodStartDate.getYear())); return report; }  @Transactional VaccineReport initialize(Long facilityId, Long programId, Long periodId, Long userId); @Transactional void save(VaccineReport report, Long userId); @Transactional void submit(VaccineReport report, Long userId); List<ReportStatusDTO> getReportedPeriodsFor(Long facilityId, Long programId); List<ReportStatusDTO> getPeriodsFor(Long facilityId, Long programId, Date endDate); VaccineReport getById(Long id); Long getReportIdForFacilityAndPeriod(Long facilityId, Long periodId); List<HashMap<String, Object>> vaccineUsageTrend(String facilityCode, String productCode, Long periodId, Long zoneId); Map<String, Object> getMonthlyVaccineReport(Long facilityId, Long periodId, Long zoneId); static final String VACCINE_REPORT_VACCINE_CATEGORY_CODE; static final String VACCINE_REPORT_VITAMINS_CATEGORY_CODE; static final String VACCINE_REPORT_SYRINGES_CATEGORY_CODE; }